Education

Teaching and learning about math, Maple and MapleSim

What is new in Physics in Maple 2025

 

This post is, basically, the page of what is new in Physics distributed with Maple 2025. Why post it? Because this time we achieved a result that is a breakthrough/milestone in Computer Algebra: for the first time we can systematically compute Einstein's equations from first principles, using a computer, starting from a Lagrangian for gravity. This is something to celebrate.

 

Although being able to perform this computation on a computer algebra sheet is relevant mostly for physicists working in general relativity, the developments performed in the tensor manipulation and functional differentiation routines of the Maple system to cover this computation were tremendous, in number of lines of code, efforts and time, resulting in improvements not just fore general relativity but for physics all around, and in an area out of reach of neural network AIs . Other results, like the new routines for linearizing gravity, requested other times here in Mapleprimes, are also part of the relevant novelties.

 

 

Lagrange Equations and simplification of tensorial expressions in curved spacetimes

Linearized Gravity

Relative Tensors

New Physics:-Library commands

See Also

 

 

 

Lagrange Equations and simplification of tensorial expressions in curved spacetimes

 

 

LagrangeEquations  is a Physics command introduced in 2023 taking advantage of the functional differentiation  capabilities of the Physics  package . This command can handle tensors  and vectors  of the Physics  package as well as derivatives using vectorial differential operators (see d_  and Nabla ), works by performing functional differentiation (see Fundiff ), and handles 1st, and higher order derivatives of the coordinates in the Lagrangian automatically. LagrangeEquations  receives an expression representing a Lagrangian and returns a sequence of Lagrange equations with as many equations as coordinates are indicated. The number of parameters can also be many. For example, in electrodynamics, the "coordinate" is a tensor field A[mu](x, y, z, t), there are then four coordinates, one for each of the values of the index mu, and there are four parameters x, y, z, t.

 

New in Maple 2025, the "coordinates" can now also be the components of the metric tensor in a curved spacetime, in which case the equations returned are Einstein's equations. Also new, instead of a coordinate or set of them, you can pass the keyword EnergyMomentum, in which case the output is the conserved energy-momentum tensor of the physical model represented by the given Lagrangian L.

 

Examples

 

with(Physics)

Setup(mathematicalnotation = true, coordinates = cartesian)

[coordinatesystems = {X}, mathematicalnotation = true]

(1)

The lambda*Phi^4 model in classical field theory and corresponding field equations, as in previous releases

CompactDisplay(Phi(X))

Phi(x, y, z, t)*`will now be displayed as`*Phi

(2)

L := (1/2)*d_[mu](Phi(X))*d_[mu](Phi(X))-(1/2)*m^2*Phi(X)^2+(1/4)*lambda*Phi(X)^4

(1/2)*Physics:-d_[mu](Phi(X), [X])*Physics:-d_[`~mu`](Phi(X), [X])-(1/2)*m^2*Phi(X)^2+(1/4)*lambda*Phi(X)^4

(3)

Lagrange's equations

LagrangeEquations(L, Phi)

Phi(X)^3*lambda-Phi(X)*m^2-Physics:-dAlembertian(Phi(X), [X]) = 0

(4)

New: The energy-momentum tensor can be computed as the Lagrange equations taking the metric as the coordinate, not equating to 0 the result, but multiplying the variation of the action "(delta S)/(delta g[]^(mu,nu))" by 2/sqrt(-%g_[determinant]) (in flat spacetimes sqrt(-%g_[determinant]) = 1). For that purpose, you can use the EnergyMomentum keyword. You can optionally indicate the indices to be used in the output as well as their covariant or contravariant character

LagrangeEquations(L, EnergyMomentum[mu, nu])

Physics:-EnergyMomentum[mu, nu] = (-(1/4)*lambda*Phi(X)^4+(1/2)*m^2*Phi(X)^2-(1/2)*Physics:-d_[`~beta`](Phi(X), [X])*Physics:-d_[beta](Phi(X), [X]))*Physics:-g_[mu, nu]+Physics:-d_[mu](Phi(X), [X])*Physics:-d_[nu](Phi(X), [X])

(5)

To further compute using the above as the definition for T[mu, nu], you can use the Define  command

Define(Physics:-EnergyMomentum[mu, nu] = (-(1/4)*lambda*Phi(X)^4+(1/2)*m^2*Phi(X)^2-(1/2)*Physics[d_][`~beta`](Phi(X), [X])*Physics[d_][beta](Phi(X), [X]))*Physics[g_][mu, nu]+Physics[d_][mu](Phi(X), [X])*Physics[d_][nu](Phi(X), [X]))

`Defined objects with tensor properties`

 

{Physics:-Dgamma[mu], Physics:-Psigma[mu], Physics:-d_[mu], Physics:-g_[mu, nu], Physics:-EnergyMomentum[mu, nu], Physics:-LeviCivita[alpha, beta, mu, nu], Physics:-SpaceTimeVector[mu](X)}

(6)

After which the system knows about the symmetry properties and the components of T[mu, nu]

EnergyMomentum[definition]

Physics:-EnergyMomentum[mu, nu] = (-(1/4)*lambda*Phi(X)^4+(1/2)*m^2*Phi(X)^2-(1/2)*Physics:-d_[`~beta`](Phi(X), [X])*Physics:-d_[beta](Phi(X), [X]))*Physics:-g_[mu, nu]+Physics:-d_[mu](Phi(X), [X])*Physics:-d_[nu](Phi(X), [X])

(7)

Library:-IsTensorialSymmetric(EnergyMomentum[mu, nu])

true

(8)

EnergyMomentum[]

Physics:-EnergyMomentum[mu, nu] = Matrix(%id = 36893488151952536988)

(9)

New: LagrangeEquations takes advantage of the extension of Fundiff  to compute functional derivatives in curved spacetimes introduced for Maple 2025, and so it also handles the case of a scalar field in a curved spacetime. Set for instance an arbitrary metric

g_[arb]

_______________________________________________________

 

`Setting `*lowercaselatin_is*` letters to represent `*space*` indices`

 

`The arbitrary metric in coordinates `*[x, y, z, t]

 

`Signature: `(`- - - +`)

 

_______________________________________________________

 

Physics:-g_[mu, nu] = Matrix(%id = 36893488152257720060)

(10)

For the action to be a true scalar in spacetime, the Lagrangian density now needs to be multiplied by the square root of the determinant of the metric

L := sqrt(-%g_[determinant])*L

(-%g_[determinant])^(1/2)*((1/2)*Physics:-d_[mu](Phi(X), [X])*Physics:-d_[`~mu`](Phi(X), [X])-(1/2)*m^2*Phi(X)^2+(1/4)*lambda*Phi(X)^4)

(11)

New: With the extension of the tensorial simplification algorithms for curved spacetimes, the Lagrange equations can be computed arriving directly to the compact form

LagrangeEquations(L, Phi)

Phi(X)^3*lambda-Phi(X)*m^2-Physics:-D_[kappa](Physics:-d_[`~kappa`](Phi(X), [X]), [X]) = 0

(12)

Comparing with the result (4) for the same Lagrangian in a flat spacetime, we see the only difference is that the dAlembertian  is now expressed in terms of covariant derivatives D_ .

 

The EnergyMomentum  tensor is computed in the same way as when the spacetime is flat

LagrangeEquations(L, EnergyMomentum[mu, nu])

Physics:-EnergyMomentum[mu, nu] = (-(1/4)*lambda*Phi(X)^4+(1/2)*m^2*Phi(X)^2-(1/2)*Physics:-d_[`~beta`](Phi(X), [X])*Physics:-d_[beta](Phi(X), [X]))*Physics:-g_[mu, nu]+Physics:-d_[mu](Phi(X), [X])*Physics:-d_[nu](Phi(X), [X])

(13)

General Relativity

 

New: the most significant development in LagrangeEquations is regarding General Relativity. It can now compute Einstein's equations directly from the Lagrangian, not using tabulated cases, and properly handling several (traditional or not) alternative ways of presenting the Lagrangian.

 

Einstein's equations concern the case of a curved spacetime with metric g[mu, nu] as, for instance, the general case of an arbitrary metric set lines above. In the Lagrangian formulation, the coordinates of the problem are the components of the metric g[mu, nu], and as in the case of electrodynamics the parameters are the spacetime coordinates X^alpha. The simplest case is that of Einstein's equation in vacuum, for which the Lagrangian density is expressed in terms of the trace of the Ricci  tensor by

L := sqrt(-%g_[determinant])*Ricci[alpha, `~alpha`]

(-%g_[determinant])^(1/2)*Physics:-Ricci[alpha, `~alpha`]

(14)

Einstein's equations in vacuum:

LagrangeEquations(L, g_[mu, nu])

-(1/2)*Physics:-g_[mu, nu]*Physics:-Ricci[alpha, `~alpha`]+Physics:-Ricci[mu, nu] = 0

(15)

where in the above instead of passing g as second argument, we passed g[mu, nu] to get the equations using those free indices. The tensorial equation computed is also the definition of the Einstein  tensor

Einstein[definition]

Physics:-Einstein[mu, nu] = -(1/2)*Physics:-g_[mu, nu]*Physics:-Ricci[alpha, `~alpha`]+Physics:-Ricci[mu, nu]

(16)

The Lagrangian L used to compute Einstein's equations (15)  contains first and second derivatives of the metric. To see that, rewrite L in terms of Christoffel  symbols

L__C := convert(L, Christoffel)

(-%g_[determinant])^(1/2)*Physics:-g_[`~alpha`, `~lambda`]*(Physics:-d_[nu](Physics:-Christoffel[`~nu`, alpha, lambda], [X])-Physics:-d_[lambda](Physics:-Christoffel[`~nu`, alpha, nu], [X])+Physics:-Christoffel[`~beta`, alpha, lambda]*Physics:-Christoffel[`~nu`, beta, nu]-Physics:-Christoffel[`~beta`, alpha, nu]*Physics:-Christoffel[`~nu`, beta, lambda])

(17)

Recalling the definition

Christoffel[definition]

Physics:-Christoffel[alpha, mu, nu] = (1/2)*Physics:-d_[nu](Physics:-g_[alpha, mu], [X])+(1/2)*Physics:-d_[mu](Physics:-g_[alpha, nu], [X])-(1/2)*Physics:-d_[alpha](Physics:-g_[mu, nu], [X])

(18)

in L[C] the two terms containing derivatives of Christoffel symbols contain second order derivatives of g[mu, nu]. Now, it is always possible to add a total spacetime derivative to L[C] without changing Einstein's equations (assuming the variation of the metric in the corresponding boundary integrals vanishes), and in that way, in this particular case of L[C], obtain a Lagrangian involving only 1st order derivatives. The total derivative, expressed using the inert `∂` command to see it before the differentiation operation is performed, is

TD := %d_[alpha](g_[`~mu`, `~nu`]*sqrt(-%g_[determinant])*(g_[`~alpha`, mu]*Christoffel[`~beta`, nu, beta]-Christoffel[`~alpha`, mu, nu]))

%d_[alpha](Physics:-g_[`~mu`, `~nu`]*(-%g_[determinant])^(1/2)*(Physics:-g_[mu, `~alpha`]*Physics:-Christoffel[`~beta`, beta, nu]-Physics:-Christoffel[`~alpha`, mu, nu]))

(19)

Adding this term to L[C], performing the `∂` differentiation operation and simplifying we get

L__1 := L__C+TD

(-%g_[determinant])^(1/2)*Physics:-g_[`~alpha`, `~lambda`]*(Physics:-d_[nu](Physics:-Christoffel[`~nu`, alpha, lambda], [X])-Physics:-d_[lambda](Physics:-Christoffel[`~nu`, alpha, nu], [X])+Physics:-Christoffel[`~beta`, alpha, lambda]*Physics:-Christoffel[`~nu`, beta, nu]-Physics:-Christoffel[`~beta`, alpha, nu]*Physics:-Christoffel[`~nu`, beta, lambda])+%d_[alpha](Physics:-g_[`~mu`, `~nu`]*(-%g_[determinant])^(1/2)*(Physics:-g_[mu, `~alpha`]*Physics:-Christoffel[`~beta`, beta, nu]-Physics:-Christoffel[`~alpha`, mu, nu]))

(20)

L__1 := eval(L__1, %d_ = d_)

(-%g_[determinant])^(1/2)*Physics:-g_[`~alpha`, `~lambda`]*(Physics:-d_[nu](Physics:-Christoffel[`~nu`, alpha, lambda], [X])-Physics:-d_[lambda](Physics:-Christoffel[`~nu`, alpha, nu], [X])+Physics:-Christoffel[`~beta`, alpha, lambda]*Physics:-Christoffel[`~nu`, beta, nu]-Physics:-Christoffel[`~beta`, alpha, nu]*Physics:-Christoffel[`~nu`, beta, lambda])+Physics:-d_[alpha](Physics:-g_[`~mu`, `~nu`], [X])*(-%g_[determinant])^(1/2)*(Physics:-g_[mu, `~alpha`]*Physics:-Christoffel[`~beta`, beta, nu]-Physics:-Christoffel[`~alpha`, mu, nu])-(1/2)*Physics:-g_[`~mu`, `~nu`]*(Physics:-g_[mu, `~alpha`]*Physics:-Christoffel[`~beta`, beta, nu]-Physics:-Christoffel[`~alpha`, mu, nu])*%g_[determinant]*Physics:-g_[`~kappa`, `~lambda`]*Physics:-d_[alpha](Physics:-g_[kappa, lambda], [X])/(-%g_[determinant])^(1/2)+Physics:-g_[`~mu`, `~nu`]*(-%g_[determinant])^(1/2)*(Physics:-g_[mu, `~alpha`]*Physics:-d_[alpha](Physics:-Christoffel[`~beta`, beta, nu], [X])-Physics:-d_[alpha](Physics:-Christoffel[`~alpha`, mu, nu], [X]))

(21)

L__1 := Simplify(L__1)

(Physics:-Christoffel[alpha, beta, kappa]*Physics:-Christoffel[`~beta`, `~alpha`, `~kappa`]-Physics:-Christoffel[alpha, beta, `~alpha`]*Physics:-Christoffel[`~beta`, kappa, `~kappa`])*(-%g_[determinant])^(1/2)

(22)

which is a Lagrangian depending only on 1st order derivatives of the metric through Christoffel  symbols. As expected, the equations of motion resulting from this Lagrangian are the same Einstein equations computed in (15)

LagrangeEquations(L__1, g_[mu, nu])

-(1/2)*Physics:-Ricci[iota, `~iota`]*Physics:-g_[mu, nu]+Physics:-Ricci[mu, nu] = 0

(23)

To illustrate the new Maple 2025 tensorial simplification capabilities note that `≡`(L[1], (Physics[Christoffel][alpha, beta, kappa]*Physics[Christoffel][`~beta`, `~alpha`, `~kappa`]-Physics[Christoffel][alpha, beta, `~alpha`]*Physics[Christoffel][`~beta`, kappa, `~kappa`])*(-%g_[determinant])^(1/2)) is no just L[C] ≡ (17) after discarding its two terms involving derivatives of Christoffel symbols. To verify this, split L[C] into the terms containing or not derivatives of Christoffel

L__22, L__11 := selectremove(has, expand(L__C), d_)

(-%g_[determinant])^(1/2)*Physics:-g_[`~alpha`, `~lambda`]*Physics:-d_[nu](Physics:-Christoffel[`~nu`, alpha, lambda], [X])-(-%g_[determinant])^(1/2)*Physics:-g_[`~alpha`, `~lambda`]*Physics:-d_[lambda](Physics:-Christoffel[`~nu`, alpha, nu], [X]), (-%g_[determinant])^(1/2)*Physics:-g_[`~alpha`, `~lambda`]*Physics:-Christoffel[`~beta`, alpha, lambda]*Physics:-Christoffel[`~nu`, beta, nu]-(-%g_[determinant])^(1/2)*Physics:-g_[`~alpha`, `~lambda`]*Physics:-Christoffel[`~beta`, alpha, nu]*Physics:-Christoffel[`~nu`, beta, lambda]

(24)

Comparing, the total derivative TD≡ (19) is not just -L[22], but

TD = -L__22-2*L__11

%d_[alpha](Physics:-g_[`~mu`, `~nu`]*(-%g_[determinant])^(1/2)*(Physics:-g_[mu, `~alpha`]*Physics:-Christoffel[`~beta`, beta, nu]-Physics:-Christoffel[`~alpha`, mu, nu])) = -(-%g_[determinant])^(1/2)*Physics:-g_[`~alpha`, `~lambda`]*Physics:-d_[nu](Physics:-Christoffel[`~nu`, alpha, lambda], [X])+(-%g_[determinant])^(1/2)*Physics:-g_[`~alpha`, `~lambda`]*Physics:-d_[lambda](Physics:-Christoffel[`~nu`, alpha, nu], [X])-2*(-%g_[determinant])^(1/2)*Physics:-g_[`~alpha`, `~lambda`]*Physics:-Christoffel[`~beta`, alpha, lambda]*Physics:-Christoffel[`~nu`, beta, nu]+2*(-%g_[determinant])^(1/2)*Physics:-g_[`~alpha`, `~lambda`]*Physics:-Christoffel[`~beta`, alpha, nu]*Physics:-Christoffel[`~nu`, beta, lambda]

(25)

Things like these, TD = -L__22-2*L__11, can now be verified directly with the new tensorial simplification capabilities: take the left-hand side minus the right-hand side, evaluate the inert derivative `∂` and simplify to see the equality is true

(lhs-rhs)(%d_[alpha](Physics[g_][`~mu`, `~nu`]*(-%g_[determinant])^(1/2)*(Physics[g_][mu, `~alpha`]*Physics[Christoffel][`~beta`, beta, nu]-Physics[Christoffel][`~alpha`, mu, nu])) = -(-%g_[determinant])^(1/2)*Physics[g_][`~alpha`, `~lambda`]*Physics[d_][nu](Physics[Christoffel][`~nu`, alpha, lambda], [X])+(-%g_[determinant])^(1/2)*Physics[g_][`~alpha`, `~lambda`]*Physics[d_][lambda](Physics[Christoffel][`~nu`, alpha, nu], [X])-2*(-%g_[determinant])^(1/2)*Physics[g_][`~alpha`, `~lambda`]*Physics[Christoffel][`~beta`, alpha, lambda]*Physics[Christoffel][`~nu`, beta, nu]+2*(-%g_[determinant])^(1/2)*Physics[g_][`~alpha`, `~lambda`]*Physics[Christoffel][`~beta`, alpha, nu]*Physics[Christoffel][`~nu`, beta, lambda])

%d_[alpha](Physics:-g_[`~mu`, `~nu`]*(-%g_[determinant])^(1/2)*(Physics:-g_[mu, `~alpha`]*Physics:-Christoffel[`~beta`, beta, nu]-Physics:-Christoffel[`~alpha`, mu, nu]))+(-%g_[determinant])^(1/2)*Physics:-g_[`~alpha`, `~lambda`]*Physics:-d_[nu](Physics:-Christoffel[`~nu`, alpha, lambda], [X])-(-%g_[determinant])^(1/2)*Physics:-g_[`~alpha`, `~lambda`]*Physics:-d_[lambda](Physics:-Christoffel[`~nu`, alpha, nu], [X])+2*(-%g_[determinant])^(1/2)*Physics:-g_[`~alpha`, `~lambda`]*Physics:-Christoffel[`~beta`, alpha, lambda]*Physics:-Christoffel[`~nu`, beta, nu]-2*(-%g_[determinant])^(1/2)*Physics:-g_[`~alpha`, `~lambda`]*Physics:-Christoffel[`~beta`, alpha, nu]*Physics:-Christoffel[`~nu`, beta, lambda]

(26)

eval(%d_[alpha](Physics[g_][`~mu`, `~nu`]*(-%g_[determinant])^(1/2)*(Physics[g_][mu, `~alpha`]*Physics[Christoffel][`~beta`, beta, nu]-Physics[Christoffel][`~alpha`, mu, nu]))+(-%g_[determinant])^(1/2)*Physics[g_][`~alpha`, `~lambda`]*Physics[d_][nu](Physics[Christoffel][`~nu`, alpha, lambda], [X])-(-%g_[determinant])^(1/2)*Physics[g_][`~alpha`, `~lambda`]*Physics[d_][lambda](Physics[Christoffel][`~nu`, alpha, nu], [X])+2*(-%g_[determinant])^(1/2)*Physics[g_][`~alpha`, `~lambda`]*Physics[Christoffel][`~beta`, alpha, lambda]*Physics[Christoffel][`~nu`, beta, nu]-2*(-%g_[determinant])^(1/2)*Physics[g_][`~alpha`, `~lambda`]*Physics[Christoffel][`~beta`, alpha, nu]*Physics[Christoffel][`~nu`, beta, lambda], %d_ = d_)

(-%g_[determinant])^(1/2)*(Physics:-g_[mu, `~alpha`]*Physics:-Christoffel[`~beta`, beta, nu]-Physics:-Christoffel[`~alpha`, mu, nu])*Physics:-d_[alpha](Physics:-g_[`~mu`, `~nu`], [X])-(1/2)*(Physics:-g_[mu, `~alpha`]*Physics:-Christoffel[`~beta`, beta, nu]-Physics:-Christoffel[`~alpha`, mu, nu])*Physics:-g_[`~mu`, `~nu`]*%g_[determinant]*Physics:-g_[`~kappa`, `~lambda`]*Physics:-d_[alpha](Physics:-g_[kappa, lambda], [X])/(-%g_[determinant])^(1/2)+(-%g_[determinant])^(1/2)*(Physics:-g_[mu, `~alpha`]*Physics:-d_[alpha](Physics:-Christoffel[`~beta`, beta, nu], [X])-Physics:-d_[alpha](Physics:-Christoffel[`~alpha`, mu, nu], [X]))*Physics:-g_[`~mu`, `~nu`]+(-%g_[determinant])^(1/2)*Physics:-g_[`~alpha`, `~lambda`]*Physics:-d_[nu](Physics:-Christoffel[`~nu`, alpha, lambda], [X])-(-%g_[determinant])^(1/2)*Physics:-g_[`~alpha`, `~lambda`]*Physics:-d_[lambda](Physics:-Christoffel[`~nu`, alpha, nu], [X])+2*(-%g_[determinant])^(1/2)*Physics:-g_[`~alpha`, `~lambda`]*Physics:-Christoffel[`~beta`, alpha, lambda]*Physics:-Christoffel[`~nu`, beta, nu]-2*(-%g_[determinant])^(1/2)*Physics:-g_[`~alpha`, `~lambda`]*Physics:-Christoffel[`~beta`, alpha, nu]*Physics:-Christoffel[`~nu`, beta, lambda]

(27)

Simplify((-%g_[determinant])^(1/2)*(Physics[g_][mu, `~alpha`]*Physics[Christoffel][`~beta`, beta, nu]-Physics[Christoffel][`~alpha`, mu, nu])*Physics[d_][alpha](Physics[g_][`~mu`, `~nu`], [X])-(1/2)*(Physics[g_][mu, `~alpha`]*Physics[Christoffel][`~beta`, beta, nu]-Physics[Christoffel][`~alpha`, mu, nu])*Physics[g_][`~mu`, `~nu`]*%g_[determinant]*Physics[g_][`~kappa`, `~lambda`]*Physics[d_][alpha](Physics[g_][kappa, lambda], [X])/(-%g_[determinant])^(1/2)+(-%g_[determinant])^(1/2)*(Physics[g_][mu, `~alpha`]*Physics[d_][alpha](Physics[Christoffel][`~beta`, beta, nu], [X])-Physics[d_][alpha](Physics[Christoffel][`~alpha`, mu, nu], [X]))*Physics[g_][`~mu`, `~nu`]+(-%g_[determinant])^(1/2)*Physics[g_][`~alpha`, `~lambda`]*Physics[d_][nu](Physics[Christoffel][`~nu`, alpha, lambda], [X])-(-%g_[determinant])^(1/2)*Physics[g_][`~alpha`, `~lambda`]*Physics[d_][lambda](Physics[Christoffel][`~nu`, alpha, nu], [X])+2*(-%g_[determinant])^(1/2)*Physics[g_][`~alpha`, `~lambda`]*Physics[Christoffel][`~beta`, alpha, lambda]*Physics[Christoffel][`~nu`, beta, nu]-2*(-%g_[determinant])^(1/2)*Physics[g_][`~alpha`, `~lambda`]*Physics[Christoffel][`~beta`, alpha, nu]*Physics[Christoffel][`~nu`, beta, lambda])

0

(28)

That said, it is also true that TD = -L[22]-2*L[11] results in the Lagrangian L[1] = -L[11], and since the equations of movement don't depend on the sign of the Lagrangian, for this Lagrangian `≡`(L[C], (-%g_[determinant])^(1/2)*Physics[g_][`~alpha`, `~lambda`]*(Physics[d_][nu](Physics[Christoffel][`~nu`, alpha, lambda], [X])-Physics[d_][lambda](Physics[Christoffel][`~nu`, alpha, nu], [X])+Physics[Christoffel][`~beta`, alpha, lambda]*Physics[Christoffel][`~nu`, beta, nu]-Physics[Christoffel][`~beta`, alpha, nu]*Physics[Christoffel][`~nu`, beta, lambda])) adding the term TD happens to be equivalent to just discarding the terms of L__C involving derivatives of Christoffel symbols.

 

Also new in Maple 2025, due to the extension of Fundiff  to compute in curved spacetimes, it is now also possible to compute Einstein's equations from first principles by constructing the action,

S := Intc(L, X)

Int(Int(Int(Int((-%g_[determinant])^(1/2)*Physics:-Ricci[alpha, `~alpha`], x = -infinity .. infinity), y = -infinity .. infinity), z = -infinity .. infinity), t = -infinity .. infinity)

(29)

and equating to zero the functional derivative with respect to the metric. To avoid displaying the resulting large expression, end the input line with ":"

EE__unsimplified := Fundiff(S, g_[alpha, beta]) = 0

Simplifying this result, we get an expression in terms of Christoffel  symbols and its derivatives

EEC := Simplify(EE__unsimplified)

(1/4)*(2*Physics:-Christoffel[chi, iota, kappa]*Physics:-Christoffel[`~iota`, `~chi`, `~kappa`]-2*Physics:-Christoffel[chi, iota, `~chi`]*Physics:-Christoffel[`~iota`, kappa, `~kappa`]-2*Physics:-D_[iota](Physics:-Christoffel[chi, `~chi`, `~iota`], [X])+2*Physics:-D_[chi](Physics:-Christoffel[`~chi`, iota, `~iota`], [X]))*Physics:-g_[`~alpha`, `~beta`]+(1/4)*(Physics:-Christoffel[`~alpha`, chi, `~beta`]+Physics:-Christoffel[`~beta`, chi, `~alpha`])*Physics:-Christoffel[`~chi`, iota, `~iota`]-(1/4)*Physics:-Christoffel[`~beta`, chi, iota]*Physics:-Christoffel[`~chi`, `~alpha`, `~iota`]-(1/2)*Physics:-Christoffel[chi, iota, `~alpha`]*Physics:-Christoffel[`~iota`, `~beta`, `~chi`]+(1/2)*Physics:-Christoffel[chi, `~alpha`, `~beta`]*Physics:-Christoffel[iota, `~chi`, `~iota`]-(1/4)*Physics:-Christoffel[`~alpha`, chi, iota]*Physics:-Christoffel[`~chi`, `~beta`, `~iota`]+(1/4)*Physics:-D_[chi](Physics:-Christoffel[`~alpha`, `~beta`, `~chi`], [X])+(1/4)*Physics:-D_[chi](Physics:-Christoffel[`~beta`, `~alpha`, `~chi`], [X])-(1/2)*Physics:-D_[chi](Physics:-Christoffel[`~chi`, `~alpha`, `~beta`], [X])-(1/4)*Physics:-D_[`~alpha`](Physics:-Christoffel[`~beta`, chi, `~chi`], [X])+(1/2)*Physics:-D_[`~beta`](Physics:-Christoffel[chi, `~alpha`, `~chi`], [X])-(1/4)*Physics:-D_[`~beta`](Physics:-Christoffel[`~alpha`, chi, `~chi`], [X]) = 0

(30)

In this result, we see`▿` derivatives of Christoffel  symbols, expressed using the D_  command for covariant differentiation. Although, such objects have not the geometrical meaning of a covariant derivative, computationally, they here represent what would be a covariant derivative if the Christoffel symbols were a tensor. For example,

"`▿`[chi](GAMMA[]^(alpha,beta,chi)) :"

% = expand(%)

Physics:-D_[chi](Physics:-Christoffel[`~alpha`, `~beta`, `~chi`], [X]) = Physics:-d_[chi](Physics:-Christoffel[`~alpha`, `~beta`, `~chi`], [X])+Physics:-Christoffel[`~alpha`, chi, mu]*Physics:-Christoffel[`~mu`, `~beta`, `~chi`]+Physics:-Christoffel[`~beta`, chi, mu]*Physics:-Christoffel[`~alpha`, `~chi`, `~mu`]+Physics:-Christoffel[`~chi`, chi, mu]*Physics:-Christoffel[`~alpha`, `~beta`, `~mu`]

(31)

With this computational meaning for the`▿` derivatives of Christoffel symbols appearing in (30), rewrite EEC(30) in terms of the Ricci  and Riemann  tensors. For that, consider the definition

Ricci[definition]

Physics:-Ricci[mu, nu] = Physics:-d_[alpha](Physics:-Christoffel[`~alpha`, mu, nu], [X])-Physics:-d_[nu](Physics:-Christoffel[`~alpha`, mu, alpha], [X])+Physics:-Christoffel[`~beta`, mu, nu]*Physics:-Christoffel[`~alpha`, beta, alpha]-Physics:-Christoffel[`~beta`, mu, alpha]*Physics:-Christoffel[`~alpha`, nu, beta]

(32)

Rewrite the noncovariant derivatives `∂` in terms of`▿` derivatives using the computational representation (31), simplify and isolate one of them

convert(Physics[Ricci][mu, nu] = Physics[d_][alpha](Physics[Christoffel][`~alpha`, mu, nu], [X])-Physics[d_][nu](Physics[Christoffel][`~alpha`, mu, alpha], [X])+Physics[Christoffel][`~beta`, mu, nu]*Physics[Christoffel][`~alpha`, beta, alpha]-Physics[Christoffel][`~beta`, mu, alpha]*Physics[Christoffel][`~alpha`, nu, beta], D_)

Physics:-Ricci[mu, nu] = Physics:-D_[alpha](Physics:-Christoffel[`~alpha`, mu, nu], [X])-Physics:-Christoffel[`~alpha`, alpha, kappa]*Physics:-Christoffel[`~kappa`, mu, nu]+Physics:-Christoffel[`~kappa`, alpha, mu]*Physics:-Christoffel[`~alpha`, kappa, nu]+Physics:-Christoffel[`~kappa`, alpha, nu]*Physics:-Christoffel[`~alpha`, mu, kappa]-Physics:-D_[nu](Physics:-Christoffel[`~alpha`, alpha, mu], [X])-Physics:-Christoffel[`~lambda`, mu, nu]*Physics:-Christoffel[`~alpha`, alpha, lambda]+Physics:-Christoffel[`~beta`, mu, nu]*Physics:-Christoffel[`~alpha`, alpha, beta]-Physics:-Christoffel[`~beta`, alpha, mu]*Physics:-Christoffel[`~alpha`, beta, nu]

(33)

Simplify(Physics[Ricci][mu, nu] = D_[alpha](Physics[Christoffel][`~alpha`, mu, nu], [X])-Physics[Christoffel][`~alpha`, alpha, kappa]*Physics[Christoffel][`~kappa`, mu, nu]+Physics[Christoffel][`~kappa`, alpha, mu]*Physics[Christoffel][`~alpha`, kappa, nu]+Physics[Christoffel][`~kappa`, alpha, nu]*Physics[Christoffel][`~alpha`, mu, kappa]-D_[nu](Physics[Christoffel][`~alpha`, alpha, mu], [X])-Physics[Christoffel][`~lambda`, mu, nu]*Physics[Christoffel][`~alpha`, alpha, lambda]+Physics[Christoffel][`~beta`, mu, nu]*Physics[Christoffel][`~alpha`, alpha, beta]-Physics[Christoffel][`~beta`, alpha, mu]*Physics[Christoffel][`~alpha`, beta, nu])

Physics:-Ricci[mu, nu] = Physics:-Christoffel[alpha, beta, mu]*Physics:-Christoffel[`~beta`, nu, `~alpha`]-Physics:-Christoffel[beta, mu, nu]*Physics:-Christoffel[alpha, `~alpha`, `~beta`]+Physics:-D_[alpha](Physics:-Christoffel[`~alpha`, mu, nu], [X])-Physics:-D_[nu](Physics:-Christoffel[alpha, mu, `~alpha`], [X])

(34)

C_to_Ricci := isolate(Physics[Ricci][mu, nu] = Physics[Christoffel][alpha, beta, mu]*Physics[Christoffel][`~beta`, nu, `~alpha`]-Physics[Christoffel][beta, mu, nu]*Physics[Christoffel][alpha, `~alpha`, `~beta`]+D_[alpha](Physics[Christoffel][`~alpha`, mu, nu], [X])-D_[nu](Physics[Christoffel][alpha, mu, `~alpha`], [X]), D_[alpha](Christoffel[`~alpha`, mu, nu]))

Physics:-D_[alpha](Physics:-Christoffel[`~alpha`, mu, nu], [X]) = -Physics:-Christoffel[alpha, beta, mu]*Physics:-Christoffel[`~beta`, nu, `~alpha`]+Physics:-Christoffel[beta, mu, nu]*Physics:-Christoffel[alpha, `~alpha`, `~beta`]+Physics:-Ricci[mu, nu]+Physics:-D_[nu](Physics:-Christoffel[alpha, mu, `~alpha`], [X])

(35)

Analogously, derive an expression to rewrite`▿` derivatives of Christoffel symbols using the Riemann  tensor

Riemann[`~alpha`, beta, mu, nu, definition]

Physics:-Riemann[`~alpha`, beta, mu, nu] = Physics:-d_[mu](Physics:-Christoffel[`~alpha`, beta, nu], [X])-Physics:-d_[nu](Physics:-Christoffel[`~alpha`, beta, mu], [X])+Physics:-Christoffel[`~alpha`, upsilon, mu]*Physics:-Christoffel[`~upsilon`, beta, nu]-Physics:-Christoffel[`~alpha`, upsilon, nu]*Physics:-Christoffel[`~upsilon`, beta, mu]

(36)

convert(Physics[Riemann][`~alpha`, beta, mu, nu] = Physics[d_][mu](Physics[Christoffel][`~alpha`, beta, nu], [X])-Physics[d_][nu](Physics[Christoffel][`~alpha`, beta, mu], [X])+Physics[Christoffel][`~alpha`, upsilon, mu]*Physics[Christoffel][`~upsilon`, beta, nu]-Physics[Christoffel][`~alpha`, upsilon, nu]*Physics[Christoffel][`~upsilon`, beta, mu], D_)

Physics:-Riemann[`~alpha`, beta, mu, nu] = Physics:-D_[mu](Physics:-Christoffel[`~alpha`, beta, nu], [X])+Physics:-Christoffel[`~kappa`, mu, nu]*Physics:-Christoffel[`~alpha`, beta, kappa]-Physics:-Christoffel[`~alpha`, kappa, mu]*Physics:-Christoffel[`~kappa`, beta, nu]+Physics:-Christoffel[`~kappa`, beta, mu]*Physics:-Christoffel[`~alpha`, kappa, nu]-Physics:-D_[nu](Physics:-Christoffel[`~alpha`, beta, mu], [X])-Physics:-Christoffel[`~lambda`, mu, nu]*Physics:-Christoffel[`~alpha`, beta, lambda]-Physics:-Christoffel[`~lambda`, beta, nu]*Physics:-Christoffel[`~alpha`, lambda, mu]+Physics:-Christoffel[`~alpha`, lambda, nu]*Physics:-Christoffel[`~lambda`, beta, mu]+Physics:-Christoffel[`~alpha`, mu, upsilon]*Physics:-Christoffel[`~upsilon`, beta, nu]-Physics:-Christoffel[`~alpha`, nu, upsilon]*Physics:-Christoffel[`~upsilon`, beta, mu]

(37)

Simplify(Physics[Riemann][`~alpha`, beta, mu, nu] = D_[mu](Physics[Christoffel][`~alpha`, beta, nu], [X])+Physics[Christoffel][`~kappa`, mu, nu]*Physics[Christoffel][`~alpha`, beta, kappa]-Physics[Christoffel][`~alpha`, kappa, mu]*Physics[Christoffel][`~kappa`, beta, nu]+Physics[Christoffel][`~kappa`, beta, mu]*Physics[Christoffel][`~alpha`, kappa, nu]-D_[nu](Physics[Christoffel][`~alpha`, beta, mu], [X])-Physics[Christoffel][`~lambda`, mu, nu]*Physics[Christoffel][`~alpha`, beta, lambda]-Physics[Christoffel][`~lambda`, beta, nu]*Physics[Christoffel][`~alpha`, lambda, mu]+Physics[Christoffel][`~alpha`, lambda, nu]*Physics[Christoffel][`~lambda`, beta, mu]+Physics[Christoffel][`~alpha`, mu, upsilon]*Physics[Christoffel][`~upsilon`, beta, nu]-Physics[Christoffel][`~alpha`, nu, upsilon]*Physics[Christoffel][`~upsilon`, beta, mu])

Physics:-Riemann[`~alpha`, beta, mu, nu] = -Physics:-Christoffel[`~alpha`, kappa, mu]*Physics:-Christoffel[`~kappa`, beta, nu]+Physics:-Christoffel[`~kappa`, beta, mu]*Physics:-Christoffel[`~alpha`, kappa, nu]+Physics:-D_[mu](Physics:-Christoffel[`~alpha`, beta, nu], [X])-Physics:-D_[nu](Physics:-Christoffel[`~alpha`, beta, mu], [X])

(38)

