Chap5.mw

Maple Text Commands for Chapter 5 -  

HAMILTONIAN SYSTEMS, LYAPUNOV FUNCTIONS, AND STABILITY 

> with(DEtools):with(plots):
 

The Simple Nonlinear Pendulum  

> sys1:=diff(theta(t),t)=phi(t),diff(phi(t),t)=-sin(theta(t)):
 

Figure 5.2(a): Phase portrait for the simple nonlinear pendulum. 

> DEplot([sys1],[theta(t),phi(t)],t=-10..10,[[0,0.2,0.2],[0,1,0],[0,Pi,0.1],[0,-Pi,0.1],[0,Pi,-0.1],[0,-Pi,-0.1],[0,2*Pi,0.2],[0,-2*Pi,-0.2],[0,2*Pi,1],[0,-2*Pi,1],[0,0,3],[0,0,-3],[0,3*Pi,0.1],[0,-3*Pi,0.1],[0,3*Pi,-0.1],[0,-3*Pi,-0.1],[0,4*Pi,0.2],[0,-4*Pi,-0.2],[0,4*Pi,1],[0,-4*Pi,1]],stepsize=0.1,theta=-4*Pi..4*Pi,phi=-4..4,arrows=SLIM,color=black,linecolor=blue,font=[TIMES,ROMAN,15],axes=BOXED);
 

Plot_2d
 

Figure 5.2(b): The surface  

> plot3d(y^2/2-cos(x),x=-4*Pi..4*Pi,y=-2..2);
 

Plot
 

Figure 5.8: The Lyapunov function  

> gama:=0.7:
 

Figure 5.8(a): Surface Plot of the Lyapunov Function V(x,y). 

> plot3d(-(x^2+y^2)-4*(ln(cos(1/2*Pi*x))+ln(cos(1/2*Pi*y)))/(gama*Pi^2),x=-1..1,y=-1..1,axes=BOXED,view=-0.2..0.1);
 

Plot
 

Figure 5.8(b): Contour Plot of the Lyapunov Function V(x,y). 

> contourplot(-(x^2+y^2)-4*(ln(cos(1/2*Pi*x))+ln(cos(1/2*Pi*y)))/(gama*Pi^2),x=-1..1,y=-1..1,contours=[-0.1,-0.08,-0.04,0.01,0.02,0.1],grid=[50,50]);
 

Plot_2d
 

Figure 5.8(c): Density Plot of the Lyapunov Function V(x,y). 

> densityplot(-(x^2+y^2)-4*(ln(cos(1/2*Pi*x))+ln(cos(1/2*Pi*y)))/(gama*Pi^2),x=-1..1,y=-1..1,grid=[128,128],axes=BOXED,
           style=PATCHNOGRID,brightness=0.8,contrast=0.8);
 

Plot_2d
 

End of Chapter 5 Commands