New version page

URI MTH 142 - Differential Equations

Documents in this Course
Load more

This preview shows page 1-2-3-4 out of 12 pages.

View Full Document
View Full Document

End of preview. Want to read all 12 pages?

Upload your study docs or become a GradeBuddy member to access this document.

View Full Document
Unformatted text preview:

>restart;Differential EquationsIn this worksheet we demonstrate basic techniques of working withordinarydifferential equations, (ODE’s), using Maple. An ODE is a differential equationin which the unknown function is a function of one variable. We shall stickwithfirst orderODE’s which contain only the first derivative of the unknownfunction. Moreover, we shall consider only first order ODE’sin the normal form,that is in the form:yx= f (x, y),where the left hand side is simply the derivative of the unknown function,y = y (x)in this case, and the right hand side is a given function of x and y. You knowthat for such ODE’s, under reasonable assumptions aboutf (x, y) , there existsa unique solution to anyinitial value problem,( IVP ), of the formyx= f (x, y),y (x0) = y0,wherex0,y0are given.0.1 Solving and Plotting ODE’sBasic tools for solving and plotting ODE’s are contained in the packages”plots” and ”DEtools”. We begin with loading these packages. Please, don’tforget to click on the two commands below.>with(plots):>with(DEtools):We are familiar with the package ”plots”. If you are curious about the contentof ”DEtools”, replace the colon at the end of the command with a semicolonand click on it again.Example 1.(a) Find the general solution to the ODE:yx= −2 xy .(b) Solve the following two initial value problems:yx= −2 xy,y (0) = 2 ,andyx= −2 xy,y (0) = 1/2 .(c) Plot the solutions to the IVP’s together with the slope field correspondingto the ODE.In order to simplify many commands below let’s first label our ODE:>ODE1:=diff(y(x),x)=-2*x*y(x);ODE1 :=ddxy (x) = −2 xy (x)Observe that correct syntax. The derivative is entered using the ”diff” com-mand. The command ”D(y)(x)” could be used as well. Note that ”y” has to beentered as ”y(x)”. The main command for solving ODE’s is ”dsolve”.>dsolve(ODE1,y(x));y (x) =C1 e−x2Maple returned the general solution. ”C1” denotes, of course, an arbitraryconstant. Instead of using the name ”ODE1” you could have entered the differ-ential equation ”diff(y(x),x)=-2*x*y(x)” directly into the ”dsolve” command.Maple can handle initial value problems, as well. The proper syntax looks asfollows.>dsolve({ODE1,y(0)=2},y(x)); dsolve({ODE1,y(0)=1/2},y(x));y (x) = 2 e−x2y (x) = 1/2 e−x2Maple can plot slope fields, as well as slope fields together with particular solu-tions. Proper commands are ”dfieldplot” and”DEplot”, both contained in the”DEtools” package. Let’s see how they work. Pay attention to the syntax.>dfieldplot(ODE1,[y(x)],x=-2..2,y=-2..2,color=blue,scaling=constrained,arrows=LINE,dirgrid=[30,30]);Maple plotted the slope field for our equation. All the options under the ”dfield-plot” command regarding color, appearance of the arrows, scaling and dirgridare, of course, optional. You can play with them and see what will happen.”dirgrid” tells Maple how dense you want the field of slopes to be. The defaultsetting is dirgrid[20,20] and it tends to be a little rough. On the other hand, afiner grid may take more time to compute.Remark. Whenever plotting field of slopes, you should use the ”scaling =constrained” option. Otherwise, the pictures may appear misleading, as slopesbecome distorted.The command ”DEplot” plots the slope field together with particular solu-tions.>DEplot(ODE1,y(x),-2..2,[[y(0)=2],[y(0)=1/2]], linecolor=magenta,color=blue,scaling=constrained,arrows=LINE);As we expected, the two particular solutions are bell-shaped curves. If you donot want the slope field plotted with particular solutions, you add an option”arrows=NONE” under the ”DEplot” command.Example 2.(a) Try to find the general solution to the ODE:yx= cos (xy) .(b) Solve the IVP:yx= cos (xy),y (0) = 0 .Let’s see how Maple handles this ODE.>ODE2:=diff(y(x),x)=cos(x*y(x));ODE2 :=ddxy (x) = cos (xy (x))>dsolve(ODE2,y(x));Maple returned no output! That means Maple is unable to solve the equation. Ifyou are curious what steps Maple went through to find a solution before failingto do so, you can ask to see the steps using the command ”infolevel”. The levelsof information that you can request range from 0 to 5. The higher number, themore information Maple will reveal.>infolevel[dsolve]:=3:>dsolve(ODE2,y(x));Methods for first order ODEs: — Trying classification methods —trying aquadraturetrying 1st order lineartrying Bernoullitrying separabletrying in-verse lineartrying homogeneous types:trying Chinidifferential order: 1; look-ing for linear symmetriestrying exactLooking for potential symmetriestryinginverse Riccatitrying an equivalence to an Abel ODE— Trying Lie symmetrymethods, 1st order —-¿ Computing symmetries using: way = 3-¿ Computingsymmetries using: way = 4-¿ Computing symmetries using: way = 5tryingsymmetry patterns for 1st order ODEs-¿ trying a symmetry pattern of theform [F(x)*G(y), 0]-¿ trying a symmetry pattern of the form [0, F(x)*G(y)]-¿trying symmetry patterns of the forms [F(x),G(y)] and [G(y),F(x)]-¿ tryinga symmetry pattern of the form [F(x),G(x)]-¿ trying a symmetry pattern ofthe form [F(y),G(y)]-¿ trying a symmetry pattern of the form [F(x)+G(y),0]-¿ trying a symmetry pattern of the form [0, F(x)+G(y)]-¿ trying a sym-metry pattern of the form [F(x),G(x)*y+H(x)]-¿ trying a symmetry patternof conformal typeAs you see, Maple tried to match the equation with the types of first order ODE’sthat it knows how to solve in a closed form, and failed. Out of curiosity, let’s seehow Maple solved the previous equation,ODE1, with which it was successful.>dsolve(ODE1,y(x));Methods for first order ODEs: — Trying classification methods —trying aquadraturetrying 1st order linear¡- 1st order linear successful y (x) =C1 e−x2As you see, Maple solved the equation by the first successful method, that is, asa linear equation in y(x). You don’t know that method yet. You could, however,solve the equation by hand as a separable equation. Besides the common typeequations listed above, Maple is familiar with more sophisticated techniques ofsolving ODE’s involving power series expansion, Laplace transform and others.You have to tell Maple if you want it to apply those techniques. We are notgoing to do so at this point. Let’s get back to the normal infolevel for ”dsolve”command.>infolevel[dsolve]:=0:Maple couldn’t find the general solution of the equationyx= cos (xy) and neithercan we. However, the solution to the IVP of (b), can be


View Full Document
Loading Unlocking...
Login

Join to view Differential Equations and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Differential Equations and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?