C_to_Riemann := isolate(Physics[Riemann][`~alpha`, beta, mu, nu] = -Physics[Christoffel][`~alpha`, kappa, mu]*Physics[Christoffel][`~kappa`, beta, nu]+Physics[Christoffel][`~kappa`, beta, mu]*Physics[Christoffel][`~alpha`, kappa, nu]+D_[mu](Physics[Christoffel][`~alpha`, beta, nu], [X])-D_[nu](Physics[Christoffel][`~alpha`, beta, mu], [X]), D_[mu](Christoffel[`~alpha`, beta, nu]))

Physics:-D_[mu](Physics:-Christoffel[`~alpha`, beta, nu], [X]) = Physics:-Christoffel[`~alpha`, kappa, mu]*Physics:-Christoffel[`~kappa`, beta, nu]-Physics:-Christoffel[`~kappa`, beta, mu]*Physics:-Christoffel[`~alpha`, kappa, nu]+Physics:-Riemann[`~alpha`, beta, mu, nu]+Physics:-D_[nu](Physics:-Christoffel[`~alpha`, beta, mu], [X])

(39)

Substitute  these two equations, in sequence, into Einstein's equations EEC≡(30)

Substitute(C_to_Riemann, C_to_Ricci, EEC)

-(1/4)*Physics:-Christoffel[`~beta`, psi, `~alpha`]*Physics:-Christoffel[`~psi`, omega, `~omega`]+(1/4)*Physics:-Christoffel[`~beta`, psi, `~omega`]*Physics:-Christoffel[`~psi`, omega, `~alpha`]+(1/4)*Physics:-Christoffel[`~alpha`, lambda, mu]*Physics:-Christoffel[`~lambda`, `~beta`, `~mu`]-(1/4)*Physics:-Christoffel[`~alpha`, lambda, `~mu`]*Physics:-Christoffel[`~lambda`, mu, `~beta`]+(1/4)*Physics:-Christoffel[`~beta`, nu, sigma]*Physics:-Christoffel[`~sigma`, `~alpha`, `~nu`]-(1/4)*Physics:-Christoffel[`~beta`, sigma, `~nu`]*Physics:-Christoffel[`~sigma`, nu, `~alpha`]+(1/2)*Physics:-Christoffel[omicron, zeta, `~beta`]*Physics:-Christoffel[`~zeta`, `~alpha`, `~omicron`]-(1/2)*Physics:-Christoffel[omicron, zeta, `~omicron`]*Physics:-Christoffel[`~zeta`, `~alpha`, `~beta`]-Physics:-Ricci[`~alpha`, `~beta`]-(1/2)*Physics:-Christoffel[`~tau`, `~alpha`, `~beta`]*Physics:-Christoffel[`~upsilon`, tau, upsilon]-(1/2)*Physics:-Christoffel[chi, iota, `~alpha`]*Physics:-Christoffel[`~iota`, `~beta`, `~chi`]+(1/4)*(Physics:-Christoffel[`~alpha`, chi, `~beta`]+Physics:-Christoffel[`~beta`, chi, `~alpha`])*Physics:-Christoffel[`~chi`, iota, `~iota`]+(1/2)*Physics:-Christoffel[`~upsilon`, tau, `~beta`]*Physics:-Christoffel[`~tau`, upsilon, `~alpha`]-(1/4)*Physics:-Christoffel[`~beta`, chi, iota]*Physics:-Christoffel[`~chi`, `~alpha`, `~iota`]+(1/2)*Physics:-Christoffel[chi, `~alpha`, `~beta`]*Physics:-Christoffel[iota, `~chi`, `~iota`]-(1/4)*Physics:-Christoffel[`~alpha`, chi, iota]*Physics:-Christoffel[`~chi`, `~beta`, `~iota`]-(1/4)*Physics:-D_[`~rho1`](Physics:-Christoffel[`~alpha`, rho1, `~beta`], [X])+(1/4)*Physics:-D_[`~mu`](Physics:-Christoffel[`~alpha`, mu, `~beta`], [X])+(1/4)*Physics:-D_[`~nu`](Physics:-Christoffel[`~beta`, nu, `~alpha`], [X])-(1/2)*Physics:-D_[`~beta`](Physics:-Christoffel[`~upsilon`, upsilon, `~alpha`], [X])-(1/4)*Physics:-D_[`~omega`](Physics:-Christoffel[`~beta`, omega, `~alpha`], [X])+(1/2)*Physics:-D_[`~beta`](Physics:-Christoffel[alpha9, `~alpha`, `~alpha9`], [X])-(1/4)*Physics:-Christoffel[`~alpha`, rho, `~beta`]*Physics:-Christoffel[`~rho`, rho1, `~rho1`]+(1/4)*Physics:-Christoffel[`~alpha`, rho, `~rho1`]*Physics:-Christoffel[`~rho`, rho1, `~beta`]+(1/2)*Physics:-Christoffel[alpha10, `~alpha`, `~beta`]*Physics:-Christoffel[alpha9, `~alpha10`, `~alpha9`]-(1/2)*Physics:-Christoffel[alpha9, alpha10, `~alpha`]*Physics:-Christoffel[`~alpha10`, `~alpha9`, `~beta`]+(1/4)*(2*Physics:-Christoffel[chi, iota, kappa]*Physics:-Christoffel[`~iota`, `~chi`, `~kappa`]-2*Physics:-Christoffel[chi, iota, `~chi`]*Physics:-Christoffel[`~iota`, kappa, `~kappa`]-2*Physics:-Christoffel[alpha4, alpha5, alpha6]*Physics:-Christoffel[`~alpha6`, `~alpha4`, `~alpha5`]+2*Physics:-Christoffel[alpha4, alpha6, `~alpha5`]*Physics:-Christoffel[`~alpha6`, alpha5, `~alpha4`]-2*Physics:-D_[`~alpha5`](Physics:-Christoffel[alpha4, alpha5, `~alpha4`], [X])+2*Physics:-Christoffel[`~alpha1`, alpha1, alpha3]*Physics:-Christoffel[`~alpha3`, alpha2, `~alpha2`]-2*Physics:-Christoffel[`~alpha1`, alpha3, `~alpha2`]*Physics:-Christoffel[`~alpha3`, alpha1, alpha2]+2*Physics:-Ricci[alpha2, `~alpha2`]+2*Physics:-D_[`~alpha2`](Physics:-Christoffel[`~alpha1`, alpha1, alpha2], [X]))*Physics:-g_[`~alpha`, `~beta`] = 0

(40)

Simplify  to arrive at the traditional compact form of Einstein's equations

Simplify(-(1/4)*Physics[Christoffel][`~beta`, psi, `~alpha`]*Physics[Christoffel][`~psi`, omega, `~omega`]+(1/4)*Physics[Christoffel][`~beta`, psi, `~omega`]*Physics[Christoffel][`~psi`, omega, `~alpha`]+(1/4)*Physics[Christoffel][`~alpha`, lambda, mu]*Physics[Christoffel][`~lambda`, `~beta`, `~mu`]-(1/4)*Physics[Christoffel][`~alpha`, lambda, `~mu`]*Physics[Christoffel][`~lambda`, mu, `~beta`]+(1/4)*Physics[Christoffel][`~beta`, nu, sigma]*Physics[Christoffel][`~sigma`, `~alpha`, `~nu`]-(1/4)*Physics[Christoffel][`~beta`, sigma, `~nu`]*Physics[Christoffel][`~sigma`, nu, `~alpha`]+(1/2)*Physics[Christoffel][omicron, zeta, `~beta`]*Physics[Christoffel][`~zeta`, `~alpha`, `~omicron`]-(1/2)*Physics[Christoffel][omicron, zeta, `~omicron`]*Physics[Christoffel][`~zeta`, `~alpha`, `~beta`]-(1/2)*Physics[Christoffel][`~tau`, `~alpha`, `~beta`]*Physics[Christoffel][`~upsilon`, tau, upsilon]-(1/2)*Physics[Christoffel][chi, iota, `~alpha`]*Physics[Christoffel][`~iota`, `~beta`, `~chi`]+(1/4)*(Physics[Christoffel][`~alpha`, chi, `~beta`]+Physics[Christoffel][`~beta`, chi, `~alpha`])*Physics[Christoffel][`~chi`, iota, `~iota`]+(1/2)*Physics[Christoffel][`~upsilon`, tau, `~beta`]*Physics[Christoffel][`~tau`, upsilon, `~alpha`]-(1/4)*Physics[Christoffel][`~beta`, chi, iota]*Physics[Christoffel][`~chi`, `~alpha`, `~iota`]+(1/2)*Physics[Christoffel][chi, `~alpha`, `~beta`]*Physics[Christoffel][iota, `~chi`, `~iota`]-(1/4)*Physics[Christoffel][`~alpha`, chi, iota]*Physics[Christoffel][`~chi`, `~beta`, `~iota`]-(1/4)*Physics[Christoffel][`~alpha`, rho, `~beta`]*Physics[Christoffel][`~rho`, rho1, `~rho1`]+(1/4)*Physics[Christoffel][`~alpha`, rho, `~rho1`]*Physics[Christoffel][`~rho`, rho1, `~beta`]+(1/2)*Physics[Christoffel][alpha10, `~alpha`, `~beta`]*Physics[Christoffel][alpha9, `~alpha10`, `~alpha9`]-(1/2)*Physics[Christoffel][alpha9, alpha10, `~alpha`]*Physics[Christoffel][`~alpha10`, `~alpha9`, `~beta`]+(1/4)*(2*Physics[Christoffel][chi, iota, kappa]*Physics[Christoffel][`~iota`, `~chi`, `~kappa`]-2*Physics[Christoffel][chi, iota, `~chi`]*Physics[Christoffel][`~iota`, kappa, `~kappa`]-2*Physics[Christoffel][alpha4, alpha5, alpha6]*Physics[Christoffel][`~alpha6`, `~alpha4`, `~alpha5`]+2*Physics[Christoffel][alpha4, alpha6, `~alpha5`]*Physics[Christoffel][`~alpha6`, alpha5, `~alpha4`]-2*D_[`~alpha5`](Physics[Christoffel][alpha4, alpha5, `~alpha4`], [X])+2*Physics[Christoffel][`~alpha1`, alpha1, alpha3]*Physics[Christoffel][`~alpha3`, alpha2, `~alpha2`]-2*Physics[Christoffel][`~alpha1`, alpha3, `~alpha2`]*Physics[Christoffel][`~alpha3`, alpha1, alpha2]+2*Physics[Ricci][alpha2, `~alpha2`]+2*D_[`~alpha2`](Physics[Christoffel][`~alpha1`, alpha1, alpha2], [X]))*Physics[g_][`~alpha`, `~beta`]-(1/4)*D_[`~rho1`](Physics[Christoffel][`~alpha`, rho1, `~beta`], [X])+(1/4)*D_[`~mu`](Physics[Christoffel][`~alpha`, mu, `~beta`], [X])+(1/4)*D_[`~nu`](Physics[Christoffel][`~beta`, nu, `~alpha`], [X])-(1/2)*D_[`~beta`](Physics[Christoffel][`~upsilon`, upsilon, `~alpha`], [X])-(1/4)*D_[`~omega`](Physics[Christoffel][`~beta`, omega, `~alpha`], [X])+(1/2)*D_[`~beta`](Physics[Christoffel][alpha9, `~alpha`, `~alpha9`], [X])-Physics[Ricci][`~alpha`, `~beta`] = 0)

(1/2)*Physics:-Ricci[chi, `~chi`]*Physics:-g_[`~alpha`, `~beta`]-Physics:-Ricci[`~alpha`, `~beta`] = 0

(41)

 

Linearized Gravity

 

 

Generally speaking, linearizing gravity is about discarding in Einstein's field equations the terms that are quadratic in the metric and its derivatives, an approximation valid when the gravitational field is weak (the deviation from a flat Minkowski spacetime is small). Linearizing gravity is used, e.g. in the study of gravitational waves. In the context of Maple's Physics , the formulation of linearized gravity can be done using the general relativity tensors that come predefined in Physics plus a new in Maple 2025 Physics:-Library:-Linearize  command.

 

In what follows it is shown how to linearize the Ricci  tensor and through it Einstein 's equations. To compare results, see for instance the Wikipedia page for Linearized gravity. Start setting coordinates, you could use Cartesian, spherical, cylindrical, or define your own.

restart; with(Physics); Setup(coordinates = cartesian)

`Systems of spacetime coordinates are:`*{X = (x, y, z, t)}

 

_______________________________________________________

 

[coordinatesystems = {X}]

(42)

The default metric when Physics is loaded is the Minkowski metric, representing a flat (no curvature) spacetime

g_[]

Physics:-g_[mu, nu] = Matrix(%id = 36893488151987392132)

(43)

The weakly perturbed metric


Suppose you want to define a small perturbation around this metric. For that purpose, define a perturbation tensor h[mu, nu], that in the general case depends on the coordinates and is not diagonal, the only requirement is that it is symmetric (to have it diagonal, change symmetric by diagonal; to have it constant, change delta[i, j](X) by delta[i, j])

h[mu, nu] = Matrix(4, proc (i, j) options operator, arrow; delta[i, j](X) end proc, shape = symmetric)

h[mu, nu] = Matrix(%id = 36893488152568729716)

(44)

In the above it is understood that `≪`(`δ__i,j`, 1), so that quadratic or higher powers of it or its derivatives can be approximated to 0 (discarded). Define the components of `h__μ,ν` accordingly

"Define(?)"

`Defined objects with tensor properties`

 

{Physics:-Dgamma[mu], Physics:-Psigma[mu], Physics:-d_[mu], Physics:-g_[mu, nu], h[mu, nu], Physics:-LeviCivita[alpha, beta, mu, nu], Physics:-SpaceTimeVector[mu](X)}

(45)

Define also a tensor `η__μ,ν` representing the unperturbed Minkowski metric

"eta[mu,nu] = rhs(?)"

eta[mu, nu] = Matrix(%id = 36893488151987392132)

(46)

"Define(?)"

`Defined objects with tensor properties`

 

{Physics:-Dgamma[mu], Physics:-Psigma[mu], Physics:-d_[mu], eta[mu, nu], Physics:-g_[mu, nu], h[mu, nu], Physics:-LeviCivita[alpha, beta, mu, nu], Physics:-SpaceTimeVector[mu](X)}

(47)

The weakly perturbed metric is given by

g_[mu, nu] = eta[mu, nu]+h[mu, nu]

Physics:-g_[mu, nu] = eta[mu, nu]+h[mu, nu]

(48)

Make this be the definition of the metric

Define(Physics[g_][mu, nu] = eta[mu, nu]+h[mu, nu])

_______________________________________________________

 

`Coordinates: `[x, y, z, t]*`. Signature: `(`- - - +`)

 

_______________________________________________________

 

Physics:-g_[mu, nu] = Matrix(%id = 36893488152066920564)

 

_______________________________________________________

 

`Setting `*lowercaselatin_is*` letters to represent `*space*` indices`

 

`Defined objects with tensor properties`

 

{Physics:-D_[mu], Physics:-Dgamma[mu], Physics:-Psigma[mu], Physics:-Ricci[mu, nu], Physics:-Riemann[mu, nu, alpha, beta], Physics:-Weyl[mu, nu, alpha, beta], Physics:-d_[mu], eta[mu, nu], Physics:-g_[mu, nu], Physics:-gamma_[i, j], h[mu, nu], Physics:-Christoffel[mu, nu, alpha], Physics:-Einstein[mu, nu], Physics:-LeviCivita[alpha, beta, mu, nu], Physics:-SpaceTimeVector[mu](X)}

(49)

 

Linearizing the Ricci tensor


The linearized form of the Ricci  tensor is computed by introducing this weakly perturbed metric (48) in the expression of the Ricci tensor as a function of the metric. This can be accomplished in different ways, the simpler being to use the conversion network between tensors , but for illustration purposes, showing steps one at time, a substitution of definitions one into the other one is used

Ricci[definition]

Physics:-Ricci[mu, nu] = Physics:-d_[alpha](Physics:-Christoffel[`~alpha`, mu, nu], [X])-Physics:-d_[nu](Physics:-Christoffel[`~alpha`, mu, alpha], [X])+Physics:-Christoffel[`~beta`, mu, nu]*Physics:-Christoffel[`~alpha`, beta, alpha]-Physics:-Christoffel[`~beta`, mu, alpha]*Physics:-Christoffel[`~alpha`, nu, beta]

(50)

Christoffel[`~alpha`, mu, nu, definition]

Physics:-Christoffel[`~alpha`, mu, nu] = (1/2)*Physics:-g_[`~alpha`, `~beta`]*(Physics:-d_[nu](Physics:-g_[beta, mu], [X])+Physics:-d_[mu](Physics:-g_[beta, nu], [X])-Physics:-d_[beta](Physics:-g_[mu, nu], [X]))

(51)

Substitute(Physics[Christoffel][`~alpha`, mu, nu] = (1/2)*Physics[g_][`~alpha`, `~beta`]*(Physics[d_][nu](Physics[g_][beta, mu], [X])+Physics[d_][mu](Physics[g_][beta, nu], [X])-Physics[d_][beta](Physics[g_][mu, nu], [X])), Physics[Ricci][mu, nu] = Physics[d_][alpha](Physics[Christoffel][`~alpha`, mu, nu], [X])-Physics[d_][nu](Physics[Christoffel][`~alpha`, mu, alpha], [X])+Physics[Christoffel][`~beta`, mu, nu]*Physics[Christoffel][`~alpha`, beta, alpha]-Physics[Christoffel][`~beta`, mu, alpha]*Physics[Christoffel][`~alpha`, nu, beta])

Physics:-Ricci[mu, nu] = Physics:-d_[alpha]((1/2)*Physics:-g_[`~alpha`, `~kappa`]*(Physics:-d_[nu](Physics:-g_[kappa, mu], [X])+Physics:-d_[mu](Physics:-g_[kappa, nu], [X])-Physics:-d_[kappa](Physics:-g_[mu, nu], [X])), [X])-Physics:-d_[nu]((1/2)*Physics:-g_[`~alpha`, `~tau`]*(Physics:-d_[mu](Physics:-g_[tau, alpha], [X])+Physics:-d_[alpha](Physics:-g_[tau, mu], [X])-Physics:-d_[tau](Physics:-g_[alpha, mu], [X])), [X])+(1/4)*Physics:-g_[`~beta`, `~iota`]*(Physics:-d_[nu](Physics:-g_[iota, mu], [X])+Physics:-d_[mu](Physics:-g_[iota, nu], [X])-Physics:-d_[iota](Physics:-g_[mu, nu], [X]))*Physics:-g_[`~alpha`, `~lambda`]*(Physics:-d_[beta](Physics:-g_[lambda, alpha], [X])+Physics:-d_[alpha](Physics:-g_[lambda, beta], [X])-Physics:-d_[lambda](Physics:-g_[alpha, beta], [X]))-(1/4)*Physics:-g_[`~beta`, `~omega`]*(Physics:-d_[mu](Physics:-g_[omega, alpha], [X])+Physics:-d_[alpha](Physics:-g_[omega, mu], [X])-Physics:-d_[omega](Physics:-g_[alpha, mu], [X]))*Physics:-g_[`~alpha`, `~chi`]*(Physics:-d_[nu](Physics:-g_[chi, beta], [X])+Physics:-d_[beta](Physics:-g_[chi, nu], [X])-Physics:-d_[chi](Physics:-g_[beta, nu], [X]))

