Application Center - Maplesoft

App Preview:

Hamiltonian Systems

You can switch back to the summary page by clicking here.

Learn about Maple
Download Application


 

Image 

 

INSITTUTO DE ESTUDIOS SUPERIORES DE TAMAPULIPAS 

RED DE UNIVERSIDADES AN?HUAC 

 

Image 

 

M?XICO MMVI 

Image 

 

Hamiltonian Systems 

 

Maple 10 Document 

Prepared by  

Prof. David Macias Ferrer 

E-mail: david.macias@iest.edu.mx 

Madero City, Mexico 

URL: http://www.geocities.com/dmacias_iest/MyPage.html 

 

 

Goals 

  • To show the principal characteristics of the Non Linear Differential Equations Systems, in particular: Hamiltonian Systems
 

  • To use the Maple Tools to find Hamiltonian Function associated.
 

  • To show the powerful Maple 10 graphics tools to visualize some trajectories on phase plane.
 

Introduction 

We consider the following system: 

Diff(x(t), t) = f(x, y) 

Diff(y(t), t) = g(x, y) 

where f and g are functions of two variables defined in a region Ω on x-y plane. If the following relationship: 

Diff(f(x, y), x) = -(Diff(g(x, y), y)) 

is completed then, the system is called Hamiltonian System. Additionally, exist a function H(x, y)such that: 

Diff(H(x, y), t) = 0 

or 

(Diff(H(x, y), x))*f(x, y)+(Diff(H(x, y), y))*g(x, y) = 0 

in other words, this quantity is conserved. 

Examples 

with(DEtools), with(plots), with(linalg); -1 

Example 1 

sys1 := {diff(x(t), t) = y(t), diff(y(t), t) = x(t)-x(t)^2} 

{diff(x(t), t) = y(t), diff(y(t), t) = x(t)-x(t)^2} (3.1.1)
 

For this system: 

f1 := y 

y (3.1.2)
 

g1 := x-x^2 

x-x^2 (3.1.3)
 

so that: 

