This page contains a maple code for the course: MATH 111 Applied Mathematical Modelling I --- Maple Assignment IV.
# 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);