(52)

Introducing (48)g[mu, nu] = eta[mu, nu]+h[mu, nu], and also the inert form of the Ricci tensor to facilitate simplification some steps below,

Substitute(Physics[g_][mu, nu] = eta[mu, nu]+h[mu, nu], Ricci = %Ricci, Physics[Ricci][mu, nu] = Physics[d_][alpha]((1/2)*Physics[g_][`~alpha`, `~kappa`]*(Physics[d_][nu](Physics[g_][kappa, mu], [X])+Physics[d_][mu](Physics[g_][kappa, nu], [X])-Physics[d_][kappa](Physics[g_][mu, nu], [X])), [X])-Physics[d_][nu]((1/2)*Physics[g_][`~alpha`, `~tau`]*(Physics[d_][mu](Physics[g_][tau, alpha], [X])+Physics[d_][alpha](Physics[g_][tau, mu], [X])-Physics[d_][tau](Physics[g_][alpha, mu], [X])), [X])+(1/4)*Physics[g_][`~beta`, `~iota`]*(Physics[d_][nu](Physics[g_][iota, mu], [X])+Physics[d_][mu](Physics[g_][iota, nu], [X])-Physics[d_][iota](Physics[g_][mu, nu], [X]))*Physics[g_][`~alpha`, `~lambda`]*(Physics[d_][beta](Physics[g_][lambda, alpha], [X])+Physics[d_][alpha](Physics[g_][lambda, beta], [X])-Physics[d_][lambda](Physics[g_][alpha, beta], [X]))-(1/4)*Physics[g_][`~beta`, `~omega`]*(Physics[d_][mu](Physics[g_][omega, alpha], [X])+Physics[d_][alpha](Physics[g_][omega, mu], [X])-Physics[d_][omega](Physics[g_][alpha, mu], [X]))*Physics[g_][`~alpha`, `~chi`]*(Physics[d_][nu](Physics[g_][chi, beta], [X])+Physics[d_][beta](Physics[g_][chi, nu], [X])-Physics[d_][chi](Physics[g_][beta, nu], [X])))

%Ricci[mu, nu] = (1/2)*Physics:-d_[alpha](eta[`~alpha`, `~kappa`]+h[`~alpha`, `~kappa`], [X])*(Physics:-d_[nu](eta[kappa, mu]+h[kappa, mu], [X])+Physics:-d_[mu](eta[kappa, nu]+h[kappa, nu], [X])-Physics:-d_[kappa](eta[mu, nu]+h[mu, nu], [X]))+(1/2)*(eta[`~alpha`, `~kappa`]+h[`~alpha`, `~kappa`])*(Physics:-d_[alpha](Physics:-d_[nu](eta[kappa, mu]+h[kappa, mu], [X]), [X])+Physics:-d_[alpha](Physics:-d_[mu](eta[kappa, nu]+h[kappa, nu], [X]), [X])-Physics:-d_[alpha](Physics:-d_[kappa](eta[mu, nu]+h[mu, nu], [X]), [X]))-(1/2)*Physics:-d_[nu](eta[`~alpha`, `~tau`]+h[`~alpha`, `~tau`], [X])*(Physics:-d_[mu](eta[alpha, tau]+h[alpha, tau], [X])+Physics:-d_[alpha](eta[mu, tau]+h[mu, tau], [X])-Physics:-d_[tau](eta[alpha, mu]+h[alpha, mu], [X]))-(1/2)*(eta[`~alpha`, `~tau`]+h[`~alpha`, `~tau`])*(Physics:-d_[mu](Physics:-d_[nu](eta[alpha, tau]+h[alpha, tau], [X]), [X])+Physics:-d_[alpha](Physics:-d_[nu](eta[mu, tau]+h[mu, tau], [X]), [X])-Physics:-d_[nu](Physics:-d_[tau](eta[alpha, mu]+h[alpha, mu], [X]), [X]))+(1/4)*(eta[`~beta`, `~iota`]+h[`~beta`, `~iota`])*(Physics:-d_[nu](eta[iota, mu]+h[iota, mu], [X])+Physics:-d_[mu](eta[iota, nu]+h[iota, nu], [X])-Physics:-d_[iota](eta[mu, nu]+h[mu, nu], [X]))*(eta[`~alpha`, `~lambda`]+h[`~alpha`, `~lambda`])*(Physics:-d_[beta](eta[alpha, lambda]+h[alpha, lambda], [X])+Physics:-d_[alpha](eta[beta, lambda]+h[beta, lambda], [X])-Physics:-d_[lambda](eta[alpha, beta]+h[alpha, beta], [X]))-(1/4)*(eta[`~beta`, `~omega`]+h[`~beta`, `~omega`])*(Physics:-d_[mu](eta[alpha, omega]+h[alpha, omega], [X])+Physics:-d_[alpha](eta[mu, omega]+h[mu, omega], [X])-Physics:-d_[omega](eta[alpha, mu]+h[alpha, mu], [X]))*(eta[`~alpha`, `~chi`]+h[`~alpha`, `~chi`])*(Physics:-d_[nu](eta[beta, chi]+h[beta, chi], [X])+Physics:-d_[beta](eta[chi, nu]+h[chi, nu], [X])-Physics:-d_[chi](eta[beta, nu]+h[beta, nu], [X]))

(53)

This expression contains several terms quadratic in the small perturbation `h__μ,ν` and its derivatives. The new in Maple 2025 routine to filter out those terms is Physics:-Library:-Linearize , which requires specifying the symbol representing the small quantities

Library:-Linearize(%Ricci[mu, nu] = (1/2)*Physics[d_][alpha](eta[`~alpha`, `~kappa`]+h[`~alpha`, `~kappa`], [X])*(Physics[d_][nu](eta[kappa, mu]+h[kappa, mu], [X])+Physics[d_][mu](eta[kappa, nu]+h[kappa, nu], [X])-Physics[d_][kappa](eta[mu, nu]+h[mu, nu], [X]))+(1/2)*(eta[`~alpha`, `~kappa`]+h[`~alpha`, `~kappa`])*(Physics[d_][alpha](Physics[d_][nu](eta[kappa, mu]+h[kappa, mu], [X]), [X])+Physics[d_][alpha](Physics[d_][mu](eta[kappa, nu]+h[kappa, nu], [X]), [X])-Physics[d_][alpha](Physics[d_][kappa](eta[mu, nu]+h[mu, nu], [X]), [X]))-(1/2)*Physics[d_][nu](eta[`~alpha`, `~tau`]+h[`~alpha`, `~tau`], [X])*(Physics[d_][mu](eta[alpha, tau]+h[alpha, tau], [X])+Physics[d_][alpha](eta[mu, tau]+h[mu, tau], [X])-Physics[d_][tau](eta[alpha, mu]+h[alpha, mu], [X]))-(1/2)*(eta[`~alpha`, `~tau`]+h[`~alpha`, `~tau`])*(Physics[d_][mu](Physics[d_][nu](eta[alpha, tau]+h[alpha, tau], [X]), [X])+Physics[d_][alpha](Physics[d_][nu](eta[mu, tau]+h[mu, tau], [X]), [X])-Physics[d_][nu](Physics[d_][tau](eta[alpha, mu]+h[alpha, mu], [X]), [X]))+(1/4)*(eta[`~beta`, `~iota`]+h[`~beta`, `~iota`])*(Physics[d_][nu](eta[iota, mu]+h[iota, mu], [X])+Physics[d_][mu](eta[iota, nu]+h[iota, nu], [X])-Physics[d_][iota](eta[mu, nu]+h[mu, nu], [X]))*(eta[`~alpha`, `~lambda`]+h[`~alpha`, `~lambda`])*(Physics[d_][beta](eta[alpha, lambda]+h[alpha, lambda], [X])+Physics[d_][alpha](eta[beta, lambda]+h[beta, lambda], [X])-Physics[d_][lambda](eta[alpha, beta]+h[alpha, beta], [X]))-(1/4)*(eta[`~beta`, `~omega`]+h[`~beta`, `~omega`])*(Physics[d_][mu](eta[alpha, omega]+h[alpha, omega], [X])+Physics[d_][alpha](eta[mu, omega]+h[mu, omega], [X])-Physics[d_][omega](eta[alpha, mu]+h[alpha, mu], [X]))*(eta[`~alpha`, `~chi`]+h[`~alpha`, `~chi`])*(Physics[d_][nu](eta[beta, chi]+h[beta, chi], [X])+Physics[d_][beta](eta[chi, nu]+h[chi, nu], [X])-Physics[d_][chi](eta[beta, nu]+h[beta, nu], [X])), h)

%Ricci[mu, nu] = (1/2)*eta[`~alpha`, `~tau`]*Physics:-d_[nu](Physics:-d_[tau](h[alpha, mu], [X]), [X])-(1/2)*eta[`~alpha`, `~tau`]*Physics:-d_[mu](Physics:-d_[nu](h[alpha, tau], [X]), [X])-(1/2)*eta[`~alpha`, `~kappa`]*Physics:-d_[alpha](Physics:-d_[kappa](h[mu, nu], [X]), [X])+(1/2)*eta[`~alpha`, `~kappa`]*Physics:-d_[alpha](Physics:-d_[nu](h[kappa, mu], [X]), [X])+(1/2)*eta[`~alpha`, `~kappa`]*Physics:-d_[alpha](Physics:-d_[mu](h[kappa, nu], [X]), [X])-(1/2)*eta[`~alpha`, `~tau`]*Physics:-d_[alpha](Physics:-d_[nu](h[mu, tau], [X]), [X])

(54)

Important: in this result, `η__μ,ν` is the flat Minkowski metric, not the perturbed metric g[mu, nu]. However, in the context of a linearized formulation, `η__μ,ν` raises and lowers tensor indices the same way as g[mu, nu]. Hence, to further simplify contracted products of eta[mu, nu] in (54) , it is practical to reintroduce `g__μ,ν`representing that Minkowski metric and simplify using the internal algorithms for a flat metric

g_[min]

_______________________________________________________

 

`The Minkowski metric in coordinates `*[x, y, z, t]

 

`Signature: `(`- - - +`)

 

_______________________________________________________

 

Physics:-g_[mu, nu] = Matrix(%id = 36893488152066895868)

(55)

To proceed simplifying, replace in the expression (54) for the Ricci tensor the intermediate Minkowski `η__μ,ν`by `#msub(mi("g"),mrow(mi("μ",fontstyle = "normal"),mo(","),mi("ν",fontstyle = "normal")))`

subs(eta = g_, %Ricci[mu, nu] = (1/2)*eta[`~alpha`, `~tau`]*Physics[d_][nu](Physics[d_][tau](h[alpha, mu], [X]), [X])-(1/2)*eta[`~alpha`, `~tau`]*Physics[d_][mu](Physics[d_][nu](h[alpha, tau], [X]), [X])-(1/2)*eta[`~alpha`, `~kappa`]*Physics[d_][alpha](Physics[d_][kappa](h[mu, nu], [X]), [X])+(1/2)*eta[`~alpha`, `~kappa`]*Physics[d_][alpha](Physics[d_][nu](h[kappa, mu], [X]), [X])+(1/2)*eta[`~alpha`, `~kappa`]*Physics[d_][alpha](Physics[d_][mu](h[kappa, nu], [X]), [X])-(1/2)*eta[`~alpha`, `~tau`]*Physics[d_][alpha](Physics[d_][nu](h[mu, tau], [X]), [X]))

%Ricci[mu, nu] = (1/2)*Physics:-g_[`~alpha`, `~tau`]*Physics:-d_[nu](Physics:-d_[tau](h[alpha, mu], [X]), [X])-(1/2)*Physics:-g_[`~alpha`, `~tau`]*Physics:-d_[mu](Physics:-d_[nu](h[alpha, tau], [X]), [X])-(1/2)*Physics:-g_[`~alpha`, `~kappa`]*Physics:-d_[alpha](Physics:-d_[kappa](h[mu, nu], [X]), [X])+(1/2)*Physics:-g_[`~alpha`, `~kappa`]*Physics:-d_[alpha](Physics:-d_[nu](h[kappa, mu], [X]), [X])+(1/2)*Physics:-g_[`~alpha`, `~kappa`]*Physics:-d_[alpha](Physics:-d_[mu](h[kappa, nu], [X]), [X])-(1/2)*Physics:-g_[`~alpha`, `~tau`]*Physics:-d_[alpha](Physics:-d_[nu](h[mu, tau], [X]), [X])

(56)

Simplifying, results in the linearized form of the Ricci tensor shown in the Wikipedia page for Linearized gravity.

Simplify(%Ricci[mu, nu] = (1/2)*Physics[g_][`~alpha`, `~tau`]*Physics[d_][nu](Physics[d_][tau](h[alpha, mu], [X]), [X])-(1/2)*Physics[g_][`~alpha`, `~tau`]*Physics[d_][mu](Physics[d_][nu](h[alpha, tau], [X]), [X])-(1/2)*Physics[g_][`~alpha`, `~kappa`]*Physics[d_][alpha](Physics[d_][kappa](h[mu, nu], [X]), [X])+(1/2)*Physics[g_][`~alpha`, `~kappa`]*Physics[d_][alpha](Physics[d_][nu](h[kappa, mu], [X]), [X])+(1/2)*Physics[g_][`~alpha`, `~kappa`]*Physics[d_][alpha](Physics[d_][mu](h[kappa, nu], [X]), [X])-(1/2)*Physics[g_][`~alpha`, `~tau`]*Physics[d_][alpha](Physics[d_][nu](h[mu, tau], [X]), [X]))

%Ricci[mu, nu] = -(1/2)*Physics:-d_[mu](Physics:-d_[nu](h[tau, `~tau`], [X]), [X])-(1/2)*Physics:-dAlembertian(h[mu, nu], [X])+(1/2)*Physics:-d_[nu](Physics:-d_[tau](h[mu, `~tau`], [X]), [X])+(1/2)*Physics:-d_[mu](Physics:-d_[tau](h[nu, `~tau`], [X]), [X])

(57)

Linearizing Einstein's equations

Einstein's equations are the components of Einstein's tensor , whose definition in terms of the Ricci tensor is

Einstein[definition]

Physics:-Einstein[mu, nu] = Physics:-Ricci[mu, nu]-(1/2)*Physics:-g_[mu, nu]*Physics:-Ricci[alpha, `~alpha`]

(58)

Compute the trace R[alpha, `~alpha`] directly from the linearized form (57) of the Ricci tensor,

g_[mu, nu]*(%Ricci[mu, nu] = -(1/2)*Physics[d_][mu](Physics[d_][nu](h[tau, `~tau`], [X]), [X])-(1/2)*Physics[dAlembertian](h[mu, nu], [X])+(1/2)*Physics[d_][nu](Physics[d_][tau](h[mu, `~tau`], [X]), [X])+(1/2)*Physics[d_][mu](Physics[d_][tau](h[nu, `~tau`], [X]), [X]))

%Ricci[mu, nu]*Physics:-g_[`~mu`, `~nu`] = (-(1/2)*Physics:-d_[mu](Physics:-d_[nu](h[tau, `~tau`], [X]), [X])-(1/2)*Physics:-dAlembertian(h[mu, nu], [X])+(1/2)*Physics:-d_[nu](Physics:-d_[tau](h[mu, `~tau`], [X]), [X])+(1/2)*Physics:-d_[mu](Physics:-d_[tau](h[nu, `~tau`], [X]), [X]))*Physics:-g_[`~mu`, `~nu`]

(59)

Simplify(%Ricci[mu, nu]*Physics[g_][`~mu`, `~nu`] = (-(1/2)*Physics[d_][mu](Physics[d_][nu](h[tau, `~tau`], [X]), [X])-(1/2)*Physics[dAlembertian](h[mu, nu], [X])+(1/2)*Physics[d_][nu](Physics[d_][tau](h[mu, `~tau`], [X]), [X])+(1/2)*Physics[d_][mu](Physics[d_][tau](h[nu, `~tau`], [X]), [X]))*Physics[g_][`~mu`, `~nu`])

%Ricci[nu, `~nu`] = -Physics:-dAlembertian(h[alpha, `~alpha`], [X])+Physics:-d_[alpha](Physics:-d_[tau](h[`~alpha`, `~tau`], [X]), [X])

(60)

The linearized Einstein equations are constructed reproducing the definition (58) using (57) and (60)

(%Ricci[mu, nu] = -(1/2)*Physics[d_][mu](Physics[d_][nu](h[tau, `~tau`], [X]), [X])-(1/2)*Physics[dAlembertian](h[mu, nu], [X])+(1/2)*Physics[d_][nu](Physics[d_][tau](h[mu, `~tau`], [X]), [X])+(1/2)*Physics[d_][mu](Physics[d_][tau](h[nu, `~tau`], [X]), [X]))-(1/2)*g_[mu, nu]*(%Ricci[nu, `~nu`] = -Physics[dAlembertian](h[alpha, `~alpha`], [X])+Physics[d_][alpha](Physics[d_][tau](h[`~alpha`, `~tau`], [X]), [X]))

%Ricci[mu, nu]-(1/2)*Physics:-g_[mu, nu]*%Ricci[alpha, `~alpha`] = -(1/2)*Physics:-d_[mu](Physics:-d_[nu](h[tau, `~tau`], [X]), [X])-(1/2)*Physics:-dAlembertian(h[mu, nu], [X])+(1/2)*Physics:-d_[nu](Physics:-d_[tau](h[mu, `~tau`], [X]), [X])+(1/2)*Physics:-d_[mu](Physics:-d_[tau](h[nu, `~tau`], [X]), [X])-(1/2)*Physics:-g_[mu, nu]*(-Physics:-dAlembertian(h[alpha, `~alpha`], [X])+Physics:-d_[alpha](Physics:-d_[tau](h[`~alpha`, `~tau`], [X]), [X]))

(61)

which is the same formula shown in the Wikipedia page for Linearized gravity.


You can now redefine the general h[mu, nu] introduced in (44) in different ways (see discussion in the Wikipedia page), or, depending on the case, just substitute your preferred gauge in this formula (61) for the general case. For example, the condition for the Harmonic gauge also known as Lorentz gauge reduces the linearized field equations to their simplest form

d_[mu](h[`~mu`, nu]) = (1/2)*d_[nu](h[alpha, alpha])

Physics:-d_[mu](h[`~mu`, nu], [X]) = (1/2)*Physics:-d_[nu](h[alpha, `~alpha`], [X])

(62)

Substitute(Physics[d_][mu](h[`~mu`, nu], [X]) = (1/2)*Physics[d_][nu](h[alpha, `~alpha`], [X]), %Ricci[mu, nu]-(1/2)*Physics[g_][mu, nu]*%Ricci[alpha, `~alpha`] = -(1/2)*Physics[d_][mu](Physics[d_][nu](h[tau, `~tau`], [X]), [X])-(1/2)*Physics[dAlembertian](h[mu, nu], [X])+(1/2)*Physics[d_][nu](Physics[d_][tau](h[mu, `~tau`], [X]), [X])+(1/2)*Physics[d_][mu](Physics[d_][tau](h[nu, `~tau`], [X]), [X])-(1/2)*Physics[g_][mu, nu]*(-Physics[dAlembertian](h[alpha, `~alpha`], [X])+Physics[d_][alpha](Physics[d_][tau](h[`~alpha`, `~tau`], [X]), [X])))

