newton, lagrange, hamilton and hamilton-jacobi …o.castera.free.fr/zip/newton, lagrange, hamilton...

144
Newton, Lagrange, Hamilton and Hamilton- Jacobi Mechanics of Classical Particles with Mathematica Dr. Luigi E. Masciovecchio email: [email protected] First published and available as notebook and PDF on http://sites.google.com/site/luigimasciovecchio/ 2017.06.06 In[1]:= Print@"Document revision: ", IntegerPart@Date@DDD Document revision: 82017, 10, 17, 6, 57, 57< Newton, Lagrange, Hamilton and Hamilton-Jacobi Mechanics of Classical Particles with Mathematica.nb 1

Upload: hakien

Post on 04-Feb-2018

243 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Newton, Lagrange, Hamilton and Hamilton-Jacobi …o.castera.free.fr/zip/Newton, Lagrange, Hamilton and Hamilton... · Ł Separability of the HJE for a particle attracted to two fixed

Newton, Lagrange, Hamilton and Hamilton-

Jacobi Mechanics of Classical Particles

with Mathematica

Dr. Luigi E. Masciovecchio

email: [email protected]

First published and available as notebook and PDF on

http://sites.google.com/site/luigimasciovecchio/

2017.06.06

In[1]:= Print@"Document revision: ", IntegerPart@Date@DDDDocument revision: 82017, 10, 17, 6, 57, 57<

Newton, Lagrange, Hamilton and Hamilton-Jacobi Mechanics of Classical Particles with Mathematica.nb 1

Page 2: Newton, Lagrange, Hamilton and Hamilton-Jacobi …o.castera.free.fr/zip/Newton, Lagrange, Hamilton and Hamilton... · Ł Separability of the HJE for a particle attracted to two fixed

Foreword

Dear Colleagues,

Certainly only very few words have to be spent to describe the usefulness, the efficiency, the efficacy, the value and the

beauty of Mathematica for the didactics of physics in general and, as shown in this notebook, for classical mechanics in

particular. They are: "Get it! Now!"

But it maybe happens that in the havoc of the semester lectures You don't find the time to write (and to debug...) the

code You would need to illustrate various aspects of the theory You are teaching. So I put together some examples from

Newton, Lagrange, Hamilton and Hamilton-Jacobi mechanics of classical particles that You can use immediately, with

perhaps only minor adjustments to meet Your special needs. I put special emphasis on examples with friction, on chaos,

on visualization and on constants of motion (Noether's theorem); an attention to future applications in quantum mechan-

ics is always on the background. Some comments are added to the code to explain what's going on, but this notebook is

by no means an exhaustive exposition of the theories involved; see the bibliography section for a list of many interesting

textbooks.

(You are maybe interested in my notebooks on special and general relativity too. You can find them on my web site.)

Drop my a line if I have to fix some errors.

Enjoy!

Dr. Luigi E. Masciovecchio

Newton, Lagrange, Hamilton and Hamilton-Jacobi Mechanics of Classical Particles with Mathematica.nb 2

Page 3: Newton, Lagrange, Hamilton and Hamilton-Jacobi …o.castera.free.fr/zip/Newton, Lagrange, Hamilton and Hamilton... · Ł Separability of the HJE for a particle attracted to two fixed

Table of Content

ì Foreword

ì Table of Content

ì Utilization Notes

ì Bibliography

ì Initialization code (Run it first!)

ì I) Newton mechanics for classical particles

è Gravitative three-body-problem

è actio = reactio? Not always...

ì II) Lagrange mechanics for classical particles

è Variational calculus: Formal Euler equations

è Variational calculus: Shortest path between (a, A, z) and (b, B, z) on the plane z = 0 analytical (geodetic)

è Variational calculus: Shortest path between (a, A, z) and (b, B, z) on a surface z = x2 + y analytical (geodetic)

è Variational calculus: Shortest path between (a, A, z) and (b, B, z) on a surface z = Sin[4 x] + y/3 analytical (geodetic)

è Variational calculus: Shortest path between (a, A, z) and (b, B, z) on a surface z = x2 + y2 numerical (geodetic)

è Variational calculus: Minimal area of a surface of revolution generated by rotating the graph of a function in the x-y

plane about the y axis (catenary) (see Goldstein&Poole&Safko p.40)

è Variational calculus: Brachystochrone problem from point (a, A) to point (b, B) (cycloid) (see Goldstein&Poole-

&Safko p.42)

è 1D harmonic oscillator in Cartesian coordinates

è 2D nonlinear pendulum

è 2D spring pendulum (see Zimmerman&Olness p.327)

è 3D bead sliding on a conical spiral (see Wells p.52)

è 3D Spring pendulum with viscous drag (see Wells p.338)

è A mobile (in the sense of Alexander Calder) with drag and time-dependent driving force (3D, animation)

è Noether's theorem for Lagrangian mechanics: the ten constants of motion from the Galilei transformation group

Newton, Lagrange, Hamilton and Hamilton-Jacobi Mechanics of Classical Particles with Mathematica.nb 3

Page 4: Newton, Lagrange, Hamilton and Hamilton-Jacobi …o.castera.free.fr/zip/Newton, Lagrange, Hamilton and Hamilton... · Ł Separability of the HJE for a particle attracted to two fixed

ì III) Hamilton mechanics for classical particles

è A simple 1D Hamiltonian

è A 2D central force V(r) = - Α/r Hamiltonian

è A simple 3D Hamiltonian

è Sliding bead on a wire of the form y = f(x) in a homogenous gravitational field (2D) (see Baumann p.365)

è Mass point moving on the surface of a cylinder subject to a linear central force (coil spring) and gravity (3D) (see

Baumann p.367)

è 1D harmonic oscillator in phase space and space of states

è 1D harmonic oscillator with viscous drag

è Lots of cute orbits from the problem of the gravitational attraction from two fixed masses (2D)

è A pendulum bob suspended from a coil spring and allowed to swing in a vertical plane, assuming viscous drag on the

bob, in polar coordinates (2D) (see Wells p.321)

è 2D double simple pendulum exhibits chaotic behavior (see Baumann p.393)

è 1D chaos: particle moving in a nonlinear potential with external driving force and drag

è Poisson bracket: definition and properties

è Poisson bracket: Total energy, angular momentum and Runge-Lenz vector in the Α/r potential (see Tong p.95 and

Goldstein&Poole&Safko p.102)

è A canonical transformation for the 1D damped harmonic oscillator with an ad hoc Hamiltonian and Q, P = 1 (see

Greiner p.373)

è A canonical transformation for the 1D harmonic oscillator with Q, P = 1

è A canonical transformation for the 1D q-2 2 potential with Q, P = 1

è An (at least) canonoidal transformation for the 1D harmonic oscillator with Hamiltonian K(Q, P) = P and Q, P ¹ 1

(see Torres del Castillo p.160)

è An (at least) canonoidal transformation for the 1D harmonic oscillator with Hamiltonian K(Q, P) = 0 and Q, P ¹ 1

(see Torres del Castillo p.160)

è Noether's theorem for the Hamiltonian

è Liouville's theorem for a system of free falling bodies

Newton, Lagrange, Hamilton and Hamilton-Jacobi Mechanics of Classical Particles with Mathematica.nb 4

Page 5: Newton, Lagrange, Hamilton and Hamilton-Jacobi …o.castera.free.fr/zip/Newton, Lagrange, Hamilton and Hamilton... · Ł Separability of the HJE for a particle attracted to two fixed

ì IV) Hamilton-Jacobi mechanics for classical particles

è PDE (Partial Differential Equation): A few analytically solved basic examples adapted from the Mathematica 5.2

documentation

è PDE: Numerical solution of the 1D time-dependent Schrödinger equation (Cauchy problem with a second order PDE

in two variables)

è Solving the HJE (Hamilton-Jacobi equation) for the free particle in 1D (see Jelitto p.342 or Schmutzer p.430)

è Solving the HJE for the harmonic oscillator in 1D (see Goldstein&Poole&Safko p.434-437)

è Solving the HJE for the slant throw in 2D (see Jelitto p.342 or Greiner p.395-397)

è Separability of the HJE for a particle attracted to two fixed gravitational centers in 2D (see José&Saletan, Worked

Example 6.3, p.298-301)

è Separation of variables in ("normalized") elliptic coordinates of the HJE in physically interesting planar cases (see

Landau&Lifshitz, § 48, (3) Elliptic co-ordinates)

è HJE and Hamilton's principal function for the planar problem of the attraction from two equal and fixed masses (see

Arnold, chapter IX, § 47, C. Examples)

è An opto-mechanical analogy and the dawn of Quantum Mechanics in the Hamilton-Jacobi theory

Newton, Lagrange, Hamilton and Hamilton-Jacobi Mechanics of Classical Particles with Mathematica.nb 5

Page 6: Newton, Lagrange, Hamilton and Hamilton-Jacobi …o.castera.free.fr/zip/Newton, Lagrange, Hamilton and Hamilton... · Ł Separability of the HJE for a particle attracted to two fixed

Utilization Notes

Û Note: Mathematica by Wolfram Research is a (fabulous) computer algebra system. A notebook is an interactive

Mathematica document (extension .nb), which can be printed out as a PDF file, but loosing any interactivity, of course.

Û Note: Once the (protected) initialization code has run, every of the following Mathematica subsections can be

evaluated by its own! The Remove["Global`*"] statement at the beginning of every subsections gets ruthlessly rid of

any interference from previously run code.

The code was originally written in Mathematica version 5.2 and runs with only a few minor flaws in Mathematica

version 7. For higher Mathematica versions there will be more and more issues, which had to be fixed to reproduce any

results.

Û Note: The $Assumptions statement at the beginning of a few subsections contains relations often crucial for a

proper simplification of the following expressions.

Û Note: E means ã in input, so the very similar looking capital epsilon character E is used when the usual E character

is needed, for example to designate an Energy in the code. Likewise, the capital kappa character K substitutes sometimes

the usual K character.

Ü Warning: Mathematica supposes partial differentiation to be commutative!

In[2]:= 9¶x,yf@x , yD, ¶y,xf@x, yD=HoldFormA¶x,yf@x , yD == ¶y,xf@x, yDE% ReleaseHold

Out[2]= 9fH1,1L@x, yD, fH1,1L@x, yD=Out[3]= ¶x,yf@x, yD ¶y,xf@x, yDOut[4]= True

Ü Warning: The evaluation of an expression x2 must be done very carefully to avoid errors! See some examples:

In[5]:= ::SimplifyB x2 F, H-xL2 , PowerExpandB x2 F, PowerExpandB H-xL2 F>,:SimplifyB x2 , x Î RealsF, SimplifyB x2 , x £ 0F, SimplifyB x2 , x ³ 0F>,:Ix2M 1

2 , x1

2

2

, x2

2 , SolveB x2 y, xF>>Out[5]= 99 x2 , x2 , x, x=, 8Abs@xD, -x, x<, 9 x2 , x, x, 88x ® -y<, 8x ® y<<==Ü Warning: Avoid Italian universities like hell: they are highly neurotoxic! I know what I'm talking about. Prof. Urs

Bestmann (my excellent mathematics, geometry and informatics teacher) was right about that! Absolutely right.

Bibliography

Newton, Lagrange, Hamilton and Hamilton-Jacobi Mechanics of Classical Particles with Mathematica.nb 6

Page 7: Newton, Lagrange, Hamilton and Hamilton-Jacobi …o.castera.free.fr/zip/Newton, Lagrange, Hamilton and Hamilton... · Ł Separability of the HJE for a particle attracted to two fixed

Bibliography

N. Straumann. Skript Klassische Mechanik, Sommersemester 1984.

V.I. Arnold. Mathematical Methods of Classical Mechanics, 1974.

A. Romano. Classical Mechanics with Mathematica, 2012.

D.A. Wells. Schaum's Outline of Theory and Problems of Lagrangian Dynamics, 1967.

D. Tong. vol. 2 Classical Dynamics, 2015.

H. Goldstein, C.Poole, J.Safko. Classical Mechanics, 3.ed. 2000.

R.M. Dreizler, C.S. Lüdde. Theoretical Physics 1. Theoretical Mechanics, 2011.

R.L. Zimmerman, F.I. Olness. Mathematica for Physics, 2.ed. 2002.

G. Baumann. Mathematica for Theoretical Physics I, 2.ed. 2005.

W. Greiner. Classical Mechanics, 2.ed. 2010.

L.D. Landau, E.M. Lifshitz. Course of Theoretical Physics 1. Mechanics, 3.ed. 1976.

G.F. Torres del Castillo. "The generating function of a canonical transformation", Revista Mexicana de Física E 57158–163, december 2011.

E. Schmutzer. Grundlagen der Theoretischen Physik - Band 1 und 2, 3.ed, 2005.

R.J. Jelitto. Theoretische Physik 2: Mechanik II, 2.ed, 1987.

J.V. José, E.J. Saletan. Classical Dynamics: A Contemporary Approach, 1998.

Newton, Lagrange, Hamilton and Hamilton-Jacobi Mechanics of Classical Particles with Mathematica.nb 7

Page 8: Newton, Lagrange, Hamilton and Hamilton-Jacobi …o.castera.free.fr/zip/Newton, Lagrange, Hamilton and Hamilton... · Ł Separability of the HJE for a particle attracted to two fixed

Initialization code (Run it first!)

In[6]:= Print@"This system is: ",8"ProductIDName", "ProductVersion"< . $ProductInformationDPrint@"Operating system: ", ReadList@"!ver", StringDDPrint@"$MachineType,$ProcessorType,$ByteOrdering,$SystemCharacterEncoding: ",8$MachineType, $ProcessorType, $ByteOrdering, $SystemCharacterEncoding<DThis system is: 8Mathematica, 7.0 for Microsoft Windows H32-bitL HNovember 10, 2008L<Operating system: 8Microsoft Windows XP @Versione 5.1.2600D<$MachineType,$ProcessorType,$ByteOrdering,$SystemCharacterEncoding:8PC, x86, -1, WindowsANSI<

In[9]:= H* graphic output parameters *LUnprotect@"*Sizepic"D;minSizepic = 150;

medSizepic = 300;

maxSizepic = 500;

Protect@"*Sizepic"D;In[14]:= Unprotect@HamiltonD;

Hamilton@L_, xList_List, pList_List, t_: tD :=

Module@8xx, vv, pp, sol, ham, eqp, eqx, eqs<,xx = Through@xList@tDD;vv = D@xx, tD;pp = Through@pList@tDD;sol = Solve@HD@L, ð D & vvL pp, vvD Flatten;

ham = pp.vv - L . sol Simplify Expand;

eqp = D@pp, tD -Map@D@ham, ð D &, xxD Thread;

eqx = D@xx, tD +Map@D@ham, ð D &, ppD Thread;

eqs = Join@eqx, eqpD;Return@8sol, ham, eqs<DDH*

sol = relation between generalized velocity and canonical momentum

ham = Hamiltonian expressed in terms of canonical variables

eqs = equation of motion

from R.L.Zimmerman,F.I.Olness - Mathematica for Physics H2.ed,2002L*LProtect@HamiltonD;

In[17]:= Unprotect@PoissonBracketD;PoissonBracket@f_, g_, q_List, p_ListD ; Length@qD == Length@pD :=

D@f, 8q<D.D@g, 8p<D - D@f, 8p<D.D@g, 8q<D H* by Suba Thomas *LProtect@PoissonBracketD;

In[20]:= << Utilities`Notation`

In[21]:= NotationB8f_, g_<q_,p_

PoissonBracket@f_, g_, q_, p_DFIn[22]:= << Calculus`VariationalMethods`

"Ready, set, go!"

Newton, Lagrange, Hamilton and Hamilton-Jacobi Mechanics of Classical Particles with Mathematica.nb 8

Page 9: Newton, Lagrange, Hamilton and Hamilton-Jacobi …o.castera.free.fr/zip/Newton, Lagrange, Hamilton and Hamilton... · Ł Separability of the HJE for a particle attracted to two fixed

I) Newton mechanics for classical particles

Q uantum mechanics isn't logically independent from classical mechanics and the most general formulation of

classical mechanics is Newton mechanics. So let's solve (numerically) the gravitative three-body-problem in this

framework; en passant we also check the conservation laws for an isolated system. Then we take also a look at New-

ton's third law in a special case.

Gravitative three-body-problem

In[23]:= Remove@"Global`*"DIn[24]:= Bewegungsgleichungen =8

m1 x1''@tD -G m1 m2Hx1@tD - x2@tD L H Hx1@tD - x2@tDL^2 + Hy1@tD - y2@tDL^2 + Hz1@tD - z2@tDL^2L^H3 2L - G m1 m3 Hx1@tD - x3@tD L H Hx1@tD - x3@tDL^2 + Hy1@tD - y3@tDL^2 + Hz1@tD - z3@tDL^2L^H3 2L ,

m1 y1''@tD

-G m1 m2 Hy1@tD - y2@tD L H Hx1@tD - x2@tDL^2 + Hy1@tD - y2@tDL^2 + Hz1@tD - z2@tDL^2L^H3 2L -

G m1 m3 Hy1@tD - y3@tDL H Hx1@tD - x3@tDL^2 + Hy1@tD - y3@tDL^2 +Hz1@tD - z3@tDL^2L^H3 2L , m1 z1''@tD

-G m1 m2 Hz1@tD - z2@tD L H Hx1@tD - x2@tDL^2 + Hy1@tD - y2@tDL^2 +Hz1@tD - z2@tDL^2L^H3 2L - G m1 m3 Hz1@tD - z3@tDL H Hx1@tD - x3@tDL^2 + Hy1@tD - y3@tDL^2 + Hz1@tD - z3@tDL^2L^H3 2L ,

m2 x2''@tD -G m2 m3Hx2@tD - x3@tD L H Hx2@tD - x3@tDL^2 + Hy2@tD - y3@tDL^2 + Hz2@tD - z3@tDL^2L^H3 2L - G m2 m1 Hx2@tD - x1@tD L H Hx2@tD - x1@tDL^2 + Hy2@tD - y1@tDL^2 + Hz2@tD - z1@tDL^2L^H3 2L ,

m2 y2''@tD -G m2 m3 Hy2@tD - y3@tD L H Hx2@tD - x3@tDL^2 + Hy2@tD - y3@tDL^2 +Hz2@tD - z3@tDL^2L^H3 2L - G m2 m1 Hy2@tD - y1@tD L H Hx2@tD - x1@tDL^2 + Hy2@tD - y1@tDL^2 + Hz2@tD - z1@tDL^2L^H3 2L ,

m2 z2''@tD -G m2 m3 Hz2@tD - z3@tD L H Hx2@tD - x3@tDL^2 + Hy2@tD - y3@tDL^2 +Hz2@tD - z3@tDL^2L^H3 2L - G m2 m1 Hz2@tD - z1@tD L H Hx2@tD - x1@tDL^2 + Hy2@tD - y1@tDL^2 + Hz2@tD - z1@tDL^2L^H3 2L ,

m3 x3''@tD -G m3 m2Hx3@tD - x2@tD L H Hx3@tD - x2@tDL^2 + Hy3@tD - y2@tDL^2 + Hz3@tD - z2@tDL^2L^H3 2L - G m3 m1 Hx3@tD - x1@tD L H Hx3@tD - x1@tDL^2 + Hy3@tD - y1@tDL^2 + Hz3@tD - z1@tDL^2L^H3 2L ,

m3 y3''@tD -G m3 m2 Hy3@tD - y2@tD L H Hx3@tD - x2@tDL^2 + Hy3@tD - y2@tDL^2 +Hz3@tD - z2@tDL^2L^H3 2L - G m3 m1 Hy3@tD - y1@tD L H Hx3@tD - x1@tDL^2 + Hy3@tD - y1@tDL^2 + Hz3@tD - z1@tDL^2L^H3 2L ,

m3 z3''@tD -G m3 m2 Hz3@tD - z2@tD L H Hx3@tD - x2@tDL^2 + Hy3@tD - y2@tDL^2 +Hz3@tD - z2@tDL^2L^H3 2L - G m3 m1 Hz3@tD - z1@tD L H Hx3@tD - x1@tDL^2 + Hy3@tD - y1@tDL^2 + Hz3@tD - z1@tDL^2L^H3 2L<;In[25]:=

Newton, Lagrange, Hamilton and Hamilton-Jacobi Mechanics of Classical Particles with Mathematica.nb 9

Page 10: Newton, Lagrange, Hamilton and Hamilton-Jacobi …o.castera.free.fr/zip/Newton, Lagrange, Hamilton and Hamilton... · Ł Separability of the HJE for a particle attracted to two fixed

In[25]:= G = 1;

m1 = 1; m2 = 1; m3 = 1;

Anfangsbedingungen =8x1@0D 0, y1@0D 0, z1@0D 0,

x1'@0D 0.1, y1'@0D 0.3, z1'@0D 0.1,

x2@0D 1, y2@0D 1, z2@0D 1,

x2'@0D 0.2, y2'@0D 0.3, z2'@0D 0.1,

x3@0D 0, y3@0D 1, z3@0D 2 3,

x3'@0D 0.3, y3'@0D 0.1, z3'@0D 0.2<;tmax = 5;

NDSolve@8Bewegungsgleichungen, Anfangsbedingungen<,8x1, y1, z1, x2, y2, z2, x3, y3, z3<, 8t, 0, tmax<D . Rule ® Set Short

Out[29]//Short=88InterpolatingFunction@880., 5.<<, <>D,7, InterpolatingFunction@880., 5.<<, <>D<<

In[30]:= ParametricPlot3D@88x1@tD, y1@tD, z1@tD, Red<,8x2@tD, y2@tD, z2@tD, Green<,8x3@tD, y3@tD, z3@tD, Blue<<,8t, 0, tmax<, PlotPoints ® 1000, AxesLabel ® 8"x", "y", "z"<, PlotLabel ®

"A classical gravitative three-body-problem:\norbits of the particles.\n",

ImageSize ® medSizepicD

Out[30]=

A classical gravitative three-body-problem:

orbits of the particles.

0.0

0.5

1.0

1.5

2.0

x

0.0

0.5

1.0

1.5

2.0

y

0.0

0.5

1.0

1.5

z

Now we search for constants of motion:

a) Total impulse conservation

Newton, Lagrange, Hamilton and Hamilton-Jacobi Mechanics of Classical Particles with Mathematica.nb 10

Page 11: Newton, Lagrange, Hamilton and Hamilton-Jacobi …o.castera.free.fr/zip/Newton, Lagrange, Hamilton and Hamilton... · Ł Separability of the HJE for a particle attracted to two fixed

a) Total impulse conservation

In[31]:= TotalImpulse@t_D = 8m1 x1'@tD + m2 x2'@tD + m3 x3'@tD,m1 y1'@tD + m2 y2'@tD + m3 y3'@tD, m1 z1'@tD + m2 z2'@tD + m3 z3'@tD<;

TotalImpulse@0DTotalImpulse@tmaxDPlot@Evaluate@TotalImpulse@tDD, 8t, 0, tmax<, PlotRange ® 80, 1<,PlotLabel ® "total impulse components HtimeL", ImageSize ® medSizepicD

Out[32]= 80.6, 0.7, 0.4<Out[33]= 80.6, 0.7, 0.4<

Out[34]=

0 1 2 3 4 5

0.2

0.4

0.6

0.8

1.0total impulse components HtimeL

b) Total angular momentum conservation

In[35]:= TotalAngularMomentum@t_D = m1 8x1@tD, y1@tD, z1@tD<8x1'@tD, y1'@tD, z1'@tD< +

m2 8x2@tD, y2@tD, z2@tD<8x2'@tD, y2'@tD, z2'@tD< +

m3 8x3@tD, y3@tD, z3@tD<8x3'@tD, y3'@tD, z3'@tD<;TotalAngularMomentum@0DTotalAngularMomentum@tmaxDPlot@Evaluate@TotalAngularMomentum@tDD, 8t, 0, tmax<, PlotRange ® 8-1, 1<,PlotLabel ® "total angular momentum components HtimeL", ImageSize ® medSizepicD

Out[36]= 8-0.0666667, 0.3, -0.2<Out[37]= 8-0.0666666, 0.3, -0.2<

Out[38]=

1 2 3 4 5

-1.0

-0.5

0.5

1.0total angular momentum components HtimeL

c) Total energy conservation

In[39]:=

Newton, Lagrange, Hamilton and Hamilton-Jacobi Mechanics of Classical Particles with Mathematica.nb 11

Page 12: Newton, Lagrange, Hamilton and Hamilton-Jacobi …o.castera.free.fr/zip/Newton, Lagrange, Hamilton and Hamilton... · Ł Separability of the HJE for a particle attracted to two fixed

In[39]:= TotalEnergy@t_D =m1

2Ix1'@tD2 + y1'@tD2 + z1'@tD2M +

m2

2Ix2'@tD2 + y2'@tD2 + z2'@tD2M +

m3

2Ix3'@tD2 + y3'@tD2 + z3'@tD2M -

G m1 m2 Hx1@tD - x2@tDL2 + Hy1@tD - y2@tDL2 + Hz1@tD - z2@tDL2 -

G m1 m3 Hx1@tD - x3@tDL2 + Hy1@tD - y3@tDL2 + Hz1@tD - z3@tDL2 -

G m2 m3 Hx2@tD - x3@tDL2 + Hy2@tD - y3@tDL2 + Hz2@tD - z3@tDL2 ;

TotalEnergy@0DTotalEnergy@tmaxDPlotATotalEnergy@tD, 8t, 0, tmax<, PlotRange ® TotalEnergy@0D 91 - 10-4, 1 + 10-4=,PlotLabel ® "total energy HtimeL", ImageSize ® medSizepicE

Out[40]= -2.16308

Out[41]= -2.16309

Out[42]=

0 1 2 3 4 5

-2.1632

-2.1631

-2.1630

-2.1629

total energy HtimeL

Note: Looking very closely we notice a slight decrease of the energy in time which should not appear in a conservative

system; this is due to the numerical errors which act like some kind of friction!

d) Inertial motion of center of mass

In[43]:= CenterOfMassPosition@t_D =Hm1 8x1@tD, y1@tD, z1@tD< + m2 8x2@tD, y2@tD, z2@tD< + m3 8x3@tD, y3@tD, z3@tD<L Hm1 + m2 + m3L;CenterOfMassPosition@0DCenterOfMassPosition@tmaxD - tmax CenterOfMassPosition'@0DPlot@Evaluate@CenterOfMassPosition@tD - t CenterOfMassPosition'@0DD,8t, 0, tmax<, PlotRange ® 80, 1<, PlotLabel ®

"reduced center of mass\nposition components HtimeL", ImageSize ® medSizepicDOut[44]= 80.333333, 0.666667, 0.555556<Out[45]= 80.333333, 0.666667, 0.555556<

Newton, Lagrange, Hamilton and Hamilton-Jacobi Mechanics of Classical Particles with Mathematica.nb 12

Page 13: Newton, Lagrange, Hamilton and Hamilton-Jacobi …o.castera.free.fr/zip/Newton, Lagrange, Hamilton and Hamilton... · Ł Separability of the HJE for a particle attracted to two fixed

Out[46]=

0 1 2 3 4 5

0.2

0.4

0.6

0.8

1.0

reduced center of mass

position components HtimeL

So we found ten constants of motion. (See also section "Noether's theorem for Lagrangian mechanics")

actio = reactio? Not always...

We consider here the Lorentz force between two point charges with electric field E and magnetic field B given in a low

speed, small distance approximation. The electric interaction satisfies Newton's third law, but the magnetic interaction

doesn't. We must consider also the electromagnetic field to re-establish the momentum conservation! (See Dreizler-

&Lüdde p.81.)

In[47]:= Remove@"Global`*"DIn[48]:= r@i_D := 9ri,x, ri,y, ri,z=

v@i_D := 9vi,x, vi,y, vi,z=In[50]:= E@i_D@Ρ_D :=

qi

4 Π Ε0

HΡ - r@iDLNorm@Ρ - r@iDD3

. Abs ® Identity

E@iD@r@jDDOut[51]= 9 qi I-ri,x + rj,xM

4 Π Ε0 JI-ri,x + rj,xM2+ I-ri,y + rj,yM2

+ I-ri,z + rj,zM2N32 ,qi I-ri,y + rj,yM

4 Π Ε0 JI-ri,x + rj,xM2+ I-ri,y + rj,yM2

+ I-ri,z + rj,zM2N32 ,qi I-ri,z + rj,zM

4 Π Ε0 JI-ri,x + rj,xM2+ I-ri,y + rj,yM2

+ I-ri,z + rj,zM2N32 =In[52]:= B@i_D@Ρ_D :=

Μo qi

4 Πv@iD

HΡ - r@iDLNorm@Ρ - r@iDD3

. Abs ® Identity Simplify;

B@iD@r@jDD

Newton, Lagrange, Hamilton and Hamilton-Jacobi Mechanics of Classical Particles with Mathematica.nb 13

Page 14: Newton, Lagrange, Hamilton and Hamilton-Jacobi …o.castera.free.fr/zip/Newton, Lagrange, Hamilton and Hamilton... · Ł Separability of the HJE for a particle attracted to two fixed

Out[53]= 9 qi Μo I-ri,z vi,y + rj,z vi,y + Iri,y - rj,yM vi,zM4 Π JIri,x - rj,xM2

+ Iri,y - rj,yM2+ Iri,z - rj,zM2N32 ,

qi Μo Iri,z vi,x - rj,z vi,x + I-ri,x + rj,xM vi,zM4 Π JIri,x - rj,xM2

+ Iri,y - rj,yM2+ Iri,z - rj,zM2N32 ,

qi Μo I-ri,y vi,x + rj,y vi,x + Iri,x - rj,xM vi,yM4 Π JIri,x - rj,xM2

+ Iri,y - rj,yM2+ Iri,z - rj,zM2N32 =

A little test:

In[54]:= HB@iD@r@jDD == Ε0 Μo v@iDE@iD@r@jDDL Simplify

Out[54]= True

In[55]:= Fel@i_D@j_D := qi E@jD@r@iDDFel@1D@2DFel@2D@1DSimplify@% + %%D === 80, 0, 0<

Out[56]= 9 q1 q2 Hr1,x - r2,xL4 Π Ε0 JHr1,x - r2,xL2 + Ir1,y - r2,yM2

+ Hr1,z - r2,zL2N32 ,q1 q2 Ir1,y - r2,yM

4 Π Ε0 JHr1,x - r2,xL2 + Ir1,y - r2,yM2+ Hr1,z - r2,zL2N32 ,

q1 q2 Hr1,z - r2,zL4 Π Ε0 JHr1,x - r2,xL2 + Ir1,y - r2,yM2

+ Hr1,z - r2,zL2N32 =Out[57]= 9 q1 q2 H-r1,x + r2,xL

4 Π Ε0 JH-r1,x + r2,xL2 + I-r1,y + r2,yM2+ H-r1,z + r2,zL2N32 ,

q1 q2 I-r1,y + r2,yM4 Π Ε0 JH-r1,x + r2,xL2 + I-r1,y + r2,yM2

+ H-r1,z + r2,zL2N32 ,q1 q2 H-r1,z + r2,zL

4 Π Ε0 JH-r1,x + r2,xL2 + I-r1,y + r2,yM2+ H-r1,z + r2,zL2N32 =

Out[58]= True

In[59]:= Fmag@i_D@j_D := qi v@iDB@jD@r@iDD Simplify

Fmag@1D@2DFmag@2D@1DSimplify@% + %%D === 80, 0, 0<

Newton, Lagrange, Hamilton and Hamilton-Jacobi Mechanics of Classical Particles with Mathematica.nb 14

Page 15: Newton, Lagrange, Hamilton and Hamilton-Jacobi …o.castera.free.fr/zip/Newton, Lagrange, Hamilton and Hamilton... · Ł Separability of the HJE for a particle attracted to two fixed

Out[60]= 9Iq1 q2 Μo Ir1,y v1,y v2,x - r2,y v1,y v2,x + r1,z v1,z v2,x -

r2,z v1,z v2,x - r1,x v1,y v2,y + r2,x v1,y v2,y - r1,x v1,z v2,z + r2,x v1,z v2,zMM 4 Π JHr1,x - r2,xL2 + Ir1,y - r2,yM2

+ Hr1,z - r2,zL2N32,Iq1 q2 Μo IHr1,x v1,x - r2,x v1,x + Hr1,z - r2,zL v1,zL v2,y -

r1,y Hv1,x v2,x + v1,z v2,zL + r2,y Hv1,x v2,x + v1,z v2,zLMM 4 Π JHr1,x - r2,xL2 + Ir1,y - r2,yM2

+ Hr1,z - r2,zL2N32,Iq1 q2 Μo I-r1,z Iv1,x v2,x + v1,y v2,yM + r2,z Iv1,x v2,x + v1,y v2,yM +Ir1,x v1,x - r2,x v1,x + Ir1,y - r2,yM v1,yM v2,zMM

4 Π JHr1,x - r2,xL2 + Ir1,y - r2,yM2+ Hr1,z - r2,zL2N32 =

Out[61]= 9Iq1 q2 Μo I-r1,y v1,x v2,y + r2,y v1,x v2,y + r1,x v1,y v2,y -

r2,x v1,y v2,y - r1,z v1,x v2,z + r2,z v1,x v2,z + r1,x v1,z v2,z - r2,x v1,z v2,zMM 4 Π JHr1,x - r2,xL2 + Ir1,y - r2,yM2

+ Hr1,z - r2,zL2N32,Iq1 q2 Μo Iv1,y H-r1,x v2,x + r2,x v2,x + H-r1,z + r2,zL v2,zL +

r1,y Hv1,x v2,x + v1,z v2,zL - r2,y Hv1,x v2,x + v1,z v2,zLMM 4 Π JHr1,x - r2,xL2 + Ir1,y - r2,yM2

+ Hr1,z - r2,zL2N32,Iq1 q2 Μo Iv1,z I-r1,x v2,x + r2,x v2,x + I-r1,y + r2,yM v2,yM +

r1,z Iv1,x v2,x + v1,y v2,yM - r2,z Iv1,x v2,x + v1,y v2,yMMM 4 Π JHr1,x - r2,xL2 + Ir1,y - r2,yM2

+ Hr1,z - r2,zL2N32 =Out[62]= False

In[63]:= H* optional: random input data *Lr@1D = Table@Random@D, 83<D; r@2D = Table@Random@D, 83<D;v@1D = Table@Random@D, 83<D; v@2D = Table@Random@D, 83<D;q1 = 10 Random@D; q2 = 10 Random@D;

In[65]:= H* optional: "nice" input data *Lr@1D = 80, 0, 0<;r@2D = 81, 0, 0<;v@1D = 2 Π 81, 1, 0<;v@2D = 2 Π 81, -1 , 0<;q1 = 1; q2 = 1;

In[70]:= Μo = 1;9a = Fmag@1D@2D, Norm@aD=9b = Fmag@2D@1D, Norm@bD=Show@Graphics3D@8

Gray, Line@8r@1D, r@2D<D,8Blue, PointSize@ 0.02D, Point@r@1DD, Point@r@2DD<,Cyan, Line@8r@1D, r@1D + v@1D<D,Magenta, Line@8r@2D, r@2D + v@2D<D,Red, Line@8r@1D, r@1D + a<D,Green,

Newton, Lagrange, Hamilton and Hamilton-Jacobi Mechanics of Classical Particles with Mathematica.nb 15

Page 16: Newton, Lagrange, Hamilton and Hamilton-Jacobi …o.castera.free.fr/zip/Newton, Lagrange, Hamilton and Hamilton... · Ł Separability of the HJE for a particle attracted to two fixed

In[70]:=

Red, Line@8r@1D, r@1D + a<D,Green, Line@8r@2D, r@2D + b<D<D,

PlotRange ® All, Axes ® True, AxesLabel ® 8"x", "y", "z"<,AspectRatio ® Automatic, ViewPoint ® 81, 1, 2<,PlotLabel ®

"Two point charges with speed vectors\n and acting magnetic forces\n",

ImageSize ® medSizepicDOut[71]= 98-1, 1, 0<, 2 =Out[72]= 981, 1, 0<, 2 =

Out[73]=

Two point charges with speed vectors

and acting magnetic forces

0

2

4

x

-2

0

2

y

-1.0-0.50.0

0.51.0

z

Note: The magnetic forces between the two moving point charges are not colinear!

Newton, Lagrange, Hamilton and Hamilton-Jacobi Mechanics of Classical Particles with Mathematica.nb 16

Page 17: Newton, Lagrange, Hamilton and Hamilton-Jacobi …o.castera.free.fr/zip/Newton, Lagrange, Hamilton and Hamilton... · Ł Separability of the HJE for a particle attracted to two fixed

II) Lagrange mechanics for classical particles

Die Lagrange-Mechanik eignet sich besser zum Übergang zur relativistischen Physik und zur Feldtheorie. Der

Hamilton- Formalismus eignet sich besser zum Übergang zur Quantenmechanik und zur statistischen Physik.

Carsten Timm

Variational calculus: Formal Euler equations

In[74]:= Remove@"Global`*"Da)

In[75]:= Print@"Functional: ", F = Φ@y@xD, y'@xD, xDDPrintBà

A

B

F âx "Extremum !"FPrint@"Functional derivative:"DVariationalD@F, y@xD, xDPrint@"Euler equation:"DEulerEquations@F, y@xD, xD% TraditionalForm

Functional: Φ@y@xD, y¢@xD, xDàA

B

Φ@y@xD, y¢@xD, xD âx Extremum !

Functional derivative:

Out[78]= -ΦH0,1,1L@y@xD, y¢@xD, xD - y¢¢@xD ΦH0,2,0L@y@xD, y¢@xD, xD +

ΦH1,0,0L@y@xD, y¢@xD, xD - y¢@xD ΦH1,1,0L@y@xD, y¢@xD, xDEuler equation:

Out[80]= -ΦH0,1,1L@y@xD, y¢@xD, xD - y¢¢@xD ΦH0,2,0L@y@xD, y¢@xD, xD +

ΦH1,0,0L@y@xD, y¢@xD, xD - y¢@xD ΦH1,1,0L@y@xD, y¢@xD, xD 0

Out[81]//TraditionalForm=

-ΦH0,1,1LHyHxL, y¢HxL, xL + ΦH1,0,0LHyHxL, y¢HxL, xL - y¢HxL ΦH1,1,0LHyHxL, y¢HxL, xL - y¢¢HxL ΦH0,2,0LHyHxL, y¢HxL, xL 0

b)

In[82]:= Print@"Functional: ", F = Φ@y@xD, y'@xD, y''@xD, xDDPrintBà

A

B

F âx "Extremum !"FPrint@"Euler equation:"DEulerEquations@F, y@xD, xD FullSimplify;

Collect@%, 8y'@xD, y''@xD<D TraditionalForm

Functional: Φ@y@xD, y¢@xD, y¢¢@xD, xDàA

B

Φ@y@xD, y¢@xD, y¢¢@xD, xD âx Extremum !

Newton, Lagrange, Hamilton and Hamilton-Jacobi Mechanics of Classical Particles with Mathematica.nb 17

Page 18: Newton, Lagrange, Hamilton and Hamilton-Jacobi …o.castera.free.fr/zip/Newton, Lagrange, Hamilton and Hamilton... · Ł Separability of the HJE for a particle attracted to two fixed

Euler equation:

Out[86]//TraditionalForm=

y¢HxL2 ΦH2,0,1,0LHyHxL, y¢HxL, y¢¢HxL, xL + ΦH0,0,1,2LHyHxL, y¢HxL, y¢¢HxL, xL +

y¢¢HxL2 ΦH0,2,1,0LHyHxL, y¢HxL, y¢¢HxL, xL + ΦH1,0,0,0LHyHxL, y¢HxL, y¢¢HxL, xL +

y¢HxL I2 ΦH1,0,1,1LHyHxL, y¢HxL, y¢¢HxL, xL - ΦH1,1,0,0LHyHxL, y¢HxL, y¢¢HxL, xL + 2 y¢¢HxL ΦH1,1,1,0LHyHxL, y¢HxL, y¢¢HxL, xL +

2 yH3LHxL ΦH1,0,2,0LHyHxL, y¢HxL, y¢¢HxL, xLM + yH4LHxL ΦH0,0,2,0LHyHxL, y¢HxL, y¢¢HxL, xL +

2 yH3LHxL ΦH0,0,2,1LHyHxL, y¢HxL, y¢¢HxL, xL + yH3LHxL2ΦH0,0,3,0LHyHxL, y¢HxL, y¢¢HxL, xL +

y¢¢HxL I2 ΦH0,1,1,1LHyHxL, y¢HxL, y¢¢HxL, xL - ΦH0,2,0,0LHyHxL, y¢HxL, y¢¢HxL, xL +

ΦH1,0,1,0LHyHxL, y¢HxL, y¢¢HxL, xL + 2 yH3LHxL ΦH0,1,2,0LHyHxL, y¢HxL, y¢¢HxL, xLM ΦH0,1,0,1LHyHxL, y¢HxL, y¢¢HxL, xLc)

In[87]:= Print@"Functional: ", F = Φ@u@xD, v@xD, u'@xD, v'@xD, xDDPrintBà

A

B

F âx "Extremum !"FPrint@"Euler equations:"DEulerEquations@F, 8u@xD, v@xD<, xD TableForm

Functional: Φ@u@xD, v@xD, u¢@xD, v¢@xD, xDàA

B

Φ@u@xD, v@xD, u¢@xD, v¢@xD, xD âx Extremum !

Euler equations:

Out[90]//TableForm=

-ΦH0,0,1,0,1L@u@xD, v@xD, u¢@xD, v¢@xD, xD - v¢¢@xD ΦH0,0,1,1,0L@u@xD, v@xD, u¢@xD, v¢@xD, xD - u¢¢@-ΦH0,0,0,1,1L@u@xD, v@xD, u¢@xD, v¢@xD, xD - v¢¢@xD ΦH0,0,0,2,0L@u@xD, v@xD, u¢@xD, v¢@xD, xD - u¢¢@

d)

In[91]:= PrintA"Functional: ", F = ΦAu@x, yD, ¶xu@x, yD, ¶yu@x, yD, x, yEEPrintB"à

A

B

", F, " âx ây Extremum !"FPrint@"Euler equation:"DEulerEquations@F, u@x, yD, 8x, y<D

Functional: ΦAu@x, yD, uH1,0L@x, yD, uH0,1L@x, yD, x, yEàA

B

ΦAu@x, yD, uH1,0L@x, yD, uH0,1L@x, yD, x, yE âx ây Extremum !

Euler equation:

Out[94]= -ΦH0,0,1,0,1LAu@x, yD, uH1,0L@x, yD, uH0,1L@x, yD, x, yE -

uH0,2L@x, yD ΦH0,0,2,0,0LAu@x, yD, uH1,0L@x, yD, uH0,1L@x, yD, x, yE -

ΦH0,1,0,1,0LAu@x, yD, uH1,0L@x, yD, uH0,1L@x, yD, x, yE -

2 uH1,1L@x, yD ΦH0,1,1,0,0LAu@x, yD, uH1,0L@x, yD, uH0,1L@x, yD, x, yE -

uH2,0L@x, yD ΦH0,2,0,0,0LAu@x, yD, uH1,0L@x, yD, uH0,1L@x, yD, x, yE +

ΦH1,0,0,0,0LAu@x, yD, uH1,0L@x, yD, uH0,1L@x, yD, x, yE -

uH0,1L@x, yD ΦH1,0,1,0,0LAu@x, yD, uH1,0L@x, yD, uH0,1L@x, yD, x, yE -

uH1,0L@x, yD ΦH1,1,0,0,0LAu@x, yD, uH1,0L@x, yD, uH0,1L@x, yD, x, yE 0

e)

Newton, Lagrange, Hamilton and Hamilton-Jacobi Mechanics of Classical Particles with Mathematica.nb 18

Page 19: Newton, Lagrange, Hamilton and Hamilton-Jacobi …o.castera.free.fr/zip/Newton, Lagrange, Hamilton and Hamilton... · Ł Separability of the HJE for a particle attracted to two fixed

e)

In[95]:= Print@"Functional: ", F = Φ@u@x, yD, v@x, yD, x, yDDPrintB"à

A

B

", F, " âx ây Extremum !"FPrint@"Euler equations:"DEulerEquations@F, 8u@x, yD, v@x, yD<, 8x, y<D TableForm

Functional: Φ@u@x, yD, v@x, yD, x, yDàA

B

Φ@u@x, yD, v@x, yD, x, yD âx ây Extremum !

Euler equations:

Out[98]//TableForm=

ΦH1,0,0,0L@u@x, yD, v@x, yD, x, yD 0

ΦH0,1,0,0L@u@x, yD, v@x, yD, x, yD 0

f)

In[99]:= PrintA"Functional: ", F = ΦAu@x, yD, v@x, yD, ¶xu@x, yD, ¶yv@x, yD, x, yEEPrintB"à

A

B

", F, " âx ây Extremum !"FPrint@"Euler equations:"DEulerEquations@F, 8u@x, yD, v@x, yD<, 8x, y<D TableForm

Functional: ΦAu@x, yD, v@x, yD, uH1,0L@x, yD, vH0,1L@x, yD, x, yEàA

B

ΦAu@x, yD, v@x, yD, uH1,0L@x, yD, vH0,1L@x, yD, x, yE âx ây Extremum !

Euler equations:

Out[102]//TableForm=

-ΦH0,0,1,0,1,0LAu@x, yD, v@x, yD, uH1,0L@x, yD, vH0,1L@x, yD, x, yE - vH1,1L@x, yD ΦH0,0,1,1,0,0LAu@x-ΦH0,0,0,1,0,1LAu@x, yD, v@x, yD, uH1,0L@x, yD, vH0,1L@x, yD, x, yE - vH0,2L@x, yD ΦH0,0,0,2,0,0LAu@x

Variational calculus: Shortest path between (a, A, z) and (b, B, z) on the plane z = 0 analytical (geodetic)

In[103]:=

Remove@"Global`*"DIn[104]:=

Dt@sD SimplifyBDt@xD Dt@xD-2 IDt@xD2 + Dt@y@xDD2M FEulerEquations@Φ@y'@xD, xD, y@xD, xDEulerEquations@%%@@2DD Dt@xD, y@xD, xD Simplify

Collect@ð, xD & DSolve@8%, y@aD A, y@bD B<, y@xD, xDOut[104]=

Dt@sD Dt@xD 1 + y¢@xD2

Out[105]=

-ΦH1,1L@y¢@xD, xD - y¢¢@xD ΦH2,0L@y¢@xD, xD 0

Newton, Lagrange, Hamilton and Hamilton-Jacobi Mechanics of Classical Particles with Mathematica.nb 19

Page 20: Newton, Lagrange, Hamilton and Hamilton-Jacobi …o.castera.free.fr/zip/Newton, Lagrange, Hamilton and Hamilton... · Ł Separability of the HJE for a particle attracted to two fixed

Out[106]=

y¢¢@xD1 + y¢@xD2

0

Out[107]=99y@xD ®-A b + a B

a - b+

HA - BL x

a - b==

The geodetic on a plane is of course a straight segment!

Variational calculus: Shortest path between (a, A, z) and (b, B, z) on a surface z = x2 + y analytical (geodetic)

In[108]:=

Remove@"Global`*"DIn[109]:=

z@x_, y_D := x2 + y

Dt@sD SimplifyBDt@xD Dt@xD-2 IDt@xD2 + Dt@y@xDD2 + Dt@z@x, y@xDDD2M FEulerEquations@%@@2DD Dt@xD, y@xD, xD Simplify

eq = Numerator@%@@1DDD 0

DSolve@8eq, y@aD A, y@bD B<, y@xD, xD Simplify

y@x_D = %@@1, 1, 2DD . 8a ® 1, A ® 2, b ® 2, B ® 4<Out[110]=

Dt@sD Dt@xD 1 + 4 x2 + 4 x y¢@xD + 2 y¢@xD2

Out[111]=

1 - 2 x y¢@xD + I1 + 2 x2M y¢¢@xD1 + 4 x2 + 4 x y¢@xD + 2 y¢@xD2

0

Out[112]=

1 - 2 x y¢@xD + I1 + 2 x2M y¢¢@xD 0

Out[113]=99y@xD ®

2 a 1 + 2 a2 b2 - 2 a2 b 1 + 2 b2 - 4 A b 1 + 2 b2 + 4 a 1 + 2 a2 B - 2 a 1 + 2 a2 x2 +

2 b 1 + 2 b2 x2 + 2 a2 x 1 + 2 x2 + 4 A x 1 + 2 x2 - 2 b2 x 1 + 2 x2 - 4 B x 1 + 2 x2 +

2 Ib2 + 2 B - x2M ArcSinhA 2 aE - 2 Ia2 + 2 A - x2M ArcSinhA 2 bE +

2 a2 ArcSinhA 2 xE + 2 2 A ArcSinhA 2 xE -

2 b2 ArcSinhA 2 xE - 2 2 B ArcSinhA 2 xE 4 a 1 + 2 a2 - 4 b 1 + 2 b2 + 2 2 ArcSinhA 2 aE - 2 2 ArcSinhA 2 bE ==

Newton, Lagrange, Hamilton and Hamilton-Jacobi Mechanics of Classical Particles with Mathematica.nb 20

Page 21: Newton, Lagrange, Hamilton and Hamilton-Jacobi …o.castera.free.fr/zip/Newton, Lagrange, Hamilton and Hamilton... · Ł Separability of the HJE for a particle attracted to two fixed

Out[114]=

-60 + 24 3 + 12 x2 - 2 3 x2 - 14 x 1 + 2 x2 +

2 I12 - x2M ArcSinhA 2 E - 2 I5 - x2M ArcSinhA2 2 E - 7 2 ArcSinhA 2 xE J-24 + 4 3 + 2 2 ArcSinhA 2 E - 2 2 ArcSinhA2 2 ENIn[115]:=

Print@"A geodesic on the choosen surface with its projection on the x-y-plane:"DParametricPlot3DA9x, y@xD, z@x, y@xDD + 10-2=, 8x, 0, 1<, DisplayFunction ® IdentityE;Plot3D@z@x, yD, 8x, -1, 1<, 8y, -1, 1<, Mesh ® False, DisplayFunction ® IdentityD;ParametricPlot3D@8x, y@xD, 0<, 8x, 0, 1<, DisplayFunction ® IdentityD;Show @Graphics3D@EdgeForm@D, Axes ® True,

AxesLabel ® 8"X", "Y", "Z"<, ViewPoint -> 81, 2, 5<D, %, %%,

%%%, DisplayFunction ® $DisplayFunction, ImageSize ® minSizepicDA geodesic on the choosen surface with its projection on the x-y-plane:

Out[119]=

-1.0-0.5

0.00.5

1.0

X -1

0

1

2

Y

-1

0

1

2

3

Z

Variational calculus: Shortest path between (a, A, z) and (b, B, z) on a surface z = Sin[4 x] + y/3 analytical (geodetic)

In[120]:=

Remove@"Global`*"D

Newton, Lagrange, Hamilton and Hamilton-Jacobi Mechanics of Classical Particles with Mathematica.nb 21

Page 22: Newton, Lagrange, Hamilton and Hamilton-Jacobi …o.castera.free.fr/zip/Newton, Lagrange, Hamilton and Hamilton... · Ł Separability of the HJE for a particle attracted to two fixed

In[121]:=

z@x_, y_D := Sin@4 xD + y 3

Dt@sD SimplifyBDt@xD Dt@xD-2 IDt@xD2 + Dt@y@xDD2 + Dt@z@x, y@xDDD2M FEulerEquations@%@@2DD Dt@xD, y@xD, xD Simplify

eq = Numerator@%@@1DDD 0

DSolve@8eq, y@aD A, y@bD B<, y@xD, xD Simplify

y@x_D = %@@1, 1, 2DD . 8a ® 1, A ® 2, b ® 2, B ® 4<Out[122]=

Dt@sD 1

3Dt@xD 81 + 72 Cos@8 xD + 24 Cos@4 xD y¢@xD + 10 y¢@xD2

Out[123]=

-24 Sin@4 xD + 144 Sin@8 xD y¢@xD + H41 + 36 Cos@8 xDL y¢¢@xD81 + 72 Cos@8 xD + 24 Cos@4 xD y¢@xD + 10 y¢@xD2

0

Out[124]=

-24 Sin@4 xD + 144 Sin@8 xD y¢@xD + H41 + 36 Cos@8 xDL y¢¢@xD 0

Out[125]=99y@xD ® EllipticEA4 x, 72

77E H10 A - 10 B + 3 Sin@4 aD - 3 Sin@4 bDL +

EllipticEA4 a, 72

77E H10 B + 3 Sin@4 bD - 3 Sin@4 xDL +

EllipticEA4 b, 72

77E H-10 A - 3 Sin@4 aD + 3 Sin@4 xDL

10 EllipticEA4 a, 72

77E - EllipticEA4 b, 72

77E ==

Out[126]=

EllipticEA4 x, 72

77E H-20 + 3 Sin@4D - 3 Sin@8DL + EllipticEA4, 72

77E

H40 + 3 Sin@8D - 3 Sin@4 xDL + EllipticEA8, 72

77E H-20 - 3 Sin@4D + 3 Sin@4 xDL

10 EllipticEA4, 72

77E - EllipticEA8, 72

77E

Newton, Lagrange, Hamilton and Hamilton-Jacobi Mechanics of Classical Particles with Mathematica.nb 22

Page 23: Newton, Lagrange, Hamilton and Hamilton-Jacobi …o.castera.free.fr/zip/Newton, Lagrange, Hamilton and Hamilton... · Ł Separability of the HJE for a particle attracted to two fixed

In[127]:=

Print@"A geodesic on the choosen surface with its projection on the x-y-plane:"DParametricPlot3DA9x, y@xD, z@x, y@xDD + 10-2=, 8x, 0, 1<, DisplayFunction ® IdentityE;Plot3D@z@x, yD, 8x, -1, 1<, 8y, -1, 1<, Mesh ® False, DisplayFunction ® IdentityD;ParametricPlot3D@8x, y@xD, 0<, 8x, 0, 1<, DisplayFunction ® IdentityD;Show @Graphics3D@EdgeForm@D, Axes ® True,

AxesLabel ® 8"X", "Y", "Z"<, ViewPoint -> 81, -2, 2<D, %, %%,

%%%, DisplayFunction ® $DisplayFunction, ImageSize ® minSizepicDA geodesic on the choosen surface with its projection on the x-y-plane:

Out[131]=

-1.0-0.5

0.00.5

1.0X

-1

0

1

2

Y

-1

0

1

Z

Variational calculus: Shortest path between (a, A, z) and (b, B, z) on a surface z = x2 + y2 numerical (geodetic)

In[132]:=

Remove@"Global`*"DIn[133]:=

z@x_, y_D := x2 + y2

Dt@sD SimplifyBDt@xD Dt@xD-2 IDt@xD2 + Dt@y@xDD2 + Dt@z@x, y@xDDD2M FEulerEquations@%@@2DD Dt@xD, y@xD, xD FullSimplify

eq = Numerator@%@@1DDD 0

DSolve@8eq, y@aD A, y@bD B<, y@xD, xDNDSolve@8eq, y@0D 1 3, y'@0D 1 5<, y@xD, 8x, 0, 1<D;y@x_D = %@@1, 1, 2DD

Out[134]=

Dt@sD Dt@xD 1 + 4 x2 + 8 x y@xD y¢@xD + y¢@xD2 + 4 y@xD2 y¢@xD2

Out[135]=

4 Hy@xD - x y¢@xDL I1 + y¢@xD2M + I1 + 4 x2 + 4 y@xD2M y¢¢@xD1 + 4 x2 + 8 x y@xD y¢@xD + I1 + 4 y@xD2M y¢@xD2

0

Out[136]=

4 Hy@xD - x y¢@xDL I1 + y¢@xD2M + I1 + 4 x2 + 4 y@xD2M y¢¢@xD 0

Newton, Lagrange, Hamilton and Hamilton-Jacobi Mechanics of Classical Particles with Mathematica.nb 23

Page 24: Newton, Lagrange, Hamilton and Hamilton-Jacobi …o.castera.free.fr/zip/Newton, Lagrange, Hamilton and Hamilton... · Ł Separability of the HJE for a particle attracted to two fixed

Out[137]=

DSolveA94 Hy@xD - x y¢@xDL I1 + y¢@xD2M + I1 + 4 x2 + 4 y@xD2M y¢¢@xD 0, y@aD A, y@bD B=,y@xD, xE

Out[139]=

InterpolatingFunction@880., 1.<<, <>D@xDIn[140]:=

Print@"A geodesic on the choosen surface with its projection on the x-y-plane:"DParametricPlot3DA9x, y@xD, z@x, y@xDD + 10-2=, 8x, 0, 1<, DisplayFunction ® IdentityE;Plot3D@z@x, yD, 8x, -1, 1<, 8y, -1, 1<, Mesh ® False, DisplayFunction ® IdentityD;ParametricPlot3D@8x, y@xD, 0<, 8x, 0, 1<, DisplayFunction ® IdentityD;Show @Graphics3D@EdgeForm@D, Axes ® True,

AxesLabel ® 8"X", "Y", "Z"<, ViewPoint -> 8-1, 3, 3<D, %, %%,

%%%, DisplayFunction ® $DisplayFunction, ImageSize ® minSizepicDA geodesic on the choosen surface with its projection on the x-y-plane:

Out[144]=

-1.0-0.5

0.00.5

1.0

X

-1.0

-0.5

0.0

0.5

1.0

Y

0.0

0.5

1.0

1.5

2.0

Z

Variational calculus: Minimal area of a surface of revolution generated by rotating the graph of a function in the x-y plane about the y axis (catenary) (see Goldstein&Poole&Safko p.40)

In[145]:=

Remove@"Global`*"DIn[146]:=

2 Π x Dt@sD% . Dt@sD ® SimplifyB Dt@xD2 + Dt@y@xDD2 , Dt@xD > 0F% Dt@xD;PrintB"Area of a surface of revolution: ", à

x1

x2% âxF

EulerEquations@%%, y@xD, xD FullSimplify

eq = Numerator@%@@1DDD 0

DSolve@8eq H*,y@aDA,y@bDB*L<, y@xD, xD% . 9ãC@1D ® c, ã2 C@1D ® c2, C@2D ® d=

Out[146]=

2 Π x Dt@sD

Newton, Lagrange, Hamilton and Hamilton-Jacobi Mechanics of Classical Particles with Mathematica.nb 24

Page 25: Newton, Lagrange, Hamilton and Hamilton-Jacobi …o.castera.free.fr/zip/Newton, Lagrange, Hamilton and Hamilton... · Ł Separability of the HJE for a particle attracted to two fixed

Out[147]=

2 Π x Dt@xD 1 + y¢@xD2

Area of a surface of revolution: àx1

x22 Π x 1 + y¢@xD2 âx

Out[150]=

y¢@xD + y¢@xD3 + x y¢¢@xD1 + y¢@xD2

0

Out[151]=

y¢@xD + y¢@xD3 + x y¢¢@xD 0

Out[152]=99y@xD ® -ä ãC@1D ArcTanA x

ã2 C@1D - x2E + C@2D=,

9y@xD ® ä ãC@1D ArcTanA x

ã2 C@1D - x2E + C@2D==

Out[153]=99y@xD ® d - ä c ArcTanA x

c2 - x2E=, 9y@xD ® d + ä c ArcTanA x

c2 - x2E==

Let's change from ArcTan to ArcCosh to meet the result in Goldstein&Poole&Safko.

In[154]:=

A = d - ä c ArcTanB x

c2 - x2

F;% TrigToExp

Out[155]=

d +1

2c LogA1 -

ä x

c2 - x2E -

1

2c LogA1 +

ä x

c2 - x2E

In[156]:=

d +1

2c LogBSimplifyB 1 -

ä x

c2 - x2

1 +ä x

c2 - x2

FFOut[156]=

d +1

2c LogA -ä x + c2 - x2

ä x + c2 - x2E

In[157]:=

d +1

2c LogB -ä ä x + ä ä Ic2 - x2M

ä ä x + ä ä Ic2 - x2M FOut[157]=

d +1

2c LogA x + -c2 + x2

-x + -c2 + x2E

Newton, Lagrange, Hamilton and Hamilton-Jacobi Mechanics of Classical Particles with Mathematica.nb 25

Page 26: Newton, Lagrange, Hamilton and Hamilton-Jacobi …o.castera.free.fr/zip/Newton, Lagrange, Hamilton and Hamilton... · Ł Separability of the HJE for a particle attracted to two fixed

In[158]:=

d +1

2c LogB x c + SimplifyAI-c2 + x2M c2E

-x c + SimplifyAI-c2 + x2M c2E FOut[158]=

d +1

2c LogA x

c+ -1 +

x2

c2

-x

c+ -1 +

x2

c2

EIn[159]:=

AA = d +1

2c LogBApartB

x

c+ -1 +

x2

c2

-x

c+ -1 +

x2

c2

FF

Out[159]=

d +1

2c LogA1 -

2 x2

c2-

2 x -1 +x2

c2

cE

In[160]:=

B = d -ä c Π

2+ c ArcCoshB x

cF;

% TrigToExp

Out[161]=

d -ä c Π

2+ c LogAx

c+ -1 +

x

c1 +

x

cE

In[162]:=

d -ä c Π

2+ c LogB x

c+ ExpandB -1 +

x

c1 +

x

cF F

Out[162]=

d -ä c Π

2+ c LogAx

c+ -1 +

x2

c2E

In[163]:=

d -ä c Π

2+ c 2 LogBExpandB x

c+ -1 +

x2

c2

2

FFOut[163]=

d -ä c Π

2+1

2c LogA-1 +

2 x2

c2+

2 x -1 +x2

c2

cE

Newton, Lagrange, Hamilton and Hamilton-Jacobi Mechanics of Classical Particles with Mathematica.nb 26

Page 27: Newton, Lagrange, Hamilton and Hamilton-Jacobi …o.castera.free.fr/zip/Newton, Lagrange, Hamilton and Hamilton... · Ł Separability of the HJE for a particle attracted to two fixed

In[164]:=

d -ä c Π

2+1

2c LogB-1 -1 +

2 x2

c2+

2 x -1 +x2

c2

cF + Log@-1D

Out[164]=

d -ä c Π

2+1

2c ä Π + LogA1 -

2 x2

c2-

2 x -1 +x2

c2

cE

In[165]:=

BB = d -ä c Π

2+1

2c ä Π + LogB1 -

2 x2

c2-

2 x -1 +x2

c2

cF Expand

Out[165]=

d +1

2c LogA1 -

2 x2

c2-

2 x -1 +x2

c2

cE

Let's check the results:

In[166]:=

A B

AA BB

Out[166]=

d - ä c ArcTanA x

c2 - x2E d -

ä c Π

2+ c ArcCoshA x

cE

Out[167]=

True

A numerical test with a little surprise:

In[168]:=

t := 8A, B, AA, BB< . data TableForm;

Print@"TEST with random input: ",

data = 8x ® Random@RealD, d ® Random@D, c ® Random@D<, "\n", tDPrint@"Branch cut effect? ", data = 8x ® 0.7, d ® 0.4, c ® 0.3<, "\n", tDTEST with random input: 8x ® 0.745379, d ® 0.0259364, c ® 0.517567<-0.443423 + 0.812992 ä

0.495296 - 0.812992 ä

0.495296 + 0.812992 ä

0.495296 + 0.812992 ä

Branch cut effect? 8x ® 0.7, d ® 0.4, c ® 0.3<-0.0472989 + 0.471239 ä

0.847299 - 0.471239 ä

0.847299 + 0.471239 ä

0.847299 + 0.471239 ä

We get finally the result from Goldstein&Poole&Safko:

Newton, Lagrange, Hamilton and Hamilton-Jacobi Mechanics of Classical Particles with Mathematica.nb 27

Page 28: Newton, Lagrange, Hamilton and Hamilton-Jacobi …o.castera.free.fr/zip/Newton, Lagrange, Hamilton and Hamilton... · Ł Separability of the HJE for a particle attracted to two fixed

We get finally the result from Goldstein&Poole&Safko:

In[171]:=

y@x_D = B . d -ä c Π

2® b . c ® a

Plot@ArcCosh@xD, 8x, 1, 10<, PlotRange ® 880, 9<, 80, 3<<,AxesLabel ® 8x, ArcCosh@xD<, GridLines ® 8Range@10D, Range@5D<,AspectRatio ® Automatic, ImageSize ® medSizepicD

Out[171]=

b + a ArcCoshA xa

EOut[172]=

0 2 4 6 8x0.0

0.5

1.0

1.5

2.0

2.5

3.0cosh-1HxL

An example comparing the catenary solution with a segment solution (cone):

In[173]:=

y@x_D = b + a ArcCoshB xa

Fx1 = 1.1; y1 = 2.5;

x2 = 5.1; y2 = 4.5;8y@x1D == y1, y@x2D == y2<FindRoot@%, 8a, 1<, 8b, 1<D Chop

y@x_D = y@xD . %

ycone@x_D =x Hy1 - y2Lx1 - x2

+-x2 y1 + x1 y2

x1 - x2Plot@8y@xD, ycone@xD<, 8x, 1, 10<, PlotRange ® 880 x1, x2<, 8y1, y2<<,AxesLabel ® 8x, y<, AspectRatio ® Automatic, ImageSize ® medSizepicD

àx1

x22 Π x 1 + ycone

¢@xD2 âx;

àx1

x22 Π x 1 + y¢@xD2 âx;

:%%, "TEST:", Π Hx2 - x1L2 + Hy2 - y1L2 Hx1 + x2L, %, H%% - %L % 100 "%">Out[173]=

b + a ArcCoshA xa

EOut[176]=9b + a ArcCoshA1.1

aE 2.5, b + a ArcCoshA 5.1

aE 4.5=

Out[177]=8a ® 1.03698, b ® 2.14028<

Newton, Lagrange, Hamilton and Hamilton-Jacobi Mechanics of Classical Particles with Mathematica.nb 28

Page 29: Newton, Lagrange, Hamilton and Hamilton-Jacobi …o.castera.free.fr/zip/Newton, Lagrange, Hamilton and Hamilton... · Ł Separability of the HJE for a particle attracted to two fixed

Out[178]=

2.14028 + 1.03698 [email protected] xDOut[179]=

1.95 + 0.5 x

Out[180]=

0 1 2 3 4 5x2.5

3.0

3.5

4.0

4.5y

Out[183]=887.1077, TEST:, 87.1077, 85.2532, 2.17528 %<The area of the surface of revolution from the catenery solution (ca. 85) is indeed smaller as the area obtained from a

segment (ca. 87) by about 2% !

In[184]:=

<< Graphics`SurfaceOfRevolution`

SurfaceOfRevolution@-y@xD, 8x, 0, 2 Pi<, AxesLabel ® 8x, y, -z<,PlotRange ® 88-x2, x2<, 8-x2, x2<, Automatic<, ImageSize ® medSizepicD

Out[185]=

-5

0

5

x

-5

0

5

y

-4

-3-z

Variational calculus: Brachystochrone problem from point (a, A) to point (b, B) (cycloid) (seeGoldstein&Poole&Safko p.42)

In[186]:=

Remove@"Global`*"DIn[187]:=

Dt@sD v Dt@tDDt@tD == Dt@sD v

Newton, Lagrange, Hamilton and Hamilton-Jacobi Mechanics of Classical Particles with Mathematica.nb 29

Page 30: Newton, Lagrange, Hamilton and Hamilton-Jacobi …o.castera.free.fr/zip/Newton, Lagrange, Hamilton and Hamilton... · Ł Separability of the HJE for a particle attracted to two fixed

SolveB12m v2 m g HA - y@xDL, vF

%@@2, 1DD Simplify

%%% . %

SimplifyB% . Dt@sD ® Dt@xD2 + Dt@y@xDD2 , Dt@xD > 0F%@@2DD Dt@xDPrintBt HoldFormBà

0

t

âtF == àx0

xt% âx "min!"F

EulerEquations@%%, y@xD, xDPrint@"Euler equation:"Deq = Numerator@%%@@1DDD J 2 gN 0

Out[187]=

Dt@sD v Dt@tDOut[188]=

Dt@tD Dt@sDv

Out[189]=99v ® - 2 A g - g y@xD =, 9v ® 2 A g - g y@xD ==Out[190]=

v ® 2 g HA - y@xDLOut[191]=

Dt@tD Dt@sD

2 g HA - y@xDLOut[192]=

Dt@tD Dt@xD 1 + y¢@xD2

2 g HA - y@xDLOut[193]=

1 + y¢@xD2

2 g HA - y@xDLt à

0

t

1 ât àx0

xt 1 + y¢@xD2

2 g HA - y@xDL âx min!

Out[195]=

g I1 + y¢@xD2 - 2 HA - y@xDL y¢¢@xDM2 2 Hg HA - y@xDLL32 I1 + y¢@xD2M32 0

Euler equation:

Out[197]=

1 + y¢@xD2 - 2 HA - y@xDL y¢¢@xD 0

This Euler equation seems to be too hard for DSolve[]...

Newton, Lagrange, Hamilton and Hamilton-Jacobi Mechanics of Classical Particles with Mathematica.nb 30

Page 31: Newton, Lagrange, Hamilton and Hamilton-Jacobi …o.castera.free.fr/zip/Newton, Lagrange, Hamilton and Hamilton... · Ł Separability of the HJE for a particle attracted to two fixed

In[198]:=

DSolve@8eq , y@aD A, y@bD B<, y@xD, xD Short

Out[198]//Short=

99y@xD ® InverseFunctionA--ã2 C@1D Log@1D -2 A + ã2 1 + 2 ð1 + 1

2 -A + ð1 --2 A+1+2 ð1

-A+ð1

&EAx +

1

2 1 1 1E=, 8y@xD ® 1<=

...but "Ist egal!", because everybody knows that the solutions are cycloids:

In[199]:=

xc@t_D := 1 Ht - Sin@tDLyc@t_D := -1 H1 - Cos@tDL8xc@tD, yc@tD, yc'@tD xc'@tD<Limit@%, t ® 0D%% . t ® 1 5

de = % N

ParametricPlot@8xc@tD, yc@tD<, 8t, 0, 4 Π<,AspectRatio ® Automatic, ImageSize ® medSizepicD

Out[201]=9t - Sin@tD, -1 + Cos@tD, -Sin@tD

1 - Cos@tD =Out[202]=80, 0, -¥<Out[203]=

915

- SinA15

E, -1 + CosA15

E, -SinA 1

5E

1 - CosA 1

5E =

Out[204]=80.00133067, -0.0199334, -9.96664<Out[205]=

2 4 6 8 10 12

-2.0-1.5-1.0-0.5

Let's retrieve this particular solution numerically:

In[206]:=

Block@8a = 0, A = 0, x0 = 0.00133, y0 = -0.0199, Dy0 = -9.97, c<,c = 8x0, y0, Dy0<;Print@cD;Print@Hc - deL de 1000 "000"D;sol = NDSolve@8eq, y@x0D y0, y'@x0D Dy0<, y@xD, 8x, x0, 6.27<D@@1, 1, 2DD;Print@solD;Plot@sol, 8x, x0, 6.27<, AspectRatio ® Automatic, ImageSize ® medSizepicDD

Print@"TEST"Dxc@ΠD N

Newton, Lagrange, Hamilton and Hamilton-Jacobi Mechanics of Classical Particles with Mathematica.nb 31

Page 32: Newton, Lagrange, Hamilton and Hamilton-Jacobi …o.castera.free.fr/zip/Newton, Lagrange, Hamilton and Hamilton... · Ł Separability of the HJE for a particle attracted to two fixed

xc@ΠD N

yc@ΠD N

sol . x ® %%H% - %%L %% 1000 "000"80.00133, -0.0199, -9.97<8-0.502909 000, -1.67669 000, 0.336681 000<[email protected], 6.27<<, <>D@xD

Out[206]=

1 2 3 4 5 6

-2.0

-1.5

-1.0

-0.5

TEST

Out[208]=

3.14159

Out[209]=

-2.

Out[210]=

-1.99798

Out[211]=

-1.01204 000Pick up your favoured solution by the shooting method:

In[212]:=

nmax = 5;

Table@Block@8a = 0, A = 0, x0 = 0.001, y0 = -0.02 - n 0.05, Dy0 = -10, sol<,Print@8n, x0, y0, Dy0<D;sol = NDSolve@8eq, y@x0D y0, y'@x0D Dy0<, y@xD, 8x, x0, 6<D;pb0@nD = Plot@sol@@1, 1, 2DD,8x, x0, 6<, PlotStyle ® 8Red<, DisplayFunction ® IdentityD;D,8n, 0, nmax<D;

Table@Block@8a = 0, A = 0, x0 = 0.001, y0 = -0.02, Dy0 = -11 - n 5, sol<,Print@8n, x0, y0, Dy0<D;sol = NDSolve@8eq, y@x0D y0, y'@x0D Dy0<, y@xD, 8x, x0, 6<D;pb1@nD = Plot@sol@@1, 1, 2DD, 8x, x0, 6<,

PlotStyle ® 8Green<, DisplayFunction ® IdentityD;D,8n, 0, nmax<D;Show@Table@8pb0@nD, pb1@nD<, 8n, 0, nmax<D,DisplayFunction ® $DisplayFunction, PlotRange ® All, ImageSize ® medSizepicD80, 0.001, -0.02, -10<

81, 0.001, -0.07, -10<82, 0.001, -0.12, -10<83, 0.001, -0.17, -10<

Newton, Lagrange, Hamilton and Hamilton-Jacobi Mechanics of Classical Particles with Mathematica.nb 32

Page 33: Newton, Lagrange, Hamilton and Hamilton-Jacobi …o.castera.free.fr/zip/Newton, Lagrange, Hamilton and Hamilton... · Ł Separability of the HJE for a particle attracted to two fixed

84, 0.001, -0.22, -10<85, 0.001, -0.27, -10<80, 0.001, -0.02, -11<81, 0.001, -0.02, -16<82, 0.001, -0.02, -21<83, 0.001, -0.02, -26<84, 0.001, -0.02, -31<85, 0.001, -0.02, -36<

Out[215]=

1 2 3 4 5 6

-10

-8

-6

-4

-2

Appendix: An educated guess for the initial conditions of the Euler equation of the problem:

In[216]:=

eq

yS@x_D = A + b1 Hx - aL + b2 Hx - aL2

%% . y ® yS

Solve@%, b2D Simplify8x, yS@xD, yS'@xD< . %@@1, 1DD Simplify

% . 8a ® 0, A ® 0<Print@"Example:"D%% . 8x ® 0.00133067, b1 ® -17.6<Print@H% - deL de 100 "%"D;

Out[216]=

1 + y¢@xD2 - 2 HA - y@xDL y¢¢@xD 0

Out[217]=

A + b1 H-a + xL + b2 H-a + xL2

Out[218]=

1 + Hb1 + 2 b2 H-a + xLL2 - 4 b2 I-b1 H-a + xL - b2 H-a + xL2M 0

Newton, Lagrange, Hamilton and Hamilton-Jacobi Mechanics of Classical Particles with Mathematica.nb 33

Page 34: Newton, Lagrange, Hamilton and Hamilton-Jacobi …o.castera.free.fr/zip/Newton, Lagrange, Hamilton and Hamilton... · Ł Separability of the HJE for a particle attracted to two fixed

Out[219]=

99b2 ® -

-2 a b1 + 2 I-1 + b12M Ha - xL2 + 2 b1 x

4 Ha - xL2=,

9b2 ®

2 a b1 + 2 I-1 + b12M Ha - xL2 - 2 b1 x

4 Ha - xL2==

Out[220]=

9x, 1

44 A - 2 a b1 - 2 I-1 + b12M Ha - xL2 + 2 b1 x ,

I-1 + b12M Ha - xL2

2 Ha - xL =Out[221]=

9x, 1

42 b1 x - 2 I-1 + b12M x2 , -

I-1 + b12M x2

2 x=

Example:

Out[223]=80.00133067, -0.0199767, -12.425<80.000059749 %, 0.216945 %, 24.6656 %<

1D harmonic oscillator in Cartesian coordinates

In[225]:=

Remove@"Global`*"DIn[226]:=

T = m 2 x'@tD2;

V = k 2 x@tD2;

L = T - V

Out[228]=

-1

2k x@tD2 +

1

2m x¢@tD2

In[229]:=

EulerEquations@L, x@tD, tDDSolve@8%, x@0D a, x'@0D 0<, x@tD, tD;Simplify@%, k > 0 && m > 0D

Out[229]=

-k x@tD - m x¢¢@tD 0

Out[231]=

99x@tD ® a CosA k

mtE==

In[232]:=

FirstIntegrals@L, x@tD, tD

Newton, Lagrange, Hamilton and Hamilton-Jacobi Mechanics of Classical Particles with Mathematica.nb 34

Page 35: Newton, Lagrange, Hamilton and Hamilton-Jacobi …o.castera.free.fr/zip/Newton, Lagrange, Hamilton and Hamilton... · Ł Separability of the HJE for a particle attracted to two fixed

Out[232]=9FirstIntegral@tD ®1

2Ik x@tD2 + m x¢@tD2M=

2D nonlinear pendulum

In[233]:=

Remove@"Global`*"DIn[234]:=

T = m 2 Ix¢@tD2 + y¢@tD2M;V = m g y@tD;L = T - V

Out[236]=

-g m y@tD +1

2m Ix¢@tD2 + y¢@tD2M

In[237]:=8x ® H-l Sin@Θ@ð DD &L, y ® H-l Cos@Θ@ð DD &L<;L . %

FirstIntegrals@%, Θ@tD, tDEulerEquations@%%, Θ@tD, tD;Simplify@%, l > 0 && m > 0D

Out[238]=

g l m Cos@Θ@tDD +1

2m Il2 Cos@Θ@tDD2 Θ¢@tD2 + l2 Sin@Θ@tDD2 Θ¢@tD2M

Out[239]=9FirstIntegral@tD ®1

2l m I-2 g Cos@Θ@tDD + l Θ¢@tD2M=

Out[241]=

g Sin@Θ@tDD + l Θ¢¢@tD 0

In[242]:=

Print@"Linearization..."D%% . Sin ® HSeries@Sin@ð D, 8ð, 0, 1<D &L Normal

DSolve@8%, Θ@0D Q, Θ'@0D 0<, Θ@tD, tD;Simplify@%, l > 0DPrint@"Schwingungsdauer math. Pendel: ",

Simplify@2 Π %@@1, 1, 2, 2, 1, 1DD, g > 0 && l > 0DD2

l

gΠ "sm12" . g ® 9.81

Linearization...

Out[243]=

g Θ@tD + l Θ¢¢@tD 0

Out[245]=

99Θ@tD ® Q CosA g

ltE==

Newton, Lagrange, Hamilton and Hamilton-Jacobi Mechanics of Classical Particles with Mathematica.nb 35

Page 36: Newton, Lagrange, Hamilton and Hamilton-Jacobi …o.castera.free.fr/zip/Newton, Lagrange, Hamilton and Hamilton... · Ł Separability of the HJE for a particle attracted to two fixed

Schwingungsdauer math. Pendel: 2l

Out[247]=

2.00607 sm12 l

2D spring pendulum (see Zimmerman&Olness p.327)

In[248]:=

Remove@"Global`*"DIn[249]:=

$Assumptions = 8m > 0, L0 > 0, k > 0, g > 0, r@tD ³ 0<;In[250]:=

T = m 2 Ix¢@tD2 + y¢@tD2M;V = m g y@tD + k 2 x@tD2 + y@tD2 - L0

2

;

L = T - V

Out[252]=

-g m y@tD -1

2k -L0 + x@tD2 + y@tD2

2

+1

2m Ix¢@tD2 + y¢@tD2M

In[253]:=8x ® H Sin@Θ@ð DD r@ð D &L, y ® H- Cos@Θ@ð DD r@ð D &L<;L . %

EulerEquations@%, 8Θ@tD, r@tD<, tD;Solve@%, 8Θ''@tD, r''@tD<D;MapAll@Collect@ð, kD &, %D;MapAll@Simplify@ð, $AssumptionsD &, %D

Out[254]=

g m Cos@Θ@tDD r@tD -1

2k -L0 + Cos@Θ@tDD2 r@tD2 + r@tD2 Sin@Θ@tDD2

2

+1

2mIHSin@Θ@tDD r¢@tD + Cos@Θ@tDD r@tD Θ¢@tDL2 + H-Cos@Θ@tDD r¢@tD + r@tD Sin@Θ@tDD Θ¢@tDL2M

Out[258]=99Θ¢¢@tD ® -g Sin@Θ@tDD + 2 r¢@tD Θ¢@tD

r@tD , r¢¢@tD ® g Cos@Θ@tDD +k HL0 - r@tDL

m+ r@tD Θ¢@tD2==

3D bead sliding on a conical spiral (see Wells p.52)

In[259]:=

Remove@"Global`*"DIn[260]:=

$Assumptions = 8m > 0, g > 0, a > 0, b > 0<;In[261]:=

T = m 2 Ix¢@tD2 + y¢@tD2 + z¢@tD2M;V = m g z@tD;L = T - V

Newton, Lagrange, Hamilton and Hamilton-Jacobi Mechanics of Classical Particles with Mathematica.nb 36

Page 37: Newton, Lagrange, Hamilton and Hamilton-Jacobi …o.castera.free.fr/zip/Newton, Lagrange, Hamilton and Hamilton... · Ł Separability of the HJE for a particle attracted to two fixed

Out[263]=

-g m z@tD +1

2m Ix¢@tD2 + y¢@tD2 + z¢@tD2M

In[264]:=8x ® H Cos@Φ@ð DD Ρ@ð D &L, y ® HSin@Φ@ð DD Ρ@ð D &L, z ® Hz@ð D &L<% . 8Φ@ðD ® -b z@ðD, Ρ@ðD ® a z@ðD<L . %

EulerEquations@%, 8z@tD<, tD Simplify;

MapAll@Collect@ð, z¢¢@tDD &, %DOut[264]=8x ® HCos@Φ@ð1DD Ρ@ð1D &L, y ® HSin@Φ@ð1DD Ρ@ð1D &L, z ® Hz@ð1D &L<Out[265]=8x ® HCos@-b z@ð1DD Ha z@ð1DL &L, y ® HSin@-b z@ð1DD Ha z@ð1DL &L, z ® Hz@ð1D &L<Out[266]=

-g m z@tD +1

2m Iz¢@tD2 + H-a Sin@b z@tDD z¢@tD - a b Cos@b z@tDD z@tD z¢@tDL2 +Ha Cos@b z@tDD z¢@tD - a b Sin@b z@tDD z@tD z¢@tDL2M

Out[268]=9g + a2 b2 z@tD z¢@tD2 + I1 + a2 + a2 b2 z@tD2M z¢¢@tD 0= 3D Spring pendulum with viscous drag (see Wells p.338)

In[269]:=

Remove@"Global`*"DIn[270]:=

Print@"Assumptions: ", $Assumptions = 8g > 0, m > 0, k ³ 0, r0 ³ 0, b ³ 0, r@tD ³ 0<DT = m 2 Ix¢@tD2 + y¢@tD2 + z¢@tD2M;V = m g z@tD + k 2 x@tD2 + y@tD2 + z@tD2 - r0

2

;

Print@"Lagrangian: ", L = T - VDPrintA"Dissipation function: ", F = b 2 Ix¢@tD2 + y¢@tD2 + z¢@tD2MEcoord = 8r@tD, Θ@tD, Φ@tD<;coordTransformation = 8

x ® Hr@ð D Sin@Θ@ð DD Cos@Φ@ð DD &L,y ® Hr@ð D Sin@Θ@ð DD Sin@Φ@ð DD &L,z ® Hr@ð D Cos@Θ@ð D D &L<;

Print@"Coordinate transformation: ",

% . Function@a_D ® a . b_@ðD ® b ColumnFormDAssumptions: 8g > 0, m > 0, k ³ 0, r0 ³ 0, b ³ 0, r@tD ³ 0<Lagrangian: -g m z@tD -

1

2k -r0 + x@tD2 + y@tD2 + z@tD2

2

+1

2m Ix¢@tD2 + y¢@tD2 + z¢@tD2M

Dissipation function:1

2b Ix¢@tD2 + y¢@tD2 + z¢@tD2M

Coordinate transformation: x ® r Cos@ΦD Sin@ΘDy ® r Sin@ΘD Sin@ΦDz ® r Cos@ΘD

Newton, Lagrange, Hamilton and Hamilton-Jacobi Mechanics of Classical Particles with Mathematica.nb 37

Page 38: Newton, Lagrange, Hamilton and Hamilton-Jacobi …o.castera.free.fr/zip/Newton, Lagrange, Hamilton and Hamilton... · Ł Separability of the HJE for a particle attracted to two fixed

In[278]:=

EulerEquations@L . coordTransformation, coord, tD;Expand %

D@MapAt@Expand, F . coordTransformation Simplify, 83, 2<D, ð D & HD@ð, tD & coordL-%%@@ð, 1DD + %@@ð DD 0 & Range@Length@%%DD;Collect@ð, kD & %

Print@"Euler-Lagrange equations with dissipation term:",

% . a_@tD ® a ColumnForm TraditionalFormDOut[279]=9-g m Cos@Θ@tDD - k r@tD + k r0 + m r@tD Θ¢@tD2 + m r@tD Sin@Θ@tDD2 Φ¢@tD2 - m r¢¢@tD 0,

g m r@tD Sin@Θ@tDD - 2 m r@tD r¢@tD Θ¢@tD + m Cos@Θ@tDD r@tD2 Sin@Θ@tDD Φ¢@tD2 -

m r@tD2 Θ¢¢@tD 0, -2 m r@tD Sin@Θ@tDD2 r¢@tD Φ¢@tD -

2 m Cos@Θ@tDD r@tD2 Sin@Θ@tDD Θ¢@tD Φ¢@tD - m r@tD2 Sin@Θ@tDD2 Φ¢¢@tD 0=Out[280]=9b r¢@tD, b r@tD2 Θ¢@tD, b r@tD2 Sin@Θ@tDD2 Φ¢@tD=Out[282]=9g m Cos@Θ@tDD + k Hr@tD - r0L + b r¢@tD - m r@tD Θ¢@tD2 - m r@tD Sin@Θ@tDD2 Φ¢@tD2 + m r¢¢@tD

0, -g m r@tD Sin@Θ@tDD + b r@tD2 Θ¢@tD + 2 m r@tD r¢@tD Θ¢@tD -

m Cos@Θ@tDD r@tD2 Sin@Θ@tDD Φ¢@tD2 + m r@tD2 Θ¢¢@tD 0,

b r@tD2 Sin@Θ@tDD2 Φ¢@tD + 2 m r@tD Sin@Θ@tDD2 r¢@tD Φ¢@tD +

2 m Cos@Θ@tDD r@tD2 Sin@Θ@tDD Θ¢@tD Φ¢@tD + m r@tD2 Sin@Θ@tDD2 Φ¢¢@tD 0=Euler-Lagrange equations with dissipation term:

-m r HΘ¢L2 - m r sin2HΘL HΦ¢L2 + g m cosHΘL + k Hr - r0L + b r¢ + m r¢¢ 0

-m cosHΘL sinHΘL HΦ¢L2 r2 + b Θ¢ r2 + m Θ¢¢ r2 - g m sinHΘL r + 2 m r¢ Θ¢ r 0

b sin2HΘL Φ¢ r2 + 2 m cosHΘL sinHΘL Θ¢ Φ¢ r2 + m sin2HΘL Φ¢¢ r2 + 2 m sin2HΘL r¢ Φ¢ r 0

A mobile (in the sense of Alexander Calder) with drag and time-dependent driving force (3D, animation)

The simulation of the motion of a mobile is a nice example of a complex system which can be modeled nearly effortless

with Lagrangian mechanics. Our mobile is made out of (ideal) mass points, rigid rods, hinges (restraining the motion in

a plane) and ball joints (allowing full rotation about the pivot); gravity, an external time-dependent driving force and

various types of dissipative forces can be added. The modelling of chains and rigid systems of mass points is also

possible; springs can be included by changing first the Lagrangian appropriately. Any number of elements can be

combined, but the numerical solution will take of course increasingly longer with the growth of the system complexity.

Note: Switching to the Hamiltonian formulation could make the numeric evaluation faster (only first order differential

equations!).

In[284]:=

Remove@"Global`*"DIn[285]:=H* Generic Lagrangian in Cartesian coordinates for n

particles subject to gravity and an external driving force *LT = HoldBâ

i=1

n

m@iD 2 Ix@iD'@tD2 + y@iD'@tD2 + z@iD'@tD2MF;

Newton, Lagrange, Hamilton and Hamilton-Jacobi Mechanics of Classical Particles with Mathematica.nb 38

Page 39: Newton, Lagrange, Hamilton and Hamilton-Jacobi …o.castera.free.fr/zip/Newton, Lagrange, Hamilton and Hamilton... · Ł Separability of the HJE for a particle attracted to two fixed

V = HoldBâi=1

n Hm@iD g z@iD@tD - f@tD Hx@iD@tD + y@iD@tD + z@iD@tDLLF;L = T - V;H* Power function *LH* power function for dry friction *LF = HoldBâ

i=1

n

b Hx@iD'@tD + y@iD'@tD + z@iD'@tDLF ;

H* Rayleigh dissipation function for viscous drag *LF = HoldBâ

i=1

n

b 2 Ix@iD'@tD2 + y@iD'@tD2 + z@iD'@tD2MF ;

In[290]:=

H* Unitary vector vïkHΘkHtL,ΦkHtLLin Cartesian coordinates parametrized by time-

dependent spherical coordinates

Φ from x-axis, Θ from z-axis *LDoVec@index_D = 8

Sin@Θ@indexD@tDD Cos@Φ@indexD@tDD,Sin@Θ@indexD@tDD Sin@Φ@indexD@tDD,Cos@Θ@indexD@tDD<;

In[291]:=H* A list of colors *Lcolor = 8Red, Green, Blue, Cyan, Magenta, Yellow<;

First we define an example mobile (see also pictures below):

In[292]:=H* System definition: example mobile *LH* Number n of mass points... *Ln = 2;

H* ...with position vectors Pz

i in Cartesian coordinates... *LP@1D = v@1D + v@2D;P@2D = v@1D + v@3D + v@4D;H* ...defined by the vectors v

zk = rkv

ïk. *L

v@1D = r@1D DoVec@1D . Φ@1D@tD ® Π 2;

v@2D = r@2D DoVec@2D . Φ@2D@tD ® 5 Π 6;

v@3D = -r@3D v@2D r@2D . Θ@2D@tD ® Θ@2D@tD - Π 6;

v@4D = r@4D DoVec@4D;Starting from the system definition the Lagrangian equations of motion are now analytically determined in a fully

automatic way. Only the truly independent (state-defining) variables are retained. They are the new coordinates.

In[299]:=

Print@"Independent variables:\n",Hcoord = Union@Cases@Table@P@iD, 8i, n<D, _@tD, 80, ¥<DDLD;8x@iD@tD, y@iD@tD, z@iD@tD<;coordTransformation = Table@8Thread@Rule@%, P@iDDD, Thread@Rule@D@%, tD, D@P@iD, tDDD<, 8i, n<D Flatten;

Print@"Coordinate transformation for positions and velocities:"D%% TableForm

Independent variables:8Θ@1D@tD, Θ@2D@tD, Θ@4D@tD, Φ@4D@tD<

Newton, Lagrange, Hamilton and Hamilton-Jacobi Mechanics of Classical Particles with Mathematica.nb 39

Page 40: Newton, Lagrange, Hamilton and Hamilton-Jacobi …o.castera.free.fr/zip/Newton, Lagrange, Hamilton and Hamilton... · Ł Separability of the HJE for a particle attracted to two fixed

Coordinate transformation for positions and velocities:

Out[303]//TableForm=

x@1D@tD ® -1

23 r@2D Sin@Θ@2D@tDD

y@1D@tD ® r@1D Sin@Θ@1D@tDD +1

2r@2D Sin@Θ@2D@tDD

z@1D@tD ® Cos@Θ@1D@tDD r@1D + Cos@Θ@2D@tDD r@2Dx@1D¢@tD ® -

1

23 Cos@Θ@2D@tDD r@2D Θ@2D¢@tD

y@1D¢@tD ® Cos@Θ@1D@tDD r@1D Θ@1D¢@tD +1

2Cos@Θ@2D@tDD r@2D Θ@2D¢@tD

z@1D¢@tD ® -r@1D Sin@Θ@1D@tDD Θ@1D¢@tD - r@2D Sin@Θ@2D@tDD Θ@2D¢@tDx@2D@tD ® -

1

23 r@3D SinA Π

6- Θ@2D@tDE + Cos@Φ@4D@tDD r@4D Sin@Θ@4D@tDD

y@2D@tD ® r@1D Sin@Θ@1D@tDD +1

2r@3D SinA Π

6- Θ@2D@tDE + r@4D Sin@Θ@4D@tDD Sin@Φ@4D@tDD

z@2D@tD ® Cos@Θ@1D@tDD r@1D - CosA Π

6- Θ@2D@tDE r@3D + Cos@Θ@4D@tDD r@4D

x@2D¢@tD ®1

23 CosA Π

6- Θ@2D@tDE r@3D Θ@2D¢@tD + Cos@Θ@4D@tDD Cos@Φ@4D@tDD r@4D Θ@4D¢@tD -

y@2D¢@tD ® Cos@Θ@1D@tDD r@1D Θ@1D¢@tD -1

2CosA Π

6- Θ@2D@tDE r@3D Θ@2D¢@tD + Cos@Θ@4D@tDD r@4D

z@2D¢@tD ® -r@1D Sin@Θ@1D@tDD Θ@1D¢@tD - r@3D SinA Π

6- Θ@2D@tDE Θ@2D¢@tD - r@4D Sin@Θ@4D@tDD

In[304]:=

LL = ReleaseHold@LD . coordTransformation;

Print@"Lagrangian in the new coordinates: ", Short@%, 3DDFF = ReleaseHold@FD . coordTransformation;

Print@"Power function in the new coordinates: ", Short@%, 3DDEquationsOfMotion = Table@

D@D@LL, D@coord@@jDD, tDD, tD - D@LL, coord@@jDDD + D@FF, D@coord@@jDD, tDD 0,8j, 1, Length@coordD<D;Print@"Lagrangian equations of motion for the new coordinates:"DShort@ð, 2D & %% TableForm

Lagrangian in the new coordinates: 6 +1

2m@2D

-r@1D Sin@Θ@1D@tDD Θ@1D¢@tD - r@3D SinB Π

6- Θ@2D@tDF Θ@2D¢@tD - r@4D Sin@Θ@4D@tDD Θ@4D¢@tD 2

+

H1L2 + H1L2

Power function in the new coordinates:1

2b

3

4Cos@Θ@2D@tDD2 r@2D2 Θ@2D¢@tD2 +

Cos@Θ@1D@tDD r@1D Θ@1D¢@tD +1

2Cos@Θ@2D@tDD r@2D Θ@2D¢@tD 2

+

I-r@1D Sin@Θ@1D@tDD Θ@1D¢@tD - r@2D Sin@Θ@2D@tDD Θ@2D¢@tDM2+

1

2b H1L2 + H1L2 +

1

23 CosB Π

6- Θ@2D@tDF r@3D Θ@2D¢@tD + 1 - r@4D 3

2

Lagrangian equations of motion for the new coordinates:

Newton, Lagrange, Hamilton and Hamilton-Jacobi Mechanics of Classical Particles with Mathematica.nb 40

Page 41: Newton, Lagrange, Hamilton and Hamilton-Jacobi …o.castera.free.fr/zip/Newton, Lagrange, Hamilton and Hamilton... · Ł Separability of the HJE for a particle attracted to two fixed

Out[310]//TableForm=

-g m@1D r@1D Sin@Θ@1D@tDD - g m@2D r@1D Sin@Θ@1D@tDD - 2 f@tD HCos@Θ@1D@tDD r@1D - r@1D Sin@Θ

-g m@2D r@3D SinA Π

6- Θ@2D@tDE - f@tD J-

1

2CosA Π

6- Θ@2D@tDE r@3D +

1

23 CosA Π

6- Θ@2D@tDE r@3D

-g m@2D r@4D Sin@Θ@4D@tDD - f@tD HCos@Θ@4D@tDD Cos@Φ@4D@tDD r@4D - r@4D Sin@Θ@4D@tDD + Cos@-f@tD HCos@Φ@4D@tDD r@4D Sin@Θ@4D@tDD - r@4D Sin@Θ@4D@tDD Sin@Φ@4D@tDDL +

1

2b J1 - 2

If F is the Rayleigh dissipation function, then -2F is the rate of energy dissipation due to drag as long as the Lagrangian

is time-independent (see Goldstein&Poole&Safko p.24 or Landau&Lifshitz § 25). (In general, F seems to be propor-

tional to the energy dissipation rate.)

Newton, Lagrange, Hamilton and Hamilton-Jacobi Mechanics of Classical Particles with Mathematica.nb 41

Page 42: Newton, Lagrange, Hamilton and Hamilton-Jacobi …o.castera.free.fr/zip/Newton, Lagrange, Hamilton and Hamilton... · Ł Separability of the HJE for a particle attracted to two fixed

In[311]:=

D1TotalEnergy@t_D = D@ReleaseHold@T + VD . coordTransformation, tD;Print@"Total time derivative of the total energy in the new coordinates: ",

Short@%, 9DDDissipationRate@t_D = -2 FF;

Print@"Rate of energy dissipation in the new coordinates: ", Short@%, 5DDTotal time derivative of the total energy in the new coordinates:

- Cos@Θ@1D@tDD r@1D + Cos@Θ@2D@tDD r@2D + r@1D Sin@Θ@1D@tDD +1

2r@2D Sin@Θ@2D@tDD -

1

23 r@2D Sin@Θ@2D@tDD f¢@tD - H1L f¢@tD + 6 + 1 +

1

2m@2D

2 -r@1D Sin@Θ@1D@tDD Θ@1D¢@tD - r@3D SinB Π

6- Θ@2D@tDF Θ@2D¢@tD - r@4D Sin@Θ@4D@tDD Θ@4D¢@tD

-Cos@Θ@1D@tDD r@1D Θ@1D¢@tD2 + CosB Π

6- Θ@2D@tDF r@3D Θ@2D¢@tD2 -

Cos@Θ@4D@tDD r@4D Θ@4D¢@tD2 - r@1D Sin@Θ@1D@tDD Θ@1D¢¢@tD -

r@3D SinB Π

6- Θ@2D@tDF Θ@2D¢¢@tD - r@4D Sin@Θ@4D@tDD Θ@4D¢¢@tD +

2 H1L H12 + Cos@1D 3L + 21

23 CosB Π

6- Θ@2D@tDF r@3D Θ@2D¢@tD +

Cos@Θ@4D@tDD Cos@Φ@4D@tDD r@4D Θ@4D¢@tD - r@4D Sin@Θ@4D@tDD Sin@Φ@4D@tDD Φ@4D¢@tD1

23 r@3D SinB Π

6- Θ@2D@tDF Θ@2D¢@tD2 - Cos@Φ@4D@tDD r@4D Sin@Θ@4D@tDD Θ@4D¢@tD2 -

2 Cos@Θ@4D@tDD r@4D Sin@Φ@4D@tDD Θ@4D¢@tD Φ@4D¢@tD -

Cos@Φ@4D@tDD r@4D Sin@Θ@4D@tDD Φ@4D¢@tD2 +1

23 CosB Π

6- Θ@2D@tDF r@3D Θ@2D¢¢@tD +

Cos@Θ@4D@tDD Cos@Φ@4D@tDD r@4D Θ@4D¢¢@tD - r@4D Sin@Θ@4D@tDD Sin@Φ@4D@tDD Φ@4D¢¢@tDRate of energy dissipation in the new coordinates:

-21

2b

3

4Cos@Θ@2D@tDD2 r@2D2 Θ@2D¢@tD2 + Cos@Θ@1D@tDD r@1D Θ@1D¢@tD +

1

2Cos@Θ@2D@tDD r@2D

Θ@2D¢@tD 2

+ I-r@1D Sin@Θ@1D@tDD Θ@1D¢@tD - r@2D Sin@Θ@2D@tDD Θ@2D¢@tDM2+

1

2b -r@1D Sin@Θ@1D@tDD Θ@1D¢@tD - r@3D SinB Π

6- Θ@2D@tDF Θ@2D¢@tD - r@4D Sin@Θ@4D@tDD

Θ@4D¢@tD 2

+ H4 + Cos@Φ@4D@tDD 3L2 +1

23 CosB Π

6- Θ@2D@tDF r@3D Θ@2D¢@tD +

Cos@Θ@4D@tDD 2 1@tD - r@4D Sin@Θ@4D@tDD Sin@Φ@4D@tDD Φ@4D¢@tD 2

We must assign numerical values to all system parameters and specify the initial conditions in order to solve numeri-

cally the Lagrange equations of motion.

Newton, Lagrange, Hamilton and Hamilton-Jacobi Mechanics of Classical Particles with Mathematica.nb 42

Page 43: Newton, Lagrange, Hamilton and Hamilton-Jacobi …o.castera.free.fr/zip/Newton, Lagrange, Hamilton and Hamilton... · Ł Separability of the HJE for a particle attracted to two fixed

In[315]:=

Parameters = 8g ® 1, b ® 0.25,

m@1D ® 2, m@2D ® 1,

r@1D ® 30, r@2D ® 10, r@3D ® 20, r@4D ® 15<;f@t_D = 20 ExpA-1 2 Ht - 50L2E;

In[317]:=H* random initial conditions *LInitialConditions =

Table@Hcoord@@jDD . t ® 0L 6 Random@D, 8j, 1, Length@coordD<D ÜTable@HD@coord@@jDD, tD . t ® 0L 2 Random@D, 8j, 1, Length@coordD<D

Out[317]=8Θ@1D@0D 4.91034, Θ@2D@0D 3.04043, Θ@4D@0D 0.554141, Φ@4D@0D 2.43257,

Θ@1D¢@0D 1.17979, Θ@2D¢@0D 0.5877, Θ@4D¢@0D 1.21274, Φ@4D¢@0D 1.45768<Let's find now the numerical solutions:

In[318]:=

NDSolve@8EquationsOfMotion . Parameters, InitialConditions<,coord, 8t, 0, tmax = 120<D First;

h = 8Parameters, %, % . g_@tD ® g'@tD, % . g_@tD ® g''@tD< Flatten

Out[319]=8g ® 1, b ® 0.25, m@1D ® 2, m@2D ® 1, r@1D ® 30, r@2D ® 10, r@3D ® 20,

r@4D ® 15, Θ@1D@tD ® InterpolatingFunction@880., 120.<<, <>D@tD,Θ@2D@tD ® InterpolatingFunction@880., 120.<<, <>D@tD,Θ@4D@tD ® InterpolatingFunction@880., 120.<<, <>D@tD,Φ@4D@tD ® InterpolatingFunction@880., 120.<<, <>D@tD,Θ@1D¢@tD ® InterpolatingFunction@880., 120.<<, <>D@tD,Θ@2D¢@tD ® InterpolatingFunction@880., 120.<<, <>D@tD,Θ@4D¢@tD ® InterpolatingFunction@880., 120.<<, <>D@tD,Φ@4D¢@tD ® InterpolatingFunction@880., 120.<<, <>D@tD,Θ@1D¢¢@tD ® InterpolatingFunction@880., 120.<<, <>D@tD,Θ@2D¢¢@tD ® InterpolatingFunction@880., 120.<<, <>D@tD,Θ@4D¢¢@tD ® InterpolatingFunction@880., 120.<<, <>D@tD,Φ@4D¢¢@tD ® InterpolatingFunction@880., 120.<<, <>D@tD<

Graphics output and animation:

In[320]:=

Show@GraphicsArray@Partition@8

Table@Plot@coord@@jDD . h, 8t, 0, tmax<,PlotLabel ® ToString@coord@@jDDD, PlotRange ® All, PlotStyle ® Orange,

DisplayFunction ® IdentityD, 8j, 1, Length@coordD<D,Plot@Evaluate@8D1TotalEnergy@tD, DissipationRate@tD< . hD,8t, 0, tmax<, PlotLabel ® "Etotal'@tD = -2 F@tD", PlotRange ® All,

PlotStyle ® 88Gray<, 8Orange<<, DisplayFunction ® IdentityD,ParametricPlot3D@Evaluate@Table@Append@P@iD, color@@iDDD . h, 8i, n<DD,8t, 0, tmax<, PlotLabel ® "orbit P@iD\n", PlotRange ® All,

PlotPoints ® 400, DisplayFunction ® IdentityD< Flatten

, 3, 3, 81, 1<, 8<DD, ImageSize ® maxSizepicD

Newton, Lagrange, Hamilton and Hamilton-Jacobi Mechanics of Classical Particles with Mathematica.nb 43

Page 44: Newton, Lagrange, Hamilton and Hamilton-Jacobi …o.castera.free.fr/zip/Newton, Lagrange, Hamilton and Hamilton... · Ł Separability of the HJE for a particle attracted to two fixed

Out[320]=

20 40 60 80 100 120

456789

10Θ@1D@tD

20 40 60 80 100 120

6

8

10

Θ@2D@tD

20 40 60 80 100 120

1.0

1.5

2.0

2.5

3.0Θ@4D@tD

20 40 60 80 100 120

10

15

20

25Φ@4D@tD

20 40 60 80 100 120

-500

500

Etotal'@tD = -2 F@tD orbit P@iD-200 20

-2002040

-50

0

50

In[321]:=

<< Graphics`Animation`

In[322]:=

zero = 80, 0, 0<;maxrange = 70;

nframes = 3; H* total number of frames of the animation *Lframes = Table@Graphics3D@88PointSize@ 0.04D, color@@1DD, Point@P@1D . hD<,8PointSize@ 0.04D, color@@2DD, Point@P@2D . hD<,8PointSize@ 0.02D, color@@1DD,

Point@8P@1D@@1DD, P@1D@@2DD, -maxrange< . hD<,8PointSize@ 0.02D, color@@2DD, Point@8P@2D@@1DD, P@2D@@2DD, -maxrange< . hD<,8PointSize@ 0.015D, Gray, Point@8v@1D@@1DD, v@1D@@2DD, -maxrange< . hD<,8PointSize@ 0.015D,Point@8v@1D@@1DD + v@3D@@1DD, v@1D@@2DD + v@3D@@2DD, -maxrange< . hD<,8Gray, Point@80, 0, -maxrange< . hD<,[email protected], Gray, Point@zeroD<,[email protected], Gray, Point@v@1DD . h<,[email protected], Point@v@1D + v@3DD . h<,

Line@8zero, v@1D, P@1D< . hD,Line@8zero, v@1D, v@1D + v@3D, P@2D< . hD<,

PlotRange ® maxrange 88-1, 1<, 8-1, 1<, 8-1, 1<<,Boxed ® True, ViewPoint -> 84, 2, 1<, ImageSize ® minSizepicD,8t, 0, tmax, If@nframes > 1, tmax Hnframes - 1L, InfinityD<D;

ShowAnimation@framesD

Newton, Lagrange, Hamilton and Hamilton-Jacobi Mechanics of Classical Particles with Mathematica.nb 44

Page 45: Newton, Lagrange, Hamilton and Hamilton-Jacobi …o.castera.free.fr/zip/Newton, Lagrange, Hamilton and Hamilton... · Ł Separability of the HJE for a particle attracted to two fixed

Out[326]=

In[327]:=

Show@Last@framesD, ImageSize ® medSizepic,

PlotLabel -> "The example mobile near the equilibrium position"DOut[327]=

The example mobile near the equilibrium position

Note: Black segments = rods, green and red dots = mass points, gray dots = hinges (allowing swinging in a plane), black

dot = ball joint (allowing full rotation about the pivot). The hinge in the center of the box is fixed in space. On the

bottom of the box, the orthogonal projections of the mass points and the pivots are shown as small dots.

Newton, Lagrange, Hamilton and Hamilton-Jacobi Mechanics of Classical Particles with Mathematica.nb 45

Page 46: Newton, Lagrange, Hamilton and Hamilton-Jacobi …o.castera.free.fr/zip/Newton, Lagrange, Hamilton and Hamilton... · Ł Separability of the HJE for a particle attracted to two fixed

Noether's theorem for Lagrangian mechanics: the ten constants of motion from the Galilei transformation group

In[328]:=

Remove@"Global`*"D"Das Noether-Theorem besagt, dass die Invarianz des Wirkungsfunktionals gegenüber einer einparametrigen stetigen

Transformationsgruppe die Existenz einer Erhaltungsgröße zur Folge hat und dass umgekehrt jede Erhaltungsgröße die

Existenz einer (mindestens infinitesimalen) Symmetrie der Wirkung zur Folge hat." (Wikipedia)

We use the formulation of the Noether's theorem as found in Straumann p.95: Es sei ΦΕ eine 1-parametrige Ε -Schar von

Symmetrietransformationen mit L ë TΦΕ = L + dMΕ dt und ΦΕ=0 = Id. Mit ∆qk º ¶HΦΕLk / ¶Ε und G º ¶MΕ ¶Ε,

beide für Ε = 0, ist Úk ¶L ¶q k ∆qk - G ein erstes Integral der Bewegung.

We discuss here the example of an isolated system of two particles with mass m1 and m2 interacting only gravitationally.

In[329]:=

SetAttributes@8G, m1, m2, a, Α, a<, ConstantDT =

1

2m1 Ix@1D'@tD2 + y@1D'@tD2 + z@1D'@tD2M +

1

2m2 Ix@2D'@tD2 + y@2D'@tD2 + z@2D'@tD2M;

V = -G m1 m2 Hx@1D@tD - x@2D@tDL2 + Hy@1D@tD - y@2D@tDL2 + Hz@1D@tD - z@2D@tDL2 ;

Print@"Lagrangian L = ", L = T - VDLagrangian L =

m1 m2 G

Hx@1D@tD - x@2D@tDL2 + Hy@1D@tD - y@2D@tDL2 + Hz@1D@tD - z@2D@tDL2

+

1

2m1 Ix@1D¢@tD2 + y@1D¢@tD2 + z@1D¢@tD2M +

1

2m2 Ix@2D¢@tD2 + y@2D¢@tD2 + z@2D¢@tD2M

a) Conservation of linear momentum from spatial translational symmetry

In[333]:=

q@i_D := x@iD@tDIn[334]:=

Dq@i_D := Head@q@iDD'@tDΦ@Ε, iD = q@iD + Ε a

L . 8q@i_D ® Φ@Ε, iD<;M'@Ε, tD = % - L

M@Ε, tD = Integrate@M'@Ε, tD, tD + C@Unique@DDG = D@ M@Ε, tD, ΕD . Ε ® 0

∆q@i_D = D@Φ@Ε, iD, ΕD . Ε ® 0

âi=1

2

D@L, Dq@iDD ∆q@iD - G Simplify;

Print@"Noether: ", %, " is a constant of motion!\nSo we have finally..."D%% a const

Out[335]=

a Ε + x@iD@tDOut[337]=

0

Newton, Lagrange, Hamilton and Hamilton-Jacobi Mechanics of Classical Particles with Mathematica.nb 46

Page 47: Newton, Lagrange, Hamilton and Hamilton-Jacobi …o.castera.free.fr/zip/Newton, Lagrange, Hamilton and Hamilton... · Ł Separability of the HJE for a particle attracted to two fixed

Out[338]=

C@$1DOut[339]=

0

Out[340]=

a

Noether: a Im1 x@1D¢@tD + m2 x@2D¢@tDM is a constant of motion!

So we have finally...

Out[343]=

m1 x@1D¢@tD + m2 x@2D¢@tD const

In[344]:=

q@i_D := y@iD@tDIn[345]:=

Dq@i_D := Head@q@iDD'@tDΦ@Ε, iD = q@iD + Ε a

L . 8q@i_D ® Φ@Ε, iD<;M'@Ε, tD = % - L

M@Ε, tD = Integrate@M'@Ε, tD, tD + C@Unique@DDG = D@ M@Ε, tD, ΕD . Ε ® 0

∆q@i_D = D@Φ@Ε, iD, ΕD . Ε ® 0

âi=1

2

D@L, Dq@iDD ∆q@iD - G Simplify;

Print@"Noether: ", %, " is a constant of motion!\nSo we have finally..."D%% a const

Out[346]=

a Ε + y@iD@tDOut[348]=

0

Out[349]=

C@$2DOut[350]=

0

Out[351]=

a

Noether: a Im1 y@1D¢@tD + m2 y@2D¢@tDM is a constant of motion!

So we have finally...

Out[354]=

m1 y@1D¢@tD + m2 y@2D¢@tD const

In[355]:=

q@i_D := z@iD@tDIn[356]:=

Dq@i_D := Head@q@iDD'@tDΦ@Ε, iD = q@iD + Ε a

L . 8q@i_D ® Φ@Ε, iD<;

Newton, Lagrange, Hamilton and Hamilton-Jacobi Mechanics of Classical Particles with Mathematica.nb 47

Page 48: Newton, Lagrange, Hamilton and Hamilton-Jacobi …o.castera.free.fr/zip/Newton, Lagrange, Hamilton and Hamilton... · Ł Separability of the HJE for a particle attracted to two fixed

L . 8q@i_D ® Φ@Ε, iD<;M'@Ε, tD = % - L

M@Ε, tD = Integrate@M'@Ε, tD, tD + C@Unique@DDG = D@ M@Ε, tD, ΕD . Ε ® 0

∆q@i_D = D@Φ@Ε, iD, ΕD . Ε ® 0

âi=1

2

D@L, Dq@iDD ∆q@iD - G Simplify;

Print@"Noether: ", %, " is a constant of motion!\nSo we have finally..."D%% a const

Out[357]=

a Ε + z@iD@tDOut[359]=

0

Out[360]=

C@$3DOut[361]=

0

Out[362]=

a

Noether: a Im1 z@1D¢@tD + m2 z@2D¢@tDM is a constant of motion!

So we have finally...

Out[365]=

m1 z@1D¢@tD + m2 z@2D¢@tD const

b) Conservation of angular momentum from spatial rotational symmetry

In[366]:=

rotationX = 8y@i_D@tD ® y@iD@tD Cos@Ε ΑD + z@iD@tD Sin@Ε ΑD,z@i_D@tD ® -y@iD@tD Sin@Ε ΑD + z@iD@tD Cos@Ε ΑD,y@i_D'@tD ® y@iD'@tD Cos@Ε ΑD + z@iD'@tD Sin@Ε ΑD,z@i_D'@tD ® -y@iD'@tD Sin@Ε ΑD + z@iD'@tD Cos@Ε ΑD<;

L . rotationX;

M'@Ε, tD = % - L Simplify

M@Ε, tD = Integrate@M'@Ε, tD, tD + C@Unique@DDG = D@ M@Ε, tD, ΕD . Ε ® 0

∆q@i_, coord_D := D@rotationX@@coord, 2DD, ΕD . Ε ® 0

âi=1

2 HD@L, y@iD'@tDD ∆q@i, 1D + D@L, z@iD'@tDD ∆q@i, 2DL - G Simplify

Print@"Noether: ", %, " is a constant of motion!\nSo we have finally..."DCollect@-%% Α, 8m1, m2<D const

Lx = %@@1DD;Out[368]=

0

Out[369]=

C@$4DOut[370]=

0

Newton, Lagrange, Hamilton and Hamilton-Jacobi Mechanics of Classical Particles with Mathematica.nb 48

Page 49: Newton, Lagrange, Hamilton and Hamilton-Jacobi …o.castera.free.fr/zip/Newton, Lagrange, Hamilton and Hamilton... · Ł Separability of the HJE for a particle attracted to two fixed

Out[372]=

Α Hm1 z@1D@tD y@1D¢@tD + m2 z@2D@tD y@2D¢@tD - m1 y@1D@tD z@1D¢@tD - m2 y@2D@tD z@2D¢@tDLNoether: Α Im1 z@1D@tD y@1D¢@tD + m2 z@2D@tD y@2D¢@tD - m1 y@1D@tD z@1D¢@tD - m2 y@2D@tD z@2D¢@tDM

is a constant of motion!

So we have finally...

Out[374]=

m1 H-z@1D@tD y@1D¢@tD + y@1D@tD z@1D¢@tDL +

m2 H-z@2D@tD y@2D¢@tD + y@2D@tD z@2D¢@tDL const

In[376]:=

rotationY = 8x@i_D@tD ® x@iD@tD Cos@Ε ΑD + z@iD@tD Sin@Ε ΑD,z@i_D@tD ® -x@iD@tD Sin@Ε ΑD + z@iD@tD Cos@Ε ΑD,x@i_D'@tD ® x@iD'@tD Cos@Ε ΑD + z@iD'@tD Sin@Ε ΑD,z@i_D'@tD ® -x@iD'@tD Sin@Ε ΑD + z@iD'@tD Cos@Ε ΑD<;

L . rotationY;

M'@Ε, tD = % - L Simplify

M@Ε, tD = Integrate@M'@Ε, tD, tD + C@Unique@DDG = D@ M@Ε, tD, ΕD . Ε ® 0

∆q@i_, coord_D := D@rotationY@@coord, 2DD, ΕD . Ε ® 0

âi=1

2 HD@L, x@iD'@tDD ∆q@i, 1D + D@L, z@iD'@tDD ∆q@i, 2DL - G Simplify

Print@"Noether: ", %, " is a constant of motion!\nSo we have finally..."DCollect@%% Α, 8m1, m2<D const

Ly = %@@1DD;Out[378]=

0

Out[379]=

C@$5DOut[380]=

0

Out[382]=

Α Hm1 z@1D@tD x@1D¢@tD + m2 z@2D@tD x@2D¢@tD - m1 x@1D@tD z@1D¢@tD - m2 x@2D@tD z@2D¢@tDLNoether: Α Im1 z@1D@tD x@1D¢@tD + m2 z@2D@tD x@2D¢@tD - m1 x@1D@tD z@1D¢@tD - m2 x@2D@tD z@2D¢@tDM

is a constant of motion!

So we have finally...

Out[384]=

m1 Hz@1D@tD x@1D¢@tD - x@1D@tD z@1D¢@tDL + m2 Hz@2D@tD x@2D¢@tD - x@2D@tD z@2D¢@tDL const

In[386]:=

rotationZ = 8x@i_D@tD ® x@iD@tD Cos@Ε ΑD + y@iD@tD Sin@Ε ΑD,y@i_D@tD ® -x@iD@tD Sin@Ε ΑD + y@iD@tD Cos@Ε ΑD,x@i_D'@tD ® x@iD'@tD Cos@Ε ΑD + y@iD'@tD Sin@Ε ΑD,y@i_D'@tD ® -x@iD'@tD Sin@Ε ΑD + y@iD'@tD Cos@Ε ΑD<;

L . rotationZ;

M'@Ε, tD = % - L Simplify

M@Ε, tD = Integrate@M'@Ε, tD, tD + C@Unique@DDG = D@ M@Ε, tD, ΕD . Ε ® 0

∆q@i_, coord_D := D@rotationZ@@coord, 2DD, ΕD . Ε ® 0

Newton, Lagrange, Hamilton and Hamilton-Jacobi Mechanics of Classical Particles with Mathematica.nb 49

Page 50: Newton, Lagrange, Hamilton and Hamilton-Jacobi …o.castera.free.fr/zip/Newton, Lagrange, Hamilton and Hamilton... · Ł Separability of the HJE for a particle attracted to two fixed

âi=1

2 HD@L, x@iD'@tDD ∆q@i, 1D + D@L, y@iD'@tDD ∆q@i, 2DL - G Simplify

Print@"Noether: ", %, " is a constant of motion!\nSo we have finally..."DCollect@-%% Α, 8m1, m2<D const

Lz = %@@1DD;Out[388]=

0

Out[389]=

C@$6DOut[390]=

0

Out[392]=

Α Hm1 y@1D@tD x@1D¢@tD + m2 y@2D@tD x@2D¢@tD - m1 x@1D@tD y@1D¢@tD - m2 x@2D@tD y@2D¢@tDLNoether: Α Im1 y@1D@tD x@1D¢@tD + m2 y@2D@tD x@2D¢@tD - m1 x@1D@tD y@1D¢@tD - m2 x@2D@tD y@2D¢@tDM

is a constant of motion!

So we have finally...

Out[394]=

m1 H-y@1D@tD x@1D¢@tD + x@1D@tD y@1D¢@tDL +

m2 H-y@2D@tD x@2D¢@tD + x@2D@tD y@2D¢@tDL const

Final check (one never knows...):

In[396]:=

TotalAngularMomentum = Collect@8x@1D@tD, y@1D@tD, z@1D@tD<Hm1 8x@1D'@tD, y@1D'@tD, z@1D'@tD<L +8x@2D@tD, y@2D@tD, z@2D@tD<Hm2 8x@2D'@tD, y@2D'@tD, z@2D'@tD<L, 8m1, m2<D;TotalAngularMomentum MatrixForm8Lx, Ly, Lz< == TotalAngularMomentum

Out[397]//MatrixForm=

m1 H-z@1D@tD y@1D¢@tD + y@1D@tD z@1D¢@tDL + m2 H-z@2D@tD y@2D¢@tD + y@2D@tD z@2D¢@tDLm1 Hz@1D@tD x@1D¢@tD - x@1D@tD z@1D¢@tDL + m2 Hz@2D@tD x@2D¢@tD - x@2D@tD z@2D¢@tDL

m1 H-y@1D@tD x@1D¢@tD + x@1D@tD y@1D¢@tDL + m2 H-y@2D@tD x@2D¢@tD + x@2D@tD y@2D¢@tDLOut[398]=

True

c) Conservation of energy from time translational symmetry

This one is a little bit tricky. We have to change from "time as parameter" to "time as Lagrangian coordinate" transform-

ing the original Lagarangian L to a new Lagrangian L1 to use Noether's theorem. See Arnold (§ 20) or Romano (p.309)

for more details.

In[399]:=

L . 8x@i_D@tD ® X@iD@ΤD, x@i_D'@tD ® X@iD'@ΤD t'@ΤD,y@i_D@tD ® Y@iD@ΤD, y@i_D'@tD ® Y@iD'@ΤD t'@ΤD,z@i_D@tD ® Z@iD@ΤD, z@i_D'@tD ® Z@iD'@ΤD t'@ΤD<;

L1 = % t'@ΤD

Newton, Lagrange, Hamilton and Hamilton-Jacobi Mechanics of Classical Particles with Mathematica.nb 50

Page 51: Newton, Lagrange, Hamilton and Hamilton-Jacobi …o.castera.free.fr/zip/Newton, Lagrange, Hamilton and Hamilton... · Ł Separability of the HJE for a particle attracted to two fixed

Out[400]=

t¢@ΤD m1 m2 G

HX@1D@ΤD - X@2D@ΤDL2 + HY@1D@ΤD - Y@2D@ΤDL2 + HZ@1D@ΤD - Z@2D@ΤDL2

+

1

2m1

X@1D¢@ΤD2

t¢@ΤD2+Y@1D¢@ΤD2

t¢@ΤD2+Z@1D¢@ΤD2

t¢@ΤD2+1

2m2

X@2D¢@ΤD2

t¢@ΤD2+Y@2D¢@ΤD2

t¢@ΤD2+Z@2D¢@ΤD2

t¢@ΤD2

In[401]:=

timetranslation = 8t@ΤD ® t@ΤD + Ε a<;L1 . timetranslation

M'@Ε, ΤD = % - L1 Simplify

M@Ε, ΤD = Integrate@M'@Ε, ΤD, ΤD + C@Unique@DDG = D@ M@Ε, ΤD, ΕD . Ε ® 0

∆q = D@t@ΤD + Ε a, ΕD . Ε ® 0

I1 = D@L1, t¢@ΤD D ∆q - G Simplify

Print@"Noether: ", %, " is a constant of motion!\nSo we have finally..."DHI1bis = %% -aL const

Out[402]=

t¢@ΤD m1 m2 G

HX@1D@ΤD - X@2D@ΤDL2 + HY@1D@ΤD - Y@2D@ΤDL2 + HZ@1D@ΤD - Z@2D@ΤDL2

+

1

2m1

X@1D¢@ΤD2

t¢@ΤD2+Y@1D¢@ΤD2

t¢@ΤD2+Z@1D¢@ΤD2

t¢@ΤD2+1

2m2

X@2D¢@ΤD2

t¢@ΤD2+Y@2D¢@ΤD2

t¢@ΤD2+Z@2D¢@ΤD2

t¢@ΤD2

Out[403]=

0

Out[404]=

C@$7DOut[405]=

0

Out[406]=

a

Out[407]=

1

2 t¢@ΤD2

a II2 m1 m2 G t¢@ΤD2M I,IX@1D@ΤD2 - 2 X@1D@ΤD X@2D@ΤD + X@2D@ΤD2 + Y@1D@ΤD2 - 2 Y@1D@ΤDY@2D@ΤD + Y@2D@ΤD2 + Z@1D@ΤD2 - 2 Z@1D@ΤD Z@2D@ΤD + Z@2D@ΤD2MM - m1 X@1D¢@ΤD2 -

m2 X@2D¢@ΤD2 - m1 Y@1D¢@ΤD2 - m2 Y@2D¢@ΤD2 - m1 Z@1D¢@ΤD2 - m2 Z@2D¢@ΤD2MNoether:

1

2 t¢@ΤD2

a II2 m1 m2 G t¢@ΤD2MI,IX@1D@ΤD2 - 2 X@1D@ΤD X@2D@ΤD + X@2D@ΤD2 + Y@1D@ΤD2 - 2 Y@1D@ΤD Y@2D@ΤD +

Y@2D@ΤD2 + Z@1D@ΤD2 - 2 Z@1D@ΤD Z@2D@ΤD + Z@2D@ΤD2MM - m1 X@1D¢@ΤD2 - m2 X@2D¢@ΤD2 -

m1 Y@1D¢@ΤD2 - m2 Y@2D¢@ΤD2 - m1 Z@1D¢@ΤD2 - m2 Z@2D¢@ΤD2M is a constant of motion!

So we have finally...

Newton, Lagrange, Hamilton and Hamilton-Jacobi Mechanics of Classical Particles with Mathematica.nb 51

Page 52: Newton, Lagrange, Hamilton and Hamilton-Jacobi …o.castera.free.fr/zip/Newton, Lagrange, Hamilton and Hamilton... · Ł Separability of the HJE for a particle attracted to two fixed

Out[409]=

-1

2 t¢@ΤD2II2 m1 m2 G t¢@ΤD2M I,IX@1D@ΤD2 - 2 X@1D@ΤD X@2D@ΤD + X@2D@ΤD2 + Y@1D@ΤD2 - 2 Y@1D@ΤDY@2D@ΤD + Y@2D@ΤD2 + Z@1D@ΤD2 - 2 Z@1D@ΤD Z@2D@ΤD + Z@2D@ΤD2MM - m1 X@1D¢@ΤD2 -

m2 X@2D¢@ΤD2 - m1 Y@1D¢@ΤD2 - m2 Y@2D¢@ΤD2 - m1 Z@1D¢@ΤD2 - m2 Z@2D¢@ΤD2M const

In[410]:=

I1bis . 8t¢@ΤD ® 1,

X@i_D@ΤD ® x@iD@tD, X@i_D'@ΤD ® x@iD'@tD,Y@i_D@ΤD ® y@iD@tD, Y@i_D'@ΤD ® y@iD'@tD,Z@i_D@ΤD ® z@iD@tD, Z@i_D'@ΤD ® z@iD'@tD<

Out[410]=

1

2I-H2 m1 m2 GL I,Ix@1D@tD2 - 2 x@1D@tD x@2D@tD + x@2D@tD2 + y@1D@tD2 - 2 y@1D@tD y@2D@tD +

y@2D@tD2 + z@1D@tD2 - 2 z@1D@tD z@2D@tD + z@2D@tD2MM + m1 x@1D¢@tD2 +

m2 x@2D¢@tD2 + m1 y@1D¢@tD2 + m2 y@2D¢@tD2 + m1 z@1D¢@tD2 + m2 z@2D¢@tD2MFinal check:

In[411]:=

T + V H* Total energy *LFullSimplify@%% == %D

Out[411]=

-m1 m2 G

Hx@1D@tD - x@2D@tDL2 + Hy@1D@tD - y@2D@tDL2 + Hz@1D@tD - z@2D@tDL2

+

1

2m1 Ix@1D¢@tD2 + y@1D¢@tD2 + z@1D¢@tD2M +

1

2m2 Ix@2D¢@tD2 + y@2D¢@tD2 + z@2D¢@tD2M

Out[412]=

True

d) Inertial motion of center of mass from Galilei boost invariance

In[413]:=

q@i_D := x@iD@tDIn[414]:=

Dq@i_D := Head@q@iDD'@tDΦ@Ε, iD = q@iD + Ε a t

D@Φ@Ε, iD, tDL . 8q@i_D ® %%, Dq@i_D ® %<M'@Ε, tD = % - L FullSimplify

M@Ε, tD = Integrate@M'@Ε, tD, tD + C@Unique@DDG = D@ M@Ε, tD, ΕD . Ε ® 0

∆q@i_D = D@Φ@Ε, iD, ΕD . Ε ® 0

âi=1

2

D@L, Dq@iDD ∆q@iD - G Simplify

Print@"Noether: ", %, " is a constant of motion!\nSo we have finally..."DCollect@%% -a Hm1 + m2L, -tD const

Newton, Lagrange, Hamilton and Hamilton-Jacobi Mechanics of Classical Particles with Mathematica.nb 52

Page 53: Newton, Lagrange, Hamilton and Hamilton-Jacobi …o.castera.free.fr/zip/Newton, Lagrange, Hamilton and Hamilton... · Ł Separability of the HJE for a particle attracted to two fixed

Out[415]=

t a Ε + x@iD@tDOut[416]=

a Ε + x@iD¢@tDOut[417]=

m1 m2 G

Hx@1D@tD - x@2D@tDL2 + Hy@1D@tD - y@2D@tDL2 + Hz@1D@tD - z@2D@tDL2

+

1

2m1 IHa Ε + x@1D¢@tDL2 + y@1D¢@tD2 + z@1D¢@tD2M +

1

2m2 IHa Ε + x@2D¢@tDL2 + y@2D¢@tD2 + z@2D¢@tD2M

Out[418]=

1

2a Ε HHm1 + m2L a Ε + 2 m1 x@1D¢@tD + 2 m2 x@2D¢@tDL

Out[419]=

1

2m1 t a2 Ε2 +

1

2m2 t a2 Ε2 + C@$8D + m1 a Ε x@1D@tD + m2 a Ε x@2D@tD

Out[420]=

m1 a x@1D@tD + m2 a x@2D@tDOut[421]=

t a

Out[422]=

a H-m1 x@1D@tD - m2 x@2D@tD + m1 t x@1D¢@tD + m2 t x@2D¢@tDLNoether: a I-m1 x@1D@tD - m2 x@2D@tD + m1 t x@1D¢@tD + m2 t x@2D¢@tDM is a constant of motion!

So we have finally...

Out[424]=

m1 x@1D@tD + m2 x@2D@tDm1 + m2

-t Hm1 x@1D¢@tD + m2 x@2D¢@tDL

m1 + m2 const

In[425]:=

q@i_D := y@iD@tDIn[426]:=

Dq@i_D := Head@q@iDD'@tDΦ@Ε, iD = q@iD + Ε a t

D@Φ@Ε, iD, tDL . 8q@i_D ® %%, Dq@i_D ® %<M'@Ε, tD = % - L FullSimplify

M@Ε, tD = Integrate@M'@Ε, tD, tD + C@Unique@DDG = D@ M@Ε, tD, ΕD . Ε ® 0

∆q@i_D = D@Φ@Ε, iD, ΕD . Ε ® 0

âi=1

2

D@L, Dq@iDD ∆q@iD - G Simplify

Print@"Noether: ", %, " is a constant of motion!\nSo we have finally..."DCollect@%% -a Hm1 + m2L, -tD const

Out[427]=

t a Ε + y@iD@tD

Newton, Lagrange, Hamilton and Hamilton-Jacobi Mechanics of Classical Particles with Mathematica.nb 53

Page 54: Newton, Lagrange, Hamilton and Hamilton-Jacobi …o.castera.free.fr/zip/Newton, Lagrange, Hamilton and Hamilton... · Ł Separability of the HJE for a particle attracted to two fixed

Out[428]=

a Ε + y@iD¢@tDOut[429]=

m1 m2 G

Hx@1D@tD - x@2D@tDL2 + Hy@1D@tD - y@2D@tDL2 + Hz@1D@tD - z@2D@tDL2

+

1

2m1 Ix@1D¢@tD2 + Ha Ε + y@1D¢@tDL2 + z@1D¢@tD2M +

1

2m2 Ix@2D¢@tD2 + Ha Ε + y@2D¢@tDL2 + z@2D¢@tD2M

Out[430]=

1

2a Ε HHm1 + m2L a Ε + 2 m1 y@1D¢@tD + 2 m2 y@2D¢@tDL

Out[431]=

1

2m1 t a2 Ε2 +

1

2m2 t a2 Ε2 + C@$9D + m1 a Ε y@1D@tD + m2 a Ε y@2D@tD

Out[432]=

m1 a y@1D@tD + m2 a y@2D@tDOut[433]=

t a

Out[434]=

a H-m1 y@1D@tD - m2 y@2D@tD + m1 t y@1D¢@tD + m2 t y@2D¢@tDLNoether: a I-m1 y@1D@tD - m2 y@2D@tD + m1 t y@1D¢@tD + m2 t y@2D¢@tDM is a constant of motion!

So we have finally...

Out[436]=

m1 y@1D@tD + m2 y@2D@tDm1 + m2

-t Hm1 y@1D¢@tD + m2 y@2D¢@tDL

m1 + m2 const

In[437]:=

q@i_D := z@iD@tDIn[438]:=

Dq@i_D := Head@q@iDD'@tDΦ@Ε, iD = q@iD + Ε a t

D@Φ@Ε, iD, tDL . 8q@i_D ® %%, Dq@i_D ® %<M'@Ε, tD = % - L FullSimplify

M@Ε, tD = Integrate@M'@Ε, tD, tD + C@Unique@DDG = D@ M@Ε, tD, ΕD . Ε ® 0

∆q@i_D = D@Φ@Ε, iD, ΕD . Ε ® 0

âi=1

2

D@L, Dq@iDD ∆q@iD - G Simplify

Print@"Noether: ", %, " is a constant of motion!\nSo we have finally..."DCollect@%% -a Hm1 + m2L, -tD const

Out[439]=

t a Ε + z@iD@tDOut[440]=

a Ε + z@iD¢@tD

Newton, Lagrange, Hamilton and Hamilton-Jacobi Mechanics of Classical Particles with Mathematica.nb 54

Page 55: Newton, Lagrange, Hamilton and Hamilton-Jacobi …o.castera.free.fr/zip/Newton, Lagrange, Hamilton and Hamilton... · Ł Separability of the HJE for a particle attracted to two fixed

Out[441]=

m1 m2 G

Hx@1D@tD - x@2D@tDL2 + Hy@1D@tD - y@2D@tDL2 + Hz@1D@tD - z@2D@tDL2

+

1

2m1 Ix@1D¢@tD2 + y@1D¢@tD2 + Ha Ε + z@1D¢@tDL2M +

1

2m2 Ix@2D¢@tD2 + y@2D¢@tD2 + Ha Ε + z@2D¢@tDL2M

Out[442]=

1

2a Ε HHm1 + m2L a Ε + 2 m1 z@1D¢@tD + 2 m2 z@2D¢@tDL

Out[443]=

1

2m1 t a2 Ε2 +

1

2m2 t a2 Ε2 + C@$10D + m1 a Ε z@1D@tD + m2 a Ε z@2D@tD

Out[444]=

m1 a z@1D@tD + m2 a z@2D@tDOut[445]=

t a

Out[446]=

a H-m1 z@1D@tD - m2 z@2D@tD + m1 t z@1D¢@tD + m2 t z@2D¢@tDLNoether: a I-m1 z@1D@tD - m2 z@2D@tD + m1 t z@1D¢@tD + m2 t z@2D¢@tDM is a constant of motion!

So we have finally...

Out[448]=

m1 z@1D@tD + m2 z@2D@tDm1 + m2

-t Hm1 z@1D¢@tD + m2 z@2D¢@tDL

m1 + m2 const

The Galilei group has ten parameters inducing ten invariances, so we found the expected ten constants of motion.

Newton, Lagrange, Hamilton and Hamilton-Jacobi Mechanics of Classical Particles with Mathematica.nb 55

Page 56: Newton, Lagrange, Hamilton and Hamilton-Jacobi …o.castera.free.fr/zip/Newton, Lagrange, Hamilton and Hamilton... · Ł Separability of the HJE for a particle attracted to two fixed

III) Hamilton mechanics for classical particles

"The main advantage of the Hamilton formulation is that different theories such as quantum mechanics, statistical

physics, and perturbation theory can be based on this formulation. Hamilton's formulation of classical mechanics also

allows a natural approach to chaotic systems and the question of integrability." Gerd Baumann

A simple 1D Hamiltonian

In[449]:=

Remove@"Global`*"DIn[450]:=

L = m 2 x'@ΤD2 - V@x@ΤDD;Hamilton@L, 8x<, 8p<, ΤD TableForm

Out[451]//TableForm=

x¢@ΤD ®p@ΤDm

p@ΤD22 m

+ V@x@ΤDDx¢@ΤD

p@ΤDm

p¢@ΤD -V¢@x@ΤDD A 2D central force V(r) = - Α/r Hamiltonian

In[452]:=

Remove@"Global`*"DIn[453]:=

$Assumptions = 8m > 0, Α Î Reals, r@tD ³ 0<;T = m 2 Ix¢@tD2 + y¢@tD2M;V = -Α x@tD2 + y@tD2 ;

trafo = 8x ® H r@ð D Cos@Φ@ð DD &L, y ® Hr@ð D Sin@Φ@ð DD &L<;Print@"Lagrangian in Cartesian coordinates:"DPrint@"L = T - V =", T - VDPrint@"Transformation to polar coordinates:"DL = T - V . trafo Simplify Expand ;

Print@"L = ", Collect@%, m 2DDLagrangian in Cartesian coordinates:

L = T-V =Α

x@tD2 + y@tD2

+1

2m Ix¢@tD2 + y¢@tD2M

Transformation to polar coordinates:

L =Α

r@tD +1

2m Ir¢@tD2 + r@tD2 Φ¢@tD2M

pΦ is just Lz in polar coordinates:

In[462]:=

Print@"pr = ", D@L, r'@tDD, ", pΦ = ", D@L, Φ'@tDDD

Newton, Lagrange, Hamilton and Hamilton-Jacobi Mechanics of Classical Particles with Mathematica.nb 56

Page 57: Newton, Lagrange, Hamilton and Hamilton-Jacobi …o.castera.free.fr/zip/Newton, Lagrange, Hamilton and Hamilton... · Ł Separability of the HJE for a particle attracted to two fixed

Print@"pr = ", D@L, r'@tDD, ", pΦ = ", D@L, Φ'@tDDDm 8x@tD, y@tD, 0<8x¢@tD, y¢@tD, 0<% . trafo Simplify

D@L, Φ'@tDD == Last@%Dpr = m r¢@tD, pΦ = m r@tD2 Φ¢@tD

Out[463]=80, 0, m H-y@tD x¢@tD + x@tD y¢@tDL<Out[464]=90, 0, m r@tD2 Φ¢@tD=Out[465]=

True

In[466]:=

Hamilton@L, qL = 8r, Φ<, pð & qL, tD;Print@"Hamiltonian H = ", %@@2DD, "\neqn. of motion: ", %@@3DD TableFormDHamiltonian H = -

Α

r@tD +pr@tD2

2 m+

pΦ@tD2

2 m r@tD2

eqn. of motion:

r¢@tD pr@tDm

Φ¢@tD pΦ@tDm r@tD2HprL¢@tD -

Α

r@tD2 +pΦ@tD2m r@tD3HpΦL¢@tD 0

Note: Φ is cyclic, so pΦ = Lz is a constant of motion.

A simple 3D Hamiltonian

In[468]:=

Remove@"Global`*"DIn[469]:=

L = m 2 I x'@tD2 + y'@tD2 + z'@tD2M - V@x@tD, y@tD, z@tDD;TableForm Rest@Hamilton@L, xL = 8x, y, z<, pð & xL, tDD

Out[470]=

9V@x@tD, y@tD, z@tDD +px@tD2

2 m+py@tD2

2 m+pz@tD2

2 m,

x¢@tD px@tDm

y¢@tD py@tDm

z¢@tD pz@tDmHpxL¢@tD -VH1,0,0L@x@tD, y@tD, z@tDDIpyM¢@tD -VH0,1,0L@x@tD, y@tD, z@tDDHpzL¢@tD -VH0,0,1L@x@tD, y@tD, z@tDD

=

Sliding bead on a wire of the form y = f(x) in a homogenous gravitational field (2D) (see Baumann p.365)

In[471]:=

Remove@"Global`*"DIn[472]:=

T = m 2 Ix'@tD2 + y'@tD2M;

Newton, Lagrange, Hamilton and Hamilton-Jacobi Mechanics of Classical Particles with Mathematica.nb 57

Page 58: Newton, Lagrange, Hamilton and Hamilton-Jacobi …o.castera.free.fr/zip/Newton, Lagrange, Hamilton and Hamilton... · Ł Separability of the HJE for a particle attracted to two fixed

T = m 2 Ix'@tD2 + y'@tD2M;V = m g y@tD;L = T - V . y ® Function@t, f@x@tDDD

Out[474]=

-g m f@x@tDD +1

2m Ix¢@tD2 + f¢@x@tDD2 x¢@tD2M

In[475]:=

TableForm Rest@Hamilton@L, 8x<, 8p<, tDD FullSimplify

Out[475]=

9g m f@x@tDD +p@tD2

2 m + 2 m f¢@x@tDD2,

p@tDm+m f¢@x@tDD2 x¢@tDp¢@tD

f¢@x@tDD -g m2+p@tD2 f¢¢@x@tDDJ1+f¢@x@tDD2N2

m

=If we choose the function f(x) for example as a parabola, we find:

In[476]:=I% . f ® FunctionAx, x2EM Simplify

Out[476]=

9g m x@tD2 +p@tD2

2 m + 8 m x@tD2,

p@tDm+4 m x@tD2 x¢@tDp¢@tD x@tD -2 g m +

4 p@tD2m I1+4 x@tD2M2

= Mass point moving on the surface of a cylinder subject to a linear central force (coil spring) and

gravity (3D) (see Baumann p.367)

In[477]:=

Remove@"Global`*"DIn[478]:=

$Assumptions = 8m > 0, g > 0, k > 0, R > 0<;In[479]:=

T = m 2 Ix¢@tD2 + y¢@tD2 + z¢@tD2M;V = m g z@tD + k 2 IHXS - x@tDL2 + HYS - y@tDL2 + HZS - z@tDL2M;L = T - V . 8x ® H Cos@Θ@ð DD R &L, y ® HSin@Θ@ð DD R &L, z ® Hz@ð D &L< Simplify

Out[481]=

1

2I-k IHXS - R Cos@Θ@tDDL2 + HYS - R Sin@Θ@tDDL2 + HZS - z@tDL2M -

2 g m z@tD + m Iz¢@tD2 + R2 Θ¢@tD2MMIn[482]:=

TableForm Rest@Hamilton@L, xL = 8Θ, z<, pð & xL, tDD

Newton, Lagrange, Hamilton and Hamilton-Jacobi Mechanics of Classical Particles with Mathematica.nb 58

Page 59: Newton, Lagrange, Hamilton and Hamilton-Jacobi …o.castera.free.fr/zip/Newton, Lagrange, Hamilton and Hamilton... · Ł Separability of the HJE for a particle attracted to two fixed

Out[482]=

9k R22

+k XS2

2+k YS2

2+k ZS2

2- k R XS Cos@Θ@tDD - k R YS Sin@Θ@tDD + g m z@tD - k ZS z@tD +

1

2k z@tD2 +

pz@tD2

2 m+pΘ@tD2

2 m R2,

Θ¢@tD pΘ@tDm R2

z¢@tD pz@tDmHpΘL¢@tD k R YS Cos@Θ@tDD - k R XS Sin@Θ@tDDHpzL¢@tD -g m + k ZS - k z@tD

=With the center of the linear force put in the origin and without gravity we get:

In[483]:=

Map@Simplify, 8L, %< . 8XS ® 0, YS ® 0, ZS ® 0, g ® 0<, 1DOut[483]=91

2I-k z@tD2 + m z¢@tD2 + R2 I-k + m Θ¢@tD2MM,

9k m R4 + k m R2 z@tD2 + R2 pz@tD2 + pΘ@tD2

2 m R2,

pΘ@tD m R2 Θ¢@tDpz@tD m z¢@tDHpΘL¢@tD 0

k z@tD + HpzL¢@tD 0

== 1D harmonic oscillator in phase space and space of states

In[484]:=

Remove@"Global`*"DIn[485]:=

T = m 2 x'@tD2;

V = k 2 x@tD2;

Print@"Lagrangian: L = ", L = T - VDLagrangian: L = -

1

2k x@tD2 +

1

2m x¢@tD2

In[488]:=

Print@"Hamiltonian and Hamilton equations:"DH8hamiltonian, eqnMotion< = Rest@Hamilton@L, 8x<, 8p<, tDDL TableForm

Hamiltonian and Hamilton equations:

Out[489]//TableForm=

p@tD22 m

+1

2k x@tD2

x¢@tD p@tDm

p¢@tD -k x@tDIn[490]:=

iniCondition = 8p@0D p0, x@0D x0<;sol = DSolve@eqnMotion~Join~iniCondition, 8x, p<, tD FullSimplify Flatten

Newton, Lagrange, Hamilton and Hamilton-Jacobi Mechanics of Classical Particles with Mathematica.nb 59

Page 60: Newton, Lagrange, Hamilton and Hamilton-Jacobi …o.castera.free.fr/zip/Newton, Lagrange, Hamilton and Hamilton... · Ł Separability of the HJE for a particle attracted to two fixed

Out[491]=

9x ® FunctionA8t<, k m x0 CosA k t

mE + p0 SinA k t

mE

k mE,

p ® FunctionA8t<, p0 CosA k t

mE - k m x0 SinA k t

mEE=

In[492]:=

Block@8k = 1, m = 1, x0 = Random@D, p0 = Random@D<,p1 = ParametricPlot@Evaluate@8x@tD, p@tD< . solD, 8t, 0, tmax = 1.8 Π<,

PlotLabel ® "orbit in phase space QP\nHgreen=START,red=STOPL\n",PlotStyle ® 8Blue<, AxesLabel ® 8"xHtL", "pHtL"<,Epilog ® [email protected], Green, Point@8x0, p0<D,[email protected], Red, Point@8x@tmaxD, p@tmaxD< . solD<<,DisplayFunction ® Identity, AspectRatio ® 1D;

p2 = ParametricPlot3D@Evaluate@88t, x@tD, p@tD<, 80, x@tD, p@tD<< . solD,8t, 0, tmax<, PlotLabel ®

"trajectory in space of states QPT\norbit in phase space QP HprojectionL\n",AxesLabel ® 8"t", " xHtL", " pHtL"<, DisplayFunction ® IdentityD;

Show@GraphicsArray@8p1,

Show@p2, Graphics3D@[email protected], Green, Point@80, x0, p0<D<,[email protected], Pink, Point@80, x@tmaxD, p@tmaxD< . solD<,[email protected], Red, Point@8tmax, x@tmaxD, p@tmaxD< . solD<<DD<D, DisplayFunction ® $DisplayFunction, ImageSize ® maxSizepicDDOut[492]=

-0.5 0.5xHtL

-0.5

0.5

pHtLorbit in phase space QPHgreen=START,red=STOPL

trajectory in space of states QPT

orbit in phase space QP HprojectionL

0

2

4t-0.5

0.00.5

xHtL-0.5

0.0

0.5

pHtL

1D harmonic oscillator with viscous drag

In[493]:=

Remove@"Global`*"DIn[494]:=

Print@"Assumptions: ", $Assumptions = 8m > 0, k ³ 0, a ³ 0<DT = m 2 x¢@tD2;

Newton, Lagrange, Hamilton and Hamilton-Jacobi Mechanics of Classical Particles with Mathematica.nb 60

Page 61: Newton, Lagrange, Hamilton and Hamilton-Jacobi …o.castera.free.fr/zip/Newton, Lagrange, Hamilton and Hamilton... · Ł Separability of the HJE for a particle attracted to two fixed

T = m 2 x¢@tD2;

V = k 2 x@tD2;

Print@"Lagrangian: L = ", L = T - VDPrintA"Dissipation function: F = ", F = a 2 x¢@tD2EAssumptions: 8m > 0, k ³ 0, a ³ 0<Lagrangian: L = -

1

2k x@tD2 +

1

2m x¢@tD2

Dissipation function: F =1

2a x¢@tD2

In[499]:=

Hamilton@L, 8x<, 8p<, tD;Print@"Hamiltonian: H = ", H = %@@2DDDHeqns = 8%%@@3, 1DD,

%%@@3, 2DD . lhs_ rhs_ ® lhs rhs - D@F, x¢@tDD<;Print@"Hamilton equations with dissipation function:"DHeqns TableForm

Hamiltonian: H =p@tD2

2 m+1

2k x@tD2

Hamilton equations with dissipation function:

Out[503]//TableForm=

x¢@tD p@tDm

p¢@tD -k x@tD - a x¢@tDIn[504]:=

solution = First@DSolve@Heqns~Join~8x@0D x0, p@0D p0<, 8x, p<, tDD;rl = a2 - 4 k m ® Β

%%@@2, 1DD@tD HH%%@@2, 2, 2DD . rlL SimplifyL . x0 c_ :> x0 FullSimplify@cDH%%%@@1, 1DD@tD H%%%@@1, 2, 2DD FullSimplifyL . rlLPrint@" ",H% . Hlhs_ rhs_L :> Collect@Numerator@rhsD, p0D Denominator@rhsDLD

Out[505]=

a2 - 4 k m ® Β

Out[506]=

x@tD

ã-t a+ Β

2 m 2 -1 + ãt Β

m p0 + x0 -a + ãt Β

m Ia + Β M + Β

2 Β

Out[507]=

p@tD

ã-a t

2 m Kp0 Β CoshA t Β

2 mE - Ha p0 + 2 k m x0L SinhA t Β

2 mEO

Β

ã-a t

2 m -2 k m x0 SinhB t Β

2 mF + p0 Β CoshB t Β

2 mF - a SinhB t Β

2 mF

Β

In[509]:=

sol = solution . 8m ® 1, g ® 1, k ® 1, a ® .1, x0 ® 1, p0 ® 2<;tmax = 50;

Newton, Lagrange, Hamilton and Hamilton-Jacobi Mechanics of Classical Particles with Mathematica.nb 61

Page 62: Newton, Lagrange, Hamilton and Hamilton-Jacobi …o.castera.free.fr/zip/Newton, Lagrange, Hamilton and Hamilton... · Ł Separability of the HJE for a particle attracted to two fixed

tmax = 50;

ParametricPlot@Evaluate@8x@tD, p@tD< . solD, 8t, 0, tmax<,PlotStyle ® 8Blue<, AxesLabel ® 8x, p<, PlotRange ® All,

PlotLabel ® " Orbit in phase space\nHgreen=START,red=STOPL\n",Epilog ® [email protected], Green, Point@8x@0D, p@0D<D . sol, [email protected], Red,

Point@8x@tmaxD, p@tmaxD<D . sol<, ImageSize ® medSizepic, AspectRatio ® 1DOut[511]=

-1 1 2x

-2

-1

1

2

p

Orbit in phase spaceHgreen=START,red=STOPL

Lots of cute orbits from the problem of the gravitational attraction from two fixed masses (2D)

In[512]:=

Remove@"Global`*"DIn[513]:=

Print@"Assumptions: ", $Assumptions = 8c > 0, m > 0, 8k1, k2< Î Reals<DAssumptions: 8c > 0, m > 0, Hk1 k2L Î Reals<

In[514]:=

T = m 2 Ix¢@tD2 + y¢@tD2M;V = -k1 Hx@tD + cL2 + y@tD2 - k2 Hc - x@tDL2 + y@tD2 ;

Print@"Lagrangian L = ", L = T - VDLagrangian L =

k2

Hc - x@tDL2 + y@tD2

+k1

Hc + x@tDL2 + y@tD2

+1

2m Ix¢@tD2 + y¢@tD2M

Newton, Lagrange, Hamilton and Hamilton-Jacobi Mechanics of Classical Particles with Mathematica.nb 62

Page 63: Newton, Lagrange, Hamilton and Hamilton-Jacobi …o.castera.free.fr/zip/Newton, Lagrange, Hamilton and Hamilton... · Ł Separability of the HJE for a particle attracted to two fixed

In[517]:=

HamiltonAL, 8x, y<, 9px, py=, tEHeqns = %@@3DD;

Out[517]=99x¢@tD ®px@tDm

, y¢@tD ®py@tDm

=,-

k2

c2 - 2 c x@tD + x@tD2 + y@tD2

-k1

c2 + 2 c x@tD + x@tD2 + y@tD2

+px@tD2

2 m+py@tD2

2 m,

9x¢@tD px@tDm

, y¢@tD py@tDm

,

HpxL¢@tD -k2 H-2 c + 2 x@tDL

2 Ic2 - 2 c x@tD + x@tD2 + y@tD2M32 -k1 H2 c + 2 x@tDL

2 Ic2 + 2 c x@tD + x@tD2 + y@tD2M32 ,IpyM¢@tD -

k2 y@tDIc2 - 2 c x@tD + x@tD2 + y@tD2M32 -k1 y@tDIc2 + 2 c x@tD + x@tD2 + y@tD2M32 ==

Some initial conditions leading to interesting orbits:

In[519]:=

iniCondition = 9x@0D 1, y@0D 1, px@0D -1 2 , py@0D -1 3 =;In[520]:=

iniCondition = 9x@0D 1 5, y@0D 5 6, px@0D 1 3 , py@0D 1 3=;In[521]:=

iniCondition = 9x@0D 1, y@0D 2, px@0D 1 10 , py@0D 1 10 =;In[522]:=

iniCondition = 9x@0D 1 5, y@0D 5 6, px@0D 0, py@0D 0=;Now we solve the Hamilton equations numerically and plot the solutions.

In[523]:=

params = 8c ® 1, m ® 1, k1 ® 1, k2 ® 1<tmin = 0; tmax = 50;

iniCondition

sol = NDSolveAHHeqns . paramsL~Join~iniCondition, 9x, y, px, py=, 8t, tmin, tmax<E;PlotAEvaluateA9x@tD, y@tD, px@tD, py@tD= . solE, 8t, tmin, tmax<,PlotStyle ® 8Red, Blue, Magenta, Cyan<, PlotLabel ® "ΞHtL, ΗHtL, pΞHtL, pΗHtL",AxesLabel ® 8"t", None<, ImageSize ® medSizepicE

ParametricPlot@Evaluate@8x@tD, y@tD< . solD, 8t, tmin, tmax<,PlotStyle ® Purple, PlotRange ® 88-2.5, 2.5<, All<,PlotLabel ® "ORBIT HxHtL,yHtLL\n\n", AspectRatio ® Automatic,

Epilog ® [email protected], Black, Point@8-c, 0<D, Point@8c, 0<D,Green, Point@8x@0D, y@0D<D< . sol . paramsL,

AxesLabel ® 8"x", "y"<, ImageSize ® maxSizepic, PlotPoints ® 75DPrint@"t, 8xHtL,yHtL<:"D8t, H8x@tD, y@tD< . solL@@1DD< . t ® tmin8t, H8x@tD, y@tD< . solL@@1DD< . t ® tmax

Out[523]=8c ® 1, m ® 1, k1 ® 1, k2 ® 1<

Newton, Lagrange, Hamilton and Hamilton-Jacobi Mechanics of Classical Particles with Mathematica.nb 63

Page 64: Newton, Lagrange, Hamilton and Hamilton-Jacobi …o.castera.free.fr/zip/Newton, Lagrange, Hamilton and Hamilton... · Ł Separability of the HJE for a particle attracted to two fixed

Out[525]=9x@0D 1

5, y@0D

5

6, px@0D 0, py@0D 0=

Out[527]=

10 20 30 40 50t

-2

-1

1

2

ΞHtL, ΗHtL, pΞHtL, pΗHtL

Out[528]=

-2 -1 1 2x

-0.5

0.5

y

ORBIT HxHtL,yHtLL

t, 8xHtL,yHtL<:Out[530]=80, 80.2, 0.833333<<Out[531]=850, 80.487002, -0.664204<< A pendulum bob suspended from a coil spring and allowed to swing in a vertical plane, assuming

viscous drag on the bob, in polar coordinates (2D) (see Wells p.321)

In[532]:=

Remove@"Global`*"DIn[533]:=

Print@"Assumptions: ", $Assumptions = 8m > 0, g > 0, k ³ 0, r0 ³ 0, a ³ 0, r@tD ³ 0<DT = m 2 Ix¢@tD2 + y¢@tD2M;V = -m g y@tD + k 2 x@tD2 + y@tD2 - r0

2

;

Print@"Lagrangian: L = ", L = T - VDPrintA"Dissipation function: F = ", F = a 2 Ix¢@tD2 + y¢@tD2ME

Newton, Lagrange, Hamilton and Hamilton-Jacobi Mechanics of Classical Particles with Mathematica.nb 64

Page 65: Newton, Lagrange, Hamilton and Hamilton-Jacobi …o.castera.free.fr/zip/Newton, Lagrange, Hamilton and Hamilton... · Ł Separability of the HJE for a particle attracted to two fixed

PrintA"Dissipation function: F = ", F = a 2 Ix¢@tD2 + y¢@tD2MEcoordTrafo = 8

x ® Hr@ð D Sin@Θ@ð DD &L,y ® Hr@ð D Cos@Θ@ð DD &L<;

Print@"Transformation to polar coordinates:"DL = L . coordTrafo Simplify Expand

F = F . coordTrafo Simplify

Assumptions: 8m > 0, g > 0, k ³ 0, r0 ³ 0, a ³ 0, r@tD ³ 0<Lagrangian: L = g m y@tD -

1

2k -r0 + x@tD2 + y@tD2

2

+1

2m Ix¢@tD2 + y¢@tD2M

Dissipation function: F =1

2a Ix¢@tD2 + y¢@tD2M

Transformation to polar coordinates:

Out[540]=

g m Cos@Θ@tDD r@tD -1

2k r@tD2 + k r@tD r0 -

k r02

2+1

2m r¢@tD2 +

1

2m r@tD2 Θ¢@tD2

Out[541]=

1

2a Ir¢@tD2 + r@tD2 Θ¢@tD2M

In[542]:=

Hamilton@L, xL = 8Θ, r<, pð & xL, tD;Print@"Hamiltonian: H = ", H = %@@2DDDHeqns = 8%%@@3, 81, 2<DD,

%%@@3, 3DD . lhs_ rhs_ ® lhs rhs - D@F, %%@@3, 1, 1DDD,%%@@3, 4DD . lhs_ rhs_ ® lhs rhs - D@F, %%@@3, 2, 1DDD< Flatten;

Print@"Hamilton equations with dissipation function:"DHeqns TableForm

Hamiltonian: H = -g m Cos@Θ@tDD r@tD +1

2k r@tD2 - k r@tD r0 +

k r02

2+pr@tD2

2 m+

pΘ@tD2

2 m r@tD2

Hamilton equations with dissipation function:

Out[546]//TableForm=

Θ¢@tD pΘ@tDm r@tD2

r¢@tD pr@tDmHpΘL¢@tD -g m r@tD Sin@Θ@tDD - a r@tD2 Θ¢@tDHprL¢@tD g m Cos@Θ@tDD - k r@tD + k r0 +

pΘ@tD2m r@tD3 - a r¢@tD

Compare with Wells, p.321, Example 16.6 (Ü Warning: sign error).

In[547]:=

params = 8m ® 1, g ® 1, k ® 1, r0 ® 1, a ® 0.3<;tmax = 50;

iniCondition = 8Θ@0D 1, pΘ@0D 2, r@0D 3, pr@0D 4<;sol =

First@NDSolve@HHeqns . paramsL~Join~iniCondition, 8Θ, r, pΘ, pr<, 8t, 0, tmax<DD;Show@GraphicsArray@8ParametricPlot@Evaluate@8Θ@tD, pΘ@tD< . solD,8t, 0, tmax<, PlotStyle ® 8Blue<, AxesLabel ® 8Θ, pΘ<,

PlotRange ® All, DisplayFunction ® Identity,

Epilog ® [email protected], Green, Point@8Θ@0D, pΘ@0D<D . sol, [email protected],Red, <, D,

Newton, Lagrange, Hamilton and Hamilton-Jacobi Mechanics of Classical Particles with Mathematica.nb 65

Page 66: Newton, Lagrange, Hamilton and Hamilton-Jacobi …o.castera.free.fr/zip/Newton, Lagrange, Hamilton and Hamilton... · Ł Separability of the HJE for a particle attracted to two fixed

Epilog ® [email protected], Green, Point@8Θ@0D, pΘ@0D<D . sol, [email protected],Red, Point@8Θ@tmaxD, pΘ@tmaxD<D . sol<, AspectRatio ® 1D,

ParametricPlot@Evaluate@8r@tD, pr@tD< . solD, 8t, 0, tmax<, PlotStyle ® 8Purple<,AxesLabel ® 8r, pr<, PlotRange ® All, DisplayFunction ® Identity, Epilog ®[email protected], Green, Point@8r@0D, pr@0D<D . sol, [email protected], Red,

Point@8r@tmaxD, pr@tmaxD<D . sol<, AspectRatio ® 1D<D, ImageSize ® maxSizepicDOut[551]=

-1.0 -0.5 0.5 1.0Θ

-4

-2

2

2.5 3.0 3.5 4.0 4.5 5.0r

-2

-1

1

2

3

4

pr

2D double simple pendulum exhibits chaotic behavior (see Baumann p.393)

In[552]:=

Remove@"Global`*"DIn[553]:=

$Assumptions = 8m@1D > 0, m@2D > 0, g > 0, l@1D > 0, l@2D > 0<;T = â

i=1

2

m@iD 2 Ix@iD'@tD2 + y@iD'@tD2M;V = â

i=1

2

m@iD g y@iD@tD;coordTrafo = 8

x@1D ® Hl@1D Sin @Θ@1D@ð DD &L,y@1D ® H-l@1D Cos@Θ@1D@ð DD &L,x@2D ® Hl@1D Sin @Θ@1D@ð DD + l@2D Sin @Θ@2D@ð DD &L,y@2D ® H-l@1D Cos@Θ@1D@ð DD - l@2D Cos@Θ@2D@ð DD &L<;

L = T - V . coordTrafo FullSimplify;

Some small manipulation for an easier comparison with the result shown in http://scienceworld.wolfram.com/physics/-

DoublePendulum.html:

In[558]:=

CollectAExpand@LD, 9l@1D2 Θ@1D¢@tD2 2, g Cos@Θ@1D@tDD l@1D =E;"L" == % . h_@i_IntegerD :> hi ; h =!= Derivative . f_@tD ® f TraditionalForm

Out[559]//TraditionalForm=

L g l2 m2 cosHΘ2L + g l1 Hm1 + m2L cosHΘ1L +1

2l12 Hm1 + m2L HHΘ1L¢L2 +

1

2l22 m2 HHΘ2L¢L2 + l1 l2 m2 HΘ2L¢ HΘ1L¢ cosHΘ1 - Θ2L

Ý

Newton, Lagrange, Hamilton and Hamilton-Jacobi Mechanics of Classical Particles with Mathematica.nb 66

Page 67: Newton, Lagrange, Hamilton and Hamilton-Jacobi …o.castera.free.fr/zip/Newton, Lagrange, Hamilton and Hamilton... · Ł Separability of the HJE for a particle attracted to two fixed

Ý

In[560]:=

Hamilton@L, xL = 8Θ@1D, Θ@2D<, pð & xL, tD;H = %@@2DD FullSimplify;

Heqns = %%@@3DD . a_ b_ ® a FullSimplify@bD;H Short

Heqns . a_ b_ ® a Short@bDOut[563]//Short=

-g Cos@Θ@2D@tDD l@2D m@2D - 1 +

l@2D2 m@2D p1@tD2 - 1 + l@1D2 Hm@1D + 1L 12

2 l@1D2 12 m@2D Im@1D + m@2D Sin@1D2MOut[564]=9Θ@1D¢@tD -

2 pΘ@1D@tDl@1D2 H-2 m@1D - m@2D + Cos@2 Θ@1D@tD - 2 Θ@2D@tDD m@2DL +

2 Cos@Θ@1D@tD - 1D pΘ@2D@tD1

,

Θ@2D¢@tD 2 Cos@Θ@1D@tD - Θ@2D@tDD pΘ@1D@tD

l@1D l@2D H-2 m@1D - m@2D + Cos@2 Θ@1D@tD - 2 Θ@2D@tDD m@2DL -

1

1-

2 m@1D p1@tD12 1 H1L,

HpΘ@1DL¢@tD 2 g l@1D m@1D2 Sin@Θ@1D@tDD

-2 m@1D - m@2D + Cos@2 Θ@1D@tD - 2 Θ@2D@tDD m@2D +

29 + 1 +2 m@2D 1 Sin 1 1D 1@tD2

l@2D2 H1L2,

HpΘ@2DL¢@tD 4 g Cos@Θ@1D@tDD l@1D 12 m@2D Sin@2 Θ@1D@tD - 2 Θ@2D@tDDH-2 m@1D - 1 + Cos@1D 1L2

+ 26=Compare with http://scienceworld.wolfram.com/physics/DoublePendulum.html:

In[565]:=

"H" == H . h_@i_IntegerD :> hi ; h =!= Derivative . f_@tD ® f TraditionalForm

Out[565]//TraditionalForm=

H -g l2 m2 cosHΘ2L - g l1 Hm1 + m2L cosHΘ1L +l22 m2 pΘ1

2 + l12 Hm1 + m2L pΘ2

2 - 2 l1 l2 m2 pΘ2pΘ1

cosHΘ1 - Θ2L2 l1

2 l22 m2 Im2 sin2HΘ1 - Θ2L + m1M

In[566]:=

params = 8m@1D ® 1, m@2D ® 1, l@1D ® 1, l@2D ® 1, g ® 1<;tmax = 15;

f@1D = 1; f@2D = 1.01;

Clear@sol, iniConditionDsol@i_D := NDSolve@HHeqns . paramsL~Join~iniCondition@iD,8Θ@1D, Θ@2D, pΘ@1D, pΘ@2D<, 8t, 0, tmax<D; sol1sol2plot := Show@GraphicsArray@8ParametricPlot@Evaluate@8Θ@1D@tD, pΘ@1D@tD< . 8sol@1D, sol@2D<D, 8t, 0, tmax<,

PlotStyle ® 8Green, Red<, AxesLabel ® 8Θ1, pΘ1<, DisplayFunction ® IdentityD,ParametricPlot@Evaluate@8Θ@2D@tD, pΘ@2D@tD< . 8sol@1D, sol@2D<D, 8t, 0, tmax<,PlotStyle ® 8Green, Red<, AxesLabel ® 8Θ2, pΘ2<, DisplayFunction ® IdentityD,

Plot@Evaluate@8Θ@1D@tD, Θ@2D@tD< . 8sol@1D, sol@2D<D, 8t, 0, tmax<,PlotStyle ® 8Green, Green, Red, Red<, AxesLabel ® 8t, "Θ1HtL,Θ2HtL"<,DisplayFunction ® IdentityD<D, ImageSize ® maxSizepicD;

è Regular behavior (green = unperturbed initial conditions, red = +1% perturbed initial conditions):

Newton, Lagrange, Hamilton and Hamilton-Jacobi Mechanics of Classical Particles with Mathematica.nb 67

Page 68: Newton, Lagrange, Hamilton and Hamilton-Jacobi …o.castera.free.fr/zip/Newton, Lagrange, Hamilton and Hamilton... · Ł Separability of the HJE for a particle attracted to two fixed

è

Regular behavior (green = unperturbed initial conditions, red = +1% perturbed initial conditions):

In[571]:=

iniCondition@i_D = 8Θ@1D@0D .02 * f@iD,pΘ@1D@0D .01 * f@iD, Θ@2D@0D -.03 * f@iD, pΘ@2D@0D -.01 * f@iD<;

sol1sol2plot

Out[572]=

-0.02 0.010.02Θ1

-0.02

-0.01

0.01

0.02

pΘ1

-0.03-0.02-0.01 0.010.020.03Θ2

-0.02

-0.01

0.01

0.02

pΘ2

2 4 6 8 10 12 14t

-0.03-0.02-0.01

0.010.020.03

Θ1HtL,Θ2HtL

è Chaotic behavior (green = unperturbed initial conditions, red = +1% perturbed initial conditions):

In[573]:=

iniCondition@i_D =8Θ@1D@0D 2 * f@iD, pΘ@1D@0D 1 * f@iD, Θ@2D@0D -3 * f@iD, pΘ@2D@0D -1 * f@iD<;sol1sol2plot

Out[574]=

-8 -6 -4 -2 2Θ1

-4

-2

2

4

pΘ1

-20 -15 -10 -5Θ2

-2

23

pΘ2

2 4 6 8 101214t

-20

-15

-10

-5

Θ1HtL,Θ2HtL

As you can see, for this particular initial conditions and for the choosen error level predictability is gone for t t 7.

1D chaos: particle moving in a nonlinear potential with external driving force and drag

In[575]:=

Remove@"Global`*"DIn[576]:=

$Assumptions = 8m > 0, Α ³ 0, Ω ³ 0, a ³ 0<;T = m 2 x'@tD2;Hx@tD + 1L2 Hx@tD - 1L2;

Plot@%, 8x@tD, -2, +2<, PlotStyle ® 8Red<,AxesLabel ® 8x, "Potential VHxL"<, ImageSize ® medSizepicD

V = %% - Α Sin@Ω tD x@tD;Print@"Lagrangian: L = ", L = T - VDPrintA"Dissipation function: F = ", F = a 2 x¢@tD2E

Newton, Lagrange, Hamilton and Hamilton-Jacobi Mechanics of Classical Particles with Mathematica.nb 68

Page 69: Newton, Lagrange, Hamilton and Hamilton-Jacobi …o.castera.free.fr/zip/Newton, Lagrange, Hamilton and Hamilton... · Ł Separability of the HJE for a particle attracted to two fixed

Out[579]=

-2 -1 1 2x

2

4

6

8

Potential VHxL

Lagrangian: L = Α Sin@t ΩD x@tD - H-1 + x@tDL2 H1 + x@tDL2 +1

2m x¢@tD2

Dissipation function: F =1

2a x¢@tD2

In[583]:=

Hamilton@L, 8x<, 8p<, tD;Print@"Hamiltonian: H = ", H = %@@2DDDHeqns = 8%%@@3, 1DD,

%%@@3, 2DD . lhs_ rhs_ ® lhs rhs - D@F, x¢@tDD<;Print@"Hamilton equations with dissipation function:"DHeqns TableForm

Hamiltonian: H = 1 +p@tD2

2 m- Α Sin@t ΩD x@tD - 2 x@tD2 + x@tD4

Hamilton equations with dissipation function:

Out[587]//TableForm=

x¢@tD p@tDm

p¢@tD Α Sin@t ΩD + 4 x@tD - 4 x@tD3 - a x¢@tDIn[588]:=

In[589]:=

sol@i_D := NDSolve@HHeqns . paramsL~Join~iniCondition@iD, 8x, p<, 8t, 0, tmax<D;sol1sol2plot :=

Show@GraphicsArray@8ParametricPlot@Evaluate@8x@tD, p@tD< . 8sol@1D, sol@2D<D,8t, 0, tmax<, PlotStyle ® 8Green, Red<, AxesLabel ® 8"xHtL", "pHtL"<,PlotRange ® All, Epilog ® [email protected], Blue, Point@8x@0D, p@0D<D,[email protected], Orange, Point@8x@tmaxD, p@tmaxD<D<< .8sol@1D, sol@2D<L, DisplayFunction ® IdentityD,

Plot@Evaluate@8x@tD< . 8sol@1D, sol@2D<D, 8t, 0, tmax<, PlotStyle ® 8Green, Red<,AxesLabel ® 8t, "x1HtL,x2HtL"<, PlotRange ® All, DisplayFunction ® IdentityD<D, ImageSize ® maxSizepicD;

iniCondition@i_D = 8x@0D 1 * f@iD, p@0D 2 * f@iD<;

Newton, Lagrange, Hamilton and Hamilton-Jacobi Mechanics of Classical Particles with Mathematica.nb 69

Page 70: Newton, Lagrange, Hamilton and Hamilton-Jacobi …o.castera.free.fr/zip/Newton, Lagrange, Hamilton and Hamilton... · Ł Separability of the HJE for a particle attracted to two fixed

In[591]:=

tmax = 50;

f@1D = 1; f@2D = 1.001;

è Regular behavior (green = unperturbed initial conditions, red = + 0.1% perturbed initial conditions, START = blue

dots, STOP = orange dots):

a) With drive and damping:

In[593]:=

params = 8m ® 1, Ω ® 1, Α ® 2.0, a ® 0.09<;sol1sol2plot

Out[594]=

-1.5-1.0-0.5 0.51.01.5xHtL

-2

-1

1

2

3pHtL

10 20 30 40 50t

-1.5

-1.0

-0.5

0.5

1.0

1.5

x1HtL,x2HtL

b) Slightly less drive, but no damping at all:

In[595]:=

params = 8m ® 1, Ω ® 1, Α ® 1.9, a ® 0<;sol1sol2plot

Out[596]=

-1.5-1.0-0.5 0.51.01.5xHtL

-2

-1

1

2

pHtL

10 20 30 40 50t

-1.5

-1.0

-0.5

0.5

1.0

1.5

x1HtL,x2HtL

è Chaotic behavior got by carefully fine tuning the drive and damping parameters (green = unperturbed initial condi-

tions, red = + 0.1% perturbed initial conditions, START = blue dot, STOP = orange dot):

Newton, Lagrange, Hamilton and Hamilton-Jacobi Mechanics of Classical Particles with Mathematica.nb 70

Page 71: Newton, Lagrange, Hamilton and Hamilton-Jacobi …o.castera.free.fr/zip/Newton, Lagrange, Hamilton and Hamilton... · Ł Separability of the HJE for a particle attracted to two fixed

è

Chaotic behavior got by carefully fine tuning the drive and damping parameters (green = unperturbed initial condi-

tions, red = + 0.1% perturbed initial conditions, START = blue dot, STOP = orange dot):

a) With drive and damping:

In[597]:=

params = 8m ® 1, Ω ® 1, Α ® 2.2, a ® 0.08<;sol1sol2plot

Out[598]=

-2 -1 1 2xHtL

-3

-2

-1

1

2

3

pHtL

10 20 30 40 50t

-2

-1

1

2

x1HtL,x2HtL

b) Same drive, but no damping:

In[599]:=

params = 8m ® 1, Ω ® 1, Α ® 2.2, a ® 0<;sol1sol2plot

Out[600]=

-2 -1 1 2xHtL

-3

-2

-1

1

2

3

pHtL

10 20 30 40 50t

-2

-1

1

2x1HtL,x2HtL

In[601]:=

Newton, Lagrange, Hamilton and Hamilton-Jacobi Mechanics of Classical Particles with Mathematica.nb 71

Page 72: Newton, Lagrange, Hamilton and Hamilton-Jacobi …o.castera.free.fr/zip/Newton, Lagrange, Hamilton and Hamilton... · Ł Separability of the HJE for a particle attracted to two fixed

In[602]:=

Phaseplots := HdHue = If@nTraj 1, 0, .8 HnTraj - 1LD;

iniConditions = Table@8x@0D xmax Random@Real, 8-1, 1<D,p@0D pmax Random@Real, 8-1, 1<D<, 8i, nTraj<D;

Trajectories = Table@Append@First@NDSolve@HHeqns . paramsL~Join~iniConditions@@iDD, 8x, p<, 8t, 0, tmax<DD, color ® Hue@Hi - 1L dHueDD, 8i, nTraj<D;

TrajectoriesPlot =

ParametricPlot3D@Evaluate@8t, x@tD, p@tD, color< . TrajectoriesD, 8t, 0, tmax<,PlotLabel ® "Trajectories Ht,xHtL,pHtLL in space of states QPT\n\n",

PlotRange ® 880, tmax<, All, All<,AxesLabel ® 8"t", "xHtL", "pHtL"<, DisplayFunction ® IdentityD;

ifp = [email protected], color, Point@8t, x@tD, p@tD<D< . Trajectories;

IniFiniPointsPlot := Graphics3D@Hifp . t ® 0L~Join~Hifp . t ® tmaxLD;p1 = Show@TrajectoriesPlot, IniFiniPointsPlot, DisplayFunction ® IdentityD;p2 = ParametricPlot@Evaluate@8x@tD, p@tD< . TrajectoriesD,8t, 0, tmax<, PlotStyle ® Hcolor . TrajectoriesL,

PlotLabel ® "Orbits HxHtL,pHtLL\nin phase space

QP\n START = big dot, STOP = small dot\n\n",

PlotRange ® 8All, All<, AxesLabel ® 8"xHtL", "pHtL"<, Epilog ®[email protected], color, Point@8x@0D, p@0D<D<<[email protected], color, Point@8x@tmaxD, p@tmaxD<D<< .TrajectoriesL, DisplayFunction ® IdentityD;

Show@GraphicsArray@8p1, p2<D, ImageSize ® maxSizepicDLIn[603]:=

nTraj = 50; xmax = 2; pmax = 2; tmax = 5;

è With weak damping the phase portrait shows two focuses:

In[604]:=

params = 8m ® 1, Ω ® 1, Α ® 1, a ® 1<;Phaseplots

Out[605]=

Trajectories Ht,xHtL,pHtLL in space of states QPT

02

4

t

-2-1

01xHtL

-2

0

2

pHtL

-2.0-1.5-1.0 0.51.01.5xHtL

-2

-1

1

2

3

pHtL

Orbits HxHtL,pHtLLin phase space QP

START = big dot, STOP = small dot

Note: trajectories in space of states never cross.

Newton, Lagrange, Hamilton and Hamilton-Jacobi Mechanics of Classical Particles with Mathematica.nb 72

Page 73: Newton, Lagrange, Hamilton and Hamilton-Jacobi …o.castera.free.fr/zip/Newton, Lagrange, Hamilton and Hamilton... · Ł Separability of the HJE for a particle attracted to two fixed

Note: trajectories in space of states never cross.

è For strong damping you get two knots in the phase space portrait:

In[606]:=

params = 8m ® 1, Ω ® 1, Α ® .1, a ® 15<;Phaseplots

Out[607]=

Trajectories Ht,xHtL,pHtLL in space of states QPT

0

2

4t

-10

12

xHtL

-2

-1

0

1

2

pHtL-1 1 2

xHtL

-2

-1

1

2pHtL

Orbits HxHtL,pHtLLin phase space QP

START = big dot, STOP = small dot

Poisson bracket: definition and properties

In[608]:=

Remove@"Global`*"DA little test:

In[609]:=

H =p2

2 m+1

2k q2;

98q == PoissonBracket@q, H, 8q<, 8p<D, p == PoissonBracket@p, H, 8q<, 8p<D<,9q == -8H, q<8q<,8p<, p == -8H, p<8q<,8p<==Out[610]=99q

p

m, p -k q=, 9q

p

m, p -k q==

In[611]:=

n = 2;

Print@"list of the q variables: qList = ", qList = Table@q@iD, 8i, 1, n<DDPrint@"list of the p variables: pList = ", pList = Table@p@iD, 8i, 1, n<DDvars = Join@qList, pListD;f1 = vars . List ® f1; f2 = vars . List ® f2;

g1 = vars . List ® g1; g2 = vars . List ® g2;

h1 = vars . List ® h1;

list of the q variables: qList = 8q@1D, q@2D<list of the p variables: pList = 8p@1D, p@2D<

0) Definition of Poisson bracket

Newton, Lagrange, Hamilton and Hamilton-Jacobi Mechanics of Classical Particles with Mathematica.nb 73

Page 74: Newton, Lagrange, Hamilton and Hamilton-Jacobi …o.castera.free.fr/zip/Newton, Lagrange, Hamilton and Hamilton... · Ł Separability of the HJE for a particle attracted to two fixed

0) Definition of Poisson bracket

In[618]:=8f1, g1<qList,pList

Out[618]=

g1H0,0,0,1L@q@1D, q@2D, p@1D, p@2DD f1H0,1,0,0L@q@1D, q@2D, p@1D, p@2DD -

f1H0,0,0,1L@q@1D, q@2D, p@1D, p@2DD g1H0,1,0,0L@q@1D, q@2D, p@1D, p@2DD +

g1H0,0,1,0L@q@1D, q@2D, p@1D, p@2DD f1H1,0,0,0L@q@1D, q@2D, p@1D, p@2DD -

f1H0,0,1,0L@q@1D, q@2D, p@1D, p@2DD g1H1,0,0,0L@q@1D, q@2D, p@1D, p@2DD1) Constants kill Poisson bracket

In[619]:=8const, g1<qList,pList

Out[619]=

0

2) Poisson bracket is anti-commutative

In[620]:=8f1, g1<qList,pList -8g1, f1<qList,pList

Out[620]=

True

3) Poisson bracket is bilinear

In[621]:=8a f1 + b f2, g1<qList,pList a 8f1, g1<qList,pList + b 8f2, g1<qList,pList Simplify

8f1, a g1 + b g2<qList,pList a 8f1, g1<qList,pList + b 8f1, g2<qList,pList Simplify

Out[621]=

True

Out[622]=

True

4) Jacobi identity

In[623]:=9f1, 8g1, h1<qList,pList=qList,pList

+ 9g1, 8h1, f1<qList,pList=qList,pList

+

9h1, 8f1, g1<qList,pList=qList,pList

0 Simplify

Out[623]=

True

5) Leibniz's rule

In[624]:=8f1, g1 h1<qList,pList == 8f1, g1<qList,pList h1 + g1 8f1, h1<qList,pList Simplify

Out[624]=

True

Newton, Lagrange, Hamilton and Hamilton-Jacobi Mechanics of Classical Particles with Mathematica.nb 74

Page 75: Newton, Lagrange, Hamilton and Hamilton-Jacobi …o.castera.free.fr/zip/Newton, Lagrange, Hamilton and Hamilton... · Ł Separability of the HJE for a particle attracted to two fixed

6) Partial derivatives of a (possibly time-dependent) phase-space function

In[625]:=

fun = Append@vars, tD . List ® fI8fun, ð <qList,pListM 8fun, ð <"qList,pList" & Join@pList, -qListD TableForm

Out[625]=

f@q@1D, q@2D, p@1D, p@2D, tDOut[626]//TableForm=

fH1,0,0,0,0L@q@1D, q@2D, p@1D, p@2D, tD 8f@q@1D, q@2D, p@1D, p@2D, tD, p@1D<qList,pList

fH0,1,0,0,0L@q@1D, q@2D, p@1D, p@2D, tD 8f@q@1D, q@2D, p@1D, p@2D, tD, p@2D<qList,pList

fH0,0,1,0,0L@q@1D, q@2D, p@1D, p@2D, tD 8f@q@1D, q@2D, p@1D, p@2D, tD, -q@1D<qList,pList

fH0,0,0,1,0L@q@1D, q@2D, p@1D, p@2D, tD 8f@q@1D, q@2D, p@1D, p@2D, tD, -q@2D<qList,pList

7) Fundamental Poisson brackets

In[627]:=

TableFormAOuterA8ð1, ð2< == 8ð1, ð2<qList,pList &, vars, varsE, TableSpacing -> 84, 1<EOut[627]//TableForm=8q@1D, q@1D< 0 8q@1D, q@2D< 0 8q@1D, p@1D< 1 8q@1D, p@2D< 0

8q@2D, q@1D< 0 8q@2D, q@2D< 0 8q@2D, p@1D< 0 8q@2D, p@2D< 1

8p@1D, q@1D< -1 8p@1D, q@2D< 0 8p@1D, p@1D< 0 8p@1D, p@2D< 0

8p@2D, q@1D< 0 8p@2D, q@2D< -1 8p@2D, p@1D< 0 8p@2D, p@2D< 0

Poisson bracket: Total energy, angular momentum and Runge-Lenz vector in the Α/r potential (see Tong p.95 and Goldstein&Poole&Safko p.102)

In[628]:=

Remove@"Global`*"DLagrangian of the Α/r potential in Cartesian coordinates:

In[629]:=

$Assumptions = 8m > 0, Α Î Reals<;T = m 2 Ix¢@tD2 + y¢@tD2 + z¢@tD2M;V = Α x@tD2 + y@tD2 + z@tD2 ;

L = T - V

Out[632]=

x@tD2 + y@tD2 + z@tD2

+1

2m Ix¢@tD2 + y¢@tD2 + z¢@tD2M

Hamilonian and equations of motion:

In[633]:=

q = 8x@tD, y@tD, z@tD<; p = 8px@tD, py@tD, pz@tD<; qp = Join@q, pD;In[634]:=

Hamilton@L, q . s_@tD ® s, p . s_@tD ® s, tD;H@tD = %@@2DD; Heqns = %@@3DD;

Newton, Lagrange, Hamilton and Hamilton-Jacobi Mechanics of Classical Particles with Mathematica.nb 75

Page 76: Newton, Lagrange, Hamilton and Hamilton-Jacobi …o.castera.free.fr/zip/Newton, Lagrange, Hamilton and Hamilton... · Ł Separability of the HJE for a particle attracted to two fixed

H@tD = %@@2DD; Heqns = %@@3DD;8H@tD, TableForm@HeqnsD<pRule = Solve@Heqns, Union@p, D@ð, tD &pDD First;

% Short

Out[636]=

9px@tD2

2 m+py@tD2

2 m+pz@tD2

2 m+

Α

x@tD2 + y@tD2 + z@tD2

,

x¢@tD px@tD

m

y¢@tD py@tD

m

z¢@tD pz@tD

m

px¢@tD Α x@tDIx@tD2+y@tD2+z@tD2M32

py¢@tD Α y@tDIx@tD2+y@tD2+z@tD2M32

pz¢@tD Α z@tDIx@tD2+y@tD2+z@tD2M32

=

Out[638]//Short=9px@tD ® m x¢@tD, py@tD ® m y¢@tD, pz@tD ® m z¢@tD, px¢@tD ®Α 1 1

1,

py¢@tD ®Α y@tDH1L32 , pz¢@tD ®

Α z@tDIx@tD2 + 12 + 12M32 =Definition of total energy, angular momentum and Runge-Lenz vector:

In[639]:=

ETotal@tD = Α x@tD2 + y@tD2 + z@tD2 + Ipx@tD2 + py@tD2 + pz@tD2M H2 mL8Lx@tD, Ly@tD, Lz@tD< = 8x@tD, y@tD, z@tD<8px@tD, py@tD, pz@tD<8Ax@tD, Ay@tD, Az@tD< = 8px@tD, py@tD, pz@tD<8Lx@tD, Ly@tD, Lz@tD< +

Α m 8x@tD, y@tD, z@tD< x@tD2 + y@tD2 + z@tD2

Out[639]=

px@tD2 + py@tD2 + pz@tD2

2 m+

Α

x@tD2 + y@tD2 + z@tD2

Out[640]=8pz@tD y@tD - py@tD z@tD, -pz@tD x@tD + px@tD z@tD, py@tD x@tD - px@tD y@tD<Out[641]=9py@tD2 x@tD + pz@tD2 x@tD - px@tD py@tD y@tD - px@tD pz@tD z@tD +

m Α x@tDx@tD2 + y@tD2 + z@tD2

,

-px@tD py@tD x@tD + px@tD2 y@tD + pz@tD2 y@tD - py@tD pz@tD z@tD +m Α y@tD

x@tD2 + y@tD2 + z@tD2

,

-px@tD pz@tD x@tD - py@tD pz@tD y@tD + px@tD2 z@tD + py@tD2 z@tD +m Α z@tD

x@tD2 + y@tD2 + z@tD2

=Definition of Poisson bracket and time evolution of phase-space functions:

In[642]:=

PB@f_, g_D := D@f, 8q<D.D@g, 8p<D - D@f, 8p<D.D@g, 8q<D Simplify

fEvolution@f_D := H-PB@H@tD, fD + D@f, tDL . pRule Simplify

Total energy, angular momentum and Runge-Lenz vector are indeed constants of motion:

Newton, Lagrange, Hamilton and Hamilton-Jacobi Mechanics of Classical Particles with Mathematica.nb 76

Page 77: Newton, Lagrange, Hamilton and Hamilton-Jacobi …o.castera.free.fr/zip/Newton, Lagrange, Hamilton and Hamilton... · Ł Separability of the HJE for a particle attracted to two fixed

Total energy, angular momentum and Runge-Lenz vector are indeed constants of motion:

In[644]:=

fEvolution@ð D & 8ETotal@tD, Lx@tD, Ly@tD, Lz@tD, Ax@tD, Ay@tD, Az@tD<Out[644]=80, 0, 0, 0, 0, 0, 0<Note: The Hamiltonian has a hidden SO(4) symmetry group responsible for the conservation of the Runge-Lenz vector.

We found 7 constants for a motion in a 6D phase space; there must be 2 relations between the constants to get a 1D

trajectory:

In[645]:=8Lx@tD, Ly@tD, Lz@tD<.8Ax@tD, Ay@tD, Az@tD< 0 Simplify8Ax@tD, Ay@tD, Az@tD<.8Ax@tD, Ay@tD, Az@tD<

Α2 m2 + 2 m ETotal@tD 8Lx@tD, Ly@tD, Lz@tD<.8Lx@tD, Ly@tD, Lz@tD< Simplify

Out[645]=

True

Out[646]=

True

Hamiltonian is here equal to total energy (and a constant of motion); equations of motion get by Poisson bracket:

In[647]:=

H@tD == ETotal@tD Simplify

fEvolution@H@tDDHð ' -PB@H@tD, ð DL & qp == Heqns . Derivative@1D@f_D@tD ® Derivative@1D@f@tDDOut[647]=

True

Out[648]=

0

Out[649]=

True

Interesting things about the angular momentum:

In[650]:=

fEvolutionALTotal@tD = Lx@tD2 + Ly@tD2 + Lz@tD2EPB@Lx@tD, Ly@tDD Lz@tDPB@LTotal@tD, ð D & 8Lx@tD, Ly@tD, Lz@tD<

Out[650]=

0

Out[651]=

True

Out[652]=80, 0, 0<Let's verify our results in a specific example:

Newton, Lagrange, Hamilton and Hamilton-Jacobi Mechanics of Classical Particles with Mathematica.nb 77

Page 78: Newton, Lagrange, Hamilton and Hamilton-Jacobi …o.castera.free.fr/zip/Newton, Lagrange, Hamilton and Hamilton... · Ł Separability of the HJE for a particle attracted to two fixed

In[653]:=

params = 8m ® 1, Α ® -1<;H* random initial conditions *LiniCondition = 8

x@0D Random@Real, 8-1, 1<D, px@0D 1.5 Random@Real, 8-1, 1<D,y@0D Random@Real, 8-1, 1<D, py@0D 1.5 Random@Real, 8-1, 1<D,z@0D Random@Real, 8-1, 1<D, pz@0D 1.5 Random@Real, 8-1, 1<D<H* nice initial conditions *L

iniCondition = 8x@0D 0.116, px@0D 0.631,

y@0D -0.028, py@0D 1.090,

z@0D -0.552, pz@0D 0.863<tmax = 5;

sol = NDSolve@HHeqns . paramsL~Join~iniCondition, qp, 8t, 0, tmax<D@@1DD8ETotal@tD, 8Lx@tD, Ly@tD, Lz@tD<, 8Ax@tD, Ay@tD, Az@tD<< . sol . params;

tr = Random@D tmax; TableForm@88ET, L, A< = H% . t ® 0L, % . t ® tr, % . t ® tmax<,TableHeadings ® 88to, "t=" <> ToString@trD, tmax<,8"total energy\n", "angular momentum", "Runge-Lenz vector"<<D

Show@ParametricPlot3D@Evaluate@8x@tD, y@tD, z@tD, Red< . solD,8t, 0, tmax<, PlotPoints ® 150, PlotRange ® 1.3 88-1, 1<, 8-1, 1<, 8-1, 1<<,AxesLabel ® 8x, y, z<, DisplayFunction ® IdentityD,

Graphics3D@8Blue, Line@8q, q + p< . sol . t ® 0D<D,Graphics3D@8Green, Line@880, 0, 0<, L<D<D,Graphics3D@8Magenta, Line@880, 0, 0<, A<D<D,PlotLabel ®

"Orbit, initial linear momentum,\nangular momentum, Runge-Lenz vector\n",

DisplayFunction ® $DisplayFunction, ImageSize ® medSizepicDOut[654]=8x@0D -0.710462, px@0D 0.601706, y@0D -0.538144,

py@0D 1.42035, z@0D 0.472208, pz@0D -0.73466<Out[655]=8x@0D 0.116, px@0D 0.631, y@0D -0.028,

py@0D 1.09, z@0D -0.552, pz@0D 0.863<Out[657]=8x@tD ® InterpolatingFunction@880., 5.<<, <>D@tD,

y@tD ® InterpolatingFunction@880., 5.<<, <>D@tD,z@tD ® InterpolatingFunction@880., 5.<<, <>D@tD,px@tD ® InterpolatingFunction@880., 5.<<, <>D@tD,py@tD ® InterpolatingFunction@880., 5.<<, <>D@tD,pz@tD ® InterpolatingFunction@880., 5.<<, <>D@tD<

Newton, Lagrange, Hamilton and Hamilton-Jacobi Mechanics of Classical Particles with Mathematica.nb 78

Page 79: Newton, Lagrange, Hamilton and Hamilton-Jacobi …o.castera.free.fr/zip/Newton, Lagrange, Hamilton and Hamilton... · Ł Separability of the HJE for a particle attracted to two fixed

Out[659]//TableForm=

total energy angular momentum Runge-Lenz vector

to -0.6051760.577516-0.448420.144108

0.3386640.4570440.064976

t=3.09101 -0.6051760.577516-0.448420.144108

0.3386640.4570430.0649759

tmax -0.6051760.577516-0.448420.144108

0.3386640.4570440.0649761

Out[660]=

Orbit, initial linear momentum,

angular momentum, Runge-Lenz vector

-1

0

1

x

-1

0

1

y

-1

0

1

z

Note: The Runge-Lenz vector points from the focus to the perigean.

A canonical transformation for the 1D damped harmonic oscillator with an ad hoc Hamiltonian and Q, P = 1 (see Greiner p.373)

WARNING: Canonical transformations are a rather muddy terrain: varying nomenclature, slight, but important differ-

ences in the fundamental definitions and a widespread use of proofs flawed by fallacies can You easy get stuck. (For

more details see Torres del Castillo and the footnotes in Arnold § 44 and § 45.) Anyway, the basic ideas are easy to

grasp and I present here a few examples.

Newton, Lagrange, Hamilton and Hamilton-Jacobi Mechanics of Classical Particles with Mathematica.nb 79

Page 80: Newton, Lagrange, Hamilton and Hamilton-Jacobi …o.castera.free.fr/zip/Newton, Lagrange, Hamilton and Hamilton... · Ł Separability of the HJE for a particle attracted to two fixed

In[661]:=

Remove@"Global`*"DIn[662]:=

Print@"Assumptions: ", $Assumptions = 8m > 0, Γ ³ 0, Ω ³ 0, t Î Reals<DSetAttributes@8m, Γ, Ω<, ConstantDAssumptions: 8m > 0, Γ ³ 0, Ω ³ 0, t Î Reals<

An ad hoc Hamiltonian H(q, p, t) for the 1D damped harmonic oscillator is given by:

In[664]:=

:"HHqHtL,pHtL,tL = ", H =p@tD2

2 mã-2 Γ t +

1

2m Ω2 ã2 Γ t q@tD2>

Out[664]=9HHqHtL,pHtL,tL = ,ã-2 t Γ p@tD2

2 m+1

2ã2 t Γ m Ω2 q@tD2=

The canonical equations for this dynamical system are:

In[665]:=9"q'HtL=", D1q@tD = ¶p@tDH, "p'HtL=", D1p@tD = -¶q@tDH=Out[665]=

9q'HtL=,ã-2 t Γ p@tD

m, p'HtL=, -ã2 t Γ m Ω2 q@tD=

Combining this two equations we obtain the equation of motion of the damped harmonic oscillator in its usual form...

In[666]:=

Solve@D1q@tD q'@tD, p@tDD@@1, 1DD . Rule ® Equal

D@ð, tD & %

%@@2DD == D1p@tD% Simplify

Out[666]=

p@tD ã2 t Γ m q¢@tDOut[667]=

p¢@tD 2 ã2 t Γ m Γ q¢@tD + ã2 t Γ m q¢¢@tDOut[668]=

2 ã2 t Γ m Γ q¢@tD + ã2 t Γ m q¢¢@tD -ã2 t Γ m Ω2 q@tDOut[669]=

Ω2 q@tD + 2 Γ q¢@tD + q¢¢@tD 0

...but we don't solve this equation for q(t) by the usual means, instead we will use the solution method via canonicaltransformation as an example!

An appropriate canonical transformation is based on a generating function of type F2

In[670]:=

PrintB"F2HqHtL,PHtL,tL = ", F2 = ãΓ t q@tD P@tD -1

2m Γ ã2 Γ t q@tD2F

F2HqHtL,PHtL,tL = ãt Γ P@tD q@tD -1

2ã2 t Γ m Γ q@tD2

F2 generates a canonical coordinate transformation (q,p,t) ® (Q,P,t) ...

Newton, Lagrange, Hamilton and Hamilton-Jacobi Mechanics of Classical Particles with Mathematica.nb 80

Page 81: Newton, Lagrange, Hamilton and Hamilton-Jacobi …o.castera.free.fr/zip/Newton, Lagrange, Hamilton and Hamilton... · Ł Separability of the HJE for a particle attracted to two fixed

F2 generates a canonical coordinate transformation (q,p,t) ® (Q,P,t) ...

In[671]:=

A = 9p@tD == ¶q@tDF2, Q@tD ¶P@tDF2=Hold2newTrafo = Solve@A, 8p@tD, q@tD<D@@1DDL TableForm

Out[671]=9p@tD ãt Γ P@tD - ã2 t Γ m Γ q@tD, Q@tD ãt Γ q@tD=Out[672]//TableForm=

p@tD ® ãt Γ HP@tD - m Γ Q@tDLq@tD ® ã-t Γ Q@tD

... with back transformation (Q,P,t) ® (q,p,t) ...

In[673]:=Hnew2oldTrafo = Solve@A, 8P@tD, Q@tD<D@@1DDL TableForm

Out[673]//TableForm=

P@tD ® ã-t Γ Ip@tD + ã2 t Γ m Γ q@tDMQ@tD ® ãt Γ q@tD

...and a new Hamiltonian K(Q, P, t) ("Kamiltonian"):

In[674]:=

Print@"K - H = ", KminusH = ¶tF2 . 8P¢@tD ® 0, q¢@tD ® 0< . old2newTrafoDPrintB"KHQHtL,PHtL,tL = ", K = H + KminusH . old2newTrafo Expand,

" = ", K = Simplify@KD . I-Γ2 + Ω2M ® Ω2 ExpandF

K - H = Γ P@tD Q@tD - m Γ2 Q@tD2

KHQHtL,PHtL,tL =P@tD2

2 m-1

2m Γ2 Q@tD2 +

1

2m Ω2 Q@tD2 =

P@tD2

2 m+1

2m Ω

2Q@tD2

The transformed Hamiltonian K(Q, P, t) "emerges as exactly the Hamiltonian of an undamped harmonic oscillator with

angular frequency Ω = Ω2 - Γ2 . Its solution is already known" (Greiner).

Note: In ¶ F2 ¶t the variables P(t) and q(t) are held fixed (P'(t) = 0, q'(t) = 0), otherwise You get the following

wrong result:

In[676]:=

¶t F2

Out[676]=

ãt Γ Γ P@tD q@tD - ã2 t Γ m Γ2 q@tD2 + ãt Γ q@tD P¢@tD + ãt Γ P@tD q¢@tD - ã2 t Γ m Γ q@tD q¢@tDLet's check the Poisson brackets of the transformed canonical conjugated coordinates:

Newton, Lagrange, Hamilton and Hamilton-Jacobi Mechanics of Classical Particles with Mathematica.nb 81

Page 82: Newton, Lagrange, Hamilton and Hamilton-Jacobi …o.castera.free.fr/zip/Newton, Lagrange, Hamilton and Hamilton... · Ł Separability of the HJE for a particle attracted to two fixed

In[677]:=8Q@tD . new2oldTrafo, P@tD . new2oldTrafo<8q@tD<,8p@tD<8Q@tD . new2oldTrafo, Q@tD . new2oldTrafo<8q@tD<,8p@tD<8P@tD . new2oldTrafo, P@tD . new2oldTrafo<8q@tD<,8p@tD<Out[677]=

1

Out[678]=

0

Out[679]=

0

We choose some simple initial conditions in the old coordinates, transform them to the new coordinates and solve the

new canonical equations:

In[680]:=

newIni = new2oldTrafo . t ® 0 . HoldIni = 8q@0D ® 0, p@0D ® 1<L . Rule ® Equal;8Q'@tD == ¶P@tDK, P'@tD -¶Q@tDK< Ü newIni

A = DSolve@%, 8Q@tD, P@tD<, tD@@1DD . Rule ® Equal

Out[681]=9P@0D 1, Q@0D 0, P¢@tD -m Ω2

Q@tD, Q¢@tD P@tDm

=Out[682]=

9P@tD CosAt ΩE, Q@tD

SinAt ΩE

m Ω =

Back transformation yields to the solution in the old coordinates:

In[683]:=

Solve@A . new2oldTrafo, 8q@tD, p@tD<D Simplify

Out[683]=

99p@tD ®ãt Γ ICosAt Ω

E Ω

- Γ SinAt ΩEM

Ω , q@tD ®

ã-t Γ SinAt ΩE

m Ω ==

, which satisfies the Hamilton equations in the old coordinates with the choosen initial conditions given by

In[684]:=

oldIni

Out[684]=8q@0D ® 0, p@0D ® 1<Note: Here the canonical momentum no longer coincides with the kinetic momentum, if Γ ¹ 0!

For a more impressive example of the solution method via canonical transformation see Greiner p.440 (time-dependent

harmonic oscillator with also time-dependent damping coefficient).

Question: Is dF = P dQ - K dt - (p dq - H dt) an exact differential?

Newton, Lagrange, Hamilton and Hamilton-Jacobi Mechanics of Classical Particles with Mathematica.nb 82

Page 83: Newton, Lagrange, Hamilton and Hamilton-Jacobi …o.castera.free.fr/zip/Newton, Lagrange, Hamilton and Hamilton... · Ł Separability of the HJE for a particle attracted to two fixed

In[685]:=

rl = new2oldTrafo . f_@tD ® f

H = H . f_@tD ® f

K = K . new2oldTrafo . Ω2

® I-Γ2 + Ω2M . f_@tD ® f

Out[685]=9P ® ã-t Γ Ip + ã2 t Γ m q ΓM, Q ® ãt Γ q=Out[686]=

ã-2 t Γ p2

2 m+1

2ã2 t Γ m q2 Ω2

Out[687]=

ã-2 t Γ Ip + ã2 t Γ m q ΓM2

2 m+1

2ã2 t Γ m q2 I-Γ2 + Ω2M

We apply the standard criterion for a differential form to be exact to dF = P dQ - K dt - (p dq - H dt):

In[688]:=

P Dt@QD - K Dt@tD - Hp Dt@qD - H Dt@tDL . rl Expand

% TraditionalForm

D@%%@@1DD Dt@qD, tD D@%%@@2DD Dt@tD, qD Simplify

Out[688]=

ã2 t Γ m q Γ Dt@qD + ã2 t Γ m q2 Γ2 Dt@tDOut[689]//TraditionalForm=

m q2 Γ2 ã2 t Γ â t + m q Γ â q ã2 t Γ

Out[690]=

True

By considering the coefficients of dq and dt we verify that dF is indeed an exact differential.

A canonical transformation for the 1D harmonic oscillator with Q, P = 1

In[691]:=

Remove@"Global`*"DIn[692]:=

Print@"Assumptions: ", $Assumptions = 8m > 0, Ω ³ 0<, " and constants."DSetAttributes@8m, Ω<, ConstantDAssumptions: 8m > 0, Ω ³ 0< and constants.

In[694]:=

PrintB"Hamiltonian HHq,pL = ", H =1

2 mp2 +

m

2Ω2 q2F

Hamiltonian HHq,pL =p2

2 m+1

2m q2 Ω2

In[695]:=

PrintB"Generating function F1HQ,qL = ", F1 =m

2Ω q2 Cot@QDF

Generating function F1HQ,qL =1

2m q2 Ω Cot@QD

Newton, Lagrange, Hamilton and Hamilton-Jacobi Mechanics of Classical Particles with Mathematica.nb 83

Page 84: Newton, Lagrange, Hamilton and Hamilton-Jacobi …o.castera.free.fr/zip/Newton, Lagrange, Hamilton and Hamilton... · Ł Separability of the HJE for a particle attracted to two fixed

In[696]:=

PrintA"p = ¶q F1, P = -¶Q F1, K - H = ¶t F1"EPrint@HA = 8p == D@F1, qD, P == -D@F1, QD<L, ", K -H = ", D@F1, tDDSolve@A, 8q, p<D Simplify

Print@"Forward transformation:"DHold2newTrafo = %%@@2DD ReverseL TableForm

Print@"Back transformation:"DSolve@A, P, QD@@1DD;Solve@A@@1DD . %, QD@@1DD;Hnew2oldTrafo = Join@%, %%DL TableForm

Print@"Transformed Hamiltonian:\nKHQ,PL = ",

K = H + ¶t F1 . old2newTrafo SimplifyDp = ¶q F1, P = -¶Q F1, K-H = ¶t F1

:p m q Ω Cot@QD, P 1

2m q2 Ω Csc@QD2>, K-H = 0

Out[698]=

99p ® - 2 m P Ω Cos@QD, q ® -2 P Sin@QD

m Ω=,

9p ® 2 m P Ω Cos@QD, q ®2 P Sin@QD

m Ω==

Forward transformation:

Out[700]//TableForm=

q ®2 P Sin@QD

m Ω

p ® 2 m P Ω Cos@QDBack transformation:

Out[704]//TableForm=

Q ® ArcCotA p

m q ΩE

P ®p2+m2 q2 Ω2

2 m Ω

Transformed Hamiltonian:

KHQ,PL = P Ω

Note: Q is cyclic.

Poisson brackets Q, P, Q, Q, P, P:

Newton, Lagrange, Hamilton and Hamilton-Jacobi Mechanics of Classical Particles with Mathematica.nb 84

Page 85: Newton, Lagrange, Hamilton and Hamilton-Jacobi …o.castera.free.fr/zip/Newton, Lagrange, Hamilton and Hamilton... · Ł Separability of the HJE for a particle attracted to two fixed

In[706]:=8Q . new2oldTrafo, P . new2oldTrafo<8q<,8p< Simplify

8Q . new2oldTrafo, Q . new2oldTrafo<8q<,8p<8P . new2oldTrafo, P . new2oldTrafo<8q<,8p<Out[706]=

1

Out[707]=

0

Out[708]=

0

Question: Is dF = P dQ - K dt - (p dq - H dt) an exact differential?

We apply the standard criterion for a differential form to be exact:

In[709]:=

A = P Dt@QD - K Dt@tD - Hp Dt@qD - H Dt@tDL . old2newTrafo Simplify;HDt@FD == AL TraditionalForm

D@A@@1DD Dt@QD, PD == D@A@@2DD Dt@PD, QD% Simplify

Out[710]//TraditionalForm=

â F -P â Q cosH2 QL - â P sinHQL cosHQLOut[711]=

-Cos@2 QD -Cos@QD2 + Sin@QD2

Out[712]=

True

By considering the coefficients of dQ and dP we verify that dF is indeed an exact differential.

A canonical transformation for the 1D q-2 2 potential with Q, P = 1

In[713]:=

Remove@"Global`*"DIn[714]:=

PrintA"Hamiltonian HHq,pL = ", H = p2 2 + q-2 2EHamiltonian HHq,pL =

p2

2+

1

2 q2

Newton, Lagrange, Hamilton and Hamilton-Jacobi Mechanics of Classical Particles with Mathematica.nb 85

Page 86: Newton, Lagrange, Hamilton and Hamilton-Jacobi …o.castera.free.fr/zip/Newton, Lagrange, Hamilton and Hamilton... · Ł Separability of the HJE for a particle attracted to two fixed

In[715]:=

Print@"Generating function F2Hq,PL = ", F2 = P Log@qDDPrintA"p = ¶q F2, Q = ¶P F2, K -H = ¶t F2"EPrint@HA = 8p == D@F2, qD, Q == D@F2, PD<L, ", K - H = ", D@F2, tDDPrint@"Forward transformation:"DHold2newTrafo = Solve@A, 8q, p<D@@1DD ReverseL TableForm

Print@"Back transformation:"DHnew2oldTrafo = Solve@A, 8Q, P<D@@1DD ReverseL TableForm

Print@"Transformed Hamiltonian:\nKHQ,PL = ",

K = H + ¶t F2 . old2newTrafo SimplifyDGenerating function F2Hq,PL = P Log@qDp = ¶q F2, Q = ¶P F2, K-H = ¶t F2

:p P

q, Q Log@qD>, K-H = 0

Forward transformation:

Out[719]//TableForm=

q ® ãQ

p ® ã-Q P

Back transformation:

Out[721]//TableForm=

Q ® Log@qDP ® p q

Transformed Hamiltonian:

KHQ,PL =1

2ã-2 Q I1 + P2M

Poisson brackets Q, P, Q, Q, P, P:

In[723]:=8Q . new2oldTrafo, P . new2oldTrafo<8q<,8p<8Q . new2oldTrafo, Q . new2oldTrafo<8q<,8p<8P . new2oldTrafo, P . new2oldTrafo<8q<,8p<Out[723]=

1

Out[724]=

0

Out[725]=

0

Question: Is dF = P dQ - K dt - (p dq - H dt) an exact differential?

We apply the standard criterion for a differential form to be exact:

Newton, Lagrange, Hamilton and Hamilton-Jacobi Mechanics of Classical Particles with Mathematica.nb 86

Page 87: Newton, Lagrange, Hamilton and Hamilton-Jacobi …o.castera.free.fr/zip/Newton, Lagrange, Hamilton and Hamilton... · Ł Separability of the HJE for a particle attracted to two fixed

In[726]:=

P Dt@QD - K Dt@tD - Hp Dt@qD - H Dt@tDL . old2newTrafo

% Simplify

Out[726]=

-1

2ã-2 Q I1 + P2M Dt@tD +

ã-2 Q

2+1

2ã-2 Q P2 Dt@tD

Out[727]=

0

We verify that dF = 0·dt is indeed an exact differential.

An (at least) canonoidal transformation for the 1D harmonic oscillator with Hamiltonian K(Q, P) = P and Q, P ¹ 1 (see Torres del Castillo p.160)

In[728]:=

Remove@"Global`*"DIn[729]:=

Plot@8Tan@xD, ArcTan@xD<, 8x, -Π, +Π<,PlotStyle ® 8Green, Red<, AxesLabel ® 8"x", "tanHxL, arctanHxL"<,PlotRange ® 8-Π, +Π<, ImageSize ® medSizepicD

Out[729]=

-3 -2 -1 1 2 3x

-3

-2

-1

1

2

3

tanHxL, arctanHxL

In[730]:=

PrintA"Hamiltonian HHq,pL = ", H = 1 2 Ip@tD2 + q@tD2MEoldIni = 8q@0D q0, p@0D p0<oldSol =

DSolveA9q'@tD == ¶p@tDH, p'@tD == -¶q@tDH= Ü oldIni, 8q@tD, p@tD<, tE@@1DD Reverse

Hamiltonian HHq,pL =1

2Ip@tD2 + q@tD2M

Out[731]=8q@0D q0, p@0D p0<Out[732]=8q@tD ® q0 Cos@tD + p0 Sin@tD, p@tD ® p0 Cos@tD - q0 Sin@tD<Forward transformation (q,p) ® (Q,P):

Newton, Lagrange, Hamilton and Hamilton-Jacobi Mechanics of Classical Particles with Mathematica.nb 87

Page 88: Newton, Lagrange, Hamilton and Hamilton-Jacobi …o.castera.free.fr/zip/Newton, Lagrange, Hamilton and Hamilton... · Ł Separability of the HJE for a particle attracted to two fixed

In[733]:=

new2oldTrafo = :Q@tD ® ArcTan@q@tD p@tDD, P@tD ® p@tD2 + q@tD2 >;% . Rule ® Equal TableForm

Out[734]//TableForm=

Q@tD ArcTanA q@tDp@tD E

P@tD p@tD2 + q@tD2

To avoid a lengthy discussion of the appropriate back transformation, we restrict us to the first quadrant q³0 and p³0

and the time scale is choosen so that 0 £ t + arctan(q0/p0) £ Π/4.

In[735]:=

Solve@new2oldTrafo . Rule ® Equal, 8q@tD, p@tD<D FullSimplify

Print@"With the restriction q³0 and p³0, only the second set is appropriate."DHold2newTrafo = %%@@2DDL . Rule ® Equal TableForm

Out[735]=99q@tD ® -P@tD Tan@Q@tDD

Sec@Q@tDD2

, p@tD ® -P@tD

Sec@Q@tDD2

=,9q@tD ®

P@tD Tan@Q@tDDSec@Q@tDD2

, p@tD ®P@tD

Sec@Q@tDD2

==With the restriction q³0 and p³0, only the second set is appropriate.

Out[737]//TableForm=

q@tD P@tD Tan@Q@tDD

Sec@Q@tDD2p@tD

P@tDSec@Q@tDD2

Poisson brackets Q, P, Q, Q, P, P and H, Q, P:

In[738]:=8Q@tD . new2oldTrafo, P@tD . new2oldTrafo<8q@tD<,8p@tD< Simplify

PBQP = %;8Q@tD . new2oldTrafo, Q@tD . new2oldTrafo<8q@tD<,8p@tD<8P@tD . new2oldTrafo, P@tD . new2oldTrafo<8q@tD<,8p@tD<8H, PBQP<8q@tD<,8p@tD< D@PBQP, tD . 8q'@tD ® 0, p'@tD ® 0<Out[738]=

1

p@tD2 + q@tD2

Out[740]=

0

Out[741]=

0

Out[742]=

True

Note: Q, P ¹ 1 and a constant of motion of H.

Newton, Lagrange, Hamilton and Hamilton-Jacobi Mechanics of Classical Particles with Mathematica.nb 88

Page 89: Newton, Lagrange, Hamilton and Hamilton-Jacobi …o.castera.free.fr/zip/Newton, Lagrange, Hamilton and Hamilton... · Ł Separability of the HJE for a particle attracted to two fixed

In[743]:=

Print@"Transformed Hamiltonian KHQ,PL = ", K = P@tDDnewIni = new2oldTrafo . 8q@tD ® q0, p@tD ® p0, t ® 0, Rule ® Equal<DSolve@8Q'@tD == ¶P@tDK, P'@tD == -¶Q@tDK, Q@0D Q0, P@0D P0<, 8Q@tD, P@tD<, tD@@1DDDSolve@8Q'@tD == ¶P@tDK, P'@tD == -¶Q@tDK< Ü newIni, 8Q@tD, P@tD<, tD@@1DD Reverse

Print@"Are the Hamilton equations with HHq,pL and KHQ,PL equivalent?"Dold2newTrafo

% . %%%

FullSimplify@%, 8q0 ³ 0, p0 ³ 0, 0 £ t + ArcTan@q0 p0D £ Π 4<D% == oldSol

Transformed Hamiltonian KHQ,PL = P@tDOut[744]=9Q@0D ArcTanA q0

p0E, P@0D p02 + q02 =

Out[745]=8Q@tD ® Q0 + t, P@tD ® P0<Out[746]=9Q@tD ® t + ArcTanA q0

p0E, P@tD ® p02 + q02 =

Are the Hamilton equations with HHq,pL and KHQ,PL equivalent?

Out[748]=9q@tD ®P@tD Tan@Q@tDD

Sec@Q@tDD2

, p@tD ®P@tD

Sec@Q@tDD2

=Out[749]=

9q@tD ®

p02 + q02 TanAt + ArcTanA q0

p0EE

SecAt + ArcTanA q0

p0EE2

, p@tD ®p02 + q02

SecAt + ArcTanA q0

p0EE2

=Out[750]=8q@tD ® q0 Cos@tD + p0 Sin@tD, p@tD ® p0 Cos@tD - q0 Sin@tD<Out[751]=

True

Question: Is dF = P dQ - K dt - (p dq - H dt) an exact differential (as maybe most of us would expect)?

Let's check first eqn. (17), Torres del Castillo p.160, by substituting Q, P and K(Q, P), in terms of q and p:

Newton, Lagrange, Hamilton and Hamilton-Jacobi Mechanics of Classical Particles with Mathematica.nb 89

Page 90: Newton, Lagrange, Hamilton and Hamilton-Jacobi …o.castera.free.fr/zip/Newton, Lagrange, Hamilton and Hamilton... · Ł Separability of the HJE for a particle attracted to two fixed

In[752]:=

PrintB"H = ", H =1

2Ip2 + q2M, " , K = ", K = PF

rl = new2oldTrafo . f_@tD ® fH* lhs *L P Dt@QD - K Dt@tD . rl

H* rhs *L 2 Ip2 + q2M-12 Hp Dt@qD - H Dt@tD - Dt@p q 2DLH%% %L Simplify

H =1

2Ip2 + q2M , K = P

Out[753]=9Q ® ArcTanA qp

E, P ® p2 + q2 =Out[754]=

p2 + q2 K-q Dt@pD

p2+

Dt@qDp

O1 +

q2

p2

- p2 + q2 Dt@tDOut[755]=

2 J-1

2q Dt@pD +

1

2p Dt@qD -

1

2Ip2 + q2M Dt@tDN

p2 + q2

Out[756]=

True

We apply the standard criterion for a differential form to be exact to dF = P dQ - K dt - (p dq - H dt)...

In[757]:=

P Dt@QD - K Dt@tD - Hp Dt@qD - H Dt@tDL . rl Simplify;

Collect@%, 8Dt@qD, Dt@pD, Dt@tD<D TraditionalForm

D@%@@1DD Dt @pD, tD D@%@@3DD Dt@tD, pDOut[758]//TraditionalForm=

1

2Ip2 + q2M - p2 + q2 â t -

q â p

p2 + q2

+p

p2 + q2

- p â q

Out[759]=

0 p -p

p2 + q2

...and by considering the coefficients of dp and dt we verify that dF cannot be an exact differential.

An (at least) canonoidal transformation for the 1D harmonic oscillator with Hamiltonian K(Q, P) = 0 and Q, P ¹ 1 (see Torres del Castillo p.160)

In[760]:=

Remove@"Global`*"D

Newton, Lagrange, Hamilton and Hamilton-Jacobi Mechanics of Classical Particles with Mathematica.nb 90

Page 91: Newton, Lagrange, Hamilton and Hamilton-Jacobi …o.castera.free.fr/zip/Newton, Lagrange, Hamilton and Hamilton... · Ł Separability of the HJE for a particle attracted to two fixed

In[761]:=

PlotAEvaluateAHð - ArcTan@xDL2 & 8-1, -1 2, 0, 1 2, 1<E,8x, -Π, +Π<, PlotStyle ® 8Pink , Blue, Yellow, Green, Red<,AxesLabel ® 9"x", "Hconstant - ArcTan@xDL2"=,PlotRange ® 8-Π, +Π<, ImageSize ® medSizepicE

Out[761]=

-3 -2 -1 1 2 3x

-3

-2

-1

1

2

3

Hconstant - ArcTan@xDL2

In[762]:=

PrintA"Hamiltonian HHq,pL = ", H = 1 2 Ip@tD2 + q@tD2MEoldIni = 8q@0D q0, p@0D p0<oldSol =

DSolveA9q'@tD == ¶p@tDH, p'@tD == -¶q@tDH= Ü oldIni, 8q@tD, p@tD<, tE@@1DD Reverse

Hamiltonian HHq,pL =1

2Ip@tD2 + q@tD2M

Out[763]=8q@0D q0, p@0D p0<Out[764]=8q@tD ® q0 Cos@tD + p0 Sin@tD, p@tD ® p0 Cos@tD - q0 Sin@tD<Explicitly time-dependent forward transformation (q,p) ® (Q,P):

In[765]:=

new2oldTrafo = 9Q@tD ® Ht - ArcTan@q@tD p@tDDL2, P@tD ® 1 2 Ip@tD2 + q@tD2M=;% . Rule ® Equal TableForm

Out[766]//TableForm=

Q@tD Jt - ArcTanA q@tDp@tD EN2

P@tD 1

2Ip@tD2 + q@tD2M

To avoid a lengthy discussion of the appropriate back transformation, we restrict us to the first quadrant q³0 and p³0

and the time scale is choosen so that 0 £ t + arctan(q0/p0) £ Π/4.

Newton, Lagrange, Hamilton and Hamilton-Jacobi Mechanics of Classical Particles with Mathematica.nb 91

Page 92: Newton, Lagrange, Hamilton and Hamilton-Jacobi …o.castera.free.fr/zip/Newton, Lagrange, Hamilton and Hamilton... · Ł Separability of the HJE for a particle attracted to two fixed

In[767]:=

Solve@new2oldTrafo . Rule ® Equal, 8q@tD, p@tD<Deqns =

SequenceB:Α Q@tD t - ArcTanBq@tDp@tD F , P@tD

1

2Ip@tD2 + q@tD2M>, 8q@tD, p@tD<F;

HSolve@eqnsD . Α ® +1L Ü HSolve@eqnsD . Α ® -1LPrint@"With the restriction q³0 and p³0, only the forth set is appropriate."D%%@@4DD . Rule ® Equal TableForm

Out[767]=

SolveA9Q@tD t - ArcTanA q@tDp@tD E 2

, P@tD 1

2Ip@tD2 + q@tD2M=, 8q@tD, p@tD<E

Out[769]=

99q@tD ® -2 P@tD TanAt - Q@tD E

1 + TanAt - Q@tD E2

, p@tD ® -2 P@tD

1 + TanAt - Q@tD E2

=,

9q@tD ®2 P@tD TanAt - Q@tD E

1 + TanAt - Q@tD E2

, p@tD ®2 P@tD

1 + TanAt - Q@tD E2

=,

9q@tD ® -2 P@tD TanAt + Q@tD E

1 + TanAt + Q@tD E2

, p@tD ® -2 P@tD

1 + TanAt + Q@tD E2

=,

9q@tD ®2 P@tD TanAt + Q@tD E

1 + TanAt + Q@tD E2

, p@tD ®2 P@tD

1 + TanAt + Q@tD E2

==With the restriction q³0 and p³0, only the forth set is appropriate.

Out[771]//TableForm=

q@tD 2 P@tD TanBt+ Q@tD F

1+TanBt+ Q@tD F2p@tD

2 P@tD1+TanBt+ Q@tD F2

Poisson brackets Q, P, Q, Q, P, P and H, Q, P:

Newton, Lagrange, Hamilton and Hamilton-Jacobi Mechanics of Classical Particles with Mathematica.nb 92

Page 93: Newton, Lagrange, Hamilton and Hamilton-Jacobi …o.castera.free.fr/zip/Newton, Lagrange, Hamilton and Hamilton... · Ł Separability of the HJE for a particle attracted to two fixed

In[772]:=8Q@tD . new2oldTrafo, P@tD . new2oldTrafo<8q@tD<,8p@tD< Factor

PBQP = %;8Q@tD . new2oldTrafo, Q@tD . new2oldTrafo<8q@tD<,8p@tD<8P@tD . new2oldTrafo, P@tD . new2oldTrafo<8q@tD<,8p@tD<8H, PBQP<8q@tD<,8p@tD< D@PBQP, tD . 8q'@tD ® 0, p'@tD ® 0< Simplify

Out[772]=

-2 t - ArcTanAq@tDp@tD E

Out[774]=

0

Out[775]=

0

Out[776]=

True

Note: Q, P ¹ 1 and a constant of motion of H.

In[777]:=

Print@"Transformed Hamiltonian KHQ,PL = ", K = 0DnewIni = new2oldTrafo . 8q@tD ® q0, p@tD ® p0, t ® 0, Rule ® Equal<DSolve@8Q'@tD == ¶P@tDK, P'@tD == -¶Q@tDK, Q@0D Q0, P@0D P0<, 8Q@tD, P@tD<, tD@@1DDDSolve@8Q'@tD == ¶P@tDK, P'@tD == -¶Q@tDK< Ü newIni, 8Q@tD, P@tD<, tD@@1DD Reverse

Print@"Are the Hamilton equations with HHq,pL and KHQ,PL equivalent?"D%% . new2oldTrafo . Rule ® Equal

Solve@%, 8q@tD, p@tD<DPrint@"With the restriction q³0 and p³0, only the forth set is appropriate."DFullSimplify@%%@@4DD, 8q0 ³ 0, p0 ³ 0, 0 £ t + ArcTan@q0 p0D £ Π 4<D% == oldSol

Transformed Hamiltonian KHQ,PL = 0

Out[778]=

9Q@0D ArcTanA q0p0

E2

, P@0D 1

2Ip02 + q02M=

Out[779]=8Q@tD ® Q0, P@tD ® P0<Out[780]=

9Q@tD ® ArcTanAq0p0

E2

, P@tD ®1

2Ip02 + q02M=

Are the Hamilton equations with HHq,pL and KHQ,PL equivalent?

Out[782]=

9 t - ArcTanA q@tDp@tD E 2

ArcTanA q0p0

E2

,1

2Ip@tD2 + q@tD2M

1

2Ip02 + q02M=

Newton, Lagrange, Hamilton and Hamilton-Jacobi Mechanics of Classical Particles with Mathematica.nb 93

Page 94: Newton, Lagrange, Hamilton and Hamilton-Jacobi …o.castera.free.fr/zip/Newton, Lagrange, Hamilton and Hamilton... · Ł Separability of the HJE for a particle attracted to two fixed

Out[783]=

99q@tD ® -

p02 + q02 TanAt - ArcTanA q0

p0EE

1 + TanAt - ArcTanA q0

p0EE2

, p@tD ® -p02 + q02

1 + TanAt - ArcTanA q0

p0EE2

=,

9q@tD ®

p02 + q02 TanAt - ArcTanA q0

p0EE

1 + TanAt - ArcTanA q0

p0EE2

, p@tD ®p02 + q02

1 + TanAt - ArcTanA q0

p0EE2

=,

9q@tD ® -

p02 + q02 TanAt + ArcTanA q0

p0EE

1 + TanAt + ArcTanA q0

p0EE2

, p@tD ® -p02 + q02

1 + TanAt + ArcTanA q0

p0EE2

=,

9q@tD ®

p02 + q02 TanAt + ArcTanA q0

p0EE

1 + TanAt + ArcTanA q0

p0EE2

, p@tD ®p02 + q02

1 + TanAt + ArcTanA q0

p0EE2

==With the restriction q³0 and p³0, only the forth set is appropriate.

Out[785]=8q@tD ® q0 Cos@tD + p0 Sin@tD, p@tD ® p0 Cos@tD - q0 Sin@tD<Out[786]=

True

Question: Is dF = P dQ - K dt - (p dq - H dt) an exact differential?

Let's check first the equation "P dQ = ...", Torres del Castillo p.160, by substituting Q, P and K(Q, P), in terms of q and

p:

Newton, Lagrange, Hamilton and Hamilton-Jacobi Mechanics of Classical Particles with Mathematica.nb 94

Page 95: Newton, Lagrange, Hamilton and Hamilton-Jacobi …o.castera.free.fr/zip/Newton, Lagrange, Hamilton and Hamilton... · Ł Separability of the HJE for a particle attracted to two fixed

In[787]:=

PrintB"H = ", H =1

2Ip2 + q2M, " , K = ", K = 0F

rl = new2oldTrafo . f_@tD ® fH* lhs *L P Dt@QD - K Dt@tD . rlH* rhs *L -2 Ht - ArcTan@q pDL Hp Dt@qD - H Dt@tD - Dt@p q 2DLH%% %L Simplify

H =1

2Ip2 + q2M , K = 0

Out[788]=9Q ® t - ArcTanAqp

E 2

, P ®1

2Ip2 + q2M=

Out[789]=

Ip2 + q2M t - ArcTanA qp

E -

-q Dt@pD

p2+

Dt@qDp

1 +q2

p2

+ Dt@tDOut[790]=

-2 t - ArcTanAqp

E -1

2q Dt@pD +

1

2p Dt@qD -

1

2Ip2 + q2M Dt@tD

Out[791]=

True

We apply the standard criterion for a differential form to be exact to dF = P dQ - K dt - (p dq - H dt)...

In[792]:=

P Dt@QD - K Dt@tD - Hp Dt@qD - H Dt@tDL . rl Simplify;

Collect@%, 8Dt@qD, Dt@pD, Dt@tD<D TraditionalForm

D@%@@1DD Dt @pD, qD D@%@@2DD Dt@qD, pD FullSimplify

Out[793]//TraditionalForm=

â t Ip2 + q2M t - tan-1q

p+

1

2Ip2 + q2M + q â p t - tan-1

q

p+ â q p - t - tan-1

q

p- p

Out[794]=

1 + 2 t 2 ArcTanA qp

E...and by considering the coefficients of dp and dq we verify that dF cannot be an exact differential.

Newton, Lagrange, Hamilton and Hamilton-Jacobi Mechanics of Classical Particles with Mathematica.nb 95

Page 96: Newton, Lagrange, Hamilton and Hamilton-Jacobi …o.castera.free.fr/zip/Newton, Lagrange, Hamilton and Hamilton... · Ł Separability of the HJE for a particle attracted to two fixed

Noether's theorem for the Hamiltonian

Premisesold coordinates: q,p

new coordinates: Q,P

old Hamiltonian: H(q,p)

new Hamiltonian: K(Q,P)

infinitesimal canonical transformation: Q = q + ∆q, P = p + ∆p, ∆q and ∆p small

type 2 generator for a infinitesimal canonical transformation: F2 HP, q, tL = q P + Ε G HP, q, tL, Ε small

Q = ¶PF2

Q = q + Ε GH1,0,0L(P,q,t) = q + Ε GH1,0,0L(p,q,t) + Ε ∆p GH2,0,0L(p,q,t) + O H∆pL2

Q(q,p) = q + ∆q » q + Ε ¶ G(p,q,t) / ¶ p

p = ¶qF2

p = P + Ε GH0,1,0L(P,q,t) = P + Ε GH0,1,0L(p,q,t) + Ε ∆p GH1,1,0L(p,q,t) + O H∆pL2

P(q,p) = p + ∆p » p - Ε ¶ G(p,q,t) / ¶ q

K = H + ¶tF2

K = H + Ε GH0,0,1L(P,q,t) = H + Ε GH0,0,1L(P,Q,t) - Ε ∆q GH0,1,1L(P,Q,t) + O H∆qL2

K(Q,P) » H(Q,P) + Ε ¶ G(P,Q,t) / ¶ t

Newton, Lagrange, Hamilton and Hamilton-Jacobi Mechanics of Classical Particles with Mathematica.nb 96

Page 97: Newton, Lagrange, Hamilton and Hamilton-Jacobi …o.castera.free.fr/zip/Newton, Lagrange, Hamilton and Hamilton... · Ł Separability of the HJE for a particle attracted to two fixed

Noether's TheoremG is a constant of motion of H if and only if G is a symmetry of H.

Proof

G is a constant of motion of H.

G

= 0

d G

d t=8G, H<q,p +

¶G

¶t= 0

-Ε (8G, H<q,p +¶G

¶t) = 0

-Ε ( ¶G

¶q

¶H

¶p-

¶G

¶p

¶H

¶q+

¶G

¶t) = 0

J+Ε¶G

¶pN ¶H

¶q+ J-Ε

¶G

¶qN ¶H

¶p-Ε ¶G

¶t = 0

∆q ¶H

¶q+ ∆p ¶H

¶p- Ε ¶G

¶t = 0

H(q + ∆q,p + ∆p) - H(q,p) - Ε ¶G

¶t = 0

H(q + ∆q,p + ∆p) - K(q,p) = 0

H( Q(q,p),P(q,p) ) - K(q,p) = 0

H(Q,P) = K(q,p)

G is a symmetry of H.

qed.

Great theorem, Emmy. Thank You!

Liouville's theorem for a system of free falling bodies

In[795]:=

Remove@"Global`*"DIn[796]:=

PrintA"Lagrangian L = ", L = m 2 q'@tD2 - m g q@tDEHamilton@L, 8q<, 8p<, tD;Print@"Hamiltonian H = ", %@@2DD,", eqn. of motion: ", HeqnMotion = %@@3DDL TableFormD

iniCondition = 8p@0D p0, q@0D q0<;Print@"Solution of the eqn. of motion:"DDSolve@eqnMotion~Join~iniCondition, 8q@tD, p@tD<, tD Flatten Simplify

Print@"with m=1 and g=1:"Dsol = %% . 8m ® 1, g ® 1<

Newton, Lagrange, Hamilton and Hamilton-Jacobi Mechanics of Classical Particles with Mathematica.nb 97

Page 98: Newton, Lagrange, Hamilton and Hamilton-Jacobi …o.castera.free.fr/zip/Newton, Lagrange, Hamilton and Hamilton... · Ł Separability of the HJE for a particle attracted to two fixed

Lagrangian L = -g m q@tD +1

2m q¢@tD2

Hamiltonian H =p@tD2

2 m+ g m q@tD, eqn. of motion:

q¢@tD p@tDm

p¢@tD -g m

Solution of the eqn. of motion:

Out[801]=

9q@tD ® q0 +p0 t

m-g t2

2, p@tD ® p0 - g m t=

with m=1 and g=1:

Out[803]=9q@tD ® q0 + p0 t -t2

2, p@tD ® p0 - t=

A few trajectories for the phase space portrait:

In[804]:=

trajectories = Table@sol . 8q0 ® -0.66, p0 ® p0list@@iDD<,8i, Length@p0list = 80.25, 0.70, 1.00, 1.25, 1.50, 1.75<D<DOut[804]=99q@tD ® -0.66 + 0.25 t -

t2

2, p@tD ® 0.25 - t=, 9q@tD ® -0.66 + 0.7 t -

t2

2, p@tD ® 0.7 - t=,

9q@tD ® -0.66 + 1. t -t2

2, p@tD ® 1. - t=, 9q@tD ® -0.66 + 1.25 t -

t2

2, p@tD ® 1.25 - t=,

9q@tD ® -0.66 + 1.5 t -t2

2, p@tD ® 1.5 - t=, 9q@tD ® -0.66 + 1.75 t -

t2

2, p@tD ® 1.75 - t==

Trajectories for four nearby initial conditions and phases for a few successive time instants (here the input data is given

as exact numbers to get exact results):

Newton, Lagrange, Hamilton and Hamilton-Jacobi Mechanics of Classical Particles with Mathematica.nb 98

Page 99: Newton, Lagrange, Hamilton and Hamilton-Jacobi …o.castera.free.fr/zip/Newton, Lagrange, Hamilton and Hamilton... · Ł Separability of the HJE for a particle attracted to two fixed

In[805]:=

solset = sol . 88q0 ® -6 10, p0 ® 125 100<,8q0 ® -5 10, p0 ® 125 100<,8q0 ® -5 10, p0 ® 150 100<,8q0 ® -6 10, p0 ® 150 100<<phases = Table@8q@tD, p@tD< . solset . t ® tlist@@iDD,8i, Length@tlist = 80, 2, 5, 10, 17, 24< 10D<Dpoints = Table@[email protected], Point@phases@@i, jDDD<,8i, Length@tlistD<, 8j, Length@solsetD<D;color = 8Green, Purple, Orange, Blue, Brown, Red<;polygons = Table@8color@@iDD, Polygon@phases@@iDDD<, 8i, Length@tlistD<D;

Out[805]=

99q@tD ® -3

5+5 t

4-t2

2, p@tD ®

5

4- t=, 9q@tD ® -

1

2+5 t

4-t2

2, p@tD ®

5

4- t=,

9q@tD ® -1

2+3 t

2-t2

2, p@tD ®

3

2- t=, 9q@tD ® -

3

5+3 t

2-t2

2, p@tD ®

3

2- t==

Out[806]=999-3

5,5

4=, 9-

1

2,5

4=, 9-

1

2,3

2=, 9-

3

5,3

2==,

99-37

100,21

20=, 9-

27

100,21

20=, 9-

11

50,13

10=, 9-

8

25,13

10==,

99-1

10,3

4=, 90, 3

4=, 9 1

8, 1=, 9 1

40, 1==, 99 3

20,1

4=, 91

4,1

4=, 91

2,1

2=, 9 2

5,1

2==,

99 2

25, -

9

20=, 9 9

50, -

9

20=, 9 121

200, -

1

5=, 9101

200, -

1

5==,

99-12

25, -

23

20=, 9-

19

50, -

23

20=, 9 11

50, -

9

10=, 9 3

25, -

9

10===

Newton, Lagrange, Hamilton and Hamilton-Jacobi Mechanics of Classical Particles with Mathematica.nb 99

Page 100: Newton, Lagrange, Hamilton and Hamilton-Jacobi …o.castera.free.fr/zip/Newton, Lagrange, Hamilton and Hamilton... · Ł Separability of the HJE for a particle attracted to two fixed

In[810]:=

ParametricPlot@Evaluate@8q@tD, p@tD< . trajectoriesD, 8t, 0, 3.5<,AxesLabel ® 8"qHtL", "pHtL"<, PlotRange ® 88-0.65, 0.65<, 8-1.55, 1.55<<,Frame ® True, AspectRatio ® 1, Epilog ® 8polygons, points<, ImageSize ® medSizepicD

Out[810]=

-0.6 -0.4 -0.2 0.0 0.2 0.4 0.6-1.5

-1.0

-0.5

0.0

0.5

1.0

1.5

qHtL

pHtL

We calculate now the phase space volume of the choosen ensemble of system points as it evolves in time (in the 2D

phase space shown above the volumes are actually the color filled areas).

In[811]:=

<< Statistics`MultiDescriptiveStatistics`

In[812]:=

Print@"A little test: ", ConvexHullArea@triangle = 880, 0<, 81, 0<, 81, 1<<D,", ", ConvexHullArea 8triangle<D

A little test:1

2, :1

2>

In[813]:=

Print@"Are the areas equal?"DConvexHullArea phases

Dimensions@Union@%DD@@1DD 1

Are the areas equal?

Out[814]=9 1

40,

1

40,

1

40,

1

40,

1

40,

1

40=

Out[815]=

True

All areas are equal as expected by the Liouville theorem.

Newton, Lagrange, Hamilton and Hamilton-Jacobi Mechanics of Classical Particles with Mathematica.nb 100

Page 101: Newton, Lagrange, Hamilton and Hamilton-Jacobi …o.castera.free.fr/zip/Newton, Lagrange, Hamilton and Hamilton... · Ł Separability of the HJE for a particle attracted to two fixed

IV) Hamilton-Jacobi mechanics for classical particles

"Before the advent of modern quantum theory, Bohr's atomic theory was treated in terms of Hamilton-Jacobi

theory." Tai L. Chow.

PDE (Partial Differential Equation): A few analytically solved basic examples adapted from theMathematica 5.2 documentation

In[816]:=

Remove@"Global`*"DIn[817]:=

<< Calculus`DSolveIntegrals`

"Hamilton's principal function is thus the generator of a canonical transformation to constant coordinates and momenta;

when solving the Hamilton-Jacobi equation, we are at the same time obtaining a solution to the mechanical problem.

Mathematically speaking, we have established an equivalence between the 2n canonical equations of motion, which are

first-order diffential equations, to the [single] first-order partial differential Hamilton-Jacobi equation."

Goldstein&Poole&Safko p.433

a) The general solution to a partial differential equation (PDE) with m independent variables, if it can be found at all,

must involve arbitrary functions of m - 1 arguments.

In[818]:=

¶xg@x, yD 0 TraditionalForm

DSolve@%, g@x, yD, 8x, y<, GeneratedParameters ® fD . f@i_D ® fi;

%@@1, 1DD Simplify TraditionalForm

Out[818]//TraditionalForm=

gH1,0LHx, yL 0

Out[820]//TraditionalForm=

gHx, yL ® f1HyLIn[821]:=

¶x¶yg@x, yD a TraditionalForm

DSolve@%, g@x, yD, 8x, y<, GeneratedParameters ® fD . f@i_D ® fi;

%@@1, 1DD Simplify TraditionalForm

Out[821]//TraditionalForm=

gH1,1LHx, yL a

Out[823]//TraditionalForm=

gHx, yL ® a x y + f1HxL + f2HyL

Newton, Lagrange, Hamilton and Hamilton-Jacobi Mechanics of Classical Particles with Mathematica.nb 101

Page 102: Newton, Lagrange, Hamilton and Hamilton-Jacobi …o.castera.free.fr/zip/Newton, Lagrange, Hamilton and Hamilton... · Ł Separability of the HJE for a particle attracted to two fixed

In[824]:=HD@ð, xD + D@ð, yD + D@ð, zDL &@g@x, y, zDD 0 TraditionalForm

DSolve@%, g@x, y, zD, 8x, y, z<, GeneratedParameters ® fD . f@i_D ® fi;

%@@1, 1DD Simplify TraditionalForm

Out[824]//TraditionalForm=

gH0,0,1LHx, y, zL + gH0,1,0LHx, y, zL + gH1,0,0LHx, y, zL 0

Out[826]//TraditionalForm=

gHx, y, zL ® f1Hy - x, z - xLIn[827]:=

¶xg@x, y, zD + ¶yg@x, y, zD + ¶zg@x, y, zD 1 Hx y zL TraditionalForm

DSolve@%, g@x, y, zD, 8x, y, z<, GeneratedParameters ® fD . f@i_D ® fi;

%@@1, 1DD Simplify TraditionalForm

Out[827]//TraditionalForm=

gH0,0,1LHx, y, zL + gH0,1,0LHx, y, zL + gH1,0,0LHx, y, zL 1

x y z

Out[829]//TraditionalForm=

gHx, y, zL ®Hx - yL Hx - zL Hy - zL f1Hy - x, z - xL + logHxL Hy - zL - x logHyL + x logHzL + z logHyL - y logHzL

Hx - yL Hx - zL Hy - zLb) linear first order PDE

In[830]:=

x1 D@y@x1, x2D, x1D + x2 D@y@x1, x2D, x2D Exp@x1 x2D TraditionalForm

DSolve@%, y@x1, x2D, 8x1, x2<, GeneratedParameters ® fD . f@i_D ® fi;

%@@1, 1DD Simplify TraditionalForm

Out[830]//TraditionalForm=

x2 yH0,1LHx1, x2L + x1 yH1,0LHx1, x2L ãx1 x2

Out[832]//TraditionalForm=

yHx1, x2L ®EiHx1 x2L

2+ f1

x2

x1

EiHzL = -à-z

¥

e-t t â t, where the principal value of the integral is taken.

c) weakly nonlinear first order PDE

In[833]:=Hpde = D@z@x, yD, xD + 2 D@z@x, yD, yD Exp@z@x, yDDL TraditionalForm

DSolve@pde, z@x, yD, 8x, y<, GeneratedParameters ® fD . f@i_D ® fi;Hsol = %@@1, 1DDL TraditionalForm

Out[833]//TraditionalForm=

2 zH0,1LHx, yL + zH1,0LHx, yL ãzHx,yLOut[835]//TraditionalForm=

zHx, yL ® -logH- f1Hy - 2 xL - xLSolve::"ifun": "Inverse functions are being used by Solve, so some solutions may not be found; use Reduce for complete solution information."

Fixing the arbitrary function f1Hy - 2 xL gets a particular solution:

Newton, Lagrange, Hamilton and Hamilton-Jacobi Mechanics of Classical Particles with Mathematica.nb 102

Page 103: Newton, Lagrange, Hamilton and Hamilton-Jacobi …o.castera.free.fr/zip/Newton, Lagrange, Hamilton and Hamilton... · Ł Separability of the HJE for a particle attracted to two fixed

In[836]:=

PrintA"Particular solution zpHx,yL = ",

zp@x_, y_D = z@x, yD . sol . f1@y - 2 xD ® -Hy - 2 xL2 - 3EPlot3D@zp@x, yD, 8x, -5, 5<, 8y, -5, 5<, AxesLabel ® 8"x", "y", "zpHx,yL"<,PlotPoints ® 50, ImageSize ® medSizepic, PlotRange ® All, FaceGrids ® AllD

Particular solution zpHx,yL = -LogA3 - x + H-2 x + yL2EOut[837]=

-5

0

5

x

-5

0

5

y

-4

-2

0

zpHx,yL

The selected particular solution obviously satisfies the PDE:

In[838]:=

pde . z ® zp Simplify

Out[838]=

True

d) nonlinear first order PDE with complete solution.

From a complete solution of a first order PDE we can get the general solution and the singular solution by appropriate

envelope constructions (see for example Schmutzer p.180-182).

In[839]:=

D@y@x1, x2D, x1D D@y@x1, x2D, x2D a TraditionalForm

DSolve@%, y@x1, x2D, 8x1, x2<D . C@i_D ® Ci

Out[839]//TraditionalForm=

yH0,1LHx1, x2L yH1,0LHx1, x2L a

Out[840]=99y@x1, x2D ® C1 +a x1

C2+ x2 C2==

DSolve::nlpde: Solution requested to nonlinear partial differential equation. Trying to build a complete integral.

Newton, Lagrange, Hamilton and Hamilton-Jacobi Mechanics of Classical Particles with Mathematica.nb 103

Page 104: Newton, Lagrange, Hamilton and Hamilton-Jacobi …o.castera.free.fr/zip/Newton, Lagrange, Hamilton and Hamilton... · Ł Separability of the HJE for a particle attracted to two fixed

In[841]:=Ipde = y D@u@x, yD, yD - Hx * D@u@x, yD, xDL2 == u@x, yDM TraditionalForm

Out[841]//TraditionalForm=

y uH0,1LHx, yL - x2 uH1,0LHx, yL2 uHx, yLIn[842]:=

DSolve@pde, u@x, yD, 8x, y<, GeneratedParameters ® CDOut[842]=

99u@x, yD ®-2 ProductLogAã-1+C@2D xC@1D yE - ProductLogAã-1+C@2D xC@1D yE2

4 C@1D2==

Solve::"ifun": "Inverse functions are being used by Solve, so some solutions may not be found; use Reduce for complete solution information."

In[843]:=

? ProductLog

ProductLog@zD gives the principal solution for w in z = wew.

ProductLog@k, zD gives the kth solution.

In[844]:=

CompleteIntegral[eqn,u[x,y,...], x,y,...] builds a complete integral for the nonlinear first-order

differential equation eqn in the unknown function u with independent variables x,y,... :

In[845]:=

CompleteIntegral@pde, u@x, yD, 8x, y<, GeneratedParameters ® CD;8%@@1, 1DD, %@@2, 1DD< TableForm TraditionalForm

Out[846]//TraditionalForm=

uHx, yL ®1

4I-2 c3 logHxL + c3 H4 y - c3L - log2HxLM

uHx, yL ®1

4I2 c3 logHxL + c3 H4 y - c3L - log2HxLM

e) linear second order PDE: 1D wave equation

In[847]:=

$Assumptions = 8c > 0<;Ic2 D@ð, x, xD - D@ð, t, tDM &@y@x, tDD 0 TraditionalForm

DSolve@%, y@x, tD, 8x, t<, GeneratedParameters ® fD . f@i_D ® fi;

%@@1, 1DD Simplify TraditionalForm

Out[848]//TraditionalForm=

c2 yH2,0LHx, tL - yH0,2LHx, tL 0

Out[850]//TraditionalForm=

yHx, tL ® f1 t -x

c+ f2

x

c+ t

Newton, Lagrange, Hamilton and Hamilton-Jacobi Mechanics of Classical Particles with Mathematica.nb 104

Page 105: Newton, Lagrange, Hamilton and Hamilton-Jacobi …o.castera.free.fr/zip/Newton, Lagrange, Hamilton and Hamilton... · Ł Separability of the HJE for a particle attracted to two fixed

PDE: Numerical solution of the 1D time-dependent Schrödinger equation (Cauchy problem with a second order PDE in two variables)

A particle moving along the x axis and initially described by a minimal uncertainty group wave function is incident

upon a barrier potential V. Here we use natural units with Ñ = 1 and the particle mass is m = 1/2.

In[851]:=

Remove@"Global`*"DNumerical solution of the Schrödinger equation leading to the wave function Y(x,t)for the initial condition given by

u(x,t=0):

In[852]:=

MinimalUncertaintyInitialState =

I2 Π HDxL2MI-14MExpA-Hx - x0L2 I4 HDxL2M + Hä p0 xL ÑE .

:x0 ® -15, Dx ® 3 , p0 ® 1, Ñ ® 1>Out[852]=

ãä x-

1

12H15+xL2

H6 ΠL14In[853]:=

V@x_, t_D := HUnitStep@xD - UnitStep@x - 4DLIn[854]:=

AbsoluteTimingANDSolveA9ä ¶tu@x, tD + ¶x,xu@x, tD V@x, tD u@x, tD,

u@x, 0D MinimalUncertaintyInitialState, u@-50, tD u@50, tD=,u, 8x, -50, 50<, 8t, 0, 20<EE

Y@x_, t_D = %@@2, 1, 1, 2DD@x, tD;Out[854]=810.4550336, 88u ® InterpolatingFunction@88-50., 50.<, 80., 20.<<, <>D<<<

Newton, Lagrange, Hamilton and Hamilton-Jacobi Mechanics of Classical Particles with Mathematica.nb 105

Page 106: Newton, Lagrange, Hamilton and Hamilton-Jacobi …o.castera.free.fr/zip/Newton, Lagrange, Hamilton and Hamilton... · Ł Separability of the HJE for a particle attracted to two fixed

Grayscale coded plot of the probability density function Yø Hx, tL Y Hx, tL:

In[856]:=

DensityPlotAAbs@Y@x, tDD2, 8x, -30, 30<, 8t, 0, 20<, PlotPoints ® 150,

Mesh ® False, PlotRange -> All, ColorFunction ® HGrayLevel@1 - ð D &L,FrameLabel ® 9"space x", "time t", "probability density YøHx,tLYHx,tL", ""=,ImageSize ® medSizepicE

Out[856]=

-30 -20 -10 0 10 20 30

0

5

10

15

20

space x

timet

probability density YøHx,tLYHx,tL

Newton, Lagrange, Hamilton and Hamilton-Jacobi Mechanics of Classical Particles with Mathematica.nb 106

Page 107: Newton, Lagrange, Hamilton and Hamilton-Jacobi …o.castera.free.fr/zip/Newton, Lagrange, Hamilton and Hamilton... · Ł Separability of the HJE for a particle attracted to two fixed

A few plots showing the time evolution of the wave function (color code: black = probability density, red = real part of

the wave function, green = imaginary part of the wave function, blue = barrier potential, arbitrary units); an animation is

easy to implement. See A.Goldberg, H.M.Schey, J.L.Schwartz; "Computer-Generated Motion Pictures of One-Dimen-

sional Quantum-Mechanical Transmission and Reflection Phenomena", American Journal of Physics, vol. 35, n. 3,

march 1967.

In[857]:=

nframes = 9;

GraphicsArrayAPartitionATableAPlotAEvaluateA9Abs@Y@x, tDD2, Re@Y@x, tDD, Im@Y@x, tDD, V@x, tD= 81, 2, 2, 5<E,8x, -30, 30<, PlotStyle ® 8Black, Red, Green, Blue<,PlotLabel ® "t = " <> ToString@N@tDD,PlotRange ® 8-.25, .25<, DisplayFunction ® IdentityE,8t, a = 0., b = 20, Hb - aL Hnframes - 1L<E

, 3, 3, 81, 1<, 8<EE;Show@%, ImageSize ® maxSizepicD

Out[859]=

-30 -20 -10 10 20 30

-0.2

-0.1

0.1

0.2

t = 0.

-30 -20 -10 10 20 30

-0.2

-0.1

0.1

0.2

t = 2.5

-30 -20 -10 10 20 30

-0.2

-0.1

0.1

0.2

t = 5.

-30 -20 -10 10 20 30

-0.2

-0.1

0.1

0.2

t = 7.5

-30 -20 -10 10 20 30

-0.2

-0.1

0.1

0.2

t = 10.

-30 -20 -10 10 20 30

-0.2

-0.1

0.1

0.2

t = 12.5

-30 -20 -10 10 20 30

-0.2

-0.1

0.1

0.2

t = 15.

-30 -20 -10 10 20 30

-0.2

-0.1

0.1

0.2

t = 17.5

-30 -20 -10 10 20 30

-0.2

-0.1

0.1

0.2

t = 20.

ø Let's check the normalization of the wave function at times t = 0 and t = 20:

In[860]:=

NIntegrate@Conjugate@Y@x, ð DD Y@x, ð D, 8x, -50, 50<, Method ® TrapezoidalD & 80, 20<Out[860]=80.999992 + 0. ä, 1.00047 + 0. ä<It's nearly 1, as expected and considering the errors from the numerical calculations.

ø Expectation values of the (linear) momentum at times t = 0 and t = 20:

In[861]:=

NIntegrate@Conjugate@Y@x, ð DD H-ä ¶xY@x, ð DL, 8x, -50, 50<, Method ® TrapezoidalD & 80, 20<

Newton, Lagrange, Hamilton and Hamilton-Jacobi Mechanics of Classical Particles with Mathematica.nb 107

Page 108: Newton, Lagrange, Hamilton and Hamilton-Jacobi …o.castera.free.fr/zip/Newton, Lagrange, Hamilton and Hamilton... · Ł Separability of the HJE for a particle attracted to two fixed

Out[861]=90.999989 - 6.2556 ´ 10-7 ä, -0.00133213 + 2.52624 ´ 10-7 ä=The momentum turns here from positive to slightly negative after the interaction with the barrier potential. (The imagi-

nary part is due to numerical errors.)

ø Is the total energy of this isolated system conserved? We compare the total energy at times t = 0 and t = 20. The

following relation holds for the total energy operator: E`total = -Ñ2/2m ¶2 ¶x2 + V = ä ¶ ¶t; we check both

variants.

In[862]:=

NIntegrateAConjugate@Y@x, ð DD I-¶x,x Y@x, ð D + V@x, ð D Y@x, ð DM,8x, -50, 50<, Method ® TrapezoidalE & 80, 20<Out[862]=91.0828 - 6.90872 ´ 10-8 ä, 1.08439 - 1.02174 ´ 10-8 ä=In[863]:=

DtY@x_, t_D = ¶t Y@x, tD;NIntegrate@Conjugate@Y@x, ð DD ä DtY@x, ð D, 8x, -50, 50<, Method ® TrapezoidalD & 80, 20<

Out[864]=91.08314 - 1.54931 ´ 10-7 ä, 1.0851 + 2.01471 ´ 10-7 ä=Yes, total energy conservation is fairly well confirmed. (The imaginary part is due to numerical errors.)

ø Heisenberg uncertainty relation Σx HtL × Σp HtL ³ Ñ/2 for the conjugate variables position x and momentum p,

verified at times t = 0 and t = 20.

In[865]:=

NIntegrate@Conjugate@Y@x, ð DD x Y@x, ð D, 8x, -50, 50<, Method ® TrapezoidalD & 80, 20<;Print@"8x@0D,x@20D< = ", 8x@0D, x@20D< = % ReDNIntegrateAConjugate@Y@x, ð DD x2 Y@x, ð D, 8x, -50, 50<, Method ® TrapezoidalE & 80, 20<;PrintB"8x2@0D,x2@20D< = ", :x2@0D, x2@20D> = % ReFPrintB"8Σx@0D,Σx@20D< = ", :Σx@0D = x2@0D - Hx@0DL2 , Σx@20D = x2@20D - Hx@20DL2 >F8x@0D,x@20D< = 8-14.9999, 2.48034<8x2@0D,x2@20D< = 8227.998, 590.331<8Σx@0D,Σx@20D< = 81.73256, 24.1698<

Newton, Lagrange, Hamilton and Hamilton-Jacobi Mechanics of Classical Particles with Mathematica.nb 108

Page 109: Newton, Lagrange, Hamilton and Hamilton-Jacobi …o.castera.free.fr/zip/Newton, Lagrange, Hamilton and Hamilton... · Ł Separability of the HJE for a particle attracted to two fixed

In[870]:=

NIntegrate@Conjugate@Y@x, ð DD H-ä ¶x Y@x, ð DL, 8x, -50, 50<, Method ® TrapezoidalD & 80, 20<;Print@"8p@0D,p@20D< = ", 8p@0D, p@20D< = % ReDNIntegrateAConjugate@Y@x, ð DD I-¶x,x Y@x, ð DM,8x, -50, 50<, Method ® TrapezoidalE & 80, 20<;PrintB"8p2@0D,p2@20D< = ", :p2@0D, p2@20D> = % ReFPrintB"8Σp@0D,Σp@20D< = ", :Σp@0D = p2@0D - Hp@0DL2 , Σp@20D = p2@20D - Hp@20DL2 >F8p@0D,p@20D< = 80.999989, -0.00133213<8p2@0D,p2@20D< = 81.0828, 1.0832<8Σp@0D,Σp@20D< = 80.287797, 1.04077<

In[875]:=9Σx@0D Σp@0D, Σx@20D Σp@20D=Out[875]=80.498625, 25.1552<Σx@0D Σp@0D is (nearly) Ñ /2 (Ñ = 1), as expected for the minimal uncertainty initial state used. At t = 20 the state is

spread out in space and momentum, so Σx@20D Σp@20D is increased .

Solving the HJE (Hamilton-Jacobi equation) for the free particle in 1D (see Jelitto p.342 or Schmutzer p.430)

In the Hamilton-Jacobi mechanics we search for a canonical transformation which leads from the old coordinates and

momenta to constant (time-independent) new coordinates and momenta in the phase space. If such a transformation can

be found, then the integration of the equations of motion is much simplified. The method implies the determination of a

complete solution of a problem-specific PDE called Hamilton-Jacobi equation (HJE).

In[876]:=

Remove@"Global`*"DIn[877]:=

T = m 2 x'@tD2;

V = 0;

Print@"Lagrangian: L = ", L = T - VDPrint@"Hamiltonian H and Hamilton equations of motion:"DH8H, eqnMotion< = Rest@Hamilton@L, 8x<, 8p<, tDDL TableForm

Lagrangian: L =1

2m x¢@tD2

Hamiltonian H and Hamilton equations of motion:

Out[881]//TableForm=

p@tD22 m

x¢@tD p@tDm

p¢@tD 0

Hamilton-Jacobi equation for a type 2 canonical transformation generator S:

Newton, Lagrange, Hamilton and Hamilton-Jacobi Mechanics of Classical Particles with Mathematica.nb 109

Page 110: Newton, Lagrange, Hamilton and Hamilton-Jacobi …o.castera.free.fr/zip/Newton, Lagrange, Hamilton and Hamilton... · Ł Separability of the HJE for a particle attracted to two fixed

In[882]:=

H + SH0,1L@x@tD, tD 0

Print@"Hamilton-Jacobi equation:"DIHJE = %% . p@tD ® SH1,0L@x@tD, tDM TraditionalForm

Out[882]=

p@tD2

2 m+ SH0,1L@x@tD, tD 0

Hamilton-Jacobi equation:

Out[884]//TraditionalForm=

SH1,0LHxHtL, tL2

2 m+ SH0,1LHxHtL, tL 0

Separation ansatz for solving the Hamilton-Jacobi equation with separation constant Α:

In[885]:=

HJE . S ® HΨ@ð1D + Φ@ð2D &LHlh = %@@1, 2DDL Hrh = -%@@1, 1DDL Α

Out[885]=

Φ¢@tD +Ψ¢@x@tDD2

2 m 0

Out[886]=

Ψ¢@x@tDD2

2 m -Φ¢@tD Α

Solving the separated ordinary differential equations by quadratures:

In[887]:=

DSolve@rh Α, Φ@tD, t, GeneratedParameters ® AD;Print@"Φ@tD = ", %@@1, 1DD . Rule ® SetDΦ@tD = -t Α + A@1D

In[889]:=

DSolve@lh Α, Ψ¢@x@tDD, x@tD, GeneratedParameters ® BDPrint@"We choose the first solution for Ψ@x@tDD:"DPrint@"Ψ@x@tDD = ", %%@@1, 1DD . Rule ® SetD

Out[889]=99Ψ@x@tDD ® B@1D - 2 m Α x@tD=, 9Ψ@x@tDD ® B@1D + 2 m Α x@tD==We choose the first solution for Ψ@x@tDD:Ψ@x@tDD = B@1D - 2 m Α x@tD

Note: If we choose the second solution for Ψ[x[t]], we get the motion in the opposite direction.

Putting the two results together, we get as a complete solution S to the Hamilton-Jacobi equation:

In[892]:=

Print@"S = ", S = HΨ@x@tDD + Φ@tDL . HA@1D + B@1DL ® constDS = const - t Α - 2 m Α x@tD

We set for the constant new momentum P = Α, so the constant new coordinate becomes Q = Β = ¶Α S, then we

invert this equation to get the time evolution for the old coordinate x(t):

Newton, Lagrange, Hamilton and Hamilton-Jacobi Mechanics of Classical Particles with Mathematica.nb 110

Page 111: Newton, Lagrange, Hamilton and Hamilton-Jacobi …o.castera.free.fr/zip/Newton, Lagrange, Hamilton and Hamilton... · Ł Separability of the HJE for a particle attracted to two fixed

We set for the constant new momentum P = Α, so the constant new coordinate becomes Q = Β = ¶Α S, then we

invert this equation to get the time evolution for the old coordinate x(t):

In[893]:=

Β ¶ΑS

Solve@%, x@tDD;qrule = %@@1, 1DD

Out[893]=

Β -t -m x@tD2 Α

Out[895]=

x@tD ® -2 Α Ht + ΒL

m

Formally, the time evolution for the old momentum p(t) comes from the transformation equation p = ¶x S:

In[896]:=

prule = p@tD ® ¶x@tD S

Out[896]=

p@tD ® - 2 m Α

This result checks with the Hamilton equations of motion:

In[897]:=

eqnMotion . Derivative@1D@f_D@tD ® HoldForm@D@f@tD, tDD% . 8qrule, prule< ReleaseHold

Out[897]=9¶tx@tD p@tDm

, ¶tp@tD 0=Out[898]=8True, True< Solving the HJE for the harmonic oscillator in 1D (see Goldstein&Poole&Safko p.434-437)

In[899]:=

Remove@"Global`*"DIn[900]:=

Print@"Assumptions: ", $Assumptions = 8Ω > 0 && m > 0 && Α ³ 0<DAssumptions: 8Ω > 0 && m > 0 && Α ³ 0<

In[901]:=

T = m 2 q'@tD2;

V = m 2 Ω2 q@tD2;

Print@"Lagrangian: L = ", L = T - VDPrint@"Hamiltonian H and Hamilton equations of motion:"DH8H, eqnMotion< = Rest@Hamilton@L, 8q<, 8p<, tDDL TableForm

Lagrangian: L = -1

2m Ω2 q@tD2 +

1

2m q¢@tD2

Newton, Lagrange, Hamilton and Hamilton-Jacobi Mechanics of Classical Particles with Mathematica.nb 111

Page 112: Newton, Lagrange, Hamilton and Hamilton-Jacobi …o.castera.free.fr/zip/Newton, Lagrange, Hamilton and Hamilton... · Ł Separability of the HJE for a particle attracted to two fixed

Hamiltonian H and Hamilton equations of motion:

Out[905]//TableForm=

p@tD22 m

+1

2m Ω2 q@tD2

q¢@tD p@tDm

p¢@tD -m Ω2 q@tDHamilton-Jacobi equation for a type 2 canonical transformation generator S:

In[906]:=

H + SH0,1L@q@tD, tD 0

Print@"Hamilton-Jacobi equation:"DIHJE = %% . p@tD ® SH1,0L@q@tD, tDM TraditionalForm

Out[906]=

p@tD2

2 m+1

2m Ω2 q@tD2 + SH0,1L@q@tD, tD 0

Hamilton-Jacobi equation:

Out[908]//TraditionalForm=

SH1,0LHqHtL, tL2

2 m+ SH0,1LHqHtL, tL +

1

2m Ω2 qHtL2 0

Separation ansatz for solving the Hamilton-Jacobi equation with separation constant Α ³ 0:

In[909]:=

HJE . S ® HΨ@ð1D + Φ@ð2D &LHlh = %@@1, 81, 3<DDL Hrh = -%@@1, 2DDL Α

Out[909]=

1

2m Ω2 q@tD2 + Φ¢@tD +

Ψ¢@q@tDD2

2 m 0

Out[910]=

1

2m Ω2 q@tD2 +

Ψ¢@q@tDD2

2 m -Φ¢@tD Α

Solving the separated ordinary differential equations by quadratures:

In[911]:=

DSolve@rh Α, Φ@tD, tD;Print@"Φ@tD = ", %@@1, 1DD . Rule ® SetDΦ@tD = -t Α + C@1D

In[913]:=

Solve@lh Α, Ψ¢@q@tDDDOut[913]=99Ψ¢@q@tDD ® - 2 m Α - m2 Ω2 q@tD2 =, 9Ψ¢@q@tDD ® 2 m Α - m2 Ω2 q@tD2 ==We choose the positive root and integrate formally (not actually, because it is unnecessary)...

Newton, Lagrange, Hamilton and Hamilton-Jacobi Mechanics of Classical Particles with Mathematica.nb 112

Page 113: Newton, Lagrange, Hamilton and Hamilton-Jacobi …o.castera.free.fr/zip/Newton, Lagrange, Hamilton and Hamilton... · Ł Separability of the HJE for a particle attracted to two fixed

In[914]:=

PrintB"Ψ@q@tD = ", Ψ@q@tDD = IntegrateBHoldFormB 2 m Α - m2 Ω2 q@tD2 F, q@tDFFΨ@q@tD = à 2 m Α - m2 Ω2 q@tD2 âq@tD

Putting the two results together, we get as a complete solution S to the Hamilton-Jacobi equation:

In[915]:=

Print@"S = ", S = Ψ@q@tDD + Φ@tDDS = -t Α + C@1D + à 2 m Α - m2 Ω2 q@tD2 âq@tD

We set for the constant new momentum P = Α, so the constant new coordinate is given by

Q = Β = ¶Α S = -t + à ¶Α 2 m Α - m2 Ω2 q@tD2 âq@tD. The green function below is proposed as an indefinite

integral of the red expression, derivation shows that this is indeed correct:

In[916]:=

¶Α 2 m Α - m2 Ω2 q@tD2 == ¶q@tD int = 1 Ω ArcSinBq@tD m Ω2 H2 ΑL F% FullSimplify

Out[916]=

m

2 m Α - m2 Ω2 q@tD2

m Ω2

Α

2 Ω 1 -m Ω2 q@tD2

2 Α

Out[917]=

True

Note: Mathematica get the same integral in a somewhat weird fashion...

In[918]:=

IntegrateB¶Α 2 m Α - m2 Ω2 q@tD2 , q@tDF Simplify

1 Ω ArcSinBq@tD m Ω2 H2 ΑL F TrigToExp Simplify

Out[918]=

LogA2 Ω m Ω q@tD + m I-2 Α + m Ω2 q@tD2M E -2 Α + m Ω2 q@tD2

Ω 2 Α - m Ω2 q@tD2

Out[919]=

-

ä LogA äm

ΑΩ q@tD2

+ 1 -m Ω2 q@tD2

2 ΑE

Ω

Inversion of the equation to get the time evolution for the old coordinate q(t):

Newton, Lagrange, Hamilton and Hamilton-Jacobi Mechanics of Classical Particles with Mathematica.nb 113

Page 114: Newton, Lagrange, Hamilton and Hamilton-Jacobi …o.castera.free.fr/zip/Newton, Lagrange, Hamilton and Hamilton... · Ł Separability of the HJE for a particle attracted to two fixed

In[920]:=

Β -t + int

Solve@%, q@tDDqrule = %@@1, 1DD FullSimplify PowerExpand

Out[920]=

Β -t +

ArcSinA m Ω2

Αq@tD

2

Out[921]=

99q@tD ®

2 Αm Ω2

ΑSin@Ht + ΒL ΩD

m Ω2==

Out[922]=

q@tD ®2 Α Sin@Ht + ΒL ΩD

m Ω

Finally, we got the well-know result for the harmonic oscillator.

Formally, the time evolution for the old momentum p(t) comes from the transformation equation p = ¶q S and in

conjunction with the solution for the old coordinate q(t) this becomes

In[923]:=

¶q@tD S ReleaseHold

% . qrule

prule = p@tD ® MapAtASimplify, % . Sin@x_D2 ® I1 - Cos@xD2M, 81<E PowerExpand

Out[923]=

2 m Α - m2 Ω2 q@tD2

Out[924]=

2 m Α - 2 m Α Sin@Ht + ΒL ΩD2

Out[925]=

p@tD ® 2 m Α Cos@Ht + ΒL ΩDThis result checks with the Hamilton equations of motion:

In[926]:=

eqnMotion . Derivative@1D@f_D@tD ® HoldForm@D@f@tD, tDD% . 8qrule, prule< ReleaseHold

Out[926]=9¶tq@tD p@tDm

, ¶tp@tD -m Ω2 q@tD=Out[927]=8True, True<

Newton, Lagrange, Hamilton and Hamilton-Jacobi Mechanics of Classical Particles with Mathematica.nb 114

Page 115: Newton, Lagrange, Hamilton and Hamilton-Jacobi …o.castera.free.fr/zip/Newton, Lagrange, Hamilton and Hamilton... · Ł Separability of the HJE for a particle attracted to two fixed

Solving the HJE for the slant throw in 2D (see Jelitto p.342 or Greiner p.395-397)

In[928]:=

Remove@"Global`*"DIn[929]:=

$Assumptions = 8m > 0 && g > 0<T = m 2 Ix'@tD2 + z'@tD2M;V = m g z@tD;Print@"Lagrangian: L = ", L = T - VDHamilton@L, 8x, z<, 8px, pz<, tD;Print@"Hamiltonian H = ", H = %@@2DD,",\nHamilton equations of motion: ", HeqnMotion = %@@3DDL TableFormD

Out[929]=8m > 0 && g > 0<Lagrangian: L = -g m z@tD +

1

2m Ix¢@tD2 + z¢@tD2M

Hamiltonian H = g m z@tD +px@tD2

2 m+pz@tD2

2 m,

Hamilton equations of motion:

x¢@tD px@tDm

z¢@tD pz@tDmHpxL¢@tD 0HpzL¢@tD -g m

Hamilton-Jacobi equation for a type 2 canonical transformation generator S:

In[935]:=

H + SH0,0,1L@x@tD, y@tD, tD 0

Print@"Hamilton-Jacobi equation:"DIHJE = %% . 9px@tD ® SH1,0,0L@x@tD, z@tD, tD, pz@tD ® SH0,1,0L@x@tD, z@tD, tD= SimplifyM TraditionalForm

Out[935]=

g m z@tD +px@tD2

2 m+pz@tD2

2 m+ SH0,0,1L@x@tD, y@tD, tD 0

Hamilton-Jacobi equation:

Out[937]//TraditionalForm=

2 m SH0,0,1LHxHtL, yHtL, tL + SH0,1,0LHxHtL, zHtL, tL2+ SH1,0,0LHxHtL, zHtL, tL2

+ 2 g m2 zHtL 0

Separation ansatz for solving the Hamilton-Jacobi equation with separation constants PA (for the time t) and PB (for the

space components x and z):

In[938]:=

HJE . S ® HWx@ð1D + Wz@ð2D - PA ð3 &LHlh = %@@1, 83<DDL Hrh = -%@@1, 81, 2, 4<DDL PB

Out[938]=

-2 m PA + 2 g m2 z@tD + HWxL¢@x@tDD2 + HWzL¢@z@tDD2 0

Out[939]=HWxL¢@x@tDD2 2 m PA - 2 g m2 z@tD - HWzL¢@z@tDD2 PB

Solving the separated ordinary differential equations by quadratures:

Newton, Lagrange, Hamilton and Hamilton-Jacobi Mechanics of Classical Particles with Mathematica.nb 115

Page 116: Newton, Lagrange, Hamilton and Hamilton-Jacobi …o.castera.free.fr/zip/Newton, Lagrange, Hamilton and Hamilton... · Ł Separability of the HJE for a particle attracted to two fixed

Solving the separated ordinary differential equations by quadratures:

In[940]:=

DSolve@lh PB, Wx@x@tDD, x@tD, GeneratedParameters ® aDPrint@"Wx@x@tDD = ", %@@2, 1DD . Rule ® SetD

Out[940]=99Wx@x@tDD ® a@1D - PB x@tD=, 9Wx@x@tDD ® a@1D + PB x@tD==Wx@x@tDD = a@1D + PB x@tD

In[942]:=

DSolve@rh PB, Wz@z@tDD, z@tD, GeneratedParameters ® bDPrint@"Wz@x@tDD = ", %@@2, 1DD . Rule ® SetD

Out[942]=

99Wz@z@tDD ® b@1D -I2 m PA - PB - 2 g m2 z@tDM32

3 g m2=,

9Wz@z@tDD ® b@1D +I2 m PA - PB - 2 g m2 z@tDM32

3 g m2==

Wz@x@tDD = b@1D +I2 m PA - PB - 2 g m2 z@tDM32

3 g m2

Note: You can choose either solution for Wx, but only the second solution for Wz leads to consistent Hamilton equations

of motion.

Putting all results together, we get a complete solution S to the Hamilton-Jacobi equation: As required, S solves the

Hamilton-Jacobi equation and depends on the two coordinates x(t) and y(t) and on two essential constants PA and PB

(the third additive constant C is non essential). S is called Hamilton's principal function.

In[944]:=

Print@"S = ", S = Wx@x@tDD + Wz@z@tDD - PA t . a@1D + b@1D ® CDS = C - PA t + PB x@tD +

I2 m PA - PB - 2 g m2 z@tDM323 g m2

We choose PA and PB as values for the new constant momenta, so we get for the new constant coordinates QA and QB:

In[945]:=8QA == ¶PA S, QB == ¶PBS<Out[945]=

9QA -t +2 m PA - PB - 2 g m2 z@tD

g m, QB

x@tD2 PB

-2 m PA - PB - 2 g m2 z@tD

2 g m2=

Inverting the equations we get the time evolution for the old coordinates:

In[946]:=

qrule = Solve@%, 8x@tD, z@tD<D@@1DD Simplify

Out[946]=

9x@tD ®PB HQA + 2 m QB + tL

m, z@tD ® -

-2 m PA + PB + g2 m2 HQA + tL2

2 g m2=

Finally, we fund the familiar throw parabola.

Newton, Lagrange, Hamilton and Hamilton-Jacobi Mechanics of Classical Particles with Mathematica.nb 116

Page 117: Newton, Lagrange, Hamilton and Hamilton-Jacobi …o.castera.free.fr/zip/Newton, Lagrange, Hamilton and Hamilton... · Ł Separability of the HJE for a particle attracted to two fixed

Finally, we fund the familiar throw parabola.

Formally, the time evolution for the old momenta comes from the transformation equations pq = ¶q S and in conjunc-

tion with the solution for the old coordinates this becomes

In[947]:=

prule = 8px@tD ® ¶x@tD S, pz@tD ® ¶z@tD S< . qrule Simplify PowerExpand

Out[947]=9px@tD ® PB , pz@tD ® -g m HQA + tL=The results for the old coordinates and the old momenta check with the old Hamilton equations of motion:

In[948]:=

eqnMotion . Derivative@1D@f_D@tD ® HoldForm@D@f@tD, tDD% . qrule . prule ReleaseHold Simplify

Out[948]=9¶tx@tD px@tDm

, ¶tz@tD pz@tDm

, ¶tpx@tD 0, ¶tpz@tD -g m=Out[949]=8True, True, True, True< Separability of the HJE for a particle attracted to two fixed gravitational centers in 2D (see

José&Saletan, Worked Example 6.3, p.298-301)

José&Saletan: "Show that the Hamilton-Jacobi equation for a particle attracted to two fixed (nonrelativistic) gravita-

tional centers in the plane is separable in confocal elliptical coordinates."

In[950]:=

Remove@"Global`*"DIn[951]:=

Print@"Assumptions: ", $Assumptions = 8m > 0, c > 0, 0 £ Ξ@tD < ¥, 0 £ Η@tD < 2 Π<DAssumptions: 8m > 0, c > 0, 0 £ Ξ@tD < ¥, 0 £ Η@tD < 2 Π<

Transformation from Cartesian coordinates (x, y) to confocal elliptical coordinates (Ξ, Η) as stated in the book:

In[952]:=

coordTransformation = 8x ® Hc Cosh@Ξ@ð DD Cos@Η@ð DD &L,y ® Hc Sinh@Ξ@ð DD Sin@Η@ð DD &L<;

% . Function@a_D ® a . b_@ðD ® b ColumnForm

Out[953]=

x ® c Cos@ΗD Cosh@ΞDy ® c Sin@ΗD Sinh@ΞD

Lagrangian in Cartesian coordinates:

Newton, Lagrange, Hamilton and Hamilton-Jacobi Mechanics of Classical Particles with Mathematica.nb 117

Page 118: Newton, Lagrange, Hamilton and Hamilton-Jacobi …o.castera.free.fr/zip/Newton, Lagrange, Hamilton and Hamilton... · Ł Separability of the HJE for a particle attracted to two fixed

In[954]:=

T = m 2 Ix¢@tD2 + y¢@tD2M;V = -HΑ1 r1 + Α2 r2L . :r1 ® Hx@tD - cL2 + y@tD2 , r2 ® Hx@tD + cL2 + y@tD2 >;Print@"Lagrangian L = ", L = T - VDLagrangian L =

Α1H-c + x@tDL2 + y@tD2

+Α2Hc + x@tDL2 + y@tD2

+1

2m Ix¢@tD2 + y¢@tD2M

Change of parameters for a cute potential V in confocal elliptical coordinates (in disagreement with the book):

In[957]:=

Αrule = Solve@Α == HΑ1 + Α2L c && Α¢ == -HΑ1 - Α2L c, 8Α1, Α2<D Simplify First

Out[957]=9Α1 ®1

2c HΑ - Α¢L, Α2 ®

1

2c HΑ + Α¢L=

Lagrangian in confocal elliptical coordinates (kinetic energy T is in disagreement and potential V is in agreement with

the book):

In[958]:=

Print@"T = ", TT = T . coordTransformation SimplifyDPrint@"V = ", VV = V . coordTransformation . Αrule SimplifyDPrint@"Lagrangian in the new coordinates L = ", LL = TT - VVDT = -

1

4c2 m HCos@2 Η@tDD - Cosh@2 Ξ@tDDL IΗ¢@tD2 + Ξ¢@tD2M

V =Α Cosh@Ξ@tDD - Cos@Η@tDD Α¢

Cos@Η@tDD2 - Cosh@Ξ@tDD2

Lagrangian in the new coordinates L =

-Α Cosh@Ξ@tDD - Cos@Η@tDD Α¢

Cos@Η@tDD2 - Cosh@Ξ@tDD2-1

4c2 m HCos@2 Η@tDD - Cosh@2 Ξ@tDDL IΗ¢@tD2 + Ξ¢@tD2M

Hamiltonian in confocal elliptical coordinates (result is in disagreement with the book):

In[961]:=

HamiltonALL, 8Ξ, Η<, 9pΞ, pΗ=, tE;Print@"Hamiltonian in the new coordinates H = ", H = %@@2DD FullSimplifyDHamiltonian in the new coordinates H = -

-2 c2 m Α Cosh@Ξ@tDD + 2 c2 m Cos@Η@tDD Α¢ + pΗ@tD2 + pΞ@tD2

c2 m HCos@2 Η@tDD - Cosh@2 Ξ@tDDLNow we set up the Hamilton-Jacobi equation. I'm departing here from the book by using the general HJE, not the time-

independent HJE.

Newton, Lagrange, Hamilton and Hamilton-Jacobi Mechanics of Classical Particles with Mathematica.nb 118

Page 119: Newton, Lagrange, Hamilton and Hamilton-Jacobi …o.castera.free.fr/zip/Newton, Lagrange, Hamilton and Hamilton... · Ł Separability of the HJE for a particle attracted to two fixed

In[963]:=

H + SH0,0,1L@Ξ@tD, Η@tD, tD 0

Print@"Hamilton-Jacobi equation:"DIHJE = %% . 9pΞ@tD ® SH1,0,0L@Ξ@tD, Η@tD, tD, pΗ@tD ® SH0,1,0L@Ξ@tD, Η@tD, tD=M TraditionalForm

Out[963]=

--2 c2 m Α Cosh@Ξ@tDD + 2 c2 m Cos@Η@tDD Α¢ + pΗ@tD2 + pΞ@tD2

c2 m HCos@2 Η@tDD - Cosh@2 Ξ@tDDL + SH0,0,1L@Ξ@tD, Η@tD, tD 0

Hamilton-Jacobi equation:

Out[965]//TraditionalForm=

SH0,0,1LHΞHtL, ΗHtL, tL -SH0,1,0LHΞHtL, ΗHtL, tL2

+ SH1,0,0LHΞHtL, ΗHtL, tL2+ 2 c2 m Α¢ cosHΗHtLL - 2 c2 m Α coshHΞHtLL

c2 m HcosH2 ΗHtLL - coshH2 ΞHtLLL 0

Separation ansatz S = -tE + WΗ + WΞ for solving the Hamilton-Jacobi equation with separation constants E (for the

time t) and Q (for the coordinates Ξ and Η):

In[966]:=

HJE . S ® IWΞ@ð1D + WΗ@ð2D - E ð3 &MH%@@1DD %@@1, 2, 82, 3, 4<DD SimplifyL 0Hlh = %@@1, 82, 3, 6<DDL Hrh = -%@@1, 81, 4, 5<DDL Q

SolveAlh Q . HWΞL¢@Ξ@tDD2 ® A, AE . A ® HWΞL¢@Ξ@tDD2;HWΞL¢@Ξ@tDD ® +Sqrt@%@@1, 1, 2DDDPrint@"WΞ = ", HWΞ = Integrate@tag@%@@2DDD, Ξ@tDD . tag ® HoldFormLDSolveBrh Q . IWΗM¢@Η@tDD2

® A, AF . A ® IWΗM¢@Η@tDD2;

IWΗM¢@Η@tDD ® +Sqrt@%@@1, 1, 2DDDPrintA"WΗ = ", IWΗ = Integrate@tag@%@@2DDD, Η@tDD . tag ® HoldFormME

Out[966]=

-E --2 c2 m Α Cosh@Ξ@tDD + 2 c2 m Cos@Η@tDD Α¢ + IWΗM¢@Η@tDD2

+ HWΞL¢@Ξ@tDD2

c2 m HCos@2 Η@tDD - Cosh@2 Ξ@tDDL 0

Out[967]=

-c2 m E Cos@2 Η@tDD + 2 c2 m Α Cosh@Ξ@tDD +

c2 m E Cosh@2 Ξ@tDD - 2 c2 m Cos@Η@tDD Α¢ - IWΗM¢@Η@tDD2- HWΞL¢@Ξ@tDD2 0

Out[968]=

2 c2 m Α Cosh@Ξ@tDD + c2 m E Cosh@2 Ξ@tDD - HWΞL¢@Ξ@tDD2

c2 m E Cos@2 Η@tDD + 2 c2 m Cos@Η@tDD Α¢ + IWΗM¢@Η@tDD2 Q

Out[970]=HWΞL¢@Ξ@tDD ® -Q + 2 c2 m Α Cosh@Ξ@tDD + c2 m E Cosh@2 Ξ@tDDWΞ = à -Q + 2 c2 m Α Cosh@Ξ@tDD + c2 m E Cosh@2 Ξ@tDD âΞ@tD

Out[973]=IWΗM¢@Η@tDD ® Q - c2 m E Cos@2 Η@tDD - 2 c2 m Cos@Η@tDD Α¢

WΗ = à Q - c2 m E Cos@2 Η@tDD - 2 c2 m Cos@Η@tDD Α¢ âΗ@tDThe Hamilton principal function S for the problem is therefore (in slight disagreement with the book):

Newton, Lagrange, Hamilton and Hamilton-Jacobi Mechanics of Classical Particles with Mathematica.nb 119

Page 120: Newton, Lagrange, Hamilton and Hamilton-Jacobi …o.castera.free.fr/zip/Newton, Lagrange, Hamilton and Hamilton... · Ł Separability of the HJE for a particle attracted to two fixed

The Hamilton principal function S for the problem is therefore (in slight disagreement with the book):

In[975]:=

PrintA"S = -tE + WΗ + WΞ = ", S = -t E + WΗ + WΞES = -tE + WΗ + WΞ = -t E + à -Q + 2 c2 m Α Cosh@Ξ@tDD + c2 m E Cosh@2 Ξ@tDD âΞ@tD +

à Q - c2 m E Cos@2 Η@tDD - 2 c2 m Cos@Η@tDD Α¢ âΗ@tDThe problem is indeed separable in confocal elliptical coordinates.

Separation of variables in ("normalized") elliptic coordinates of the HJE in physically interestingplanar cases (see Landau&Lifshitz, § 48, (3) Elliptic co-ordinates)

In[976]:=

Remove@"Global`*"DIn[977]:=

Print@"Assumptions: ",

$Assumptions = 8Σ > 0, r1 ³ 0, r2 ³ 0, 1 £ Ξ@tD < ¥, -1 £ Η@tD £ 1, m > 0<DAssumptions: 8Σ > 0, r1 ³ 0, r2 ³ 0, 1 £ Ξ@tD < ¥, -1 £ Η@tD £ 1, m > 0<

Transformation from Cartesian coordinates (x,y) to ("normalized") elliptic coordinates (Ξ,Η) as shown in the book; we

discuss here only the planar case, so we ignore the third coordinate and set Φ= 0, Φ

= 0.

In[978]:=

r1 = Hx@tD - ΣL2 + y@tD2 ;

r2 = Hx@tD + ΣL2 + y@tD2 ;

Solve@HΞ@tD Hr2 + r1L H2 ΣLL && HΗ@tD Hr2 - r1L H2 ΣLL, 8x@tD, y@tD<D FullSimplify

coordTransformation = %@@2DD Ü Thread@D@%@@2DD, tDD Simplify

Out[980]=

99y@tD ® -Σ I1 - Η@tD2M I-1 + Ξ@tD2M , x@tD ® Σ Η@tD Ξ@tD=,9y@tD ® Σ I1 - Η@tD2M I-1 + Ξ@tD2M , x@tD ® Σ Η@tD Ξ@tD==

Out[981]=

9x@tD ® Σ Η@tD Ξ@tD, y@tD ® Σ I1 - Η@tD2M I-1 + Ξ@tD2M ,

x¢@tD ® Σ HΞ@tD Η¢@tD + Η@tD Ξ¢@tDL,y¢@tD ®

Σ I-2 Η@tD I-1 + Ξ@tD2M Η¢@tD - 2 I-1 + Η@tD2M Ξ@tD Ξ¢@tDM2 -I-1 + Η@tD2M I-1 + Ξ@tD2M =

Note: The following inequalities hold:

Newton, Lagrange, Hamilton and Hamilton-Jacobi Mechanics of Classical Particles with Mathematica.nb 120

Page 121: Newton, Lagrange, Hamilton and Hamilton-Jacobi …o.castera.free.fr/zip/Newton, Lagrange, Hamilton and Hamilton... · Ł Separability of the HJE for a particle attracted to two fixed

In[982]:=8H* Η - Ξ = *L Hr1 - r2L H2 ΣL - Hr1 + r2L H2 ΣL £ 0,H* Η + Ξ = *L Hr1 - r2L H2 ΣL + Hr1 + r2L H2 ΣL ³ 0< FullSimplify

Out[982]=8True, True<We start here with the Lagrangian in Cartesian coordinates. The choosen form of the potential V leads to a separable

problem in the new coordinates; a(Ξ) and b(Η) are arbitrary functions (see equation (48.21) of the book). With

a HΞL = HΑ1 + Α2L Ξ Σ and b HΗL = HΑ1 - Α2L Η Σ you get for example the Coulomb field V = Α1/r1 + Α2/r2 of

two point charges at a distance 2Σ apart (see PROBLEM 2 at the end of § 48).

In[983]:=

T = m 2 Ix¢@tD2 + y¢@tD2M;V = Σ2 Hr1 r2L Ha@Hr1 + r2L H2 ΣLD + b@Hr2 - r1L H2 ΣLDLPrint@"Lagrangian L = ", L = T - VD

Out[984]=

Σ2 aA H-Σ+x@tDL2+y@tD2 + HΣ+x@tDL2+y@tD22 Σ

E + bA - H-Σ+x@tDL2+y@tD2 + HΣ+x@tDL2+y@tD22 Σ

EH-Σ + x@tDL2 + y@tD2 HΣ + x@tDL2 + y@tD2

Lagrangian L =

-

Σ2 aB H-Σ+x@tDL2+y@tD2 + HΣ+x@tDL2+y@tD22 Σ

F + bB - H-Σ+x@tDL2+y@tD2 + HΣ+x@tDL2+y@tD22 Σ

FH-Σ + x@tDL2 + y@tD2 HΣ + x@tDL2 + y@tD2

+1

2m Ix¢@tD2 + y¢@tD2M

Lagrangian in elliptic coordinates:

In[986]:=

Print@"T = ", TT = T . coordTransformation Apart SimplifyDPrint@"V = ", VV = V . coordTransformation SimplifyDPrint@"Lagrangian in the new coordinates L = ", LL = TT - VVDT =

1

2m Σ2 I-Η@tD2 + Ξ@tD2M -

Η¢@tD2

-1 + Η@tD2+

Ξ¢@tD2

-1 + Ξ@tD2

V =a@Ξ@tDD + b@Η@tDD

-Η@tD2 + Ξ@tD2

Lagrangian in the new coordinates L =

-a@Ξ@tDD + b@Η@tDD

-Η@tD2 + Ξ@tD2+1

2m Σ2 I-Η@tD2 + Ξ@tD2M -

Η¢@tD2

-1 + Η@tD2+

Ξ¢@tD2

-1 + Ξ@tD2

Hamiltonian in elliptic coordinates:

Newton, Lagrange, Hamilton and Hamilton-Jacobi Mechanics of Classical Particles with Mathematica.nb 121

Page 122: Newton, Lagrange, Hamilton and Hamilton-Jacobi …o.castera.free.fr/zip/Newton, Lagrange, Hamilton and Hamilton... · Ł Separability of the HJE for a particle attracted to two fixed

In[989]:=

HamiltonALL, 8Ξ, Η<, 9pΞ, pΗ=, tE;CollectA%@@2DD, 9a@Ξ@tDD + b@Η@tDD, pΗ@tD, pΞ@tD=E;Simplify@%@@81, 2<DDD + Simplify@%@@3DDD + Simplify@%@@4DDD;Print@"Hamiltonian in the new coordinates H = ", H = %DHamiltonian in the new coordinates H =

-a@Ξ@tDD + b@Η@tDD

Η@tD2 - Ξ@tD2+

I-1 + Η@tD2M pΗ@tD2

2 m Σ2 IΗ@tD2 - Ξ@tD2M -I-1 + Ξ@tD2M pΞ@tD2

2 m Σ2 IΗ@tD2 - Ξ@tD2MNow we set up the Hamilton-Jacobi equation.

In[993]:=IH + SH0,0,1L@Ξ@tD, Η@tD, tD TogetherM 0

%@@1, 5DD 0

Print@"Hamilton-Jacobi equation:"DIHJE = %% . 9pΞ@tD ® SH1,0,0L@Ξ@tD, Η@tD, tD, pΗ@tD ® SH0,1,0L@Ξ@tD, Η@tD, tD=M TraditionalForm

Out[993]=

1

2 m Σ2 IΗ@tD2 - Ξ@tD2MI-2 m Σ2 a@Ξ@tDD - 2 m Σ2 b@Η@tDD - pΗ@tD2 + Η@tD2 pΗ@tD2 + pΞ@tD2 - Ξ@tD2 pΞ@tD2 +

2 m Σ2 Η@tD2 SH0,0,1L@Ξ@tD, Η@tD, tD - 2 m Σ2 Ξ@tD2 SH0,0,1L@Ξ@tD, Η@tD, tDM 0

Out[994]=

-2 m Σ2 a@Ξ@tDD - 2 m Σ2 b@Η@tDD - pΗ@tD2 + Η@tD2 pΗ@tD2 + pΞ@tD2 - Ξ@tD2 pΞ@tD2 +

2 m Σ2 Η@tD2 SH0,0,1L@Ξ@tD, Η@tD, tD - 2 m Σ2 Ξ@tD2 SH0,0,1L@Ξ@tD, Η@tD, tD 0

Hamilton-Jacobi equation:

Out[996]//TraditionalForm=

2 m Σ2 ΗHtL2 SH0,0,1LHΞHtL, ΗHtL, tL - 2 m Σ2 ΞHtL2 SH0,0,1LHΞHtL, ΗHtL, tL + ΗHtL2 SH0,1,0LHΞHtL, ΗHtL, tL2-

SH0,1,0LHΞHtL, ΗHtL, tL2- ΞHtL2 SH1,0,0LHΞHtL, ΗHtL, tL2

+ SH1,0,0LHΞHtL, ΗHtL, tL2- 2 m Σ2 aHΞHtLL - 2 m Σ2 bHΗHtLL 0

Separation ansatz S = -tE + WΗ + WΞ for solving the Hamilton-Jacobi equation with separation constants E (for the

time t) and Β¢ (for the coordinates Ξ and Η):

Newton, Lagrange, Hamilton and Hamilton-Jacobi Mechanics of Classical Particles with Mathematica.nb 122

Page 123: Newton, Lagrange, Hamilton and Hamilton-Jacobi …o.castera.free.fr/zip/Newton, Lagrange, Hamilton and Hamilton... · Ł Separability of the HJE for a particle attracted to two fixed

In[997]:=

HJE . S ® IWΞ@ð1D + WΗ@ð2D - E ð3 &MHlh = %@@1, 81, 4, 7, 8<DDL Hrh = -%@@1, 82, 3, 5, 6<DDL Β¢

SolveAlh Β¢ . HWΞL¢@Ξ@tDD2 ® A, AE . A ® HWΞL¢@Ξ@tDD2 . Β' ® -Β + 2 m E Σ2;

%@@1, 1, 2DD Apart;HWΞL¢@Ξ@tDD ® +Sqrt@%@@1DD + Simplify@%@@82, 3<DDDDPrint@"WΞ = ", HWΞ = Integrate@tag@%@@2DDD, Ξ@tDD . tag ® HoldFormLDSolveBrh Β¢ . IWΗM¢@Η@tDD2

® A, AF . Β' ® -Β + 2 m E Σ2;

%@@1, 1, 2DD Apart;IWΗM¢@Η@tDD ® Sqrt@%@@1DD + Simplify@%@@82, 3<DDDDPrintA"WΗ = ", IWΗ = Integrate@tag@%@@2DDD, Η@tDD . tag ® HoldFormME

Out[997]=

-2 m Σ2 a@Ξ@tDD - 2 m Σ2 b@Η@tDD - 2 m E Σ2 Η@tD2 + 2 m E Σ2 Ξ@tD2 -IWΗM¢@Η@tDD2+ Η@tD2 IWΗM¢@Η@tDD2

+ HWΞL¢@Ξ@tDD2 - Ξ@tD2 HWΞL¢@Ξ@tDD2 0

Out[998]=

-2 m Σ2 a@Ξ@tDD + 2 m E Σ2 Ξ@tD2 + HWΞL¢@Ξ@tDD2 - Ξ@tD2 HWΞL¢@Ξ@tDD2

2 m Σ2 b@Η@tDD + 2 m E Σ2 Η@tD2 + IWΗM¢@Η@tDD2- Η@tD2 IWΗM¢@Η@tDD2

Β¢

Out[1001]=

HWΞL¢@Ξ@tDD ® 2 m E Σ2 +Β - 2 m Σ2 a@Ξ@tDD

-1 + Ξ@tD2

WΞ = á 2 m E Σ2 +Β - 2 m Σ2 a@Ξ@tDD

-1 + Ξ@tD2âΞ@tD

Out[1005]=

IWΗM¢@Η@tDD ® 2 m E Σ2 +Β + 2 m Σ2 b@Η@tDD

-1 + Η@tD2

WΗ = á 2 m E Σ2 +Β + 2 m Σ2 b@Η@tDD

-1 + Η@tD2âΗ@tD

The Hamilton principal function S for the problem is therefore:

In[1007]:=

PrintA"S = ", S = -t E + WΗ + WΞES = -t E + á 2 m E Σ2 +

Β + 2 m Σ2 b@Η@tDD-1 + Η@tD2

âΗ@tD + á 2 m E Σ2 +Β - 2 m Σ2 a@Ξ@tDD

-1 + Ξ@tD2âΞ@tD

This agrees, apart from the ignored Φ terms, with equation (48.22) of the book. (I'm rather lucky: who wants to disagree

with Landau, except Stalin perhaps...)

HJE and Hamilton's principal function for the planar problem of the attraction from two equaland fixed masses (see Arnold, chapter IX, § 47, C. Examples)

In[1008]:=

Remove@"Global`*"D

Newton, Lagrange, Hamilton and Hamilton-Jacobi Mechanics of Classical Particles with Mathematica.nb 123

Page 124: Newton, Lagrange, Hamilton and Hamilton-Jacobi …o.castera.free.fr/zip/Newton, Lagrange, Hamilton and Hamilton... · Ł Separability of the HJE for a particle attracted to two fixed

In[1009]:=

<< Graphics`ImplicitPlot`

In[1010]:=

Print@"Assumptions: ",

$Assumptions = 8c > 0, r1 ³ 0, r2 ³ 0, 2 c £ Ξ@tD, Η@tD - Ξ@tD £ 0, Η@tD + Ξ@tD ³ 0, m > 0<DAssumptions: 8c > 0, r1 ³ 0, r2 ³ 0, 2 c £ Ξ@tD, Η@tD - Ξ@tD £ 0, Η@tD + Ξ@tD ³ 0, m > 0<

Transformation from Cartesian coordinates (x,y) to elliptic coordinates (Ξ,Η) as defined in the book:

In[1011]:=

r1 = Hx@tD + cL2 + y@tD2 ;

r2 = Hc - x@tDL2 + y@tD2 ;

Solve@HΞ@tD r1 + r2L && HΗ@tD r1 - r2L, 8x@tD, y@tD<D FullSimplify

coordTransformation = %@@2DD Ü Thread@D@%@@2DD, tDD Simplify

Out[1013]=

99y@tD ® -

I4 c2 - Η@tD2M I-4 c2 + Ξ@tD2M4 c

, x@tD ®Η@tD Ξ@tD

4 c=,

9y@tD ®

I4 c2 - Η@tD2M I-4 c2 + Ξ@tD2M4 c

, x@tD ®Η@tD Ξ@tD

4 c==

Out[1014]=

9x@tD ®Η@tD Ξ@tD

4 c, y@tD ®

I4 c2 - Η@tD2M I-4 c2 + Ξ@tD2M4 c

,

x¢@tD ®Ξ@tD Η¢@tD + Η@tD Ξ¢@tD

4 c,

y¢@tD ®-2 Η@tD I-4 c2 + Ξ@tD2M Η¢@tD + 2 I4 c2 - Η@tD2M Ξ@tD Ξ¢@tD

8 c I4 c2 - Η@tD2M I-4 c2 + Ξ@tD2M =You can choose either overall sign for y(t); it doesn't matter because y(t) and y'(t) enter the Lagrangian quadratically.

Note: The following inequalities hold:

In[1015]:=8H* Η - Ξ = *L Hr1 - r2L - Hr1 + r2L £ 0,H* Η + Ξ = *L Hr1 - r2L + Hr1 + r2L ³ 0< FullSimplify

Out[1015]=8True, True<Let's plot the mesh of the elliptic coordinate system.

Newton, Lagrange, Hamilton and Hamilton-Jacobi Mechanics of Classical Particles with Mathematica.nb 124

Page 125: Newton, Lagrange, Hamilton and Hamilton-Jacobi …o.castera.free.fr/zip/Newton, Lagrange, Hamilton and Hamilton... · Ł Separability of the HJE for a particle attracted to two fixed

In[1016]:=

r1 = Hx + 2L2 + y2 ; r2 = H2 - xL2 + y2 ;

mesh = Table@r1 + r2 a, 8a, 4, 10, 1<D Ü Table@r1 - r2 a, 8a, -4 , 4, 0.5<D;PrintB"Equations of the shown mesh lines: ",

mesh . : Hx + 2L2 + y2 ® R1, H2 - xL2 + y2 ® R2>FImplicitPlot@mesh, 8x, -5, 5<, 8y, -5, 5<, AspectRatio ® Automatic,

PlotStyle ® 88Red, a = [email protected]<, 8Blue, a<<,ImageSize ® medSizepic, Ticks ® 8b = Range@-5, 5D, b<, PlotLabel ®

"mesh lines of the elliptic coordinate\nsystem with foci at x = ± 2",

Epilog ® [email protected], Black, Point@8-2, 0<D, Point@82, 0<D<DEquations of the shown mesh lines:8R1 - R2 -4., R1 - R2 -3.5, R1 - R2 -3., R1 - R2 -2.5, R1 - R2 -2., R1 - R2 -1.5,

R1 - R2 -1., R1 - R2 -0.5, R1 - R2 0., R1 - R2 0.5, R1 - R2 1., R1 - R2 1.5,

R1 - R2 2., R1 - R2 2.5, R1 - R2 3., R1 - R2 3.5, R1 - R2 4., R1 + R2 4,

R1 + R2 5, R1 + R2 6, R1 + R2 7, R1 + R2 8, R1 + R2 9, R1 + R2 10<Out[1019]=

-5 -4 -3 -2 -1 1 2 3 4 5

-5

-4

-3

-2

-1

1

2

3

4

5

mesh lines of the elliptic coordinate

system with foci at x = ± 2

Note: All ellipses and hyperbolas cross at a right angle. A segment (between the foci), two half-lines (starting from the

foci) and a straight line (y axis) are also part of the mesh as degenerate cases.

Lagrangian in Cartesian coordinates (Note: the book puts m = 1):

In[1020]:=

T = m 2 Ix¢@tD2 + y¢@tD2M;V = -k r1 - k r2;

Print@"Lagrangian L = ", L = T - VDLagrangian L =

k

Hc - x@tDL2 + y@tD2

+k

Hc + x@tDL2 + y@tD2

+1

2m Ix¢@tD2 + y¢@tD2M

Lagrangian in elliptic coordinates:

Newton, Lagrange, Hamilton and Hamilton-Jacobi Mechanics of Classical Particles with Mathematica.nb 125

Page 126: Newton, Lagrange, Hamilton and Hamilton-Jacobi …o.castera.free.fr/zip/Newton, Lagrange, Hamilton and Hamilton... · Ł Separability of the HJE for a particle attracted to two fixed

In[1023]:=

Print@"kinetic energy and potential in the new coordinates:"DPrint@"T = ", TT = T . coordTransformation FullSimplifyDPrint@"V = ", VV = V . coordTransformation SimplifyDPrint@"Lagrangian in the new coordinates L = ", LL = TT - VVDPrint@"canonically conjugate momenta Hgeneralized momentaL:"DpΞ@tD ® ¶Ξ'@tDLL Simplify

pΗ@tD ® ¶Η'@tDLL Simplify

kinetic energy and potential in the new coordinates:

T =1

8m

I-Η@tD2 + Ξ@tD2M Η¢@tD2

4 c2 - Η@tD2+

IΗ@tD2 - Ξ@tD2M Ξ¢@tD2

4 c2 - Ξ@tD2

V =4 k Ξ@tD

Η@tD2 - Ξ@tD2

Lagrangian in the new coordinates L =

-4 k Ξ@tD

Η@tD2 - Ξ@tD2+1

8m

I-Η@tD2 + Ξ@tD2M Η¢@tD2

4 c2 - Η@tD2+

IΗ@tD2 - Ξ@tD2M Ξ¢@tD2

4 c2 - Ξ@tD2

canonically conjugate momenta Hgeneralized momentaL:Out[1028]=

pΞ@tD ®m IΗ@tD2 - Ξ@tD2M Ξ¢@tD

16 c2 - 4 Ξ@tD2

Out[1029]=

pΗ@tD ®m I-Η@tD2 + Ξ@tD2M Η¢@tD

4 I4 c2 - Η@tD2MHamiltonian in elliptic coordinates (with mass m = 1 the result agrees with the book):

In[1030]:=

AA = HamiltonALL, 8Ξ, Η<, 9pΞ, pΗ=, tE;CollectAAA@@2DD, 9pΞ@tD, pΗ@tD=E;Print@"Hamiltonian in the new coordinates H = ",

H = %@@1DD + Simplify@%@@2DDD + Simplify@%@@3DDDDPrint@"Hamilton equations of motion in the new coordinates: ",HHeqns = AA@@3DD SimplifyL TableFormDHamiltonian in the new coordinates H =

4 k Ξ@tDΗ@tD2 - Ξ@tD2

-2 I4 c2 - Η@tD2M pΗ@tD2

m IΗ@tD2 - Ξ@tD2M +2 I4 c2 - Ξ@tD2M pΞ@tD2

m IΗ@tD2 - Ξ@tD2MHamilton equations of motion in the new coordinates:

Ξ¢@tD 4 J4 c2-Ξ@tD2N pΞ@tDm JΗ@tD2-Ξ@tD2N

Η¢@tD 4 J-4 c2+Η@tD2N pΗ@tD

m JΗ@tD2-Ξ@tD2NHpΞL¢@tD -4 JΗ@tD2 Jk m+Ξ@tD JpΗ@tD2-pΞ@tD2NN+Ξ@tD Jk m Ξ@tD+4 c2 J-pΗ@tD2+pΞ@tD2NNN

m JΗ@tD2-Ξ@tD2N2IpΗM¢@tD

4 Η@tD J2 k m Ξ@tD+Ξ@tD2 JpΗ@tD2-pΞ@tD2N+4 c2 J-pΗ@tD2+pΞ@tD2NNm JΗ@tD2-Ξ@tD2N2

Now we set up the Hamilton-Jacobi equation. I'm departing here from the book by using the general HJE, not the time-

independent HJE.

Newton, Lagrange, Hamilton and Hamilton-Jacobi Mechanics of Classical Particles with Mathematica.nb 126

Page 127: Newton, Lagrange, Hamilton and Hamilton-Jacobi …o.castera.free.fr/zip/Newton, Lagrange, Hamilton and Hamilton... · Ł Separability of the HJE for a particle attracted to two fixed

Now we set up the Hamilton-Jacobi equation. I'm departing here from the book by using the general HJE, not the time-

independent HJE.

In[1034]:=IH + SH0,0,1L@Ξ@tD, Η@tD, tD TogetherM 0

%@@1, 3DD 0

Print@"Hamilton-Jacobi equation:"DIHJE = %% . 9pΞ@tD ® SH1,0,0L@Ξ@tD, Η@tD, tD, pΗ@tD ® SH0,1,0L@Ξ@tD, Η@tD, tD=M TraditionalForm

Out[1034]=

1

m I-Η@tD2 + Ξ@tD2M I-4 k m Ξ@tD + 8 c2 pΗ@tD2 - 2 Η@tD2 pΗ@tD2 - 8 c2 pΞ@tD2 +

2 Ξ@tD2 pΞ@tD2 - m Η@tD2 SH0,0,1L@Ξ@tD, Η@tD, tD + m Ξ@tD2 SH0,0,1L@Ξ@tD, Η@tD, tDM 0

Out[1035]=

-4 k m Ξ@tD + 8 c2 pΗ@tD2 - 2 Η@tD2 pΗ@tD2 - 8 c2 pΞ@tD2 + 2 Ξ@tD2 pΞ@tD2 -

m Η@tD2 SH0,0,1L@Ξ@tD, Η@tD, tD + m Ξ@tD2 SH0,0,1L@Ξ@tD, Η@tD, tD 0

Hamilton-Jacobi equation:

Out[1037]//TraditionalForm=

8 c2 SH0,1,0LHΞHtL, ΗHtL, tL2- 8 c2 SH1,0,0LHΞHtL, ΗHtL, tL2

- m ΗHtL2 SH0,0,1LHΞHtL, ΗHtL, tL +

m ΞHtL2 SH0,0,1LHΞHtL, ΗHtL, tL - 2 ΗHtL2 SH0,1,0LHΞHtL, ΗHtL, tL2+ 2 ΞHtL2 SH1,0,0LHΞHtL, ΗHtL, tL2

- 4 k m ΞHtL 0

Separation ansatz S = -tE + WΗ + WΞ for solving the Hamilton-Jacobi equation with separation constants E (for the

time t) and Q (for the coordinates Ξ and Η):

In[1038]:=

HJE . S ® IWΞ@ð1D + WΗ@ð2D - E ð3 &MHlh = %@@1, 82, 3, 6, 7<DDL Hrh = -%@@1, 81, 4, 5<DDL Q

Print@"change of constants: ", newConstants = 8E ® 2 c2, Q ® 2 c1, k ® 2 K, m ® 1<DSolveAlh Q . HWΞL¢@Ξ@tDD2 ® A, AE . A ® HWΞL¢@Ξ@tDD2

ExpandNumerator H% . newConstants SimplifyLHWΞL¢@Ξ@tDD ® HD1WΞ = +Sqrt@%@@1, 1, 2DDDLPrint@"WΞ = ", HWΞ = Integrate@tag@%@@2DDD, Ξ@tDD . tag ® HoldFormLDSolveBrh Q . IWΗM¢@Η@tDD2

® A, AF . A ® IWΗM¢@Η@tDD2

% . newConstants SimplifyIWΗM¢@Η@tDD ® ID1WΗ = -Sqrt@%@@1, 1, 2DDD SimplifyMPrintA"WΗ = ", IWΗ = Integrate@tag@%@@2DDD, Η@tDD . tag ® HoldFormME

Out[1038]=

m E Η@tD2 - 4 k m Ξ@tD - m E Ξ@tD2 + 8 c2 IWΗM¢@Η@tDD2-

2 Η@tD2 IWΗM¢@Η@tDD2- 8 c2 HWΞL¢@Ξ@tDD2 + 2 Ξ@tD2 HWΞL¢@Ξ@tDD2 0

Out[1039]=

-4 k m Ξ@tD - m E Ξ@tD2 - 8 c2 HWΞL¢@Ξ@tDD2 + 2 Ξ@tD2 HWΞL¢@Ξ@tDD2

-m E Η@tD2 - 8 c2 IWΗM¢@Η@tDD2+ 2 Η@tD2 IWΗM¢@Η@tDD2

Q

change of constants: 8E ® 2 c2, Q ® 2 c1, k ® 2 K, m ® 1<Out[1041]=

99HWΞL¢@Ξ@tDD2 ® -Q + 4 k m Ξ@tD + m E Ξ@tD2

2 I4 c2 - Ξ@tD2M ==

Newton, Lagrange, Hamilton and Hamilton-Jacobi Mechanics of Classical Particles with Mathematica.nb 127

Page 128: Newton, Lagrange, Hamilton and Hamilton-Jacobi …o.castera.free.fr/zip/Newton, Lagrange, Hamilton and Hamilton... · Ł Separability of the HJE for a particle attracted to two fixed

Out[1042]=

99HWΞL¢@Ξ@tDD2 ®-c1 - 4 K Ξ@tD - c2 Ξ@tD2

4 c2 - Ξ@tD2==

Out[1043]=

HWΞL¢@Ξ@tDD ®-c1 - 4 K Ξ@tD - c2 Ξ@tD2

4 c2 - Ξ@tD2

WΞ = á -c1 - 4 K Ξ@tD - c2 Ξ@tD2

4 c2 - Ξ@tD2âΞ@tD

Out[1045]=

99IWΗM¢@Η@tDD2® -

Q + m E Η@tD2

2 I4 c2 - Η@tD2M ==Out[1046]=

99IWΗM¢@Η@tDD2® -

c1 + c2 Η@tD2

4 c2 - Η@tD2==

Out[1047]=

IWΗM¢@Η@tDD ® - -c1 + c2 Η@tD2

4 c2 - Η@tD2

WΗ = á - -c1 + c2 Η@tD2

4 c2 - Η@tD2âΗ@tD

We have to choose opposite signs for WΞ¢ HΞ HtLL and WΗ

¢ HΗ HtLLsince otherwise we don't get any agreement in the

following comparison between the results from the Hamilton and Hamilton-Jacobi theory!

The Hamilton's principal function S for the problem is therefore:

In[1049]:=

PrintA"S = ", S = HWt = -t HE . newConstantsLL + WΞ + WΗES = -2 c2 t + á - -

c1 + c2 Η@tD2

4 c2 - Η@tD2âΗ@tD + á -c1 - 4 K Ξ@tD - c2 Ξ@tD2

4 c2 - Ξ@tD2âΞ@tD

With the redefinition of the constants and considering also the time-dependent term the result agrees with the book

except for the sign in the first integral. Who is to blame?

We set for the constant new momenta P1 = c1 and P2 =c2, so the constant new coordinates are given by Qc1 =

¶c1 S and Qc2 = ¶c2 S. We calculate them by choosing some special parameters to simplify as far as possible the

general expression for S. Nevertheless, at the end we will get two very weird and disturbing equations involving elliptic

integrals of various types.

Newton, Lagrange, Hamilton and Hamilton-Jacobi Mechanics of Classical Particles with Mathematica.nb 128

Page 129: Newton, Lagrange, Hamilton and Hamilton-Jacobi …o.castera.free.fr/zip/Newton, Lagrange, Hamilton and Hamilton... · Ł Separability of the HJE for a particle attracted to two fixed

In[1050]:=

sr = 8K ® 1 4, c ® 1 2<Print@"S = ", S . sr FullSimplifyD

Out[1050]=9K ®1

4, c ®

1

2=

S = -2 c2 t + á - -c1 + c2 Η@tD2

4 J 1

2N2

- Η@tD2

âΗ@tD + á -c1 -4 Ξ@tD

4- c2 Ξ@tD2

4 J 1

2N2

- Ξ@tD2

âΞ@tDIn[1052]:=

¶c1D1WΗ . sr FullSimplify;

AA = à % âΗ@tD;¶c1D1WΞ . sr FullSimplify;

BB = à % âΞ@tD Simplify;

CC = ¶c1 Wt;

eqnQc1 = HQc1 == AA + BB + CCLOut[1057]=

Qc1

EllipticFAArcSin@Η@tDD, -c2

c1E 1 +

c2 Η@tD2c1

2 1 - Η@tD2 c1+c2 Η@tD2-1+Η@tD2

-

EllipticFAArcSinA J-1 - 2 c2 + 1 - 4 c1 c2 N H1 + Ξ@tDLJ-1 + 2 c2 + 1 - 4 c1 c2 N H-1 + Ξ@tDL E, --c1 + c2 + 1 - 4 c1 c2

c1 - c2 + 1 - 4 c1 c2E

1 - 1 - 4 c1 c2 + 2 c2 Ξ@tDJ-1 + 2 c2 + 1 - 4 c1 c2 N H-1 + Ξ@tDL -1 + 1 - 4 c1 c2 + 2 c2 Ξ@tDJ1 - 2 c2 + 1 - 4 c1 c2 N H-1 + Ξ@tDL

J-1 - 2 c2 + 1 - 4 c1 c2 N H1 + Ξ@tDLJ-1 + 2 c2 + 1 - 4 c1 c2 N H-1 + Ξ@tDL c1 + Ξ@tD + c2 Ξ@tD2

-1 + Ξ@tD2

In[1058]:=

¶c2D1WΗ . sr FullSimplify;

AAA = à % âΗ@tD;¶c2D1WΞ . sr Simplify;

BBB = à % âΞ@tD Simplify;

CCC = ¶c2 Wt;

eqnQc2 = HQc2 == AAA + BBB + CCCL

Newton, Lagrange, Hamilton and Hamilton-Jacobi Mechanics of Classical Particles with Mathematica.nb 129

Page 130: Newton, Lagrange, Hamilton and Hamilton-Jacobi …o.castera.free.fr/zip/Newton, Lagrange, Hamilton and Hamilton... · Ł Separability of the HJE for a particle attracted to two fixed

Out[1063]=

Qc2

-2 t +

c1 JEllipticEAArcSin@Η@tDD, -c2

c1E - EllipticFAArcSin@Η@tDD, -

c2

c1EN 1 +

c2 Η@tD2c1

2 c2 1 - Η@tD2 c1+c2 Η@tD2-1+Η@tD2

+

1

2 c2 I-1 + Ξ@tD2M c1+Ξ@tD+c2 Ξ@tD2-1+Ξ@tD2

H1 + Ξ@tDL

c1 + Ξ@tD + c2 Ξ@tD2 +1

-1-2 c2+ 1-4 c1 c2 H1+Ξ@tDL-1+2 c2+ 1-4 c1 c2 H-1+Ξ@tDL

Jc1 - c2 + 1 - 4 c1 c2 N EllipticEA

ArcSinA J-1 - 2 c2 + 1 - 4 c1 c2 N H1 + Ξ@tDLJ-1 + 2 c2 + 1 - 4 c1 c2 N H-1 + Ξ@tDL E, --c1 + c2 + 1 - 4 c1 c2

c1 - c2 + 1 - 4 c1 c2E -

J-1 + 1 - 4 c1 c2 N EllipticFAArcSinA J-1 - 2 c2 + 1 - 4 c1 c2 N H1 + Ξ@tDLJ-1 + 2 c2 + 1 - 4 c1 c2 N H-1 + Ξ@tDL E,-

-c1 + c2 + 1 - 4 c1 c2

c1 - c2 + 1 - 4 c1 c2E - 2 EllipticPiA -1 + 2 c2 + 1 - 4 c1 c2

-1 - 2 c2 + 1 - 4 c1 c2,

ArcSinA J-1 - 2 c2 + 1 - 4 c1 c2 N H1 + Ξ@tDLJ-1 + 2 c2 + 1 - 4 c1 c2 N H-1 + Ξ@tDL E, --c1 + c2 + 1 - 4 c1 c2

c1 - c2 + 1 - 4 c1 c2E

H-1 + Ξ@tDL 1 - 1 - 4 c1 c2 + 2 c2 Ξ@tDJ-1 + 2 c2 + 1 - 4 c1 c2 N H-1 + Ξ@tDL

-1 + 1 - 4 c1 c2 + 2 c2 Ξ@tDJ1 - 2 c2 + 1 - 4 c1 c2 N H-1 + Ξ@tDL

This system of two equations can now be inverted to get Ξ(t) and Η(t) and hence the initial problem is completely solved.

Well, theoretically: Mathematica don't get any result in a reasonable time on my computer. If You are patient, increase

the time limit in the following statement...

Newton, Lagrange, Hamilton and Hamilton-Jacobi Mechanics of Classical Particles with Mathematica.nb 130

Page 131: Newton, Lagrange, Hamilton and Hamilton-Jacobi …o.castera.free.fr/zip/Newton, Lagrange, Hamilton and Hamilton... · Ł Separability of the HJE for a particle attracted to two fixed

In[1064]:=

TimeConstrained@Solve@8eqnQc1, eqnQc2<, 8Ξ@tD, Η@tD<D,5 H* time limit in seconds *LD

Out[1064]=

$Aborted

Ï Given the intractability of the analytical expressions seen so far, I resort to numerical methods to check the results

we have obtained from the Hamilton-Jacobi theory.

First, we solve numerically the Hamiltonian equations (Hamilton theory) in elliptic coordinates on a time interval

(tmin, tmax) for some given simple parameters and initial conditions. This gives us a reference solution (Ξ HtL,

Η HtL) for comparison.

In[1065]:=

params = 8c ® 1, m ® 1, k ® 1, KH* = k2 *L ® 1 2<tcr = t ® 18x@tD ® 1 5, y@tD ® 5 6< N;8R1 = r1 . %, R2 = r2 . %<;iniCondition = 9Ξ@0D R1 + R2, Η@0D R1 - R2, pΞ@0D 0, pΗ@0D 0= . params

tmin = 0; tmax = 1.4;

sol = NDSolveAHHeqns . paramsL~Join~iniCondition, 9Ξ, Η, pΞ, pΗ=, 8t, tmin, tmax<EPlotAEvaluateA9Ξ@tD, Η@tD, pΞ@tD, pΗ@tD= . solE,8t, tmin, tmax<, PlotStyle ® 8Red, Blue, Magenta, Cyan<,PlotRange ® 8All, 8-3, 3<<, ImageSize ® maxSizepic,

PlotLabel ® "ΞHtL, ΗHtL, pΞHtL, pΗHtL", AxesLabel ® 8"t", None<E8t, Ξ@tD, Η@tD< . sol;

% . t ® tmin

%% . tcr

%%% . t ® tmax

Hlist = Table@Point@8Ξ@tD, Η@tD<D . sol, 8t, tmin, tmax, Htmax - tminL 20<D;Out[1065]=9c ® 1, m ® 1, k ® 1, K ®

1

2=

Out[1066]=

t ® 1

Out[1069]=9Ξ@0D 2.61616, Η@0D 0.305792, pΞ@0D 0, pΗ@0D 0=Out[1071]=99Ξ ® InterpolatingFunction@880., 1.4<<, <>D,

Η ® InterpolatingFunction@880., 1.4<<, <>D,pΞ ® InterpolatingFunction@880., 1.4<<, <>D,pΗ ® InterpolatingFunction@880., 1.4<<, <>D==

Newton, Lagrange, Hamilton and Hamilton-Jacobi Mechanics of Classical Particles with Mathematica.nb 131

Page 132: Newton, Lagrange, Hamilton and Hamilton-Jacobi …o.castera.free.fr/zip/Newton, Lagrange, Hamilton and Hamilton... · Ł Separability of the HJE for a particle attracted to two fixed

Out[1072]=

0.2 0.4 0.6 0.8 1.0 1.2 1.4t

-3

-2

-1

1

2

3

ΞHtL, ΗHtL, pΞHtL, pΗHtL

Out[1074]=880, 2.61616, 0.305792<<Out[1075]=881, 2.17877, 0.546899<<Out[1076]=881.4, 2.00001, 1.04157<<

Newton, Lagrange, Hamilton and Hamilton-Jacobi Mechanics of Classical Particles with Mathematica.nb 132

Page 133: Newton, Lagrange, Hamilton and Hamilton-Jacobi …o.castera.free.fr/zip/Newton, Lagrange, Hamilton and Hamilton... · Ł Separability of the HJE for a particle attracted to two fixed

Now we go back to the Hamilton-Jacobi theory. From pΞ = ¶ΞS and pΗ = ¶ΗS and (Ξ HtcL, Η HtcL) for some

arbitrary tc, we get the two constants c1 and c2 specific to the initial conditions of our reference solution.

In[1078]:=

¶Ξ@tDD1WΗ . params FullSimplify;

AA = à % âΗ@tD;¶Ξ@tDD1WΞ . params FullSimplify;

BB = à % âΞ@tD Simplify;

CC = ¶Ξ@tD Wt;eqnc1 = HpΞ@tD^2 HAA + BB + CCL^2L¶Η@tDD1WΗ . params FullSimplify;

AAA = à % âΗ@tD;¶Η@tDD1WΞ . params Simplify;

BBB = à % âΞ@tD Simplify;

CCC = ¶Η@tD Wt;eqnc2 = IpΗ@tD^2 HAAA + BBB + CCCL^2MH8eqnc1, eqnc2< . tcr . solLc1c2r = HSolve@%@@1DD, 8c1, c2<DL@@1DD

Out[1083]=

pΞ@tD2 c1 + 2 Ξ@tD + c2 Ξ@tD2

-4 + Ξ@tD2

Out[1089]=

pΗ@tD2 c1 + c2 Η@tD2

-4 + Η@tD2

Out[1090]=881.00496 1.33863 H4.35754 + c1 + 4.74703 c2L,0.0430561 -0.270204 Hc1 + 0.299098 c2L<<

Out[1091]=8c1 ® 0.0724759, c2 ® -0.77507<From Qc1 = ¶c1 S, c1, c2 and (Ξ HtcL, Η HtcL) we get the appropriate constant Qc1. To simplify the calculations, the

two partial derivatives are approximated by series expansions; so we get rid of the somewhat cumbersome elliptic

integrals.

Newton, Lagrange, Hamilton and Hamilton-Jacobi Mechanics of Classical Particles with Mathematica.nb 133

Page 134: Newton, Lagrange, Hamilton and Hamilton-Jacobi …o.castera.free.fr/zip/Newton, Lagrange, Hamilton and Hamilton... · Ł Separability of the HJE for a particle attracted to two fixed

In[1092]:=

order = 13;

¶c1D1WΗ . params . c1c2r;

Series@%, 8Η@tD, 0.6, order<D Normal;

AA = à % âΗ@tD¶c1D1WΞ . params . c1c2r;

Series@%, 8Ξ@tD, 2.3, order<D Normal;

BB = à % âΞ@tDCC = ¶c1 WtQc1 == AA + BB + CC;

% . tcr Short

% . sol . Equal ® Rule

eqnQc1 = %%% . %

Out[1095]=

-856287.I-0.00268176 Η@tD + 0.0266658 Η@tD2 - 0.164781 Η@tD3 + 0.704971 Η@tD4 - 2.20559 Η@tD5 +

5.19883 Η@tD6 - 9.37234 Η@tD7 + 12.9788 Η@tD8 - 13.7332 Η@tD9 + 10.9263 Η@tD10 -

6.33658 Η@tD11 + 2.53159 Η@tD12 - 0.623557 Η@tD13 + 0.0714286 Η@tD14MOut[1098]=

-269413. I-67 721.3 Ξ@tD + 187 284. Ξ@tD2 - 318 700. Ξ@tD3 + 372 809. Ξ@tD4 -

317124. Ξ@tD5 + 202 286. Ξ@tD6 - 98293.3 Ξ@tD7 + 36 560.5 Ξ@tD8 - 10 358.6 Ξ@tD9 +

2200.62 Ξ@tD10 - 339.911 Ξ@tD11 + 36.0848 Ξ@tD12 - 2.3566 Ξ@tD13 + 0.0714286 Ξ@tD14MOut[1099]=

0

Out[1101]//Short=

Qc1 -856 287. I-0.00268176 Η@1D + 18 + 0.0714286 Η@1D14M - 269413. H1 + 19LOut[1102]=9Qc1 ® 3.06281 ´ 109=Out[1103]=

3.06281 ´ 109 -856 287.I-0.00268176 Η@tD + 0.0266658 Η@tD2 - 0.164781 Η@tD3 + 0.704971 Η@tD4 - 2.20559 Η@tD5 +

5.19883 Η@tD6 - 9.37234 Η@tD7 + 12.9788 Η@tD8 - 13.7332 Η@tD9 + 10.9263 Η@tD10 -

6.33658 Η@tD11 + 2.53159 Η@tD12 - 0.623557 Η@tD13 + 0.0714286 Η@tD14M -

269413. I-67 721.3 Ξ@tD + 187 284. Ξ@tD2 - 318 700. Ξ@tD3 + 372 809. Ξ@tD4 -

317124. Ξ@tD5 + 202 286. Ξ@tD6 - 98293.3 Ξ@tD7 + 36560.5 Ξ@tD8 - 10 358.6 Ξ@tD9 +

2200.62 Ξ@tD10 - 339.911 Ξ@tD11 + 36.0848 Ξ@tD12 - 2.3566 Ξ@tD13 + 0.0714286 Ξ@tD14MOnce the specific Qc1 is determinated, the Hamilton-Jacobi theory leads us finally to an implicit equation Qc1 =f(Ξ,Η)

(approximated in our case) for the orbit associated with the given initial conditions (see Goldstein&Poole&Safko

p.441-442). We compare this result with the orbit determined with the Hamilton theory:

Newton, Lagrange, Hamilton and Hamilton-Jacobi Mechanics of Classical Particles with Mathematica.nb 134

Page 135: Newton, Lagrange, Hamilton and Hamilton-Jacobi …o.castera.free.fr/zip/Newton, Lagrange, Hamilton and Hamilton... · Ł Separability of the HJE for a particle attracted to two fixed

In[1104]:=

ImplicitPlot@eqnQc1, 8Ξ@tD, 2.0, 2.6<, 8Η@tD, 0.3, 1.0<, PlotLabel ®

" ORBIT\nHJE solution - implicit equation\n Hamiton equations solution",

ImageSize ® maxSizepic, AxesLabel ® 8"Ξ", "Η"<, PlotStyle ® 8Red<,Epilog ® [email protected], Blue, Hlist<, PlotRange ® AllD

Out[1104]=

2.1 2.2 2.3 2.4 2.5 2.6Ξ

0.4

0.5

0.6

0.7

0.8

0.9

1.0

Η

ORBIT

HJE solution - implicit equation

Hamiton equations solution

As we can deduce from the plot, the Hamilton-Jacobi theory seems not to be a completely freakish nonsense after all...

The implicit equation can also be solved for either coordinate, getting an explicit equation for the orbit. Here we solve

for the coordinate Η = Η (Ξ).

Newton, Lagrange, Hamilton and Hamilton-Jacobi Mechanics of Classical Particles with Mathematica.nb 135

Page 136: Newton, Lagrange, Hamilton and Hamilton-Jacobi …o.castera.free.fr/zip/Newton, Lagrange, Hamilton and Hamilton... · Ł Separability of the HJE for a particle attracted to two fixed

In[1105]:=

Solve@eqnQc1, Η@tDD Short

Ηfun = Η@tD . %@@1, 1DD;Plot@Ηfun, 8Ξ@tD, 2.0, 2.6<, PlotLabel ®

" ORBIT\nHJE solution - explicit equation\n Hamiton equations solution",

ImageSize ® medSizepic, AxesLabel ® 8"Ξ", "Η"<, PlotStyle ® 8Red<,Epilog ® [email protected], Blue, Hlist<, PlotRange ® AllD

Out[1105]//Short=99Η@tD ® RootA3.06281 ´ 109 - 2296.36 ð1 + 39 + 19243.8 Ξ@tD14 &, 1E=,12, 8Η@tD ® Root@1 &, 14D<=

Out[1107]=

2.1 2.2 2.3 2.4 2.5 2.6Ξ

0.4

0.5

0.6

0.7

0.8

0.9

Η

ORBIT

HJE solution - explicit equation

Hamiton equations solution

An opto-mechanical analogy and the dawn of Quantum Mechanics in the Hamilton-Jacobi theory

Note: This subsubsection was written in Mathematica 7.

In[1108]:=

Remove@"Global`*"DWe return here to the problem of the subsubsection "Solving the HJE for the slant throw in 2D" to illustrate with a

concrete example a remarkable analogy between classical mechanics and geometrical optics discovered by W.R.

Hamilton as early as 1834.

From the aforementioned subsubsection we recover the expression for the Hamilton's principal function S and the

solution x(t), y(t) of the 2D slant throw problem. We consider here S as a field function S(x, y, t) and hence the time-

dependence of the spatial coordinates is dropped; the non essential constant C is put equal to zero. (The Lagrangian of

the problem is L =1

2m Ix¢HtL2 + z¢HtL2M - g m zHtL, where Hx, yL are Cartesian coordinates.)

Newton, Lagrange, Hamilton and Hamilton-Jacobi Mechanics of Classical Particles with Mathematica.nb 136

Page 137: Newton, Lagrange, Hamilton and Hamilton-Jacobi …o.castera.free.fr/zip/Newton, Lagrange, Hamilton and Hamilton... · Ł Separability of the HJE for a particle attracted to two fixed

In[1109]:=

C - PA t + PB x@tD +I2 m PA - PB - 2 g m2 z@tDM32

3 g m2;

Print@"SHx,y,tL = ", S@x_, z_, t_D = % . 8f_@tD ® f, C ® 0<Dqrule = :x@tD ®

PB HQA + 2 m QB + tLm

, z@tD ® --2 m PA + PB + g2 m2 HQA + tL2

2 g m2>

SHx,y,tL = -PA t + PB x +I2 m PA - PB - 2 g m2 zM32

3 g m2

Out[1111]=

9x@tD ®PB HQA + 2 m QB + tL

m, z@tD ® -

-2 m PA + PB + g2 m2 HQA + tL2

2 g m2=

We choose now suitable values for all but one parameter and the two constants used in the following calculations.

In[1112]:=

params = 8QA ® 3, PA ® 20, PB ® 20, g ® 1, m ® 1<Out[1112]=8QA ® 3, PA ® 20, PB ® 20, g ® 1, m ® 1<We plot a few S-isosurfaces (which are actually lines in our 2D example) for t = 0; the yellow boxes show the values of

S. If we select a particular S-isosurface (for example S = 10), we note that the curve swaps in time trough the investi-

gated space region like a wave front; the animation shows this very clearly.

In[1113]:=

S@x_, z_, t_D = S@x, z, tD . params

ContourPlot@S@x, z, 0D, 8x, -10, 10<, 8z, -10, 10<,ContourLabels ® HText@Framed@ð3D, 8ð1, ð2<, Background ® YellowD &L,FrameLabel ® 88z, None<, 8x, "Isosurfaces SHx, z, tL at t = 0"<<,FrameTicks ® 88Automatic, None<, 8Automatic, None<<,Contours ® 15, ImageSize ® medSizepicD

Show@GraphicsArray@Partition@Table@ContourPlot@Evaluate@S@x, z, tD 10D, 8x, -10, 10<, 8z, -10, 10<,

FrameLabel ® 88z, None<, 8x, "SHx, z, tL=10 at t = " <> ToString@tD<<,ImageSize ® minSizepicD, 8t, 8-2, -1, 0, 2, 4, 5<<D, 3DD,

PlotLabel ® "Time evolution of a S-isosurface"DAnimate@ContourPlot@Evaluate@S@x, z, tD 10D, 8x, -10, 10<, 8z, -10, 10<,

FrameLabel ® 8x, z<, PlotLabel ® "Time evolution of the isosurface SHx, z, tL=10",

PlotPoints ® 25D, 8t, -2, 5, .1<, AnimationRunning ® FalseDOut[1113]=

-20 t + 2 5 x +1

3H20 - 2 zL32

Newton, Lagrange, Hamilton and Hamilton-Jacobi Mechanics of Classical Particles with Mathematica.nb 137

Page 138: Newton, Lagrange, Hamilton and Hamilton-Jacobi …o.castera.free.fr/zip/Newton, Lagrange, Hamilton and Hamilton... · Ł Separability of the HJE for a particle attracted to two fixed

Out[1114]=

-30 -20 -10 0 10 20 30 40

50

60

70

80

90

100

110

-10 -5 0 5 10

-10

-5

0

5

10

x

zIsosurfaces SHx, z, tL at t = 0

Out[1115]=

-10 -5 0 5 10-10

-5

0

5

10

x

z

SHx, z, tL=10 at t = -2

-10 -5 0 5 10-10

-5

0

5

10

x

z

SHx, z, tL=10 at t = -1

-10 -5 0 5 10-10

-5

0

5

10

x

zSHx, z, tL=10 at t = 0

-10 -5 0 5 10-10

-5

0

5

10

x

z

SHx, z, tL=10 at t = 2

-10 -5 0 5 10-10

-5

0

5

10

x

z

SHx, z, tL=10 at t = 4

-10 -5 0 5 10-10

-5

0

5

10

x

z

SHx, z, tL=10 at t = 5

Time evolution of a S-isosurface

Newton, Lagrange, Hamilton and Hamilton-Jacobi Mechanics of Classical Particles with Mathematica.nb 138

Page 139: Newton, Lagrange, Hamilton and Hamilton-Jacobi …o.castera.free.fr/zip/Newton, Lagrange, Hamilton and Hamilton... · Ł Separability of the HJE for a particle attracted to two fixed

Out[1116]=

t

-10 -5 0 5 10

-10

-5

0

5

10

x

z

Time evolution of the isosurface SHx, z, tL=10

The trajectory ( x(t), y(t) ) and the kinetic impulse p = m v× of the particle are (without specifying yet the last remaining

parameter QB):

In[1117]:=

solpoint = 8x@tD, z@tD< . qrule . params

kineticimpulse = m D@solpoint, tD . params

Out[1117]=92 5 H3 + 2 QB + tL, 1

2I20 - H3 + tL2M=

Out[1118]=92 5 , -3 - t=The (spatial) gradient Ñ S(x, y, t) is the vector:

In[1119]:=

gradS@x_, z_, t_D = 8¶xS@x, z, tD, ¶zS@x, z, tD<Out[1119]=92 5 , - 20 - 2 z =In the following plot the colored lines are S-isosurfaces for t = 0, the black lines are particle orbits for some specified

QB values and the gray dots are the particle positions at t = -2 on the corresponding orbit. The green vectors are the

kinetic impulse p(x, y, t) and the r·e·d d·o·t·t·e·d vectors are the gradient Ñ S(x, y, t) at the same (x, y, t) for some

specified values of QB.

Newton, Lagrange, Hamilton and Hamilton-Jacobi Mechanics of Classical Particles with Mathematica.nb 139

Page 140: Newton, Lagrange, Hamilton and Hamilton-Jacobi …o.castera.free.fr/zip/Newton, Lagrange, Hamilton and Hamilton... · Ł Separability of the HJE for a particle attracted to two fixed

In the following plot the colored lines are S-isosurfaces for t = 0, the black lines are particle orbits for some specified

QB values and the gray dots are the particle positions at t = -2 on the corresponding orbit. The green vectors are the

kinetic impulse p(x, y, t) and the r·e·d d·o·t·t·e·d vectors are the gradient Ñ S(x, y, t) at the same (x, y, t) for some

specified values of QB.

In[1120]:=

Show@ContourPlot@Evaluate@Table@S@x, z, 0D s, 8s, -40, 120, 10<DD,8x, -10, 10<, 8z, -10, 10<D,ParametricPlot@Evaluate@Table@solpoint, 8QB, -4, 0.4, .2<D, 8t, -2, 5<D,PlotRange ® 88-10, 10<, 8-10, 10<<, PlotStyle ® BlackD,

Graphics@8PointSize@LargeD, Gray,

Point@Table@solpoint . t ® -2, 8QB, -4, 0.4, .2<DD<D,ListVectorPlot@8

Table@8solpoint, kineticimpulse<, 8QB, -4, 0.4, .2<, 8t, -2, 5, .5<D,Table@8solpoint, gradS@solpoint . List ® Sequence, tD<,8QB, -4, 0.4, .2<, 8t, -2, 5, .5<D<, VectorStyle ® 88Thick, Green<, 8Dotted, Red<<D,

FrameLabel ® 8x, z<, ImageSize ® maxSizepicDOut[1120]=

-10 -5 0 5 10

-10

-5

0

5

10

x

z

As theoretically expected, since p = H px, pz) = H¶xS, ¶zS) = Ñ S, the figure shows the exact coincidence of the kinetic

impulse of the particle and the gradient of the Hamilton's principal function. We can see that the particle orbits cross the

S-isosurfaces always orthogonally, also as expected, since a gradient is always orthogonal to a corresponding isosurface.

Here we have a similarity with light rays crossing wave fronts in geometrical optics. But the analogy goes even further.

Newton, Lagrange, Hamilton and Hamilton-Jacobi Mechanics of Classical Particles with Mathematica.nb 140

Page 141: Newton, Lagrange, Hamilton and Hamilton-Jacobi …o.castera.free.fr/zip/Newton, Lagrange, Hamilton and Hamilton... · Ł Separability of the HJE for a particle attracted to two fixed

As theoretically expected, since p = H px, pz) = H¶xS, ¶zS) = Ñ S, the figure shows the exact coincidence of the kinetic

impulse of the particle and the gradient of the Hamilton's principal function. We can see that the particle orbits cross the

S-isosurfaces always orthogonally, also as expected, since a gradient is always orthogonal to a corresponding isosurface.

Here we have a similarity with light rays crossing wave fronts in geometrical optics. But the analogy goes even further.

In wave optics, we can deduce from the scalar wave equation Ñ2Φ -n2

c2

d2 Φ

dt2= 0 and the ansatz Φ = A exp(ä L) a short

wavelength approximation, called the eikonal equation of geometrical optics, HÑ LL2 = n2. The L-isosurfaces determined

by the eikonal equation are the wave fronts and the light rays are always orthogonal to the wave fronts and hence are

determined by them.

In a conservative mechanical system, like our example, we have for the kinetic energy T = p2/2m = E - V, with E =

total energy and V = potential energy, hence HÑSL2 =2 mHE - V L. This equation is analogous to the eikonal equation:

the S-isosurfaces are corresponding to the wave fronts and the particle orbits to the light rays, 2 m HE - V L plays the

role of the refraction index n.

(See ä H. Goldstein, Classical Mechanics, 1.ed. 1950 (in the 3.ed. this topic is dropped!), § 9–8; ä C. Lanczos. The

Variational Principles of Mechanics, 1949, p.264-280; ä Schmutzer, p.420-421; ä José&Saletan, p.303-307; ä L.D.

Landau, E.M. Lifshitz. Course of Theoretical Physics 2. The Classical Theory of Fields, 4.ed. 1975, § 53.)

So, a long sought analogy between particle propagation and wave propagation was eventually found, buried deeply in

the theory of classical mechanics.

Now we may ask: Is there a wave equation for a single particle whose short wavelength approximation leads toHÑSL2 =2 mHE - V L? No answer can be found in classical mechanics: mechanical waves exist of course (sound, vibra-

tions in strings, water waves etc.), but there are no "waves of a single particle". But quantum mechanics can deliver the

connection! Let's consider the time-independent Schrödinger equation of a conservative 2D system where a single

particle with (constant) total energy E moves in a potential V(x, y).

In[1121]:=

Print@"In the time-independent Schrödinger equation"DÑ2 H2 mL I¶x,xu@x, yD + ¶y,yu@x, yDM + HE - V@x, yDL u@x, yD 0

Print@"we do the formal substitution"DPrint@"u@x,yD = ", u@x_, y_D = Exp@ä Ñ S@x, yDDDPrint@"obtaining"D%%%% Simplify

Print@"Now S@x,yD is expanded in a power series of + Ñä:"DS@x_, y_D = S0@x, yD + Ñ ä S1@x, yD + HÑ äL2

S2@x, yD + O@ÑD3

Print@"After the substitution and keeping only zeroth order terms in Ñ we get:"DReleaseHold@%%%%D Simplify

Series@%, 8Ñ, 0, 0<D Simplify Normal

% . Ja = HS0LH0,1L@x, yD2+ HS0LH1,0L@x, yD2N ® A;

Print@"We can now extract an equation for S0"Da A . Solve@%%, AD First

Print@"or in short"DHÑS0@x, yDL2 %%@@2DD . f_@x, yD ® f

Print@"getting again the eikonal equation of classical mechanics!"DIn the time-independent Schrödinger equation

Out[1122]=

u@x, yD HE - V@x, yDL +Ñ2 IuH0,2L@x, yD + uH2,0L@x, yDM

2 m 0

Newton, Lagrange, Hamilton and Hamilton-Jacobi Mechanics of Classical Particles with Mathematica.nb 141

Page 142: Newton, Lagrange, Hamilton and Hamilton-Jacobi …o.castera.free.fr/zip/Newton, Lagrange, Hamilton and Hamilton... · Ł Separability of the HJE for a particle attracted to two fixed

we do the formal substitution

u@x,yD = ãä S@x,yD

Ñ

obtaining

Out[1126]=

ãä S@x,yD

Ñ J2 m E - 2 m V@x, yD - SH0,1L@x, yD2+ ä Ñ SH0,2L@x, yD - SH1,0L@x, yD2

+ ä Ñ SH2,0L@x, yDNm

0

Now S@x,yD is expanded in a power series of + Ñä:

Out[1128]=

S0@x, yD - ä S1@x, yD Ñ - S2@x, yD Ñ2 + O@ÑD3

After the substitution and keeping only zeroth order terms in Ñ we get:

Out[1130]=

ãä S0@x,yD

Ñ+S1@x,yD-ä S2@x,yD Ñ+O@ÑD2

--2 m E + 2 m V@x, yD + HS0LH0,1L@x, yD2

+ HS0LH1,0L@x, yD2

m+

1

mä I2 HS0LH0,1L@x, yD HS1LH0,1L@x, yD + HS0LH0,2L@x, yD +

2 HS0LH1,0L@x, yD HS1LH1,0L@x, yD + HS0LH2,0L@x, yDM Ñ +1

mJHS1LH0,1L@x, yD2+ 2 HS0LH0,1L@x, yD HS2LH0,1L@x, yD + HS1LH0,2L@x, yD +

HS1LH1,0L@x, yD2+ 2 HS0LH1,0L@x, yD HS2LH1,0L@x, yD + HS1LH2,0L@x, yDN Ñ2 + O@ÑD3 0

Out[1131]=

ä S0@x,yDÑ

+S1@x,yD-ä Ñ S2@x,yD J-2 m E + 2 m V@x, yD + HS0LH0,1L@x, yD2+ HS0LH1,0L@x, yD2N

m 0

We can now extract an equation for S0

Out[1134]=HS0LH0,1L@x, yD2+ HS0LH1,0L@x, yD2

2 m HE - V@x, yDLor in short

Out[1136]=HÑS0L2 2 m H-V + ELgetting again the eikonal equation of classical mechanics!

(See L.D. Landau, E.M. Lifshitz. Course of Theoretical Physics 3. Quantum Mechanics: Non-Relativistic Theory, 3.ed.

1977, § 46.)

Since neglecting higher order terms of Ñ means Ñ ® 0 and hence considering only short (de Broglie) wavelengths, the

time-independent Schrödinger equation is indeed a possible candidate for the sought wave equation.

So, the Hamilton-Jacobi theory brought us to the threshold of quantum mechanics. And here, a whole new story starts...

"That's all Folks!"

* * *

Newton, Lagrange, Hamilton and Hamilton-Jacobi Mechanics of Classical Particles with Mathematica.nb 142

Page 143: Newton, Lagrange, Hamilton and Hamilton-Jacobi …o.castera.free.fr/zip/Newton, Lagrange, Hamilton and Hamilton... · Ł Separability of the HJE for a particle attracted to two fixed

* * *

Newton, Lagrange, Hamilton and Hamilton-Jacobi Mechanics of Classical Particles with Mathematica.nb 143

Page 144: Newton, Lagrange, Hamilton and Hamilton-Jacobi …o.castera.free.fr/zip/Newton, Lagrange, Hamilton and Hamilton... · Ł Separability of the HJE for a particle attracted to two fixed

In memoriam

Egidio Masciovecchio

1928 - 2016

When I was a little boy he bought me a science book.

Newton, Lagrange, Hamilton and Hamilton-Jacobi Mechanics of Classical Particles with Mathematica.nb 144