| ★ wanayoo — archive 1999 http://www.maplesoft.com/apps/categories/maple_tools/functionality/html/odes1.html | Nouvelle recherche | Portail wanayoo |
Solving Ordinary Differential Equations Using Maple
© 1998 Waterloo Maple Inc.
NOTE: This worksheet is a comprehensive introduction to Maple's capabilities with Differential Equations.
Initializing Maple to Work with Differential Equations
Many routines for working with odes (and PDEs) are contained in the Maple package, DEtools. This should normally be loaded into memory using the 'with' command.
> restart:
> with(DEtools);
[DEnormal, DEplot, DEplot3d, DEplot_polygon, DFactor, Dchangevar, GCRD, LCLM, PDEchangecoords, RiemannPsols, abelsol, adjoint, autonomous, bernoullisol, buildsol, buildsym, canoni, chinisol, clairautsol, constcoeffsols, convertAlg, convertsys, dalembertsol, de2diffop, dfieldplot, diffop2de, eigenring, endomorphism_charpoly, equinv, eta_k, eulersols, exactsol, expsols, exterior_power, formal_sol, gen_exp, generate_ic, genhomosol, hamilton_eqs, indicialeq, infgen, integrate_sols, intfactor, kovacicsols, leftdivision, liesol, line_int, linearsol, matrixDE, matrix_riccati, moser_reduce, mult, newton_polygon, odeadvisor, odepde, parametricsol, phaseportrait, poincare, polysols, ratsols, reduceOrder, regular_parts, regularsp, riccati_system, riccatisol, rightdivision, separablesol, super_reduce, symgen, symmetric_power, symmetric_product, symtest, transinv, translate, untranslate, varparam, zoom]
Entering Equations
A. First Order odes :
> diff(y(t),t)+y(t)+x(t)=0;
> diff(y(t),t)-y(t)=sin(t);
B. Higher Order odes :
> m*diff(y(t),t$2)+b*diff(y(t),t)+k*y(t)=0;
> diff(y(t),t$4)-10*diff(y(t),t$3)+35*diff(y(t),t$2)-50*y(t)+24=5*exp(t);
Solving
A. Single Equations
Example 1 - Response of a Parallel RLC Circuit
> R:=10000
: L:=0.001: C:=0.000001:
> diff(V(t),t$2) +
(1/(R*C))*diff(V(t),t) + V(t)/(L*C) = 0;
A general solution is found using:
> dsolve(%, V(t), method=laplace);
A particular solution can be found using initial values for V and dV/dt.
> dsolve({%%, V(0)=10, D(V)(0)=1}, V(t), explicit=true);
Example 2 - Bessel Equation and Series Solution
> x^2*diff(y(t),t$2) + x*diff(y(t),t) + (x^2-1)*y = 0;
> dsolve({%, y(0)=0, D(y)(0)=1}, y(t), type=series);
Example 3 - Numerical Solution
> diff(y(t),t$2) + sin(t)*y(t) = 0;
> soln := dsolve({%, y(0)=2, D(y)(0)=-2}, y(t), type=numeric);
> soln(0); soln(Pi/2); soln(Pi); soln(3*Pi/2);
B. Systems
Example 4
> interface(labelling=false): eqn1 := diff(y(t),t) = z(t) - y(t); eqn2 := diff(z(t),t) = y(t);
> soln :=
dsolve({eqn1, eqn2, y(0)=0, z(0)=1}, {y(t), z(t)}):
> collect(soln,exp);
Plotting Differential Equations
A. Single Equations - Damped Oscillator Model
> eqn5 :=
m*diff(x(t),t$2) = -b*diff(x(t),t) - k*x(t);
m:=0.5: b:=1: k:=20:
> DEplot(eqn5, {x(t)}, 0..5,
[[x(0)=5, D(x)(0)=-2]],
title=`Damped Oscillator`);
B. Systems of Equations - Dynamical System Model
> eqn5 := diff(y(t),t)=-y(t)-x(t);
> eqn6 := diff(x(t),t)=y(t);
> ic1 := x(0)=0,
y(0)=5;
> ic2 := x(0)=0, y(0)=-5;
> DEplot({eqn5,eqn6}, [x(t),y(t)], -5..5, [[ic1],[ic2]], title=`Spiral`);
Phase Portraits
> eqn3 := diff(y(x),x)=-y(x)-x^2;
> phaseportrait(eqn3,
y(x), x=-1..2.5,
[[y(0)=0],[y(0)=1],[y(0)=-1]], title=`Asymptotic Solution`,
color=magenta, linecolor=[red,blue,green]);