%Ricci[mu, nu]-(1/2)*Physics:-g_[mu, nu]*%Ricci[alpha, `~alpha`] = -(1/2)*Physics:-d_[mu](Physics:-d_[nu](h[tau, `~tau`], [X]), [X])-(1/2)*Physics:-dAlembertian(h[mu, nu], [X])+(1/2)*Physics:-d_[nu]((1/2)*Physics:-d_[mu](h[lambda, `~lambda`], [X]), [X])+(1/2)*Physics:-d_[mu]((1/2)*Physics:-d_[nu](h[kappa, `~kappa`], [X]), [X])-(1/2)*Physics:-g_[mu, nu]*(-Physics:-dAlembertian(h[alpha, `~alpha`], [X])+Physics:-d_[alpha]((1/2)*Physics:-d_[`~alpha`](h[beta, `~beta`], [X]), [X]))

(63)

Simplify(%Ricci[mu, nu]-(1/2)*Physics[g_][mu, nu]*%Ricci[alpha, `~alpha`] = -(1/2)*Physics[d_][mu](Physics[d_][nu](h[tau, `~tau`], [X]), [X])-(1/2)*Physics[dAlembertian](h[mu, nu], [X])+(1/2)*Physics[d_][nu]((1/2)*Physics[d_][mu](h[lambda, `~lambda`], [X]), [X])+(1/2)*Physics[d_][mu]((1/2)*Physics[d_][nu](h[kappa, `~kappa`], [X]), [X])-(1/2)*Physics[g_][mu, nu]*(-Physics[dAlembertian](h[alpha, `~alpha`], [X])+Physics[d_][alpha]((1/2)*Physics[d_][`~alpha`](h[beta, `~beta`], [X]), [X])))

%Ricci[mu, nu]-(1/2)*Physics:-g_[mu, nu]*%Ricci[alpha, `~alpha`] = -(1/2)*Physics:-dAlembertian(h[mu, nu], [X])+(1/4)*Physics:-dAlembertian(h[alpha, `~alpha`], [X])*Physics:-g_[mu, nu]

(64)

Relative Tensors

 

 

In General Relativity, the context of a curved spacetime, it is sometimes necessary to work with relative tensors, for which the transformation rule under a transformation of coordinates involves powers of the determinant of the transformation - see Chapter 4 of  "Lovelock, D., and Rund, H. Tensors, Differential Forms and Variational Principles, Dover, 1989." Physics  in Maple 2025 includes a complete, new implementation of relative tensors.

 

To indicate that a tensor being defined is relative pass its relative weight. For example, set a curved spacetime,

restart; with(Physics); g_[sc]

_______________________________________________________

 

`Systems of spacetime coordinates are:`*{X = (r, theta, phi, t)}

 

`Default differentiation variables for d_, D_ and dAlembertian are:`*{X = (r, theta, phi, t)}

 

`Setting `*lowercaselatin_is*` letters to represent `*space*` indices`

 

`The Schwarzschild metric in coordinates `*[r, theta, phi, t]

 

`Parameters: `[m]

 

`Signature: `(`- - - +`)

 

_______________________________________________________

 

Physics:-g_[mu, nu] = Matrix(%id = 36893488152573138332)

(65)

Define now two tensors of one index, one of them being relative

Define(T[mu])

`Defined objects with tensor properties`

 

{Physics:-D_[mu], Physics:-Dgamma[mu], Physics:-Psigma[mu], Physics:-Ricci[mu, nu], Physics:-Riemann[mu, nu, alpha, beta], T[mu], Physics:-Weyl[mu, nu, alpha, beta], Physics:-d_[mu], Physics:-g_[mu, nu], Physics:-gamma_[i, j], Physics:-Christoffel[mu, nu, alpha], Physics:-Einstein[mu, nu], Physics:-LeviCivita[alpha, beta, mu, nu], Physics:-SpaceTimeVector[mu](X)}

(66)

Define(R[mu], relativeweight = 1)

`Defined objects with tensor properties`

 

{Physics:-D_[mu], Physics:-Dgamma[mu], Physics:-Psigma[mu], R[mu], Physics:-Ricci[mu, nu], Physics:-Riemann[mu, nu, alpha, beta], T[mu], Physics:-Weyl[mu, nu, alpha, beta], Physics:-d_[mu], Physics:-g_[mu, nu], Physics:-gamma_[i, j], Physics:-Christoffel[mu, nu, alpha], Physics:-Einstein[mu, nu], Physics:-LeviCivita[alpha, beta, mu, nu], Physics:-SpaceTimeVector[mu](X)}

(67)

Transformation of Coordinates

 

Consider a transformation of coordinates, from spherical r, theta, phi, t to  rho, theta, phi, t where

TR := r = (1+m/(2*rho))^2*rho

r = (1+(1/2)*m/rho)^2*rho

(68)

The transformed components of T[mu] and R[mu] are, respectively,

TransformCoordinates(TR, T[mu], [rho, theta, phi, t])

Vector[column](%id = 36893488151820263660)

(69)

TransformCoordinates(TR, R[mu], [rho, theta, phi, t])

Vector[column](%id = 36893488151823155676)

(70)

where, when comparing both results, we see that the transformed components for R[mu] are all multiplied by J^n with n = 1 and J is the determinant of the transformation:

J__matrix := simplify(VectorCalculus:-Jacobian([rhs(TR), theta, phi, t], [rho, theta, phi, t]))

Matrix(%id = 36893488151964220700)

(71)

J = LinearAlgebra:-Determinant(J__matrix)

J = (1/4)*(-m^2+4*rho^2)/rho^2

(72)

Relative weight

 

The relative weight of a scalar, tensor or tensorial expression can be computed using the Physics:-Library:-GetRelativeWeight  command. For the two tensors T[mu] and R[mu] used above,

Library:-GetRelativeWeight(T[mu])

0

(73)

Library:-GetRelativeWeight(R[mu])

1

(74)

The relative weight of a tensor does not depend on the covariant or contravariant character of its indices

Library:-GetRelativeWeight(R[`~mu`])

1

(75)

The LeviCivita  tensor is a special case, has its relative weight defined when Physics  is loaded, and because in a curved spacetime it is not a tensor its relative weight depends on the covariant or contravariant character of its indices

Library:-GetRelativeWeight(LeviCivita[alpha, beta, mu, nu])

-1

(76)

"Library:-GetRelativeWeight(LeviCivita[~alpha, ~beta, ~mu,~nu])   "

1

(77)

The relative weight w of a product is equal to the sum of relative weights of each factor

R[mu]^2

R[mu]*R[`~mu`]

(78)

Library:-GetRelativeWeight(R[mu]*R[`~mu`])

2

(79)

The relative weight w of a power is equal to the relative weight of the base multiplied by the power

1/R[mu]^2

1/(R[mu]*R[`~mu`])

(80)

Library:-GetRelativeWeight(1/(R[mu]*R[`~mu`]))

-2

(81)

The relative weight w of a sum is equal to the relative weight of one of its terms and exists if all the terms have the same w.

"R[~mu] + LeviCivita[~alpha, ~beta, ~mu,~nu]*T[alpha] T[beta] T[nu]"

T[alpha]*T[beta]*T[nu]*Physics:-LeviCivita[`~alpha`, `~beta`, `~mu`, `~nu`]+R[`~mu`]

(82)

Library:-GetRelativeWeight(T[alpha]*T[beta]*T[nu]*Physics[LeviCivita][`~alpha`, `~beta`, `~mu`, `~nu`]+R[`~mu`])

1

(83)

The relative weight of any determinant is always equal to 2

%g_[determinant]

%g_[determinant]

(84)

Library:-GetRelativeWeight(%g_[determinant])

2

(85)

Relative Term in covariant derivatives

 

When computing the covariant derivative of a relative scalar, tensor or tensorial expression that has non-zero relative weight w, a relative term is added, that can be computed using the Physics:-Library:-GetRelativeWeight  command.

g__det := %g_[:-determinant]

%g_[determinant]

(86)

Library:-GetRelativeTerm(g__det, mu)

-2*Physics:-Christoffel[`~nu`, mu, nu]*%g_[determinant]

(87)
  

Consequently,

(%D_[mu] = D_[mu])(g__det)

%D_[mu](%g_[determinant]) = 0

(88)
  

To understand this zero value on the right-hand side, express the left-hand side in terms of d_

convert(%D_[mu](%g_[determinant]) = 0, d_)

%d_[mu](%g_[determinant], [X])-2*Physics:-Christoffel[`~alpha`, alpha, mu]*%g_[determinant] = 0

(89)
  

evaluate the inert %d_

factor(eval(%d_[mu](%g_[determinant], [X])-2*Physics[Christoffel][`~alpha`, alpha, mu]*%g_[determinant] = 0, %d_ = d_))

%g_[determinant]*(Physics:-g_[`~alpha`, `~nu`]*Physics:-d_[mu](Physics:-g_[alpha, nu], [X])-2*Physics:-Christoffel[`~alpha`, alpha, mu]) = 0

(90)
  

The factor in parentheses is equal to `#mrow(msubsup(mi("g"),none(),mrow(mi("α",fontstyle = "normal"),mo(","),mi("ν",fontstyle = "normal"))),msub(mi("▿"),mi("μ",fontstyle = "normal")),mo("⁡"),mfenced(msub(mi("g"),mrow(mi("α",fontstyle = "normal"),mo(","),mi("ν",fontstyle = "normal")))))`, where the covariant derivative of the metric is equal to zero, so

Simplify(%g_[determinant]*(Physics[g_][`~alpha`, `~nu`]*Physics[d_][mu](Physics[g_][alpha, nu], [X])-2*Physics[Christoffel][`~alpha`, alpha, mu]) = 0)

0 = 0

(91)
  

Consider the covariant derivative of T[mu] and R[mu] defined in (66) and (67)

Library:-GetRelativeWeight(T[mu])

0

(92)

Library:-GetRelativeWeight(R[mu])

1

(93)

The corresponding covariant derivatives

(%D_[mu] = D_[mu])(T[mu](X))

%D_[mu](T[`~mu`](X)) = Physics:-D_[mu](T[`~mu`](X), [X])

(94)

expand(%D_[mu](T[`~mu`](X)) = D_[mu](T[`~mu`](X), [X]))

%D_[mu](T[`~mu`](X)) = 2*T[`~mu`](X)*Physics:-d_[mu](r, [X])/r+Physics:-d_[mu](theta, [X])*cos(theta)*T[`~mu`](X)/sin(theta)+Physics:-d_[mu](T[`~mu`](X), [X])

(95)

(%D_[mu] = D_[mu])(R[mu](X))

%D_[mu](R[`~mu`](X)) = Physics:-D_[mu](R[`~mu`](X), [X])

(96)

expand(%D_[mu](R[`~mu`](X)) = D_[mu](R[`~mu`](X), [X]))

%D_[mu](R[`~mu`](X)) = 2*R[`~mu`](X)*Physics:-d_[mu](r, [X])/r+Physics:-d_[mu](theta, [X])*cos(theta)*R[`~mu`](X)/sin(theta)+Physics:-d_[mu](R[`~mu`](X), [X])-Physics:-Christoffel[`~nu`, mu, nu]*R[`~mu`](X)

(97)

where in the above we see the additional (relative) term

Library:-GetRelativeTerm(R[`~mu`](X), mu)

-Physics:-Christoffel[`~nu`, mu, nu]*R[`~mu`](X)

(98)

 

New Physics:-Library commands

 

 

ConvertToF , Linearize , GetRelativeTerm , GetRelativeWeight.

 

Examples

 

• 

ConvertToF receives an algebraic expression involving tensors and/or tensor functions and rewrites them in terms of the tensor of name F when that is possible. This routine is similar, however more general than the standard convert  which only handles the existing conversion network for the tensors of General Relativity  in that ConvertToF also uses any tensor definition you introduce using Define , expressing a tensor in terms of others.

Load any curved spacetime metric automatically setting the coordinates

 

restart; with(Physics); g_[sc]

Physics:-g_[mu, nu] = Matrix(%id = 36893488152573203868)

(99)

 

For example, rewrite the Christoffel  symbols in terms of the metric g_ ; this works as in previous releases

Christoffel[mu, alpha, beta] = Library:-ConvertToF(Christoffel[mu, alpha, beta], g_)

Physics:-Christoffel[mu, alpha, beta] = (1/2)*Physics:-d_[beta](Physics:-g_[alpha, mu], [X])+(1/2)*Physics:-d_[alpha](Physics:-g_[beta, mu], [X])-(1/2)*Physics:-d_[mu](Physics:-g_[alpha, beta], [X])

(100)

Define a A[mu] representing the 4D electromagnetic potential as a function of the coordinates X and F[mu, nu] representing the electromagnetic field tensors

Define(A[mu] = A[mu](X), quiet)

{A[mu], Physics:-D_[mu], Physics:-Dgamma[mu], Physics:-Psigma[mu], Physics:-Ricci[mu, nu], Physics:-Riemann[mu, nu, alpha, beta], Physics:-Weyl[mu, nu, alpha, beta], Physics:-d_[mu], Physics:-g_[mu, nu], Physics:-gamma_[i, j], Physics:-Christoffel[mu, nu, alpha], Physics:-Einstein[mu, nu], Physics:-LeviCivita[alpha, beta, mu, nu], Physics:-SpaceTimeVector[mu](X)}

(101)

Define(F[mu, nu] = d_[mu](A[nu])-d_[nu](A[mu]))

`Defined objects with tensor properties`

 

{A[mu], Physics:-D_[mu], Physics:-Dgamma[mu], F[mu, nu], Physics:-Psigma[mu], Physics:-Ricci[mu, nu], Physics:-Riemann[mu, nu, alpha, beta], Physics:-Weyl[mu, nu, alpha, beta], Physics:-d_[mu], Physics:-g_[mu, nu], Physics:-gamma_[i, j], Physics:-Christoffel[mu, nu, alpha], Physics:-Einstein[mu, nu], Physics:-LeviCivita[alpha, beta, mu, nu], Physics:-SpaceTimeVector[mu](X)}

(102)

Rewrite the following expression in terms of the electromagnetic potential A[mu]

F[mu, nu] = Library:-ConvertToF(F[mu, nu], A)

F[mu, nu] = Physics:-d_[mu](A[nu], [X])-Physics:-d_[nu](A[mu], [X])

(103)

In the example above, the output is similar to this other one

F[definition]

F[mu, nu] = Physics:-d_[mu](A[nu], [X])-Physics:-d_[nu](A[mu], [X])

(104)

The rewriting, however, works also with tensorial expressions

F[mu, nu]*A[mu]*A[nu]

F[mu, nu]*A[`~mu`]*A[`~nu`]

(105)

Library:-ConvertToF(F[mu, nu]*A[`~mu`]*A[`~nu`], A)

(Physics:-d_[mu](A[nu], [X])-Physics:-d_[nu](A[mu], [X]))*A[`~mu`]*A[`~nu`]

(106)
• 

Linearize receives a tensorial expression T and an indication of the small quantities h in T , and discards terms quadratic or of higher order in h. For an example of this new routine in action, see the section Linearized Gravity  above.

• 

GetRelativeTerm and GetRelativeWeight are illustrated in the section Relative Tensors  above.

 

See Also

 

Index of New Maple 2025 Features , Physics , Computer Algebra for Theoretical Physics, The Physics project, The Physics Updates

NULL


 

Download New_in_Physics_2025.mw

Edgardo S. Cheb-Terrab
Physics, Differential Equations and Mathematical Functions

LIMITS

Limits in maths are defined as the values that a function approaches the output for the given input values. Limits play a vital role in calculus and mathematical analysis and are used to define integrals, derivatives, and continuity. It is used in the analysis process, and it always concerns the behavior of the function at a particular point. The limit of a sequence is further generalized in the concept of the limit of a topological net and related to the limit and direct limit in the theory category. Generally, the integrals are classified into two types namely, definite and indefinite integrals. For definite integrals, the upper limit and lower limits are defined properly. Whereas indefinite integrals are expressed without limits, and it will have an arbitrary constant while integrating the function.

Sometimes we can't work something out directly ... but we can see what it should be as we get closer and closer!

Example 1

"restart;  f(x):=(|x|-3)/(x-3);"

proc (x) options operator, arrow, function_assign; (abs(x)-3)/(x-3) end proc

(1)

plot(f(x), x = -10 .. 10, discont = true, color = "Green")

 

f(3)

Error, (in f) numeric exception: division by zero

 

Now 0/0 is a difficulty! We don't really know the value of 0/0 (it is "indeterminate"), so we need another way of answering this.

So instead of trying to work it out for x=3 let's try approaching it closer and closer:

f(3.01)

1.000000000

(2)

f(3.0000001)

1.000000000

(3)

f(2.9999999)

1.000000000

(4)

Limit(f(x), x = 3)

Limit((abs(x)-3)/(x-3), x = 3)

(5)

limit(f(x), x = 3)

1

(6)

limit(f(x), x = 3, left)

1

(7)

limit(f(x), x = 3, right)

1

(8)

Example 2

Sometimes some functions are not continuous. That is, they appear to be approaching two different values when they are approached from two sides.

"g(x):=piecewise(0<x<2,1/(2 x-x^(2)),2 <x<=3,2 -x,3<x<4,x-4, 4<=x,Pi,undefined);"

proc (x) options operator, arrow, function_assign; piecewise(0 < x and x < 2, 1/(2*x-x^2), 2 < x and x <= 3, 2-x, 3 < x and x < 4, x-4, 4 <= x, Pi, undefined) end proc

(9)

plot(g(x), x = -10 .. 10, y = -1 .. 10, discont = true, color = "Red")

 

Suppose we want to approach 2 and see the function’s limit. This naturally leads to directions from which we can approach. Left-hand side and the right-hand side limits.

The right-hand side limit is the value of the function that it takes while approaching it from the right-hand side of the desired point. Similarly, the left-hand side limit is the value of function while approaching it from the left-hand side.

eval(g(x), x = 2)

undefined

(10)

limit(g(x), x = 2, left)

infinity

(11)

limit(g(x), x = 2, right)

0

(12)

limit(g(x), x = 2)

undefined

(13)

And the ordinary limit "does not exist".

g(4)

Pi

(14)

limit(g(x), x = 4, left)

0

(15)

limit(g(x), x = 4, right)

Pi

(16)

limit(g(x), x = 4)

undefined

(17)

And the ordinary limit "does not exist".

with(Student[Calculus1]); LimitTutor()

Example 3

Estimate the value of the following limit limit(h(x)*where, x = 2), h(x) = piecewise(x <> 2, x+12, x = 2, 4).

"h(x):={[[x+12,x<>2],[4,x=2]];"

proc (x) options operator, arrow, function_assign; piecewise(x <> 2, x+12, x = 2, 4) end proc

(18)

plot(h(x), x = -10 .. 10, discont = true, color = "#40e0d0")

 

limit(h(x), x = 2)

14

(19)

The limit is NOT 2025!Remember from the first example that limits do not care what the function is actually doing at the point in question. Limits are only concerned with what is going on around the point. Since the only thing about the function that we actually changed was its behavior at x = 2 this will not change the limit.

