This page contains a maple code for Chapter 3 (Second-order differential equations: Steady-state solutions and their stability).
#liapunov2.txt
#26.05.09
#
# investigate stability using theorem 3.3 of the lecture notes
# To use theorem 3.3 we need the function V(x,y).
# to have the property that V(x,y)>0 for at least one point (x1,y1) in
# any neighbourhood of (0,0).
# Typical functions to try are V=xy and V=x^2-y^2
# Define the candidate Lyapunov function.
# You should make sure it has the required properties
#V := x*y;
# V := x^2 -4*x*y;
V := a*x^4-b*y*x;
#Define the differential equations
xdot := -4*y +x^2;
ydot := 4*x +y^2;
# Determine Vdot
Vx := diff(V,x):
Vy := diff(V,y):
Vdot := Vx*xdot +Vy*ydot;
# If we can show that Vdot>0 then we are finished!
# If we need to use the following piece of code then we are not going
# to be able to prove global stability, only asymptotic stability or
# unstability.
# To use theorem 3.3 we need the point (0,0) to be a local minimum
# of the function Vdot(x,y). Find out if this is satisfied, or if it
# imposes some constraints on the parameters in the function
Vdotx := diff(Vdot,x):
Vdoty := diff(Vdot,y):
VdotA := subs({x=0,y=0},diff(Vdotx,x));
VdotB := subs({x=0,y=0},diff(Vdotx,y));
VdotC := subs({x=0,y=0},diff(Vdoty,y));
disc := VdotA*VdotC-VdotB^2;
print("Investigating Vdot(0,0), We always require");
print("inequality three:",disc>0);
# Print the requirements for (0,0) to be a local minimum
# This means that Vdot > 0 and (0,0) is unstable.
print("For a local minimum we require");
print("inequality four-a",VdotA>0);