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

Typesetting:-_Hold%diff%diffL,v_i,t=Typesetting:-_Hold%diffL,r_i

  

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

L1ⅆⅆtxt221kxt22

Lx.t22kxt22

(2)

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

LagrangeEquationsL,x

x..t+xtk=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)

L1m2ⅆⅆtφtalωsinωtφt+ⅆⅆtφt2l2+2cosφtgl2

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

(5)

The Lagrange equations

LagrangeEquationsL,φ

mlaω2cosωtφtsinφtgdiffdiffφt,t,tl=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

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

(9)

The Lagrangian

LFμ,ν2

d_μAνX,Xd_νAμX,Xd_~muA~nuX,Xd_~nuA~muX,X

(10)

Maxwell equations in 4D tensorial notation

LagrangeEquationsL,A

4dAlembertianA~alphaX,X+4d_μd_~alphaA~muX,X,X=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=h,G,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

L1hitψX&conjugate0;ψXm+hNorm%GradientψX2+GψX4+tψXiψX&conjugate0;h2Vx,y,z,tψX2m12m

12diffconjugateψX,tψXm+Norm%GradientψX2+GabsψX4+diffψX,tconjugateψX2VXabsψX2mm

(16)

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

LagrangeEquationsL,ψ

12diffdiffconjugateψX,x,x2+diffdiffconjugateψX,y,y2+2diffdiffconjugateψX,z,z2GconjugateψX2ψX+diffconjugateψX,t+conjugateψXVXmm=0

(17)

Make the Laplacian explicit

Laplacian=%LaplacianψX

diffdiffψX,x,x+diffdiffψX,y,y+diffdiffψX,z,z=%LaplacianψX

(18)

simplify&conjugate0;,

122diffψX,tm+2%LaplacianψX2mψXGconjugateψXψX+VXm=0

(19)

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

ihisolate,tψX

diffψX,t=122%LaplacianψX+2mψXGconjugateψXψX+VXm

(20)

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

CompactDisplayΦX

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

(21)

L1d_μΦXd_μΦX2m2ΦX22+λΦX44

12d_μΦX,Xd_~muΦX,X12m2ΦX2+14λΦX4

(22)

LagrangeEquationsL,Φ

dAlembertianΦX,X+ΦXΦX2λ+m2=0

(23)

See Also

CompactDisplay, conjugate, 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.