LagrangeEquations - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : Physics : LagrangeEquations

Physics[LagrangeEquations] - compute the Lagrange equations for a given Lagrangian

Calling Sequence

LagrangeEquations(L, F)

Parameters

L

-

any algebraic expressions representing a Lagrangian; there are no restrictions to the differentiation order of the derivatives of the coordinates or fields

F

-

a name indicating the coordinate, without the coordinate's dependency, or a set or list of them in the case of a system with many degrees of freedom

Description

• 

LagrangeEquations receives an expression representing a Lagrangian and returns a sequence of Lagrange equations, of the form expression=0, with as many equations as coordinates are indicated in the list or set F. In the case of only one degree of freedom (one coordinate), F can also be the coordinate itself, and the output consists of a single Lagrange equation.

• 

The formula in the traditional case where the Lagrangian depends on 1st order derivatives of the coordinates and there is only one parameter, t, is

ⅆⅆtviL=riL

  

where riL formally represents the derivative with respect to the coordinates of the ith particle, equal to the Gradient when working in Cartesian coordinates; viL represents the equivalent operation, replacing each coordinate by the corresponding velocity, i.e. its derivative with respect to t, and ⅆⅆt represents the total derivative with respect to t, the parameter parametrizing the coordinates. Note that in more general cases the number of parameters can be many. For example, in electrodynamics, the "coordinate" is a tensor field Aμx,y,z,t, there are then four coordinates, one for each of the values of the index μ, and there are four parameters x,y,z,t.

• 

The second argument F indicates the coordinates without their dependency, passed as names. For example, in the case of one single parameter t and a coordinate qt, pass q. It is expected that these names appear in the Lagrangian consistently, always with the same functionality.

• 

LagrangeEquations 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. Unlike the similar command VariationalCalculus:-EulerLagrange, LagrangeEquations does not return first integrals.

Examples

withPhysics:

Setupmathematicalnotation=true,coordinates=cartesian

Systems of spacetime coordinates are:X=x,y,z,t

_______________________________________________________

coordinatesystems=X,mathematicalnotation=true

(1)

The Lagrangian of a one-dimensional oscillator - small oscillations

L12diffxt,t212kxt2

Lx.t22kxt22

(2)

The corresponding Lagrange equation gives Newton's second law, a 2nd order linear ODE for xt

LagrangeEquationsL,x

xtk+x..t=0

(3)

The Lagrangian of a pendulum of mass m and length l where the suspension point moves uniformly over a vertical circumference centered at the origin, with a constant frequency ω

CompactDisplayφt

φtwill now be displayed asφ

(4)

L12m2diffφt,talωsinωtφt+diffφt,t2l2+2cosφtgl

Lm2φ.alωsinωtφ+φ.2l2+2cosφgl2

(5)

The Lagrange equations

LagrangeEquationsL,φ

mlaω2costωφsinφgφ..l=0

(6)

The Maxwell equations can be derived as Lagrange equations as follows. For simplicity, consider Maxwell equations in vacuum. Define first a tensor representing the 4D electromagnetic field potential

DefineAμ

Defined objects with tensor properties

Aμ,γμ,σμ,μ,gμ,ν,εα,β,μ,ν,Xμ

(7)

CompactDisplayAX

Ax,y,z,twill now be displayed asA

(8)

The electromagnetic field tensor

Fμ,νd_μAνXd_νAμX

Fμ,νμAννAμ

(9)

The Lagrangian

LFμ,ν2

LμAννAμμμAννννAμμ

(10)

Maxwell equations in 4D tensorial notation

LagrangeEquationsL,A

4Aαα+4μααAμμ=0

(11)

The Lagrangian of a quantum system of identical particles (bosons) can be expressed in terms of the a complex field ψX, an external potential VX and a term G12ψ4 representing the atom-atom interaction. Set first the realobjects of the problem

withVectors

&x,`+`,`.`,Assume,ChangeBasis,ChangeCoordinates,CompactDisplay,Component,Curl,DirectionalDiff,Divergence,Gradient,Identify,Laplacian,,Norm,ParametrizeCurve,ParametrizeSurface,ParametrizeVolume,Setup,Simplify,`^`,diff,int

(12)

interfaceimaginaryunit=i

I

(13)

macroh=:

Setuprealobjects=G,h,m,t,Vx,y,z,t

realobjects=,G,m,φ,r,ρ,t,θ,x,y,z,VX

(14)

CompactDisplayψX,VX

ψx,y,z,twill now be displayed asψ

Vx,y,z,twill now be displayed asV

(15)

The Lagrangian is

L12hidiffconjugateψX,tψXm+hNorm%GradientψX2+GabsψX4+diffψX,ticonjugateψXh2Vx,y,z,tabsψX2m1m

Lψ&conjugate0;tψm+ψ2+Gψ4+ψ.ψ&conjugate0;2Vψ2m2m

(16)

Taking ψ as the coordinate, the Lagrange equation is the so-called the Gross-Pitaevskii equation (GPE),

LagrangeEquationsL,ψ

ψX&conjugate0;x,x2+ψX&conjugate0;y,y2+2ψX&conjugate0;z,z2mGψ&conjugate0;2ψ+ψ&conjugate0;t+ψ&conjugate0;V2m=0

(17)

Make the Laplacian explicit

Laplacian=%LaplacianψX

ψx,x+ψy,y+ψz,z=2ψ

(18)

simplifyconjugate,

2ψ.m+22ψ2mψGψ&conjugate0;ψ+V2m=0

(19)

The standard form of the Gross-Pitaevskii equation has the time derivative of ψ isolated

ihisolate,diffψX,t

ψ.=22ψ+2mψGψ&conjugate0;ψ+V2m

(20)

The λΦ4 model in classical field theory and corresponding field equations

CompactDisplayΦX

Φx,y,z,twill now be displayed asΦ

(21)

L12d_μΦXd_μΦXm22ΦX2+λ4ΦX4

LμΦμμΦ2m2Φ22+λΦ44

(22)

LagrangeEquationsL,Φ

Φ3λΦm2Φ=0

(23)

See Also

CompactDisplay, conjugate, d_, dAlembertian, Fundiff, isolate, Physics, Physics conventions, Physics examples, Physics Updates, Tensors - a complete guide, Mini-Course Computer Algebra for Physicists, Physics[*], Setup, simplify/siderels, VariationalCalculus:-EulerLagrange

Compatibility

• 

The Physics[LagrangeEquations] command was introduced in Maple 2023.

• 

For more information on Maple 2023 changes, see Updates in Maple 2023.