Example 4

" w(x):=piecewise( x<0,-x+5,x>=0,2 x);"

proc (x) options operator, arrow, function_assign; piecewise(x < 0, -x+5, 0 <= x, 2*x) end proc

(20)

plot(w(x), x = -10 .. 10, y = -10 .. 10, discont = true, color = "Blue")

 

limit(w(x), x = 5)

10

(21)

limit(w(x), x = 6, left)

12

(22)

limit(w(x), x = 1, right)

2

(23)

Example 5

" k(x):=piecewise( x<5,x+4,x>=5, x^(2)-2);"

proc (x) options operator, arrow, function_assign; piecewise(x < 5, x+4, 5 <= x, x^2-2) end proc

(24)

plot(k(x), x = -10 .. 10, discont = true, color = orange)

 

limit(k(x), x = 2)

6

(25)

limit(k(x), x = 5, left)

9

(26)

limit(k(x), x = 5, right)

23

(27)

limit(k(x), x = 5)

undefined

(28)

limit(k(x), x = 6)

34

(29)

Example 6

restart

" l(x):=piecewise( x<=1,(x-8)/(x-3),x>=3, sqrt(x^(2)+x+2), undefined);"

proc (x) options operator, arrow, function_assign; piecewise(x <= 1, (x-8)/(x-3), 3 <= x, sqrt(x^2+x+2), undefined) end proc

(30)

plot(l(x), x = -10 .. 10, discont = true, color = "Blue")

 

limit(l(x), x = 0)

8/3

(31)

limit(l(x), x = 1, left)

7/2

(32)

limit(l(x), x = 1, right)

undefined

(33)

limit(l(x), x = 2)

undefined

(34)

Example 7

Estimate the value of the following limit. limit(H(t), t = 0)where, H(t) = piecewise(t < 0, 0, t >= 0, 1)

"  H(t):=piecewise( t<0,0,t>=0, 1);"

proc (t) options operator, arrow, function_assign; piecewise(t < 0, 0, 0 <= t, 1) end proc

(35)

This function is often called either the Heaviside or step function. We could use a table of values to estimate the limit, but it’s probably just as quick in this case to use the graph so let’s do that. Below is the graph of this function.

plot(H(t), t = -10 .. 10, discont = true, color = "Blue")

 

limit(H(t), t = 0, left)

0

(36)

limit(H(t), t = 0, right)

1

(37)

We can see from the graph that if we approach t = 0from the right side the function is moving in towards a yvalue of 1. Well actually it’s just staying at 1, but in the terminology that we’ve been using in this section it’s moving in towards 1.

Also, if we move in towards t = 0 from the left the function is moving in towards a yvalue of 0.

According to our definition of the limit the function needs to move in towards a single value as we move in towards t = a (from both sides). This isn’t happening in this case and so in this example we will also say that the limit doesn’t exist.

 

NULL

Download limits.mw

Hello everyone,

I have created a Maple worksheet titled "ΕΜΒΑΔΟΝ ΕΠΙΠΕΔΟΥ ΧΩΡΙΟΥ", designed to help my students prepare for their final exams as they qualify for university. This worksheet focuses on area calculations in plane geometry, using Maple to visualize and solve problems efficiently.

This worksheet is aimed at high school students preparing for university entrance exams, as well as teachers who want to integrate Maple into their teaching.

I would love to hear your thoughts and feedback!

Have you used Maple for similar exam preparation?
εμβαδόν_χωρίου.mw

Hi Maple lovers, and others,

I wrote up some simple Maple code that 
checks if an expression (a^3+2) is a prime number.

The output fits on one page of paper.
n_cubed_plus_2.mw

n_cubed_plus_2.pdf

Also, I have an account at mersenneforum.org

Kindest Regards,

Matt

PS Does this help?  The code works.

I'm happy to announce the publication of Volume 5, Issue #1 of Maple Transactions.  You can find it at

mapletransactions.org
 

We have a survey paper by Veselin Jungic and Naomi Borwein on teaching Experimental Mathematics courses as our Featured Contribution.  Many of you will find it interesting and useful.

In the refereed paper section we have a paper on Metaprogramming with Maple and C by Ilias Kotsireas; a paper on fast transposed Vandermonde solving by Hyukho Kwon & Michael Monagan; a paper by David Ulgenes (an honours student in Oslo) on Gamma, Pseudogamma, and Inverse Gamma functions; and a paper by John Campbell on applications of Gosper's nonlocal derangement identity (which, if you don't know that the word "derangement" has a technical mathematical meaning, may give you the wrong impression!).

As usual I've also written something, and I hope you like it: it's about Chladni figures and standing modes in an elliptical drum, and visualizing such in Maple.  It uses Mathieu functions in Maple and noodles a bit about zerofinding (but winds up using fsolve because that's so convenient).
 

Keep the papers coming.  This is the 12th issue of Maple Transactions, and I remind you that it has a "Diamond Class" designation, which means there are no page charges to authors, and the articles are free to read for everyone.  This means that there's some volunteer labour needed, of course: you have to write the articles, and what we want is that you write articles that people in the Maple community actually want to read.

I'd also like to thank the copyeditor, Michelle Hatzel, for her very hard work on this issue.  She's really made a difference, and I think you will be able to see it.   

In the book by W.G. Chinn, N.E. Steenrod "First Concepts of Topology" the another remarkable theorem was proved: any two flat bounded regions can be cut by a single straight line so that each of these regions is divided into two regions of equal area (the second  pancake problem). This is an existence theorem which does not provide any way to find this cut. In this post I made an attempt to find such cut for any 2 convex regions on the plane bounded by a piecewise smooth self-non-intersecting curves.
The Each_Into_2_Equal_Areas procedure returns a list of coordinates of 4 endpoints of the cutting segments. This procedure significantly uses my old procedures  Area  and  Picture , which can be found in detail at the link  https://mapleprimes.com/posts/145922-Perimeter-Area-And-Visualization-Of-A-Plane-Figure-  . The formal arguments of the Each_Into_2_Equal_Areas procedure are the lists  L1  and  L2 specifying the boundaries of the regions to be cut. When specifying  L1  and  L2 , the boundary can be passed clockwise or counterclockwise, but it is necessary that the parameter t (when specifying each link) should go in ascending order. This can always be achieved by replacing  t  with  -t  if necessary. The Pic procedure draws a picture of the source regions and cutting segments. For ease of use, the code for the  Area  and  Picture   procedure is also provided. It is also worth noting that the procedure also works for "not too" non-convex regions (see examples below).

restart;
Area := proc(L) 
local i, var, e, e1, e2, P; 
for i to nops(L) do 
if type(L[i], listlist(algebraic)) then 
P[i] := (1/2)*add(L[i, j, 1]*L[i, j+1, 2]-L[i, j, 2]*L[i, j+1, 1], j = 1 .. nops(L[i])-1) else 
var := lhs(L[i, 2]); 
if type(L[i, 1], algebraic) then e := L[i, 1]; 
if nops(L[i]) = 3 then P[i] := (1/2)*(int(e^2, L[i, 2])) else 
if var = y then P[i] := (1/2)*simplify(int(e-var*(diff(e, var)), L[i, 2])) else 
P[i] := (1/2)*simplify(int(var*(diff(e, var))-e, L[i, 2])) end if end if else e1 := L[i, 1, 1]; e2 := L[i, 1, 2]; 
P[i] := (1/2)*simplify(int(e1*(diff(e2, var))-e2*(diff(e1, var)), L[i, 2])) end if end if end do; 
abs(add(P[i], i = 1 .. nops(L))); 
end proc:

Picture := proc(L, C, N::posint := 100, Boundary::list := [linestyle = 1]) 
local i, var, var1, var2, e, e1, e2, P, Q, h; 
global Border;
uses plottools; 
for i to nops(L) do 
if type(L[i], listlist(algebraic)) then P[i] := op(L[i]) else 
var := lhs(L[i, 2]); var1 := lhs(rhs(L[i, 2])); var2 := rhs(rhs(L[i, 2])); h := (var2-var1)/N; 
if type(L[i, 1], algebraic) then e := L[i, 1]; 
if nops(L[i]) = 3 then P[i] := seq(subs(var = var1+h*i, [e*cos(var), e*sin(var)]), i = 0 .. N) else 
P[i] := seq([var1+h*i, subs(var = var1+h*i, e)], i = 0 .. N) fi else e1 := L[i, 1, 1]; e2 := L[i, 1, 2]; P[i] := seq(subs(var = var1+h*i, [e1, e2]), i = 0 .. N) fi; fi; od; 
Q := [seq(P[i], i = 1 .. nops(L))]; Border := curve([op(Q), Q[1]], op(Boundary)); [polygon(Q, C), Border] 
end proc:

Each_Into_2_Equal_Areas:=proc(L1::list, L2::list)
local D, n, m, L10, L20, S1,S2, f, L11, L21, i, j, k, s, A, B, C , sol;

f:=(X,Y)->expand((y-X[2])*(Y[1]-X[1])-(x-X[1])*(Y[2]-X[2]));
L10:=map(p->`if`(type(p,listlist),[[p[1,1]+t*(p[2]-p[1])[1],p[1,2]+t*(p[2]-p[1])[2]],t=0..1],p), L1);
L20:=map(p->`if`(type(p,listlist),[[p[1,1]+t*(p[2]-p[1])[1],p[1,2]+t*(p[2]-p[1])[2]],t=0..1],p), L2);
S1:=Area(L1); S2:=Area(L2);  
n:=nops(L1); m:=nops(L2);

for i from 1 to n do
for j from i to n do

for k from 1 to m do
for s from k to m do

if not ((nops({i,j})=1 and type(L1[i],listlist)) or (nops({k,s})=1 and type(L2[k],listlist))) then

A:=eval(L10[i,1],t=t1): 
B:=eval(L10[j,1],t=t2):
C:=eval(L20[k,1],t=t3): 
D:=eval(L20[s,1],t=t4):

L11:=`if`(j=i,[subsop([2,2]=t1..t2,L10[i]),[B,A]],`if`(j=i+1,[subsop([2,2]=t1..op([2,2,2],L10[i]),L10[i]),subsop([2,2]=op([2,2,1],L10[j])..t2,L10[j]),[B,A]], [subsop([2,2]=t1..op([2,2,2],L10[i]),L10[i]),op(L10[i+1..j-1]),subsop([2,2]=op([2,2,1],L10[j])..t2,L10[j]),[B,A]])):

L21:=`if`(s=k,[subsop([2,2]=t3..t4,L20[k]),[D,C]],`if`(s=k+1,[subsop([2,2]=t3..op([2,2,2],L20[k]),L20[k]),subsop([2,2]=op([2,2,1],L20[s])..t4,L20[s]),[D,C]], [subsop([2,2]=t3..op([2,2,2],L20[k]),L20[k]),op(L20[k+1..s-1]),subsop([2,2]=op([2,2,1],L20[s])..t4,L20[s]),[D,C]])):

sol:=fsolve(simplify({Area(L11)-S1/2,Area(L21)-S2/2,eval(f(A,B),[x=C[1],y=C[2]]),eval(f(A,B),[x=D[1],y=D[2]])}),{t1=op([2,2,1],L10[i])..op([2,2,2],L10[i]),t2=op([2,2,1],L10[j])..op([2,2,2],L10[j]),t3=op([2,2,1],L20[k])..op([2,2,2],L20[k]),t4=op([2,2,1],L20[s])..op([2,2,2],L20[s])});

if type(sol,set(`=`)) then  return eval([A,B,C,D],sol) fi;

fi;
od: od: od: od:
end proc:

Pic := proc(L1,L2,col1,col2,Size:=[800,400])
local P1, P2, P3, T, P;
uses plots, plottools;
P1, P2 := Picture(L1, color=col1), Picture(L2, color=col2):
P3 := line(Sol[1..2][],color=red,thickness=3), line(Sol[3..4][],color=red,thickness=3), line(Sol[1],Sol[4],linestyle=2,thickness=3,color=red):
T:=textplot([[Sol[1][],"A"],[Sol[2][],"B"],[Sol[3][],"C"],[Sol[4][],"D"]], font=[times,18], align=[left,above]);
P:=pointplot(Sol, symbol=solidcircle, color=red, symbolsize=10);
display(P1,P2,P3,T,P, scaling=constrained, size=Size, axes=none);
end proc: 


Examples of use.

local D:
L1:=[[[8,0],[6,7]],[[6,7],[2,5]],[[2,5],[0,2]],[[0,2],[0,0]],[[0,0],[8,0]]]:
L2:=[[[5*cos(t)+16,5*sin(t)],t=Pi/2..Pi],[[5*cos(t)+16,5*sin(t)/2],t=Pi..2*Pi],[[21,0],[16,5]]]:
Sol:=Each_Into_2_Equal_Areas(L1,L2): Points:=[A,B,C,D]:
seq(Points[i]=Sol[i], i=1..4);
Pic(L1,L2,"Yellow","LightBlue",[900,400]);

   

The specified regions may overlap:

L1:=[[[8,0],[6,7]],[[6,7],[2,5]],[[2,5],[0,2]],[[0,2],[0,0]],[[0,0],[8,0]]]:
L2:=[[[5*cos(t)+9,5*sin(t)],t=Pi/2..Pi],[[5*cos(t)+9,5*sin(t)/2],t=Pi..2*Pi],[[14,0],[9,5]]]:
Sol:=Each_Into_2_Equal_Areas(L1,L2):  Points:=[A,B,C,D]:
seq(Points[i]=Sol[i], i=1..4);
Pic(L1,L2,"Yellow","LightBlue");

   


If there is a solution for which the cutting segments intersect the boundary of each of the regions at 2 points, then the procedure also works for such non-convex regions:

L1:=[[[cos(t),sin(t)],t=Pi/3..2*Pi-Pi/3],[[cos(-t)+1,sin(-t)],t=-Pi-Pi/3..-Pi+Pi/3]]:
L2:=[[[cos(t)+2,sin(t)],t=-Pi/6..Pi+Pi/6],[[cos(-t)+2,sin(-t)-1],t=-5*Pi/6..-Pi/6]]:
Sol:=Each_Into_2_Equal_Areas(L1,L2): Points:=[A,B,C,D]:
seq(Points[i]=Sol[i], i=1..4);
Pic(L1,L2,"Yellow","LightBlue");

   


A number of other interesting examples can be found in the attached file.

Each_Into_2_Equal_Areas1.mw

After a long chat with ChatGPT I finally received a fully working code for a proc for a generalized Woodbury Identity for the inversion of the sum of two or more positive definite matrices.
I was inspired by a family member who is a trained professional programmer, who told me that in his professional work he uses ChatGTP for an initial draft of his program.  
I did find out that ChatGTP makes errors: from simple ones like writing 'Simplify' instead of 'simplify' to serious conceptual errors, for example in recursive loops. However, ChatGTP seems to 'understand' the error after given specific feedback. Although, this does not mean that the next proposal does not contain the same logical error. But after a long chat I received a nice proc that seems to work. 
My second surprise was that Gemini suggested a formula for the generalized Woodbury lemma that was unknown to me, and I was unable to find on Scholar Google or https://math.stackexchange.com. Based on a special case of that formula, I was able to write the second proc myself. 
In conclusion, to start working it can be helpful to collaborate with AI friend, a little patience may help, AI may not be astute as someone on Mapleprimes wrote, but neither am I. I am now retired, and it is fun to play with Maple and AI. 
By the way, the search term Woodbury did not give a single hit on Mapleprimes.With_a_little_help_from_my_friends.mw
kind regards,Harry 

 

 

 

For Maple 17, in 2013, we introduced the GroupTheory package. It has seen a lot of improvements since its introduction, and I figured I would write something about how you can use it to teach a group theory course.

 

First of all, I think it would be a great idea to have your students just play with the GroupTheory package in Maple, and get some intuition for what makes group theory tick by getting their hands dirty. But that is not what I want to talk about today. Instead, I want to discuss how you might use it for giving your lectures - to show some visualizations while you show your beamer presentation or write on the black- or whiteboard.

 

When starting out with the definition of a group, you might want to compare the Cayley table of a group with that of a binary operation that doesn't define a group. A set with any binary operation is called a magma; to find good examples, we might want to use one group; one magma that has an identity and is associative but not invertible; and one magma that is has an identity and is invertible but not associative. Maybe we also want the group to not be cyclic (so the group order will have to not be prime), because those Cayley tables look a little boring. For this we can use the Magma package.

 

We note that a magma that is invertible and has an identity element is called a loop. We can enumerate all magmas of a given order and with certain properties using the command Magma:-Enumerate, finding either the number of such objects (by default) or a list of the multiplication tables (with the output = list option). Can we find interesting examples of order 4?

 

with(Magma)

Enumerate(4, group), Enumerate(4, loop), Enumerate(4, associative, identity)

2, 2, 35

(1)

 

No: all loops of order 4 are groups. Let's try order 6.

 

Enumerate(6, group), Enumerate(6, loop), Enumerate(6, associative, identity)

2, 109, 2237

(2)

 

Yes, we can find examples here. We find the Cayley tables of three suitable magmas; we call the non-cyclic group one m1, the non-associative loop one m2, and the non-invertible magma m3.

 

Enumerate(6, group, output = list)

(3)

"m1 := ?[2]:"

Enumerate(6, loop, output = list)[1 .. 5]

(4)

 

"m2 := ?[2]:"

Enumerate(6, associative, identity, output = list)[1 .. 5]

(5)

 

Most of these appear to have many more of one value than of another (e.g., many more threes). Let's find one where that is not so extreme. For example, we might want to minimize the standard deviation of the frequencies of the values occurring in the Cayley table.

 

lst := Enumerate(6, associative, identity, output = list)

lst := remove(IsLeftInvertible, lst)

numelems(lst)

2235

(6)

frequencies := map(proc (m) options operator, arrow; map2(numboccur, m, [seq(1 .. 6)]) end proc, lst)``

with(Statistics)

sds := map(StandardDeviation, convert(frequencies, 'set'))

{HFloat(2.449489742783178), HFloat(3.0983866769659336), HFloat(3.1622776601683795), HFloat(3.22490309931942), HFloat(3.286335345030997), HFloat(3.3466401061363027), HFloat(3.4058772731852804), HFloat(3.4641016151377544), HFloat(3.464101615137755), HFloat(3.521363372331802), HFloat(3.5213633723318023), HFloat(3.5777087639996634), HFloat(3.6331804249169903), HFloat(3.687817782917155), HFloat(3.7416573867739413), HFloat(3.794733192202055), HFloat(3.8470768123342687), HFloat(3.847076812334269), HFloat(3.898717737923586), HFloat(3.9496835316262997), HFloat(3.9496835316263), HFloat(3.9999999999999996), HFloat(4.0), HFloat(4.049691346263318), HFloat(4.09878030638384), HFloat(4.147288270665544), HFloat(4.195235392680606), HFloat(4.1952353926806065), HFloat(4.2895221179054435), HFloat(4.33589667773576), HFloat(4.3817804600413295), HFloat(4.427188724235731), HFloat(4.47213595499958), HFloat(4.5166359162544865), HFloat(4.560701700396552), HFloat(4.604345773288535), HFloat(4.604345773288536), HFloat(4.6475800154489), HFloat(4.69041575982343), HFloat(4.732863826479693), HFloat(4.774934554525329), HFloat(4.77493455452533), HFloat(4.8166378315169185), HFloat(4.857983120596447), HFloat(4.898979485566356), HFloat(4.9396356140913875), HFloat(4.939635614091388), HFloat(4.979959839195493), HFloat(5.019960159204453), HFloat(5.059644256269407), HFloat(5.0990195135927845), HFloat(5.138093031466052), HFloat(5.176871642217914), HFloat(5.215361924162119), HFloat(5.253570214625479), HFloat(5.291502622129181), HFloat(5.329165037789691), HFloat(5.366563145999495), HFloat(5.403702434442518), HFloat(5.440588203494177), HFloat(5.477225575051661), HFloat(5.513619500836089), HFloat(5.549774770204643), HFloat(5.585696017507577), HFloat(5.621387729022079), HFloat(5.656854249492381), HFloat(5.692099788303083), HFloat(5.727128425310542), HFloat(5.761944116355173), HFloat(5.796550698475776), HFloat(5.830951894845301), HFloat(5.865151319446072), HFloat(5.8991524815010505), HFloat(5.93295878967653), HFloat(5.932958789676531), HFloat(5.966573556070519), HFloat(6.0), HFloat(6.0332412515993425), HFloat(6.066300355241241), HFloat(6.066300355241242), HFloat(6.099180272790763), HFloat(6.131883886702357), HFloat(6.164414002968976), HFloat(6.196773353931867), HFloat(6.228964600958975), HFloat(6.260990336999411), HFloat(6.29285308902091), HFloat(6.324555320336759), HFloat(6.356099432828282), HFloat(6.418722614352485), HFloat(6.48074069840786), HFloat(6.511528238439883), HFloat(6.542170893518451), HFloat(6.572670690061994), HFloat(6.603029607687671), HFloat(6.603029607687672), HFloat(6.6332495807108), HFloat(6.663332499583073), HFloat(6.6932802122726045), HFloat(6.693280212272605), HFloat(6.723094525588644), HFloat(6.723094525588645), HFloat(6.752777206453653), HFloat(6.782329983125268), HFloat(6.811754546370561), HFloat(6.928203230275509), HFloat(6.957010852370435), HFloat(6.985699678629192), HFloat(7.014271166700073), HFloat(7.042726744663604), HFloat(7.0710678118654755), HFloat(7.127411872482185), HFloat(7.155417527999327), HFloat(7.183313998427188), HFloat(7.18331399842719), HFloat(7.293833011524188), HFloat(7.429670248402684), HFloat(7.4565407529228995), HFloat(7.4565407529229), HFloat(7.483314773547883), HFloat(7.536577472566709), HFloat(7.53657747256671), HFloat(7.563068160475615), HFloat(7.64198926981712), HFloat(7.77174369109018), HFloat(7.8993670632526), HFloat(7.92464510246358), HFloat(7.9498427657407165), HFloat(8.024961059095553), HFloat(8.12403840463596), HFloat(8.366600265340756), HFloat(8.390470785361211), HFloat(8.390470785361213), HFloat(8.414273587185052), HFloat(8.438009243891594), HFloat(8.508818954473059), HFloat(8.854377448471462), HFloat(8.87693640846886), HFloat(8.921883209278185), HFloat(9.338094023943), HFloat(9.338094023943002), HFloat(9.359487165438072), HFloat(9.81835016690686), HFloat(9.818350166906862), HFloat(10.295630140987)}

(7)

 

Aha, the smallest standard deviation is a bit under two and a half, and the next possible value is greater than 3. Let's examine the Cayley tables that show this standard deviation.

NULL

small_sd_index := select(proc (i) options operator, arrow; StandardDeviation(frequencies[i]) < 3 end proc, [seq(1 .. numelems(frequencies))])

[1636, 1638, 2234, 2235]

(8)

small_sd := lst[small_sd_index]

(9)

 

The last of these looks interesting.

 

m3 := small_sd[-1]

NULL

Now we can display these three Cayley tables:

CayleyColorTable(m1); CayleyColorTable(m2); CayleyColorTable(m3)

 

It's clear that the multiplication shown in the third Cayley table is not invertible (because multiplying by any element other than 1, on either side, is not a permutation of the elements: rows and columns beyond the first don't have all colors). It's less visually obvious that the second Cayley table doesn't show an associative multiplication, but a quick loop showed that 5*(3*3) = 5*5 and 5*5 = 4 whereas 3*(3*5) = 3 and 3 = 3. I'm not sure if there is something real underpinning this, but to my mind this is a nice parallel to the fact that when you're proving a set with a given operation is a group, it's easier to show that there are inverses than that the operation is associative.

 

