ode2x2:=proc() # # Main program ode2x2 computes the numerical # solution to the 2 x 2 ODE system by six # integrators # # Type variables global neqn, nout, nsteps, t0, tf, abserr, relerr: local u0, u, tp, ncase, i, j: # # Step through six integrators for ncase from 1 to 6 do # # Integration parameters read "c:\\odelib\\maple\\ode2x2\\intpar.txt": intpar(): # # Size arrays u0:=array(1..neqn): u:=array(1..neqn): # # Initial condition vector read "c:\\odelib\\maple\\ode2x2\\inital.txt": inital(neqn,t0,u0): # # Output interval tp:=tf-t0: # # Compute solution at nout output points for j from 1 to nout do # # Print current solution read "c:\\odelib\\maple\\ode2x2\\fprint.txt": fprint(ncase,neqn,t0,u0): # # Fixed step modified Euler integrator if (ncase = 1) then read "c:\\odelib\\maple\\ode2x2\\euler2a.txt": euler2a(neqn,t0,tf,u0,nsteps,u): end if: # # Variable step modified Euler integrator if (ncase = 2) then read "c:\\odelib\\maple\\ode2x2\\euler2b.txt": euler2b(neqn,t0,tf,u0,nsteps,abserr,relerr,u): end if: # # Fixed step classical fourth order RK integrator if (ncase = 3) then read "c:\\odelib\\maple\\ode2x2\\rkc4a.txt": rkc4a(neqn,t0,tf,u0,nsteps,u): end if: # # Variable step classical fourth order RK integrator if (ncase = 4) then read "c:\\odelib\\maple\\ode2x2\\rkc4b.txt": rkc4b(neqn,t0,tf,u0,nsteps,abserr,relerr,u): end if: # # Fixed step RK Fehlberg (RKF45) integrator if (ncase = 5) then read "c:\\odelib\\maple\\ode2x2\\rkf45a.txt": rkf45a(neqn,t0,tf,u0,nsteps,u): end if: # # Variable step RK Fehlberg (RKF45) integrator if (ncase = 6) then read "c:\\odelib\\maple\\ode2x2\\rkf45b.txt": rkf45b(neqn,t0,tf,u0,nsteps,abserr,relerr,u): end if: # # Advance solution t0:=tf: tf:=tf+tp: for i from 1 to neqn do u0[i]:=u[i]: end do: # # Next output end do: # # Next integrator end do: # # End of ode2x2 end: