MATH971: Applied Nonlinear Differential Equations

Maple code


This page contains a maple code to integrate a single first-order differential equation.

# budworm.maple  Maple program to solve a first-order
# 17.09.03       ordinary differential equation.
#
# NOTE. This is NOT the maple code that one would use to 
# investigate a research problem, but it's good enough for the
# present purpose.
with(DEtools):

step := 0.1:  # this number controls how accurate the numerical
              # solution is.
tstart := 0:  # the initial value of time.
tend   := 30: # the final value of time.

ic1 := [0,0.1];        # one initial condition in the form (t0, x(t0));
                       # two initial conditions both in the form (t0, x(t0));
ic2 := [0,0.1],[0,1.0]; 
                       # four initial conditions
ic3 := [0,0.1],[0,1.0],[0,12.0],[0,20.0]; 

r   := 0.3;    # budworm `birth-rate'.
q   := 20.0;   # `foilage density'.

# define the differential equation.  Note that we have to TELL maple
# that x is a function of time by writing x(t)
de1 := diff(x(t),t) = r*x(t)*(1-x(t)/q) -x(t)**2/(1+x(t)**2);

# calculate a solution trajectory from an initial condition.
DEplot(de1,x(t),t=tstart..tend,[ic1],stepsize=step,arrows=NONE, \
       linecolor=BLACK);

# compare solution trajectories from TWO initial conditions.
DEplot(de1,x(t),t=tstart..tend,[ic2],stepsize=step,arrows=NONE, \
       linecolor=BLACK);

# compare solution trajectories from FOUR initial conditions.
DEplot(de1,x(t),t=tstart..tend,[ic3],stepsize=step,arrows=NONE, \
       linecolor=BLACK);


<< Return to my MATH 971 home page.
<< Return to my teaching home page.
<< Return to my start page.


Page Created: 2nd March 2010.
Last Updated: 2nd March 2010.