A second nice visualization, also usable in the first week or two of a group theory course, is also named after Cayley: Cayley graphs. Here is a Cayley graph for the dihedral group D[3] of order 6:

 

with(GroupTheory)

D3 := DihedralGroup(3)

_m132248572811840

(10)

with(GraphTheory)

DrawGraph(CayleyGraph(D3), layout = spring)

 

NULL

Here is a well-known presentation of the alternating group on 4 letters. I find "grabbing and turning" the 3D plot shows the structure much better than simply an embedding of the graph in the plane.

 

a4 := `<|>`(`<,>`(a, b), `<,>`(a^3, b^2, a.b.a = b.(a^2).b))

_m132249105458016

(11)

DrawGraph(CayleyGraph(a4), layout = spring, dimension = 3, size = [800, 800])

 

 

Another great opportunity for a visualization comes a couple of weeks later, when you talk about subgroup lattices. Here are a few examples:

 

with(GroupTheory)``

qd := QuasiDihedralGroup(2)

_m132249751531168

(12)

GroupOrder(qd)

16

(13)

DrawSubgroupLattice(qd, normal = false, center = false)

 

 

This is the plain subgroup lattice. Note how the subgroups in the first and second nontrivial "layer" from the bottom are grouped by conjugacy class. The default visualization of a subgroup lattice highlights the centre in light blue and the (in this case six) other normal subgroups in green.

 

DrawSubgroupLattice(qd)

 

 

We see that every conjugacy class of size one is a normal subgroup. We can also highlight other subgroups, if we want. Maybe we want to show which are the (cyclic) subgroups generated by one of the chosen generators:

 

generators := Generators(qd)

[_m132249751506336, _m132249751509600]

(14)

DrawSubgroupLattice(qd, highlight = [seq({g}, `in`(g, generators))])

 

 

Of course you can also show more advanced topics in this way. For example, here is the Frattini series of this group.

 

DrawSubgroupLattice(qd, highlight = FrattiniSeries(qd))

 

NULL NULL


 

Download blogpost-algebra.mw

In the excellent book by W.G. Chinn, N.E. Steenrod "First Concepts of Topology" the theorem is proved which states that any bounded planar region can be cut into 4 regions of equal area by 2 perpendicular cuts (the pancake problem). This is an existence theorem which does not provide any way to find these cuts. In this post I made an attempt to find such cuts for any convex region on the plane bounded by a piecewise smooth self-non-intersecting curve.
The Into_4_Equal_Areas procedure returns a list of coordinates of 5 points: the first 4 points are the endpoints of the cutting segments, the fifth point is the intersection point of these segments. This procedure significantly uses my old procedure Area , which can be found in detail at the link  https://mapleprimes.com/posts/145922-Perimeter-Area-And-Visualization-Of-A-Plane-Figure-  . The formal argument of the Into_4_Equal_Areas procedure is a list  L specifying the boundary of the region to be cut. When specifying  L, the boundary can be passed clockwise or counterclockwise, but it is necessary that the parameter t (when specifying each link) should go in ascending order. This can always be achieved by replacing  t  with  -t  if necessary. The Pic procedure draws a picture of the source region and cutting segments. For ease of use, the code for the  Area  procedure is also provided. It is also worth noting that the procedure also works for "not too" non-convex regions (see examples below).

restart;
Area := proc(L) 
local i, var, e, e1, e2, P; 
for i to nops(L) do 
if type(L[i], listlist(algebraic)) then 
P[i] := (1/2)*add(L[i, j, 1]*L[i, j+1, 2]-L[i, j, 2]*L[i, j+1, 1], j = 1 .. nops(L[i])-1) else 
var := lhs(L[i, 2]); 
if type(L[i, 1], algebraic) then e := L[i, 1]; 
if nops(L[i]) = 3 then P[i] := (1/2)*(int(e^2, L[i, 2])) else 
if var = y then P[i] := (1/2)*simplify(int(e-var*(diff(e, var)), L[i, 2])) else 
P[i] := (1/2)*simplify(int(var*(diff(e, var))-e, L[i, 2])) end if end if else e1 := L[i, 1, 1]; e2 := L[i, 1, 2]; 
P[i] := (1/2)*simplify(int(e1*(diff(e2, var))-e2*(diff(e1, var)), L[i, 2])) end if end if end do; 
abs(add(P[i], i = 1 .. nops(L))); 
end proc:

Into_4_Equal_Areas:=proc(L::list,N::symbol:='OneSolution', eps::numeric:=0)
local D, n, c, L1, L2, L3, f, L0, i, j, k, m, A, B, C, P, S, sol, Sol;
f:=(X,Y)->expand((y-X[2])*(Y[1]-X[1])-(x-X[1])*(Y[2]-X[2]));
L0:=map(p->`if`(type(p,listlist),[[p[1,1]+t*(p[2]-p[1])[1],p[1,2]+t*(p[2]-p[1])[2]],t=0..1],p), L);
S:=Area(L); c:=0;
n:=nops(L);
for i from 1 to n do
for j from i to n do
for k from j to n do
for m from k to n do
if not ((nops({i,j,k})=1 and type(L[i],listlist)) or (nops({j,k,m})=1 and type(L[j],listlist)))then
A:=convert(subs(t=t1,L0[i,1]),Vector): 
B:=convert(subs(t=t2,L0[j,1]),Vector):
C:=convert(subs(t=t3,L0[k,1]),Vector): 
D:=convert(subs(t=t4,L0[m,1]),Vector):
P:=eval([x,y], solve({f(A,C),f(B,D)},{x,y})):
L1:=`if`(j=i,[subsop([2,2]=t1..t2,L0[i]),[convert(B,list),P],[P,convert(A,list)]],`if`(j=i+1,[subsop([2,2]=t1..op([2,2,2],L0[i]),L0[i]),subsop([2,2]=op([2,2,1],L0[j])..t2,L0[j]),[convert(B,list),P],[P,convert(A,list)]], [subsop([2,2]=t1..op([2,2,2],L0[i]),L0[i]),L0[i+1..j-1][],subsop([2,2]=op([2,2,1],L0[j])..t2,L0[j]),[convert(B,list),P],[P,convert(A,list)]])):
L2:=`if`(k=j,[subsop([2,2]=t2..t3,L0[j]),[convert(C,list),P],[P,convert(B,list)]],`if`(k=j+1,[subsop([2,2]=t2..op([2,2,2],L0[j]),L0[j]),subsop([2,2]=op([2,2,1],L0[k])..t3,L0[k]),[convert(C,list),P],[P,convert(B,list)]], [subsop([2,2]=t2..op([2,2,2],L0[j]),L0[j]),L0[j+1..k-1][],subsop([2,2]=op([2,2,1],L0[k])..t3,L0[k]),[convert(C,list),P],[P,convert(B,list)]])):
L3:=`if`(m=k,[subsop([2,2]=t3..t4,L0[k]),[convert(D,list),P],[P,convert(C,list)]],`if`(m=k+1,[subsop([2,2]=t3..op([2,2,2],L0[k]),L0[k]),subsop([2,2]=op([2,2,1],L0[m])..t4,L0[m]),[convert(D,list),P],[P,convert(C,list)]], [subsop([2,2]=t3..op([2,2,2],L0[k]),L0[k]),L0[k+1..m-1][],subsop([2,2]=op([2,2,1],L0[m])..t4,L0[m]),[convert(D,list),P],[P,convert(C,list)]])):
sol:=fsolve({Area(L1)-S/4,Area(L2)-S/4,Area(L3)-S/4,LinearAlgebra:-DotProduct(D-B,C-A, conjugate=false)},{t1=op([2,2,1],L0[i])-eps..op([2,2,2],L0[i])+eps,t2=op([2,2,1],L0[j])-eps..op([2,2,2],L0[j])+eps,t3=op([2,2,1],L0[k])-eps..op([2,2,2],L0[k])+eps,t4=op([2,2,1],L0[m])-eps..op([2,2,2],L0[m])+eps}) assuming real:
if type(sol,set(`=`)) then if N='OneSolution' then return convert~(eval([A,B,C,D,P],sol),list) else c:=c+1; Sol[c]:=convert~(eval([A,B,C,D,P],sol),list) fi;
 fi; fi;
od: od: od: od:
convert(Sol,list);
end proc:

Pic:=proc(L,Sol)
local P1, P2, T;
uses plots, plottools;
P1:=seq(`if`(type(s,listlist),line(s[],color=blue, thickness=2),plot([s[1][],s[2]],color=blue, thickness=2)),s=L):
P2:=line(Sol[1],Sol[3],color=red, thickness=2), line(Sol[2],Sol[4],color=red):
T:=textplot([[Sol[1][],"A"],[Sol[2][],"B"],[Sol[3][],"C"],[Sol[4][],"D"],[Sol[5][],"P"]], font=[times,18], align=[left,above]);
display(P1,P2,T, scaling=constrained, size=[800,500], axes=none);
end proc: 


Examples of use:

L:=[[[0,0],[1,4]],[[1,4],[6,7]],[[6,7],[12,0]],[[12,0],[0,0]]]:
Sol:=Into_4_Equal_Areas(L);
Pic(L, Sol);

# Check (areas of all 4 regions)
Area([[L[1,1],Sol[4],Sol[5],Sol[1],L[1,1]]]),
Area([[Sol[4],Sol[5],Sol[3],L[4,1],Sol[4]]]),
Area([[Sol[5],Sol[2],L[3,1],Sol[3],Sol[5]]]),
Area([[Sol[5],Sol[2],L[1,2],Sol[1],Sol[5]]]);

        


 

L:=[[[1+cos(-t),1+sin(-t)],t=-3*Pi/2..-Pi],[[0,1],[-1,0]],[[cos(t),sin(t)],t=Pi..2*Pi]]:
Sol:=Into_4_Equal_Areas(L);
Pic(L,Sol);

    

# The boundary is the Archimedes spiral and the arc of a circle

L:=[[[t*cos(t),t*sin(t)],t=0..2*Pi],[[Pi+5*cos(-t),sqrt(25-Pi^2)+5*sin(-t)],t=arccos(Pi/5)..Pi-arccos(Pi/5)]]:
Sol:=evalf(Into_4_Equal_Areas(L));
Pic(L,Sol);

     

 

L:=[[[0,0],[2,0]],[[2,0],[1,sqrt(3)]],[[1,sqrt(3)],[0,0]]]:
Sol:=evalf[5](Into_4_Equal_Areas(L, AllSolutions, 0.1)); # All 3 solutions
plots:-display(<Pic(L, Sol[1]) | Pic(L, Sol[2])  | Pic(L, Sol[3])>, size=[300,300]);  


 

L:=[[[-t,-sin(-t)],t=-5*Pi/4..0],[[cos(t),sin(t)-1],t=Pi/2..3*Pi/2],[[t,cos(t)-3],t=0..3*Pi/2],[[3*Pi/2,-3],[5*Pi/4,sqrt(2)/2]]]:
Sol:=evalf(Into_4_Equal_Areas(L));
Pic(L,Sol);

More examples can be found in the attached file.

4_Equal_Area1.mw

[Edit]. The post has been edited. One inaccuracy in the code has been corrected, which could sometimes lead to errors. Two options have been added to the code of Into_4_Equal_Areas procedure. The first option is the formal argument  N . If N=OneSolution  (by default), the procedure returns one solution. If  N=AllSolutions , the procedure returns all solutions that it can find. The  eps  option has also been added (by default, eps=0). It is advisable to use it when we are looking for all solutions, and the ends of the cutting segments fall on the boundaries of intervals (this option slightly expands the boundaries of intervals, otherwise the  fsolve  command sometimes misses solutions). Two new examples have also been added.

 

 

Maple Transactions Volume 4 Issue 4 has now been published.

 

This issue has two Featured Contributions by people who have been plenary speakers at Maple Conferences in the past, namely Veselin Jungić and Juana Sendra. We hope you enjoy both articles.  There is an accompanying video by Professor Sendra, which we will add a link to when it becomes ready.

As usual, there is an article in the Editor's Corner, but this one is a bit different.  In this one, Michelle Hatzell (the new copyeditor for Maple Transactions, who is also a Masters' student working with me at Western) and I have written about a fun use of Maple's colour contour plots to make an image that might be used as the cover of an upcoming book, namely Perturbation Methods using backward error, which I'm just finishing now with Nic Fillion and which SIAM will publish next year.  So, while there's some math in that paper, it's more about Maple's utilities for colour plotting; so you might find it useful.  We also hope you like at least some of the images.  Some are more attractive than others!

We have several Refereed Contributions, not all of which are ready at this time of publication but which will be added as they are revised and sent in.  We have a nice paper on using continued fractions in a high school context, another on code generation, and another on using Digital Signal Processing in Engineering courses.

Finally we have a first publication in French, by Jalale Soussi.  Actually we have the paper also in English: we chose to publish both, in our Communications section, each with links to the other.  It is possible to publish in Maple Transactions solely in French, of course, but the author provided both, so why not?

Happy reading, and best wishes for 2025. 

Hello Maple enthusiasts,

I am excited to share a sample worksheet on Ordinary Differential Equations (ODEs), created as part of my ongoing project—a book I am writing for undergraduate students. This book is designed to teach ODEs using Maple, offering an interactive and intuitive approach to solving differential equations.

As far as I know, there aren’t many books available in the Greek language that combine ODEs with Maple. In fact, I believe there’s only one other such resource, which highlights the lack of materials in this niche. My goal is to fill this gap by providing students and educators with a resource that is both practical and accessible, leveraging Maple's powerful capabilities to deepen understanding and simplify complex concepts.

The worksheet I’m sharing includes:

  • Step-by-step solutions to ODEs using Maple.
  • Graphical representations to visualize solutions, which I believe are invaluable for fostering comprehension.

I hope this preview sparks your interest and provides insight into the teaching style and structure of the upcoming book. I would love to hear your thoughts, feedback, or suggestions for topics you think should be included.

Solve the following differential equation

diff(y(x), x) = x*y(x)
with initial condition y(0) = 1

restart; with(plots); with(DEtools)

ode := diff(y(x), x) = x*y(x)

diff(y(x), x) = x*y(x)

(1)

ic := y(0) = 1

y(0) = 1

(2)

general_solution := dsolve(ode, y(x))

y(x) = c__1*exp((1/2)*x^2)

(3)

particular_solution := dsolve({ic, ode}, y(x))

y(x) = exp((1/2)*x^2)

(4)

soln := dsolve({ic, ode}, y(x), numeric)

``

(5)

p1 := odeplot(soln, [x, y(x)], x = -5 .. 5, labels = ["x", "y(x)"], color = green)