Typesetting:-mrow(Typesetting:-mi( 

>
 

therefore, the differential equations system is an Hamiltonian system. 

Hamiltonian Function is given by: 

Typesetting:-mrow(Typesetting:-mi( 

 

In other hand, the phase portrait with one trajectory in .15, -.16 are given by: 

F := DEplot(sys1, [x(t), y(t)], t = -20 .. 10, x = -2 .. 2, y = -2 .. 2, [[x(0) = .15, y(0) = -.16]], linecolor = blue, thickness = 2, stepsize = .1, arrows = medium, color = red)
F := DEplot(sys1, [x(t), y(t)], t = -20 .. 10, x = -2 .. 2, y = -2 .. 2, [[x(0) = .15, y(0) = -.16]], linecolor = blue, thickness = 2, stepsize = .1, arrows = medium, color = red)
F := DEplot(sys1, [x(t), y(t)], t = -20 .. 10, x = -2 .. 2, y = -2 .. 2, [[x(0) = .15, y(0) = -.16]], linecolor = blue, thickness = 2, stepsize = .1, arrows = medium, color = red)
 

Plot
 

You can see that, exist two equilibrium points, in 0, 0 and 1, 0, this is: 

solve({g1 = 0, f1 = 0}, [x, y]) 

[[x = 0, y = 0], [x = 1, y = 0]] (3.1.4)
 

A quantitative analysis is possible if they are analyzed for each equilibrium point, through the Jacobian matrices and its eigenvalues, this is 

For 0, 0: 

Jacobian matrix is: 

Typesetting:-mrow(Typesetting:-mi( 

Typesetting:-mfenced(Typesetting:-mrow(Typesetting:-mtable(Typesetting:-mtr(Typesetting:-mtd(Typesetting:-mn( (3.1.5)
 

eigenvalues are:  

eigenvalues(Matrix(%id = 154159596)) 

1, -1 (3.1.6)
 

as the eigenvalues are real and distinct then, the equilibrium point is a saddle point. 

For 1, 0: 

Jacobian matrix is: 

Typesetting:-mrow(Typesetting:-mi( 

Typesetting:-mfenced(Typesetting:-mrow(Typesetting:-mtable(Typesetting:-mtr(Typesetting:-mtd(Typesetting:-mn( (3.1.7)
 

eigenvalues are: 

eigenvalues(Matrix(%id = 152339612)) 

I, -I (3.1.8)
 

as the eigenvalues are cojugate imaginary then, the equilibrium point can be a spiral source, a spiral sink or a center. In other words, the nature of this equilibrium point cannot be determined analytically. 

 

Returning to the Hamiltonian function, the following graph shows the existence of periodic solutions around the point 1, 0: 

G := contourplot(1/2*y^2-1/2*x^2+1/3*x^3, x = -2 .. 2, y = -2 .. 2, contours = 20, color = blue) 

Plot
 

If we compare these graphs, we have: 

F := DEplot(sys1, [x(t), y(t)], t = -20 .. 10, x = -2 .. 2, y = -2 .. 2, [[x(0) = .15, y(0) = -.16]], linecolor = blue, thickness = 2, stepsize = .1, arrows = medium, color = red); -1
F := DEplot(sys1, [x(t), y(t)], t = -20 .. 10, x = -2 .. 2, y = -2 .. 2, [[x(0) = .15, y(0) = -.16]], linecolor = blue, thickness = 2, stepsize = .1, arrows = medium, color = red); -1
F := DEplot(sys1, [x(t), y(t)], t = -20 .. 10, x = -2 .. 2, y = -2 .. 2, [[x(0) = .15, y(0) = -.16]], linecolor = blue, thickness = 2, stepsize = .1, arrows = medium, color = red); -1
 

G := contourplot(1/2*y^2-1/2*x^2+1/3*x^3, x = -2 .. 2, y = -2 .. 2, contours = 20, color = blue); -1 

display({G, F}) 

Plot
 

You can see that, the phase portrait and level curves of the Hamiltonian surface are similar, and their graphs state a lot about the behavior of the solutions. 

Level curves are: 

plot3d(1/2*y^2-1/2*x^2+1/3*x^3, x = -2 .. 2, y = -2 .. 2, axes = normal, style = patchcontour, transparency = .66, shading = zhue, contours = 15, orientation = ([-117, 41]))
plot3d(1/2*y^2-1/2*x^2+1/3*x^3, x = -2 .. 2, y = -2 .. 2, axes = normal, style = patchcontour, transparency = .66, shading = zhue, contours = 15, orientation = ([-117, 41]))
 

Plot
 

Example 2 

One important area of application of the Hamiltonian systems theory are in the field of Mechanical, in particular: Mechanical Vibrations. In this example we will show the free vibration of a mass-spring system. 

If we consider that a 0.0625 slug is attached to a spring whose constant is 4 lb/ft and suppose that there is no external force and no damping then, this phenomenon can be modeled through a second order linear differential equation, that is: 

(Diff(y, t, t))+64*y = 0 

where y(t)represent the vertical displacements of the mass attached to the spring. This equation governs the motion of a vibrating mass at the end of a vertical spring. This phenomenon is known as Simple Harmonic Motion. 

 

If Diff(y, t) = vthen, the differential equation given can be replaced by: 

restart; -1 

with(DEtools), with(plots), with(linalg); -1 

sys2 := {diff(y(t), t) = v(t), diff(v(t), t) = -64*y(t)} 

{diff(y(t), t) = v(t), diff(v(t), t) = -64*y(t)} (3.2.1)
 

whose general solution is given by: 

dsolve(sys2) 

{v(t) = _C1*sin(8*t)+_C2*cos(8*t), y(t) = -1/8*_C1*cos(8*t)+1/8*_C2*sin(8*t)} (3.2.2)
 

Of the equation (2.12) we have: 

f2 := v 

v (3.2.3)
 

g2 := -64*y 

-64*y (3.2.4)
 

so that: 

Typesetting:-mrow(Typesetting:-mi( 

 

therefore the mass-spring system is an Hamiltonian system. 

Hamiltonian is given by: 

Typesetting:-mrow(Typesetting:-mi( 

 

In Physics, the expression given by (2.17) is called Energy Function. 

J := DEplot(sys2, [y(t), v(t)], t = -10 .. 10, y = -8 .. 8, v = -40 .. 40, [[y(0) = 2.5, v(0) = 20]], linecolor = blue, thickness = 2, stepsize = 0.1e-1, arrows = medium, color = red)
J := DEplot(sys2, [y(t), v(t)], t = -10 .. 10, y = -8 .. 8, v = -40 .. 40, [[y(0) = 2.5, v(0) = 20]], linecolor = blue, thickness = 2, stepsize = 0.1e-1, arrows = medium, color = red)
 

Plot
 

You can see that, exist only one equilibrium point: in 0, 0 in y-v plane. 

solve({f2 = 0, g2 = 0}, [y, v]) 

[[y = 0, v = 0]] (3.2.5)
 

In this case, a quantitative analysis is possible if the equilibrium point can be analyzed through the Jacobian matrix and its eigenvalues, this is: 

For the unique point 0, 0 we have: 

Jacobian matrix is: 

Typesetting:-mrow(Typesetting:-mi( 

Typesetting:-mfenced(Typesetting:-mrow(Typesetting:-mtable(Typesetting:-mtr(Typesetting:-mtd(Typesetting:-mn( (3.2.6)
 

eigenvalues are: 

eigenvalues(Matrix(%id = 151574596)) 

8*I, -8*I (3.2.7)
 

as the eigenvalues are cojugate imaginary then, the equilibrium point can be a spiral source, a spiral sink or a center. In this case, is evident that the equilibrium point is a center. 

Returning to the Hamiltonian function, the following graph shows the existence of periodic solutions around the point 0, 0: 

K := contourplot(1/2*v^2+32*y^2, y = -8 .. 8, v = -40 .. 40, contours = 20, color = blue) 

Plot
 

 

J := DEplot(sys2, [y(t), v(t)], t = -10 .. 10, y = -8 .. 8, v = -40 .. 40, [[y(0) = 2.5, v(0) = 20]], linecolor = blue, thickness = 2, stepsize = 0.1e-1, arrows = medium, color = red); -1
J := DEplot(sys2, [y(t), v(t)], t = -10 .. 10, y = -8 .. 8, v = -40 .. 40, [[y(0) = 2.5, v(0) = 20]], linecolor = blue, thickness = 2, stepsize = 0.1e-1, arrows = medium, color = red); -1
 

K := contourplot(1/2*v^2+32*y^2, y = -8 .. 8, v = -40 .. 40, contours = 20, color = blue); -1 

display({K, J}) 

Plot
 

You can see that, the phase portrait and level curves of the Hamiltonian surface are similar 

Level curves of the Energy Function is given by: 

plot3d(1/2*v^2+32*y^2, y = -8 .. 8, v = -40 .. 40, axes = normal, style = patchcontour, transparency = .66, shading = zhue, contours = 15, orientation = ([63, 47]))
plot3d(1/2*v^2+32*y^2, y = -8 .. 8, v = -40 .. 40, axes = normal, style = patchcontour, transparency = .66, shading = zhue, contours = 15, orientation = ([63, 47]))
 

Plot
 

The contours lines are coincident with the trajectories on y-v phase plane. 

Bibliography 

Blanchard P.,Devaney R.L.,Hall G.R.,"Differential Equations", First Edition, Brooks Cole Publishing and ITP Company, USA, 1998. 

 


Legal Notice: The copyright for this application is owned by the author(s). Neither Maplesoft nor the author are responsible for any errors contained within and are not liable for any damages resulting from the use of this material. This application is intended for non-commercial, non-profit use only. Contact the author for permission if you wish to use this application in for-profit activities.
 

Image