Mathematics by T. Arens, F. Hettlich, Ch. Karpfinger, U. Kockelkorn, K. Lichtenegger, H. Stachel (chapter 13: Differential Equations)restart; The command dsolveOrdinary differential equations like F( LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYoLUkjbWlHRiQ2I1EhRictRiM2KC1GLDYlUSJ5RicvJSdpdGFsaWNHUSV0cnVlRicvJSxtYXRodmFyaWFudEdRJ2l0YWxpY0YnLUkjbW9HRiQ2LVEwJkFwcGx5RnVuY3Rpb247RicvRjhRJ25vcm1hbEYnLyUmZmVuY2VHUSZmYWxzZUYnLyUqc2VwYXJhdG9yR0ZCLyUpc3RyZXRjaHlHRkIvJSpzeW1tZXRyaWNHRkIvJShsYXJnZW9wR0ZCLyUubW92YWJsZWxpbWl0c0dGQi8lJ2FjY2VudEdGQi8lJ2xzcGFjZUdRJjAuMGVtRicvJSdyc3BhY2VHRlEtSShtZmVuY2VkR0YkNiQtRiM2Ji1GLDYlUSJ4RidGNEY3LyUnZmFtaWx5R1EwVGltZXN+TmV3flJvbWFuRicvJStiYWNrZ3JvdW5kR1EuWzI1NSwyNTUsMjU1XUYnRj5GPkZmbkZpbkY+RitGZm5GaW5GPg== , LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYoLUkjbWlHRiQ2I1EhRictRiM2KC1GLDYlUSNEeUYnLyUnaXRhbGljR1EldHJ1ZUYnLyUsbWF0aHZhcmlhbnRHUSdpdGFsaWNGJy1JI21vR0YkNi1RMCZBcHBseUZ1bmN0aW9uO0YnL0Y4USdub3JtYWxGJy8lJmZlbmNlR1EmZmFsc2VGJy8lKnNlcGFyYXRvckdGQi8lKXN0cmV0Y2h5R0ZCLyUqc3ltbWV0cmljR0ZCLyUobGFyZ2VvcEdGQi8lLm1vdmFibGVsaW1pdHNHRkIvJSdhY2NlbnRHRkIvJSdsc3BhY2VHUSYw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yUobGFyZ2VvcEdGRC8lLm1vdmFibGVsaW1pdHNHRkQvJSdhY2NlbnRHRkQvJSdsc3BhY2VHUSYwLjBlbUYnLyUncnNwYWNlR0ZTLUkobWZlbmNlZEdGJDYkLUYjNiYtRiw2JVEieEYnRjZGOS8lJ2ZhbWlseUdRMFRpbWVzfk5ld35Sb21hbkYnLyUrYmFja2dyb3VuZEdRLlsyNTUsMjU1LDI1NV1GJ0ZARkBGaG5GW29GQC1GPTYtUSI9RidGQEZCRkVGR0ZJRktGTUZPL0ZSUSwwLjI3Nzc3NzhlbUYnL0ZVRmJvLUkjbW5HRiQ2JFEiMEYnRkBGaG5GW29GQEYrRmhuRltvRkA=is defined by de:= (x^2+1)*D(y)(x) + 2*x*y(x) = 0;Various techniques for the analytical solution of an ODE are provided by the essential dsolve command.dsolve(de);Since we didn't set initial values for the first order ODE, a general solution including a constant "_C1" is returned. Of course any initial condition may be set and taken into account.iniv:= y(0) = 2;
sol:=dsolve({de,iniv},y(x));Mind the syntax. The ODE and the initial condition are written as a set, forming the first argument of the dsolve command. In this situation it is necessary to include the unknow function in the second argument.The result of dsolve is an expression and hence may be modified by other general commands. For example we can regard the plot of the solution.plot(rhs(sol),x);( By rhs we obtain the right hand side of the equation in the expresssion sol .)Even differential equations of higher order (see below) are solvable with Maple. As well as a lot of optional specifications for the dsolve command are possible. For example we may force a powerseries method and print the formal expression of the according powerseries.dgl2:= (D@@2)(y)(x) - (x+1)*y(x) = 0;dsolve(dgl2,y(x),type='series'); The package DEtoolsThe important command dsolve has already been introduced. Special commands to handle differential Equations, systems of differential equations and partial differential equations are included in the program package DEtools . with(DEtools);Since we may only present a small part of the listed commands, we recommend the help pages or additional literature for more detailed information.Using the dsolve command at first the ODE is classified to a certain type that determines the solution strategy. We obtain the classification by the command odeadvisor .odeadvisor(dgl);If you read the according help pages, you will get an in depth impression of the numerous possibilities offered by Maple. Another useful tool is the odetest command, that verifies whether an expression solves an ODE.odetest(y(x)=4/(1+x^2),dgl);
odetest(y(x)=x^2,dgl);In the first case 0 is returned, meaning that the ODE is fullfilled. In the second case we obtain a remainder different to 0. Of course a supposed solution may be as well tested by the subs command.f:=x->4/(1+x^2);
subs(y=f,dgl);
simplify(%);odetest is a comfortable way to check implicit solutions and solutions for systems of differential equations. In the following examples the verification of solutions determined by solve and dsolve are dropped. In general such tests are highly recommended - hidden errors appear everywhere!Furthermore the command DEplot is helpful to plot the directional field for first order ODEs of the formy'(x) = f( x, y(x)) For every point of the (x,y) plain the slope f(x,y) is plotted, while f(x,y) must have a solution of the ODE at this certain point. For example the following ODEf:=(x,y)->y^2-2*x*y;
dgl:=D(y)(x)=f(x,y(x)); DEplot(dgl,y(x),x=-1..1,{[-1,0.2]},y=-0.5..1.5,linecolor=blue);The behaviour of one concrete solution may be guessed from the directional arrows. The blue curve shows one specific solution for the inital value y(-1) = 0.2 . Mind the syntax of this command. Unfortunately it differs from the dsolve command, because the DEplot command allows even more options for DEs of higher order or systems of DEs, that are not discussed in our worksheets.Besides plots can also be exported to external files. Either you use the pop-up box by hitting the picture with the right mouse button or you apply the plotsetup command. For example we may create a Postscript file of the directional field.
(Attention: If you execute the command, a file named rfeld.ps will be created or overwritten!)plotsetup(cps,plotoptions=`color`,plotoutput=`rfeld.ps`);
DEplot(dgl,y(x),x=-1..1,{[-1,0.2]},y=-0.5..1.5,linecolor=blue);Byplotsetup(default);we reset the options of the plot command. Numerical methodsThe DEplot command approximates numerical solutions of initial value problems. There are a lot of methods available, but one of the easiest is the Euler-method. We code a short program that applies the method.myeuler:= proc(f,x0,y0,xN,h)
local x,y,yN,seq:
global eulerlist:
y:=y0:
seq:=NULL:
for x from x0 by h to xN do
yN := y:
seq := seq, [x,y]:
y := evalf(y+h*f(x,y)):
od:
eulerlist := [seq]:
yN;
end:Input variables are f - the function f of two variables x0 - initial point y0 - initial value xN - final point h - step lengthLocal varialbes x, y, yN, seq and a global variable eulerlist providing a final list of all approximations are defined.Now the method is tested. Let us consider the following DE:f:=(x,y)->y^2-2*x*y;
dgl:= D(y)(x) = f(x,y(x)); We obtain an approximation of the solution at x=1 for the initial value y(0)=1 myeuler(f,-1,0.2,1,0.5);We save the result an decrease the step length:euler1:=plot(eulerlist,color=blue):
myeuler(f,-1,0.2,1,0.25);Let us finally take an approximation with h=1/100 into account and compare the results.euler2:=plot(eulerlist,color=red):
myeuler(f,-1,0.2,1,0.01); euler3:=plot(eulerlist,color=green):
with(plots): display([euler1,euler2,euler3]);Of course there are better numerical methods then the Euler-method. One of the most common method is the Runge-Kutta-method, based on a skilful modification of the Euler idea. This method is also implemented in Maple and available by an option of the dsolve command. rk:=dsolve({dgl,y(-1)=0.2},y(x),numeric);Maple creates a procedur including the approximated solution for the function. We obtain the value of the function for x=1 byrk(1);We can regard the plot of the solution with the command odeplot from the DEtools package.odeplot(rk,[x,y(x)],-1..1); The shock absorberNow we like to use Maple for an application problem - the model of a shock absorber.The movement from the rest position, L, of a mass m attached to a spring is described by y(t) . Under the second law of Newton, the product of mass and acceleration is equivalent to the resulting force on the body, m y''(t) = F( t, y(t), y'(t)).The resulting force contains of four parts, F=F1+F2+F3+F4 with gravitation: F1 = m g (g earth acceleration) spring force: F2 = -k (y(t)+L) (k>0 spring constant) damping force: F3 = -b y'(t) (b>0 damping constant) external forces: F4 = f(t).Since gravitation, F1 , and the spring force, F2=-kL, equal each other in the rest position, we obtain the solution of the linear inhomogenius second order DE (with constant coefficients) m y''(t) + by'(t) +ky(t) = f(t) We like to analyse the behaviour of such a spring-damper-system under different conditions. First we clean up everything, load the necessary tools and define the DErestart: with(plots): with(DEtools):
dgl:= (D@@2)(y)(t) + b/m*D(y)(t) + k/m*y(t) = f(t)/m;(a) The undamped (b=0), free (f=0 no external force), oscillation:f:=t->0; dgl1:=subs(b=0,dgl); dsolve(dgl1);Likewise we expect we obtain a harmonic oscillation of frequency LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYmLUkmbXNxcnRHRiQ2Iy1JJm1mcmFjR0YkNigtRiM2Ji1JI21pR0YkNiVRImtGJy8lJ2l0YWxpY0dRJXRydWVGJy8lLG1hdGh2YXJpYW50R1EnaXRhbGljRicvJSdmYW1pbHlHUTBUaW1lc35OZXd+Um9tYW5GJy8lK2JhY2tncm91bmRHUS5bMjU1LDI1NSwyNTVdRicvRjtRJ25vcm1hbEYnLUYjNiYtRjQ2JVEibUYnRjdGOkY9RkBGQy8lLmxpbmV0aGlja25lc3NHUSIxRicvJStkZW5vbWFsaWduR1EnY2VudGVyRicvJSludW1hbGlnbkdGTy8lKWJldmVsbGVkR1EmZmFsc2VGJ0Y9RkBGQw== . Setting the initial position and the initial speed we obtain a solution, for exampleabed:= y(0)=0, D(y)(0)=-1; dsolve({dgl1,abed},y(t));(b) The damped, free oscillation:
We set m=1 and k=1 fixed and observe a damping constant of LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzY3LUkjbWlHRiQ2I1EhRictRiM2Ny1GLDY1USJiRicvJSdmYW1pbHlHUTBUaW1lc35OZXd+Um9tYW5GJy8lJXNpemVHUSMxMkYnLyUlYm9sZEdRJmZhbHNlRicvJSdpdGFsaWNHUSV0cnVlRicvJSp1bmRlcmxpbmVHRjwvJSpzdWJzY3JpcHRHRjwvJSxzdXBlcnNjcmlwdEdGPC8lK2ZvcmVncm91bmRHUShbMCwwLDBdRicvJStiYWNrZ3JvdW5kR1EuWzI1NSwyNTUsMjU1XUYnLyUnb3BhcXVlR0Y8LyUrZXhlY3V0YWJsZUdGPC8lKXJlYWRvbmx5R0Y8LyUpY29tcG9zZWRHRjwvJSpjb252ZXJ0ZWRHRjwvJStpbXNlbGVjdGVkR0Y8LyUscGxhY2Vob2xkZXJHRjwvJTZzZWxlY3Rpb24tcGxhY2Vob2xkZXJHRjwvJSxtYXRodmFyaWFudEdRJ2l0YWxpY0YnLUkjbW9HRiQ2PlEiPUYnRjRGN0Y6L0Y+RjxGQEZCRkRGRkZJRkxGTkZQRlJGVEZWRlhGWi9GZ25RJ25vcm1hbEYnLyUmZmVuY2VHRjwvJSpzZXBhcmF0b3JHRjwvJSlzdHJldGNoeUdGPC8lKnN5bW1ldHJpY0dGPC8lKGxhcmdlb3BHRjwvJS5tb3ZhYmxlbGltaXRzR0Y8LyUnYWNjZW50R0Y8LyUnbHNwYWNlR1EsMC4yNzc3Nzc4ZW1GJy8lJ3JzcGFjZUdGYHAtSSZtZnJhY0dGJDYqLUYjNjUtSSNtbkdGJDY1USIxRidGNEY3RjpGXW9GQEZCRkRGRkZJRkxGTkZQRlJGVEZWRlhGWkZeb0Y0RjdGOkZdb0ZARkJGREZGRklGTEZORlBGUkZURlZGWEZaRl5vLUYjNjUtRmlwNjVRIzEwRidGNEY3RjpGXW9GQEZCRkRGRkZJRkxGTkZQRlJGVEZWRlhGWkZeb0Y0RjdGOkZdb0ZARkJGREZGRklGTEZORlBGUkZURlZGWEZaRl5vLyUubGluZXRoaWNrbmVzc0dRIjFGJy8lK2Rlbm9tYWxpZ25HUSdjZW50ZXJGJy8lKW51bWFsaWduR0ZmcS8lKWJldmVsbGVkR0Y8LyUrZm9yZWdyb3VuZEdGSC8lK2JhY2tncm91bmRHRktGNEY3RjpGXW9GQEZCRkRGRkZJRkxGTkZQRlJGVEZWRlhGWkZeb0YrRjRGN0Y6Rl1vRkBGQkZERkZGSUZMRk5GUEZSRlRGVkZYRlpGXm8=.dgl2:=subs(b=1/10, m=1, k=1, dgl);lsg:=rhs(dsolve({dgl2,abed},y(t)));plot(lsg,t=0..30*Pi);By increasing damping we reach a critical area for b=2 .dgl3:=subs(b=1, m=1, k=1, dgl);
lsg:=rhs(dsolve({dgl3,abed},y(t))); plot(lsg,t=0..10*Pi);We change the initial condition, to amplify the effect:abed:= y(0)=0.5, D(y)(0)=-1;
dgl3:=subs(b=2, m=1, k=1, dgl);
lsg:=rhs(dsolve({dgl3,abed},y(t))); plot(lsg,t=0..10*Pi);The spring oscillates once and moves back to the rest position. An additional damping causes a movement in the overdamped area like the behaviour of an intact shock absorber.dgl4:=subs(b=3, m=1, k=1, dgl);
lsg:=rhs(dsolve({dgl4,abed},y(t))); plot(lsg,t=0..10*Pi);(c) Forced oscillation:We assume an additional external force acting on the system, for examplef:=t->cos(a*t);With the frequency LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYoLUkjbWlHRiQ2I1EhRictRiM2KC1GLDYlUSJhRicvJSdpdGFsaWNHUSV0cnVlRicvJSxtYXRodmFyaWFudEdRJ2l0YWxpY0YnLUkjbW9HRiQ2LVEiPUYnL0Y4USdub3JtYWxGJy8lJmZlbmNlR1EmZmFsc2VGJy8lKnNlcGFyYXRvckdGQi8lKXN0cmV0Y2h5R0ZCLyUqc3ltbWV0cmljR0ZCLyUobGFyZ2VvcEdGQi8lLm1vdmFibGVsaW1pdHNHRkIvJSdhY2NlbnRHRkIvJSdsc3BhY2VHUSwwLjI3Nzc3NzhlbUYnLyUncnNwYWNlR0ZRLUkmbWZyYWNHRiQ2KC1GIzYmLUkjbW5HRiQ2JFEiMUYnRj4vJSdmYW1pbHlHUTBUaW1lc35OZXd+Um9tYW5GJy8lK2JhY2tncm91bmRHUS5bMjU1LDI1NSwyNTVdRidGPi1GIzYmLUZaNiRRIjJGJ0Y+RmduRmpuRj4vJS5saW5ldGhpY2tuZXNzR1EiMUYnLyUrZGVub21hbGlnbkdRJ2NlbnRlckYnLyUpbnVtYWxpZ25HRmdvLyUpYmV2ZWxsZWRHRkJGZ25Gam5GPkYrRmduRmpuRj4= we obtain the following resultdgl4:=subs(a=1/2, b=1/10, m=1, k=1, dgl);
abed:= y(0)=0, D(y)(0)=-1;lsg4:=dsolve({dgl4,abed},y(t)): lsg4:=collect(lsg4,exp);Uff! - the command collect takes the exponential term as a common factor. The stationary part of the solution (thus without the exponential part) can be extracted from the expression by the command remove .st_lsg4:= remove(has,rhs(lsg4),exp(-1/20*t));Now we compare the plots of both oscillations pe:=plot(rhs(lsg4), t=0..30*Pi, color=red):
ps:=plot(st_lsg4, t=0..30*Pi, color=blue):
display([pe,ps]);After a certain time the forced oscillations acts like the stationary solution.Let us examine the dependency of the solution regarding the frequency a of the external acting force.dgl5:=subs(m=1, k=1, dgl);We evaluate the resonanz frequency by determining the roots of the characteristical polynominal.lambda := solve(x^2+b*x+1=0,x): l1:=lambda[1]; assume(b>0,b<2): a:=Im(l1);A damping constant b=0.1 yields the solutiondgl6:=subs(b=1/10,m=1, k=1, dgl);lsg:=rhs(dsolve({dgl6,abed},y(t))): plot(lsg,t=0..50*Pi);Note, the resulting amplitude is increased by factor 10 in comparision to the stimulating force.Without damping the situation becomes even more critical, since the amplitude is linear increasing by time.dgl7:=subs(b=0,m=1, k=1, dgl);lsg:=rhs(dsolve({dgl7,abed},y(t))): plot(lsg,t=0..30*Pi); Exercises(To work on the exercises, please open a new worksheet to trial an error your commands. You will get a suggestion for the solution, if you open up the solution. Before you look at them try on your own.)
1. Solve the following initial value problem. Regard the plot of these function and discuss the behaviour of the solution that can directly be assumed from the ODE. a) LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYoLUkjbWlHRiQ2I1EhRictRiM2Ji1JJW1zdXBHRiQ2JS1GLDYlUSJ4RicvJSdpdGFsaWNHUSV0cnVlRicvJSxtYXRodmFyaWFudEdRJ2l0YWxpY0YnLUkjbW5HRiQ2JFEiMkYnL0Y7USdub3JtYWxGJy8lMXN1cGVyc2NyaXB0c2hpZnRHUSIwRicvJSdmYW1pbHlHUTBUaW1lc35OZXd+Um9tYW5GJy8lK2JhY2tncm91bmRHUS5bMjU1LDI1NSwyNTVdRidGQUYrRkZGSUZBLUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYmLUkjbWlHRiQ2JVEieUYnLyUnaXRhbGljR1EldHJ1Z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= exp(x);abed:= y(0)=1;dsolve({dgl,abed},y(x));plot(rhs(%),x=-2..5);2. By the aid of the directional field, discuss the behaviour of the solution for the following ODEy'(x) = x+sin(y(x))and create a DEplot output that shows the solutions for the initial valuesy(0)=-1, y(0)=0 und y(0)=1 without the directional field. Solutiondgl := D(y)(x) = x+sin(y(x));DEplot(dgl,y(x),x=-3..3,y=-3..3);Look up the help pages to find the option of DEplot that avoids the output of directional arrows. ?DEplotDEplot(dgl,y(x),x=-3..3,{[0,-1],[0,0],[0,1]},y=-3..3,arrows=none);3. Solve the DEs a) y''(x) + (1-I) y'(x) - I y(x) = 0, b) y'''(x) - 3y''(x) + 4y(x) = 0, c) y^(5)(x) - y(x) = 0 and the initial value problems d) u''''(x) - u'''(x)-u''(x)-u'(x) - 2*u(x) = 0 mit u(0) = 0, u'(0) = 0, u''(0) = 0, u'''(0) = 1 e) x^2*y''(x) - 2*x*y'(x) + 2*y(x) = 0 mit y(1) = 0, y'(1) = -1 .Solutiondgl:=(D@@2)(y)(x)+(1-I)*D(y)(x)-I*y(x)= 0;
lsg:=dsolve(dgl,y(x));dgl:=(D@@3)(y)(x)-3*(D@@2)(y)(x)+4*y(x)= 0;
lsg:=dsolve(dgl,y(x));dgl:=(D@@5)(y)(x)-y(x)= 0;
lsg:=dsolve(dgl,y(x));:dgl:= (D@@4)(u)(x) - (D@@3)(u)(x)-(D@@2)(u)(x)-D(u)(x) -2*u(x)=0;abed:= u(0) = 0, D(u)(0)= 0, (D@@2)(u)(0)=0, (D@@3)(u)(0)=1;
dsolve({dgl,abed},u(x));
dgl:= x^2*(D@@2)(y)(x) - 2*x*D(y)(x) + 2*y(x)=0;
abed:= y(1) = 0, D(y)(1) = -1;
dsolve({dgl,abed},y(x));