directionfield := dfieldplot(ode, [y(x)], x = -5 .. 5, y = -5 .. 5, color = blue, arrows = slim, scaling = constrained, axes = boxed)

display([p1, directionfield], view = [-5 .. 5, -5 .. 5])

 

NULL

Solve the following differential equation

diff(y(x), x) = x/y(x)
with initial condition y(0) = 2

restart; with(plots); with(DEtools)

ode1 := diff(y(x), x) = x/y(x)

diff(y(x), x) = x/y(x)

(6)

ic := y(0) = 2

y(0) = 2

(7)

dsolve(ode1, y(x))

y(x) = (x^2+c__1)^(1/2), y(x) = -(x^2+c__1)^(1/2)

(8)

NULL

soln := dsolve({ic, ode1}, y(x), numeric)

p1 := odeplot(soln, [x, y(x)], x = -5 .. 5, labels = ["x", "y(x)"], color = green)

directionfield := dfieldplot(ode1, [y(x)], x = -5 .. 5, y = -5 .. 5, color = blue, arrows = slim, scaling = constrained, axes = boxed)

display([p1, directionfield], view = [-5 .. 5, -5 .. 5])

 

NULL

Solve the following differential equation

dy/dx = e^y/(x^2+1)
with initial condition y(0) = -1

restart; with(plots); with(DEtools)

ode2 := diff(y(x), x) = exp(y(x))/(x^2+1)

diff(y(x), x) = exp(y(x))/(x^2+1)

(9)

ic := y(0) = -1

y(0) = -1

(10)

dsolve(ode2, y(x))

y(x) = ln(-1/(arctan(x)+c__1))

(11)

soln := dsolve({ic, ode2}, y(x), numeric)

p1 := odeplot(soln, [x, y(x)], x = -5 .. 5, labels = ["x", "y(x)"], color = green)

directionfield := dfieldplot(ode2, [y(x)], x = -5 .. 5, y = -5 .. 5, color = blue, arrows = slim, scaling = constrained, axes = boxed)

display([p1, directionfield], view = [-5 .. 5, -5 .. 5])

 

NULL

Solve the following differential equation

dy/dx = y^2+y
with initial condition y(1) = 2

restart; with(plots); with(DEtools)

ode3 := diff(y(x), x) = y(x)+y(x)^2

diff(y(x), x) = y(x)+y(x)^2

(12)

ic := y(1) = 2

y(1) = 2

(13)

dsolve(ode3, y(x))

y(x) = 1/(-1+exp(-x)*c__1)

(14)

soln := dsolve({ic, ode3}, y(x))

y(x) = 2/(-2+3*exp(-x)*exp(1))

(15)

DEplot(ode3, y(x), x = -5 .. 5, y = -5 .. 5, [[y(1) = 2]], color = blue, arrows = slim, scaling = constrained, axes = boxed)

 

NULL

Solve the following differential equation

y*dy/dx-x = 0
with initial condition y(0) = 4, y(1) = 2, y(-1) = -2and y(-2) = -4.

restart; with(plots); with(DEtools)

ode4 := y(x)*(diff(y(x), x))-x = 0

y(x)*(diff(y(x), x))-x = 0

(16)

ic := y(0) = 4

y(0) = 4

(17)

dsolve(ode4, y(x))

y(x) = (x^2+c__1)^(1/2), y(x) = -(x^2+c__1)^(1/2)

(18)

DEplot(ode4, y(x), x = -5 .. 5, y = -5 .. 5, [[y(1) = 2], [y(0) = 4], [y(-1) = -2], [y(-2) = -4]], color = blue, arrows = slim, scaling = constrained, axes = boxed)

 

 

 

NULL

Solve the following differential equation

dy/dx = 2*x+2*xy^2/y
with initial condition y(0) = 2.

restart; with(plots); with(DEtools)

ode5 := diff(y(x), x) = (2*x+2*x*y(x)^2)/y(x)

diff(y(x), x) = (2*x+2*x*y(x)^2)/y(x)

(19)

ic := y(0) = 2

y(0) = 2

(20)

dsolve(ode5, y(x))

y(x) = (exp(2*x^2)*c__1-1)^(1/2), y(x) = -(exp(2*x^2)*c__1-1)^(1/2)

(21)

psoln := dsolve({ic, ode5}, y(x))

y(x) = (5*exp(2*x^2)-1)^(1/2)

(22)

soln := dsolve({ic, ode5}, y(x), numeric)

p1 := odeplot(soln, [x, y(x)], x = -5 .. 5, labels = ["x", "y(x)"], color = green)

directionfield := dfieldplot(ode5, [y(x)], x = -5 .. 5, y = -3 .. 10, color = blue, arrows = slim, scaling = constrained, axes = boxed)

display([p1, directionfield], view = [-5 .. 5, -3 .. 10])

 

NULL


 

Download separable_diff_equations.mw

 

Hello,

I present the rolling of an ellipse along a spatial curve and along curves placed on a surface, also along a Mobius surface.

Attached are the Maple source files.

Best regards.

Source_-_mw.zip






Hi all,

Hopefully this will be useful to educators who are introducing trigonometry to their students.

subjects - Maple procedures, complementary angles, and degree to radian conversion

Enjoy.

'big' Matt

cosine_teaching_tool.pdf

cosine_teaching_tool.mw

Have a nice day

Continuing from my previous post on "Exploring Oscillators: A Simple Pendulum Worksheet," we now dive deeper into the fascinating progression of oscillatory systems—from linear oscillations to complex, nonlinear dynamics with chaotic behaviors. This post examines how adjusting parameters in oscillatory models, such as the Duffing oscillator, reveal rich dynamics, including resonance and chaos.

LINEAR AND NON-LINEAR OSCILLATORS

Athanasios Paraskevopoulos

 

Imagine a block of mass m attached to a spring. The spring is fixed at one end, and the block is free to move horizontally on a frictionless surface.
 When the block is displaced from its equilibrium position and released, it oscillates back and forth


According to Hooke's Law, the restoring force Fexerted by the spring is proportional to the displacement
x from the equilibrium position and acts in the opposite direction:



F = -k*x

Using Newton's second law,
F = ma, where  a is the acceleration, we get:
"ma= - k x.   "
Since acceleration a is the second derivative of displacement xwith respect to time, the equation becomes:

 

m*(diff(x, t, t)) = -k*x
Rearranging terms, we get:

diff(x, t, t)+k*x/m = 0
Letting "omega^(2)=k/(m), "where ω is the angular frequency, the equation simplifies to

diff(x, t, t)+omega^2*x = 0
 

• 

Amplitude A: Maximum displacement from the equilibrium position.

• 

Angular Frequency omega: Related to the spring constant and mass by omega = sqrt(k/m).

• 

Period T: The time for one complete oscillation, given by "T=(2 Pi)/(omega)."

• 

Frequency f: The number of oscillations per unit time
"F=1/(T)=omega/(2 Pi). "

In a linear simple harmonic oscillator (SHO), the Hamiltonian energy represents the total energy of the system, which is a combination of its kinetic and potential energy.

1. 

Position and Momentum:

• 

Let xbe the displacement of the oscillator from its equilibrium position.

• 

Let pbe the momentum of the oscillator.

 

2. 

Hamiltonian (H):

• 

The Hamiltonian function H is expressed in terms of the kinetic energy (T) and the potential energy (V) of the system.

• 

For a linear SHO, it is given by:
H = T+V

 

3. 

Kinetic Energy (T):

Kinetic energy depends on the mass of the object and its velocity. In physics, it's expressed as:

T = (1/2)*m*u^2

where:

• 

m is the mass of the oscillator,

• 

Typesetting[delayDotProduct](u*is*the*velocity.In, terms, true)*of*momentum, p = mv, be*can*energy*kinetic*re*the-as*expressed; T = p^2/(2*m)
This equation shows that kinetic energy increases with the square of the momentum.

 

4. 

Potential Energy (V)

Potential energy in a simple harmonic oscillator arises from the restoring force of the spring. The potential energy is given by:

V = (1/2)*k*x^2
where

• 

k is the spring constant, and

• 

x is the displacement from the equilibrium position.

 

This means that the further the mass is displaced from equilibrium, the greater the potential energy stored in the system.

Suppose you have a spring with a spring constant k = 10*N/mand a mass m = .2*kg. If the mass is displaced by -.104*m from its equilibrium position and released, it will undergo SHM

restart; with(plots); with(DEtools)

k := 10; m := .2; omega := sqrt(k/m)

10

 

.2

 

7.071067812

(1)

T := 2*Pi/omega

.8885765876

(2)

plot(T, x = 0 .. 1, title = "Period vs Initial Amplitude (x)", axes = boxed, labels = ["Initial Amplitude (x)", "Period (T)"])

 

f := omega/(2*Pi)

1.125395395

(3)

Linear*Oscillator

ODE__1 := diff(x(t), t, t)+omega^2*x(t) = 0; IC := x(0) = A, (D(x))(0) = 0

diff(diff(x(t), t), t)+50.00000000*x(t) = 0

 

x(0) = A, (D(x))(0) = 0

(4)

sol := dsolve({IC, ODE__1}, x(t))

x(t) = A*cos(5*2^(1/2)*t)

(5)

plot_1 := subs(A = -.104, sol); plotsresult := plot([rhs(plot_1)], t = 0 .. 2, legend = ["-0.104cos( 7.07 t)"], color = [red])

 

x_t := rhs(subs(A = -.104, sol)); v_t := diff(x_t, t)

-.104*cos(5*2^(1/2)*t)

 

.520*2^(1/2)*sin(5*2^(1/2)*t)

(6)

T := (1/2)*m*v_t^2; V := (1/2)*k*x_t^2; H := T+V

0.5408000000e-1*sin(5*2^(1/2)*t)^2

 

0.5408000000e-1*cos(5*2^(1/2)*t)^2

 

0.5408000000e-1*sin(5*2^(1/2)*t)^2+0.5408000000e-1*cos(5*2^(1/2)*t)^2

(7)

energy_plot := plot([eval(T), eval(V), eval(H)], t = 0 .. 2, color = [red, blue, green], legend = ["Kinetic Energy", "Potential Energy", "Total Energy"], title = "Energy Exchange in Simple Harmonic Oscillator", labels = ["Time (s)", "Energy (Joules)"])

 

directionfield := DEplot([diff(x(t), t) = v(t), diff(v(t), t) = -omega^2*x(t)], [x(t), v(t)], t = 0 .. 10, x = -2 .. 2, v = -10 .. 10, arrows = medium, title = "Direction Field for Simple Harmonic Oscillator", axes = boxed)

sol1 := dsolve({ODE__1, x(0) = 1, (D(x))(0) = 0}, x(t)); sol2 := dsolve({ODE__1, x(0) = .5, (D(x))(0) = 0}, x(t)); sol3 := dsolve({ODE__1, x(0) = -1, (D(x))(0) = 0}, x(t)); sol4 := dsolve({ODE__1, x(0) = .7, (D(x))(0) = .5}, x(t))

x(t) = cos(5*2^(1/2)*t)

 

x(t) = (1/2)*cos(5*2^(1/2)*t)

 

x(t) = -cos(5*2^(1/2)*t)

 

x(t) = (1/20)*2^(1/2)*sin(5*2^(1/2)*t)+(7/10)*cos(5*2^(1/2)*t)

(8)

x1 := rhs(sol1); x2 := rhs(sol2); x3 := rhs(sol3); x4 := rhs(sol4); v1 := diff(x1, t); v2 := diff(x2, t); v3 := diff(x3, t); v4 := diff(x4, t)

cos(5*2^(1/2)*t)

 

(1/2)*cos(5*2^(1/2)*t)

 

-cos(5*2^(1/2)*t)

 

(1/20)*2^(1/2)*sin(5*2^(1/2)*t)+(7/10)*cos(5*2^(1/2)*t)

 

-5*2^(1/2)*sin(5*2^(1/2)*t)

 

-(5/2)*2^(1/2)*sin(5*2^(1/2)*t)

 

5*2^(1/2)*sin(5*2^(1/2)*t)

 

(1/2)*cos(5*2^(1/2)*t)-(7/2)*2^(1/2)*sin(5*2^(1/2)*t)

(9)

phase_plot := plot([[eval(x1, t = tval), eval(v1, t = tval), tval = 0 .. 10], [eval(x2, t = tval), eval(v2, t = tval), tval = 0 .. 10], [eval(x3, t = tval), eval(v3, t = tval), tval = 0 .. 10], [eval(x4, t = tval), eval(v4, t = tval), tval = 0 .. 10]], style = line, title = "Phase Portrait for Simple Harmonic Oscillator", labels = ["x (Displacement)", "v (Velocity)"], color = ["red", "blue", "green", "orange"], legend = ["A=1, v0=0", "A=0.5, v0=0", "A=-1, v0=0", "A=0.7, v0=0.5"], axes = boxed)

display(directionfield, phase_plot)

 

Damped Oscillators:


Consider a mass-spring-damper system, where a block of mass m is attached to a spring (with spring constant k) and a damper (with damping coefficient delta).
The damper provides resistance to the motion, simulating friction or air resistance.

Damped Oscillator Equation:
m*(diff(x, t, t))+delta*(diff(x, t))+k*x = 0

This is in the form of a homogeneous second order differential equation and has a solution of the form

x = exp(`&lambda;t`)

Substituting this form gives an auxiliary equation for lambda

`m&lambda;`^2+`&delta;&lambda;`+`k&lambda;` = 0

The roots of the quadratic auxiliary equation are

λ=(-delta+`&+-`(sqrt(delta^2-4*mk)))/(2*m)

The three resulting cases for the damped oscillator are

• 

delta^2-4*mk > 0Overdamped

• 

delta^2-4*mk = 0Critical damping

• 

delta^2-4*mk < 0Underdamped

The period T of a damped oscillator is primarily determined by the damped angular frequency `&omega;__d`; `&omega;__d` = sqrt(k/m-(delta/(2*m))^2)

Suppose a mass "m=0. 2 kg" is attached to a spring with k = 10*N/m and a damper with a damping coefficient "delta."

restart; with(plots); with(DEtools)

k := 10; m := .2; `&delta;__c` := 2*sqrt(k*m); delta := .6; omega := sqrt(k/m); `&omega;__d` := sqrt(omega^2-(delta/(2*m))^2); T := 2*Pi/`&omega;__d`; f := `&omega;__d`/(2*Pi)

10

 

.2

 

2.828427124

 

.6

 

7.071067812

 

6.910137481

 

.9092706654

 

1.099782538

(10)

ODE__2 := m*(diff(x(t), t, t))+delta*(diff(x(t), t))+k*x(t) = 0; IC := x(0) = -.104, (D(x))(0) = 0

.2*(diff(diff(x(t), t), t))+.6*(diff(x(t), t))+10*x(t) = 0

 

x(0) = -.104, (D(x))(0) = 0

(11)

sol := dsolve(ODE__2, x(t))

x(t) = c__1*exp(-(3/2)*t)*sin((1/2)*191^(1/2)*t)+c__2*exp(-(3/2)*t)*cos((1/2)*191^(1/2)*t)

(12)

sol := dsolve({IC, ODE__2}, x(t), numeric, output = listprocedure)

odeplot(sol, [t, x(t)], 0 .. 10, color = blue)

 

H := proc (t) local pos, vel, kinetic, potential; pos := rhs(sol(t)[2]); vel := rhs(sol(t)[3]); kinetic := (1/2)*m*vel^2; potential := (1/2)*k*pos^2; return kinetic+potential end proc

timeRange := 0 .. 35; plot(H(t), t = timeRange, title = "Hamiltonian Energy vs Time", labels = ["Time (t)", "Energy (H)"])

 

for meth in SolutionMethods do meth, H(100) end do

SolutionMethods, HFloat(1.6739566269541513e-16)

(13)

Mass-Spring System with a Non-Linear Spring

• 

Springs with large deflections are not linear and their forces can be approximated by a cubic term F = -a*x^3-k*x

• 

If beta > 0hardening spring (stiffer with larger deflection), if beta < 0softening spring (more flexible with larger deflection).

• 

So, the EOM fot a mass-spring system in free vibration will  be:

m*(diff(x(t), t, t))+k*x(t)+`&beta;x`^3 = 0

The period of oscillation will not be constant and depends on the applitude of oscillations and sign of "beta."

First case beta > 0

restart; with(plots); m := .2; k := 10; beta := 1

.2

 

10

 

1

(14)

EOM := m*(diff(x(t), `$`(t, 2)))+k*x(t)+beta*x(t)^3 = 0

.2*(diff(diff(x(t), t), t))+10*x(t)+x(t)^3 = 0

(15)

sol := dsolve({EOM, x(0) = -.104, (D(x))(0) = 0}, x(t), numeric, range = 0 .. 20, output = listprocedure)

odeplot(sol, [t, x(t)], 0 .. 10, title = "Nonlinear Oscillation (Hardening Spring)", labels = ["Time (s)", "Displacement (m)"], color = blue)

 

H := proc (t) local pos, vel, kinetic, potential; pos := rhs(sol(t)[2]); vel := rhs(sol(t)[3]); kinetic := (1/2)*m*vel^2; potential := (1/2)*k*pos^2+(1/4)*beta*pos^4; return kinetic+potential end proc; timeRange := 0 .. 10; plot(H(t), t = timeRange, 0 .. .1, title = "Hamiltonian Energy vs Time", labels = ["Time (t)", "Energy (H)"])

proc (t) local pos, vel, kinetic, potential; pos := rhs(sol(t)[2]); vel := rhs(sol(t)[3]); kinetic := (1/2)*m*vel^2; potential := (1/2)*k*pos^2+(1/4)*beta*pos^4; return kinetic+potential end proc

 

0 .. 10

 

 

In this non-linear mass-spring-damper system (without damping), the Hamiltonian  is essentially the total energy of the system, as there is no energy loss.

• 

The Hamiltonian remains relatively constant over time, as expected in an ideal undamped system, indicating energy conservation.

• 

Small numerical variations may occur due to the non-linear terms and the precision of numerical methods used for solving the differential equations.

eq1 := diff(x(t), t) = v(t); eq2 := diff(v(t), t) = -k*x(t)/m-beta*x(t)^3/m

diff(x(t), t) = v(t)

 

diff(v(t), t) = -50.00000000*x(t)-5.000000000*x(t)^3

(16)

initial_conditions := [[x(0) = -.104, v(0) = 0]]; with(DEtools); DEplot([eq1, eq2], [x(t), v(t)], t = 0 .. 1, x = -.3 .. .3, v = -2 .. 2, initial_conditions, title = "Phase Portrait for Nonlinear Oscillator", axes = boxed, labels = ["Displacement x", "Velocity v"], linecolor = blue)

[[x(0) = -.104, v(0) = 0]]

 

 

Second Case beta < 0

restart; with(plots)

m := .2; k := 10; beta := -1

.2

 

10

 

-1

(17)

EOM := m*(diff(x(t), `$`(t, 2)))+k*x(t)+beta*x(t)^3 = 0

.2*(diff(diff(x(t), t), t))+10*x(t)-x(t)^3 = 0

(18)

sol := dsolve({EOM, x(0) = -.104, (D(x))(0) = 0}, x(t), numeric, range = 0 .. 20, output = listprocedure)