<Text-field style="Heading 1" layout="Heading 1">Solving ODEs with constant coefficients</Text-field>To solve ODEs with constant coefficients one can invoke the Maple command dsolve without any special instructions. The syntax is dsolve( differential equation for unknown , name of unknown);For the differential equation y'' +2y'-6y=0 one would inputdsolve(diff(y(x),x,x) +2*diff(y(x),x)-6*y(x)=0 ,y(x));Notice that the first derivative in Maple is denoted diff(y(x),x) and the second derivative is diff(y(x),x,x) or diff(y(x),x$2) . The Maple command diff(y(x),x) tells Maple to differentiate the expression y(x) with respect to the independent variable x.To solve Initial Value Problems (IVP) the syntax is slightly different. Suppose that your equation is a second order equation so that there are two initial conditions, say y(x0) = y0 and y'(x0) = y'0. Then the syntax is:dsolve({<differential equation for unknown y(x)>,y(x0)=y0,D(y)(x0)=y'0},y(x));Notice that the ODE together with the initial conditions y(x0)=y0,D(y)(x0)=y'0 are grouped together inside curly braces { ...... }. One could also use diff(y(x),x)(x_0) = y'0for the second initial condition written as D(y)(x0)=y'0 above. This notation is so much longer than D(y)(x0)=y'0 , so we will not use it. Here a some examples from page 81 - 82.
<Text-field style="Heading 2" layout="Heading 2">Problem #1: Find the general solution of y''-y'-6y=0</Text-field>dsolve( diff(y(x),x$2)-diff(y(x),x)-6*y(x)=0,y(x)); Notice that Maple uses the notation _C1 and _C2 to denote the two arbitrary constants.
<Text-field style="Heading 2" layout="Heading 2">Problem #9: Find the general solution of y''-6y' +7y=0</Text-field>dsolve(diff(y(x),x,x)-6*diff(y(x),x)+7*y(x)=0,y(x));
<Text-field style="Heading 2" layout="Heading 2">Problem #23: Find the solution of the IVP: y''-2y' +y=0 , y(1) = 12 , y'(1) = -5</Text-field>dsolve({diff(y(x),x,x) - 2*diff(y(x),x) + y(x)=0,y(1)=12,D(y)(1)=-5},y(x));simplify(%);
<Text-field style="Heading 2" layout="Heading 2">Problem #25: Find the solution of the IVP: y''-y' +4y=0 , y(-2) = 1 , y'(-2) = 3</Text-field>dsolve({diff(y(x),x$2)-diff(y(x),x)+4*y(x) = 0,y(-2)=1,D(y)(-2)=3},y(x));simplify(%);
<Text-field style="Heading 1" layout="Heading 1">Solving ODEs using power series</Text-field>Once one passes from constant coefficients to non-constant coefficients in linear ODEs, one must in general seek power series solutions of such equations. Maple will do this for you for a large class of problems. The first example I'll work is the power #7 on page 170 in the textbook. I worked out this example in class on Feb. 1. To solve ODEs with a power series one uses the syntaxdsolve(<differential equation for y(x)> , y(x) , type=series); It is the type=series option that tells Maple to seek a power series solution using the recurrence formulas method.
<Text-field style="Heading 2" layout="Heading 2">Problem #7, page 170</Text-field>Here you are to use the power series method to find the first 5 terms of the Maclaurin series of the general solution of the ODEy'' - x^2*y'+2*y = xAs discussed above one solves this equation with a power series using the syntaxdsolve(<differential equation for y(x)> , y(x) , type=series); dsolve( diff(y(x),x$2)-x^2*diff(y(x),x)+2*y(x) = x , y(x),type=series); dsolve({diff(y(x),x$2)-x^2*diff(y(x),x)+2*y(x) = x,y(0)=a[0],D(y)(0)=a[1]}, y(x),type=series);The default number of explicit terms in the series is 5, and the series is said to be of "Order 6". You can change the number of terms the Maple prints on the screen using the Maple command Order as follows. Simply set the Order to any positive integer. For example, if you want 8 explicit terms we set Order := 9 . The first term is labeled with a zero 0, so the number of explicitly give terms is one less that the order. Order:=9;dsolve({diff(y(x),x$2)-x^2*diff(y(x),x)+2*y(x) = x,y(0)=a[0],D(y)(0)=a[1]}, y(x),type=series);restart:
<Text-field style="Heading 2" layout="Heading 2">Problem #9, page 170</Text-field>Find the first five terms of the Maclaurin series of the general solution of the ODEy'' +(1 - x)y' + 2y = 1 - x^2
<Text-field style="Heading 3" layout="Heading 3">Solution</Text-field>Here we will use a slightly different way to find the solution. We first assign the differential equation to a name, say ode1:ode1:=diff(y(x),x,x)+(1-x)*diff(y(x),x)+2*y(x) = 1-x^2;
dsolve({ode1,y(0)=c[0],D(y)(0)=c[1]},y(x),type=series);Order:=10;dsolve({ode1,y(0)=c[0],D(y)(0)=c[1]},y(x),type=series);restart:
<Text-field style="Heading 2" layout="Heading 2">Converting the solution to a polynomial</Text-field>The output of dsolve with the option type = series is an equation that contains the big-O statement giving the order of the solution. If you want to, for example, plot the result, then you must get rid of the big-O and convert the answer into a polynomial. You do this using the maple statement convert(what you want to convert, polynom). Here are some examples.
<Text-field style="Heading 3" layout="Heading 3">Example 1: </Text-field>From the first problem in this section:dsolve({diff(y(x),x$2)-x^2*diff(y(x),x)+2*y(x) = x,y(0)=a[0],D(y)(0)=a[1]}, y(x),type=series);convert(%,polynom); subs(a[0]=1,a[1]=2,%);
plot(rhs(%),x=0..5);
<Text-field style="Heading 3" layout="Heading 3">Example 2:</Text-field>dsolve({diff(y(x),x$2)+x^2*diff(y(x),x)+ y(x) = x,y(0)=a[0],D(y)(0)=a[1]}, y(x),type=series);convert(%,polynom); subs(a[0]=1,a[1]=2,%); plot(rhs(%),x=0..5);
<Text-field style="Heading 2" layout="Heading 2">Solve the ODE y'' + 4y = 0 using (a) <Font style="Maple Input" executable="false" size="14">dsolve</Font>, and (b) <Font style="Maple Input" executable="false" size="14">dsolve</Font> with the <Font style="Maple Input" executable="false" size="14">type = series</Font> option.</Text-field>It should be clear to you that the general solution of this ODE isy = _C1 sin(2x) + _C2 cos(2x)Let's use Maple to find the solution.
<Text-field style="Heading 3" layout="Heading 3">Solution without the 'type = series' option</Text-field>dsolve(diff(y(x),x,x) + 4*y(x));Notice something different here. The ODE was input as diff(y(x),x,x) + 4*y(x) without setting it to zero. This is the default Maple assumes if you do not set the expression equal to something. Also, notice that I did not include the name of the unknown variable here. Maple understood that there was just one unknown in the diff operators.
<Text-field style="Heading 3" layout="Heading 3">Solution using the 'type = series' option</Text-field>dsolve({diff(y(x),x,x) + 4*y(x)=0,y(0)=a[0],D(y)(0)=a[1]},y(x),type=series);simplify(%); Maple will not recognize this series as a linear combination of cos(2x) and sin(2x).
<Text-field style="Heading 1" layout="Heading 1">Solving ODEs using a Frobenius series</Text-field>To solve ODEs with a Frobenius series one uses the same syntax as for power series solutions, namelydsolve(<differential equation for y(x)> , y(x) , type=series); It is the type=series option that tells Maple to seek a power series solution using the recurrence formulas method. Maple will often return answers in terms of generalized functions (Bessel functions, Legendre polynomials, etc). To see the series form of the solution you can use Maple's series command to expand the solution in a generalized series. In the examples below I will work the examples on pages 176 - 180 that require Frobenius series solutions. (1) The rhs and lhs commands: The output of the dsolve command is an equation of the formy(x) = general solution of the ODEIf you want to work with this solution you can use the lhs (left hand side) and rhs (right hand side) Maple commands, and the subs Maple command. These commands will be used to manipulate the solutions in the following examples.(2) WARNING: Maple sometimes returns the generalized series solutions in a form that is exactly opposite of the convention used in your textbook. Thus when Maple provides the general solution in the form LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYlLUkjbWlHRiQ2I1EhRictRiM2J0YrLUYjNiUtRiw2JVEieUYnLyUnaXRhbGljR1EldHJ1ZUYnLyUsbWF0aHZhcmlhbnRHUSdpdGFsaWNGJy1JI21vR0YkNi1RMCZBcHBseUZ1bmN0aW9uO0YnL0Y6USdub3JtYWxGJy8lJmZlbmNlR1EmZmFsc2VGJy8lKnNlcGFyYXRvckdGRC8lKXN0cmV0Y2h5R0ZELyUqc3ltbWV0cmljR0ZELyUobGFyZ2VvcEdGRC8lLm1vdmFibGVsaW1pdHNHRkQvJSdhY2NlbnRHRkQvJSdsc3BhY2VHUSYwLjBlbUYnLyUncnNwYWNlR0ZTLUkobWZlbmNlZEdGJDYkLUYjNiMtRiw2JVEieEYnRjZGOUZALUY9Ni1RIj1GJ0ZARkJGRUZHRklGS0ZNRk8vRlJRLDAuMjc3Nzc3OGVtRicvRlVGXG8tRiM2J0YrLUYjNiYtRiw2JVEkX0MxRidGNkY5LUY9Ni1RMSZJbnZpc2libGVUaW1lcztGJ0ZARkJGRUZHRklGS0ZNRk9GUUZULUYjNiUtSSVtc3ViR0YkNiVGMy1GIzYjLUkjbW5HRiQ2JFEiMUYnRkAvJS9zdWJzY3JpcHRzaGlmdEdRIjBGJ0Y8RlZGKy1G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ZOLyUpc3RyZXRjaHlHRk4vJSpzeW1tZXRyaWNHRk4vJShsYXJnZW9wR0ZOLyUubW92YWJsZWxpbWl0c0dGTi8lJ2FjY2VudEdGTi8lJ2xzcGFjZUdRJjAuMGVtRicvJSdyc3BhY2VHRmduLUkobWZlbmNlZEdGJDYkLUYjNiMtRiw2JVEieEYnRjdGOkZDRis= may be reversed sometimes (but not always). Please read through the solutions to learn the manipulations you will need to do.
<Text-field style="Heading 2" layout="Heading 2">Example 4.11 (equal roots of indicial equation), page 176</Text-field>Find the general solution of the ODE x^2 y'' + 5x y' + (4+x) y = 0 about the regular singular point x = 0.
<Text-field style="Heading 3" layout="Heading 3">Solution</Text-field>We use the dsolve command and the type=series option to find the solutions. I'm going to assign the solution to the name solutions1 so I can manipulate it. I'm going to start the calulation with Maple's restart command. If you have been working with Maple for a while, Maple will remember assignments of names, etc, so it is a good idea to clear Maple's memory before you start new calculations.restart:solution1:=dsolve(x^2*diff(y(x),x$2) + 5*x*diff(y(x),x) + (x+4)*y(x),y(x),type=series);Maple has given us the general solution of the ODE. We can seperate out the two solutions by setting _C1 and _C2 to zero. So to find the first solution substitute _C2 = 0 into the right hand side of this equation. y[1]:=subs(_C2=0,rhs(solution1));This is the solution given on page 174 in your textbook. Similarly, to isolate the second solution we substitute _C1=0 into solution1:y[2]:=subs(_C1=0,rhs(solution1));This is the second solution given on page 177 of your textbook. Notice that ln(x) is multiplied by LUklbXJvd0c2Iy9JK21vZHVsZW5hbWVHNiJJLFR5cGVzZXR0aW5nR0koX3N5c2xpYkdGJzYjLUklbXN1YkdGJDYlLUkjbWlHRiQ2JVEieUYnLyUnaXRhbGljR1EldHJ1ZUYnLyUsbWF0aHZhcmlhbnRHUSdpdGFsaWNGJy1GIzYjLUkjbW5HRiQ2JFEiMUYnL0Y2USdub3JtYWxGJy8lL3N1YnNjcmlwdHNoaWZ0R1EiMEYn in the above solution.
<Text-field style="Heading 2" layout="Heading 2">Example 4.12 (conclusion (3), k = 0), page 177</Text-field>Find the general solution of the ODE x^2 y'' + x^2 y' -2y = 0.
<Text-field style="Heading 3" layout="Heading 3">Solution</Text-field>restart:solution2:=dsolve(x^2*diff(y(x),x$2) + x^2*diff(y(x),x) - 2*y(x),y(x),type=series);Let's change the order to 9 to see more terms:Order:=9;solution2:=dsolve(x^2*diff(y(x),x$2) + x^2*diff(y(x),x) - 2*y(x)=0,y(x),type=series);Notice that the logarithmic term again appears multiplied by O(x^9). This suggest that k = 0 and the logarithmic terms infact does not appear in the solution. In your textbook the coefficient k in fact turns out to be zero. Let's change the order to 20 to see what happens to the logarithmic term.Order:=20;solution2:=dsolve(x^2*diff(y(x),x$2) + x^2*diff(y(x),x) - 2*y(x)=0,y(x),type=series); We can seperate out the two solutions by setting _C1 and _C2 to zero. So to find the first solution substitute _C2 = 0 into the right hand side of this equation. y[1]:=subs(_C2=0,rhs(solution2));This is the first solution given at the top of page 178 in your textbook. Similarly, to isolate the second solution we substitute _C1=0 into solution2:y[2]:=subs(_C1=0,rhs(solution2));
<Text-field style="Heading 2" layout="Heading 2">Example 4.13 (conclusion (3), k not zero), page 179</Text-field>Find the general solution of the ODE x*y''-y = 0.
<Text-field style="Heading 3" layout="Heading 3">Solution</Text-field>restart:solution3:=dsolve(x*diff(y(x),x$2) - y(x),y(x),type=series);This is the general solution. Let's seperate out the two solutions.y[1]:=subs(_C2=0,rhs(solution3));y[2]:=subs(_C1=0,rhs(solution3));These are the first and second solutions given on pages 179 and 180 in your textbook.dsolve(diff(y(x),x,x)- x*y(x)=0 ,y(x),type=series);
Order:=12;
dsolve(diff(y(x),x,x)- x*y(x)=0 ,y(x),type=series);
dsolve({diff(y(x),x,x)- x*y(x)=0,y(0)=a[0],D(y)(0)=a[1]} ,y(x),type=series);
dsolve({diff(y(x),x,x)- y(x)=0,y(0)=a[0],D(y)(0)=a[1]} ,y(x),type=series);
dsolve(x*diff(y(x),x,x) + diff(y(x),x) + x*y(x)=0,y(x),type=series);