### Transcription

Wolfram Mathematica Tutorial CollectionDIFFERENTIAL EQUATIONSOLVING WITH DSOLVE

For use with Wolfram Mathematica 7.0 and later.For the latest updates and corrections to this manual:visit reference.wolfram.comFor information on additional copies of this documentation:visit the Customer Service website at www.wolfram.com/services/customerserviceor email Customer Service at [email protected] on this manual are welcomed at:[email protected] authored by:Devendra KapadiaPrinted in the United States of America.15 14 13 12 11 10 9 8 7 6 5 4 3 2 2008 Wolfram Research, Inc.All rights reserved. No part of this document may be reproduced or transmitted, in any form or by any means,electronic, mechanical, photocopying, recording or otherwise, without the prior written permission of the copyrightholder.Wolfram Research is the holder of the copyright to the Wolfram Mathematica software system ("Software") describedin this document, including without limitation such aspects of the system as its code, structure, sequence,organization, “look and feel,” programming language, and compilation of command names. Use of the Software unlesspursuant to the terms of a license granted by Wolfram Research or as otherwise authorized by law is an infringementof the copyright.Wolfram Research, Inc. and Wolfram Media, Inc. ("Wolfram") make no representations, express,statutory, or implied, with respect to the Software (or any aspect thereof), including, without limitation,any implied warranties of merchantability, interoperability, or fitness for a particular purpose, all ofwhich are expressly disclaimed. Wolfram does not warrant that the functions of the Software will meetyour requirements or that the operation of the Software will be uninterrupted or error free. As such,Wolfram does not recommend the use of the software described in this document for applications inwhich errors or omissions could threaten life, injury or significant loss.Mathematica, MathLink, and MathSource are registered trademarks of Wolfram Research, Inc. J/Link, MathLM,.NET/Link, and webMathematica are trademarks of Wolfram Research, Inc. Windows is a registered trademark ofMicrosoft Corporation in the United States and other countries. Macintosh is a registered trademark of AppleComputer, Inc. All other trademarks used herein are the property of their respective owners. Mathematica is notassociated with Mathematica Policy Research, Inc.

ContentsIntroduction to Differential Equation Solving with DSolve . . . . . . . . . . . . . . . . . . . . . .1Classification of Differential Equations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .7Ordinary Differential Equations (ODEs) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .11Overview of ODEs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .11First-Order ODEs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .12Linear Second-Order ODEs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .24Nonlinear Second-Order ODEs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .33Higher-Order ODEs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .36Systems of ODEs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .42Lie Symmetry Methods for Solving Nonlinear ODEs . . . . . . . . . . . . . . . . . . . . . . . . . . . . .50Partial Differential Equations (PDEs) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .55Introduction to PDEs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .55First-Order PDEs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .56Second-Order PDEs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .66Differential-Algebraic Equations (DAEs) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .70Introduction to DAEs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .70Examples of DAEs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .71Initial and Boundary Value Problems . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .76Introduction to Initial and Boundary Value Problems . . . . . . . . . . . . . . . . . . . . . . . . . . .76Linear IVPs and BVPs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .77Nonlinear IVPs and BVPs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .82IVPs with Piecewise Coefficients . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .85Working with DSolve A User’s Guide . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .89Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .89Setting Up the Problem . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .90Verification of the Solution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .94Plotting the Solution . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .98The GenerateParameters Options . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102Symbolic Parameters and Inexact Quantities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104Is the Problem Well-Posed? . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 108References . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111

Introduction to Differential EquationSolving with DSolveThe Mathematica function DSolve finds symbolic solutions to differential equations. (The Mathematica function NDSolve, on the other hand, is a general numerical differential equationsolver.) DSolve can handle the following types of equations:† Ordinary Differential Equations (ODEs), in which there is a single independent variable t andone or more dependent variables xi HtL. DSolve is equipped with a wide variety of techniquesfor solving single ODEs as well as systems of ODEs.† Partial Differential Equations (PDEs), in which there are two or more independent variablesand one dependent variable. Finding exact symbolic solutions of PDEs is a difficult problem,but DSolve can solve most first-order PDEs and a limited number of the second-order PDEsfound in standard reference books.† Differential-Algebraic Equations (DAEs), in which some members of the system are differential equations and the others are purely algebraic, having no derivatives in them. As withPDEs, it is difficult to find exact solutions to DAEs, but DSolve can solve many examples ofsuch systems that occur in [email protected],[email protected],xDsolve a differential equation for [email protected]@8eqn1 ,eqn2 , ,8y1 @xD,y2 @xD, ,xDsolve a system of differential equations for yi @xDFinding symbolic solutions to ordinary differential equations.DSolve returns results as lists of rules. This makes it possible to return multiple solutions to anequation. For a system of equations, possibly multiple solution sets are grouped together. Youcan use the rules to substitute the solutions into other calculations.This finds the general solution for the given ODE. A rule for the function that satisfies theequation is returned.In[1]: [email protected] '@xD ã [email protected] , [email protected], xDxOut[1] [email protected] Ø ‰ [email protected]

2Differential Equation Solving with DSolveYou can pick out a specific solution by using ê. (ReplaceAll ).In[2]: [email protected] ê. [email protected] '@xD ã [email protected] , [email protected], xDxOut[2] 9‰ [email protected] A general solution contains arbitrary parameters [email protected] that can be varied to produce particularsolutions for the equation. When an adequate number of initial conditions are specified, DSolvereturns particular solutions to the given equations.Here, the initial condition [email protected] 1 is specified, and DSolve returns a particular solution forthe problem.In[3]: sol [email protected] '@xD ã [email protected], [email protected] ã 1 , [email protected], xDxOut[3] [email protected] Ø ‰ This plots the solution. ReplaceAll (ê.) is used in the Plot command to substitute thesolution for [email protected][4]: [email protected]@xD ê. sol, 8x, - 3, 2 D7654Out[4] [email protected],y,xD12solve a differential equation for y as a pure [email protected] ,eqn2 , ,8y1 ,y2 , ,xDsolve a system of differential equations for the pure functions yiFinding symbolic solutions to ordinary differential equations as pure functions.When the second argument to DSolve is specified as y instead of [email protected], the solution is returned asa pure function. This form is useful for verifying the solution of the ODE and for using the solution in further work. More details are given in "Setting Up the Problem".

Differential Equation Solving with DSolve3The solution to this differential equation is given as a pure function.In[5]: eqn 8y '@xD ã [email protected] 2, [email protected] ã 1 ;sol [email protected], y, xDOut[6] ::y Ø FunctionB8x ,1F 1-xThis verifies the solution.In[7]: eqn ê. solOut[7] 88True, True This solves a system of ODEs. Each solution is labeled according to the name of the function(here, x and y), making it easier to pick out individual functions.In[8]: eqns 8Ht 2 1L * x '@tD ã - t * [email protected] [email protected] - [email protected],Ht 2 1L * y '@tD ã - [email protected] - t * [email protected] t * [email protected], [email protected] ã - 1 ê 2, [email protected] ã 2 ;sol [email protected], 8x, y , tD-1 4 t 2 [email protected] t § 0-tTrue 2t20Out[9] ::x Ø FunctionB8t ,LogA1 t2 E t § 0TrueF,2 I1 t2 M4 t-2t [email protected] t § 0-tTrue1 220y Ø FunctionB8t ,LogA1 t2 E t § 0TrueF 22 I1 t MThis substitutes a random value for the independent variable and shows that the solutions arecorrect at that point.In[10]: eqns ê. sol ê. 8t Ø [email protected] Out[10] 88True, True, True, True This plots the solutions.In[11]: [email protected]@tD ê. sol, [email protected] ê. sol , 8t, - 10, 10 D21Out[11] [email protected],[email protected],yD,8x,y Dsolve a partial differential equation for [email protected], yDFinding symbolic solutions to partial differential equations.While general solutions to ordinary differential equations involve arbitrary constants, general

4Differential Equation Solving with DSolveWhile general solutions to ordinary differential equations involve arbitrary constants, generalsolutions to partial differential equations involve arbitrary functions. DSolve labels these arbitrary functions as [email protected] is the general solution to a linear first-order PDE. In the solution, [email protected] labels an arbitraryfunction ofIn[12]: -x yxy.eqn x 2 * [email protected]@x, yD, xD y 2 * [email protected]@x, yD, yD - Hx yL * [email protected], yD;sol [email protected] ã 0, u, 8x, y DOut[13] ::u Ø FunctionB8x, y , -x y [email protected] yFF xyThis obtains a particular solution to the PDE for a specific choice of [email protected][14]: fn [email protected], yD ê. [email protected]@1DD ê. [email protected]@t D Ø [email protected] 2D Ht ê 10L Out[14] -x y-x y SinBH-x yL210 x yFx2 y2Here is a plot of the surface for this solution.In[15]: [email protected], 8x, - 5, 5 , 8y, - 5, 5 DOut[15] DSolve can also solve differential-algebraic equations. The syntax is the same as for a systemof ordinary differential equations.This solves a DAE.In[16]: eqns 8f ''@xD [email protected], [email protected] [email protected] 3 [email protected], [email protected] 1, f '@PiD 0 ;sol [email protected], 8f, g , xDOut[17] ::f Ø FunctionB8x ,g Ø FunctionB8x ,121H-2 [email protected] 3 p [email protected] - 3 x [email protected] 3 [email protected],H2 [email protected] - 3 p [email protected] 3 x [email protected] 3 [email protected] 2This verifies the solutions.

Differential Equation Solving with DSolve5This verifies the solutions.In[18]: [email protected] ê. solDOut[18] 88True, True, True, True A plot of the solutions shows that their sum satisfies the algebraic relationf @xD [email protected] ã 3 [email protected][19]: [email protected]@xD ê. sol, [email protected] ê. sol, [email protected] [email protected] ê. sol , 8x, - 5, 5 D5Out[19] -4-224-5Goals of Differential Equation Solving with DSolveTutorialsThe design of DSolve is modular: the algorithms for different classes of problems work independently of one another. Once a problem has been classified (as described in "Classification ofDifferential Equations"), the available methods for that class are tried in a specific sequenceuntil a solution is obtained. The code has a hierarchical structure whereby the solution of complex problems is reduced to the solution of relatively simpler problems, for which a greatervariety of methods is available. For example, higher-order ODEs are typically solved by reducing their order to 1 or 2.The process described is done internally and does not require any intervention from the user.For this reason, these tutorials have the following basic goals.† To provide enough information and tips so that users can pose problems to DSolve in themost appropriate form and apply the solutions in their work. This is accomplished through asubstantial number of examples. A summary of this information is given in "Working withDSolve".† To give a catalog of the kinds of problems that can be handled by DSolve as well as thenature of the solutions for each case. This is provided in the tutorials on ODEs, PDEs, DAEs,and boundary value problems (BVPs).The author hopes that these Differential Equation Solving with DSolve tutorials will be useful inacquiring a basic knowledge of DSolve and also serve as a ready reference for information onmore advanced topics.

6Differential Equation Solving with DSolveThe author hopes that these Differential Equation Solving with DSolve tutorials will be useful inacquiring a basic knowledge of DSolve and also serve as a ready reference for information onmore advanced topics.

Differential Equation Solving with DSolve7Classification of Differential EquationsWhile differential equations have three basic types ordinary (ODEs), partial (PDEs), or differential-algebraic (DAEs), they can be further described by attributes such as order, linearity, anddegree. The solution method used by DSolve and the nature of the solutions depend heavily onthe class of equation being solved.The order of a differential equation is the order of the highest derivative in the equation.This is a first-order ODE because its highest derivative is of order 1.In[1]: [email protected] 2 H1 - x 2L * y '@xD ã Hx - 3 x 3 - [email protected] [email protected], [email protected], xD-x x3Out[1] ::[email protected] Ø [email protected] - [email protected] is the general solution to a fourth-order ODE.In[2]: [email protected] ''''@xD - 16 * [email protected] ã x 2, [email protected], xDOut[2] ::[email protected] Ø -x2 ‰2 x [email protected] ‰-2 x [email protected] [email protected] [email protected] xD [email protected] [email protected] xD 16A differential equation is linear if the equation is of the first degree in y and its derivatives, andif the coefficients are functions of the independent variable.This is a nonlinear second-order ODE that represents the motion of a circular pendulum. It isnonlinear because [email protected]@xDD is not a linear function of [email protected] The Solve::ifun warningmessage appears because Solve uses JacobiAmplitude (the inverse of EllipticF) to findan expression for [email protected][3]: sol [email protected] ''@xD 3 * [email protected]@xDD ã 0, y, xDSolve::ifun :Inverse functions are being used by Solve, so some solutions may not be found; use Reduce forcomplete solution information. àOut[3] ::y Ø FunctionB8x , -2 JacobiAmplitudeB:y Ø FunctionB8x , 2 JacobiAmplitudeB1212H6 [email protected] Hx [email protected] ,12FF ,6 [email protected] [email protected] Hx [email protected] ,FF 6 [email protected]

8Differential Equation Solving with DSolveThis plots the solutions. The discontinuity in the graphs at x -3 results from the choice ofinverse functions used by Solve .In[4]: [email protected]@xD ê. [email protected]@1DD ê. [email protected] Ø - 1, [email protected] Ø 3 ,[email protected] ê. [email protected]@2DD ê. [email protected] Ø - 1, [email protected] Ø 3 , 8x, - 5, 5 D1.00.5Out[4] -4-224-0.5-1.0It should be noted that sometimes the solutions to fairly simple nonlinear equations are onlyavailable in implicit form. In these cases, DSolve returns an unevaluated Solve object.This nonlinear differential equation only has an implicit solution. The Solve::tdep messagescan be ignored; they appear because Solve cannot find an explicit expression for [email protected] becausenon-algebraic functions (ArcTan and Log) are involved.In[5]: [email protected]@xD x - 1L * y '@xD - [email protected] 2 x 3 ã 0, [email protected], xDSolve::tdep :The equations appear to involve the variables to be solved for in an essentially non-algebraic way. àSolve::tdep :The equations appear to involve the variables to be solved for in an essentially non-algebraic way. àOut[5] SolveB23-2 2 ArcTanB2H-1 x [email protected] 3 2 H2 3 xL-1 x [email protected] 3 xL K-2 O-1 x [email protected] - LogB22 3 x-1 x [email protected] ã [email protected] H2 3 [email protected] 3 xD, y F3When the coefficients of a linear ODE do not depend on x, the ODE is said to have constantcoefficients.This is an ODE with constant coefficients.In[6]: eqn y '''@xD 3 * y ''@xD - 25 * y '@xD 21 * [email protected];sol [email protected] ã 0, [email protected], xD-7 [email protected] ‰x [email protected] ‰3 x [email protected] Out[7] [email protected] Ø ‰The previous equation is also homogeneous: all terms contain y or derivatives of y and its righthand side is zero. Adding a function of the independent variable makes the equation inhomogeneous. The general solution to an inhomogeneous equation with constant coefficients isobtained by adding a particular integral to the solution to the corresponding homogeneousequation.Here, x2 is added to the right-hand side of the previous equation, making the new equationinhomogeneous. The general solution to this new equation is the sum of the previous solutionand a particular integral.

Differential Equation Solving with DSolve9Here, x2 is added to the right-hand side of the previous equation, making the new equationinhomogeneous. The general solution to this new equation is the sum of the previous solutionand a particular integral.In[8]: sol2 [email protected] ã x 2, [email protected], xDOut[8] ::[email protected] Ø1124 1050 x 441 x2 ‰-7 x [email protected] ‰x [email protected] ‰3 x [email protected] 9261When the coefficients of an ODE depend on x, the ODE is said to have variable coefficients.Since equations with variable coefficients that are rational functions of x have singularities thatare easily classified, there are sophisticated algorithms available for solving them.The coefficients of this equation are rational functions of x.In[9]: sol [email protected] ''@xD - HH1 ê xL - H3 ê H16 x 2LLL * [email protected] ã 0, [email protected] ã 1, y '@1D ã 4 , [email protected], xDOut[9] ::[email protected] Ø1‰-2-2xJ-11 ‰4 19 ‰4xN x1ë4 8There is a close relationship between functions and differential equations. Starting with a function of almost any type, it is possible to construct a differential equation satisfied by that function. Conversely, any differential equation gives rise to one or more functions, in the form ofsolutions to that equation. In fact, many special functions from classical analysis have theirorigins in the solution of differential equations. Mathieu functions are one such class of specialfunctions. Mathieu was interested in studying the vibrations of elliptical membranes. The eigenfunctions for the wave equation that describes this motion are given by products of Mathieufunctions.This linear second-order ODE with rational coefficients has a general solution given by Mathieufunctions.In[10]: [email protected] - 1L Ht 1L * y ''@tD t * y '@tD H- 2 - 6 * t 2L * [email protected] ã 0, [email protected], tDOut[10] ::[email protected] Ø [email protected] MathieuCB5, -33, [email protected] [email protected] MathieuSB5, - , [email protected] 22The presence of [email protected] in the previous solution suggests that the equation can be given asimpler form using trigonometric functions. This is the form in which these equations wereintroduced by Mathieu in 1868.In[11]: [email protected] ''@xD H3 [email protected] xD 5L [email protected] 0, y, xDOut[11] ::y Ø FunctionB8x , [email protected] MathieuCB5, -323, xF [email protected] MathieuSB5, - , xFF 2

10Differential Equation Solving with DSolveThis plots the surface for a particular product of solutions to this equation.In[12]: Plot3DBMathieuCB5, -32, xF * MathieuSB5, -32, yF, 8x, - 3, 3 , 8y, - 3, 3 FOut[12] The degree of a differential equation is the highest power of the highest-order derivative in theequation.This is a first-order ODE of degree 2.In[13]: sol [email protected] '@xD 2 ã 1 - x 2, [email protected] ã 2 , y, xDOut[13] ::y Ø FunctionB8x ,:y Ø FunctionB8x ,1214-x1 - x2 - [email protected] F ,4 x1 - x2 [email protected] F 2The higher degree leads to non-uniqueness of the solution.In[14]: [email protected]@xD ê. [email protected]@1DD, [email protected] ê. [email protected]@2DD , 8x, 0, 1 D2.5Out[14] 2.01.50.20.40.60.81.0The examples in this tutorial have focused on the classification of ODEs. The classification ofPDEs is similar but more involved. PDEs can also be classified by linearity or nonlinearity, order,degree, and constant or variable coefficients. More important is the classification that identifiesa PDE as hyperbolic, parabolic, or elliptic. These classifications are discussed in further detail in"Second-Order PDEs".

Differential Equation Solving with DSolve11Ordinary Differential Equations (ODEs)Overview of Ordinary Differential Equations (ODEs)There are four major areas in the study of ordinary differential equations that are of interest inpure and applied science.† Exact solutions, which are closed-form or implicit analytical expressions that satisfy thegiven problem.† Numerical solutions, which are available for a wider class of problems, but are typically onlyvalid over a limited range of the independent variables.† Qualitative theory, which is concerned with the global properties of solutions and is particularly important in the modern approach to dynamical systems.† Existence and uniqueness theorems, which guarantee that there are solutions with certaindesirable properties provided a set of conditions is fulfilled by the differential equation.Of these four areas, the study of exact solutions has the longest history, dating back to theperiod just after the discovery of calculus by Sir Isaac Newton and Gottfried Wilhelm von Leibniz. The following table introduces the types of equations that can be solved by DSolve.

12Differential Equation Solving with DSolvename of equationgeneral formdate of discoverymathematicianSeparabley HxL f HxL gHyL1691G. LeibnizHomogeneousy HxL 1691G. LeibnizLinear first-order ODE1694G. LeibnizBernoulliy HxL PHxL yHxL QHxLy HxL PHxL yHxL QHxL1695James BernoulliRiccatiy HxL f HxL gHxL yHxL hHxL yHxL1724Count Riccati1734L. Euler1734A-C. Clairaut1743L. Eulerxf J yHxL N Exact first-order ODEM d x N d y 0 withClairautyHxL x y HxL f Hy HxLLLinear with constantcoefficientsHnLHn-1Ly HxL an-1 y M y 2 N xHxL a0 yHxL PHxLwith a1 constantHypergeometricxH1 - xL y HxL Hc - Ha b 1L xL y HxL a b yHxL 01769L. EulerLegendreI1 - x2 M y HxL - 2 x y HxL nHn 1L yHxL 01785M. LegendreBesselx2 y HxL x y HxL Ix2 - n2 M y HxL 01824F. BesselMathieuy HxL Ha - 2 q cosH2 xLL yHxL 01868E. MathieuAbely HxL f HxL gHxL yHxL hHxL yHxL2 k HxL yHxL31834N. H. AbelChiniy HxL f HxL g HxL y HxL h HxL y HxLn1924M. ChiniExamples of ODEs belonging to each of these types are given in other tutorials (clicking a link inthe table will bring up the relevant examples).First-Order ODEsStraight IntegrationThis equation is solved by simply integrating the right-hand side with respect to x.In[1]: sol [email protected] '@xD ã x 2 * [email protected] [email protected] x 2D, y, xDOut[1] ::y Ø FunctionB8x ,12x1 x2 [email protected] [email protected] - I-2 x2 M [email protected] 2 x [email protected]

Differential Equation Solving with DSolve13Here is a plot of the integral curves for different values of the arbitrary constant [email protected][2]: tab [email protected]@xD ê. [email protected]@1DD ê. [email protected] - k , 8k, - 80, 80, 40 D;In[3]: [email protected]@tabD, 8x, 3, 18 D400300200Out[3] 100681012141618-100Separable EquationsThe general solution to this equation is found by separation of variables.In[1]: DSolveBy @xD ãx2 [email protected] 2, y, xF3 - x22Out[1] ::y Ø FunctionB8x ,x23-xF - 3 ArcSinBxF - 2 [email protected] when variables can be separated, the final solution might be accompanied by a warningmessage from Solve, or it might only be given as an InverseFunction object.Solving this ODE generates a warning message because Solve obtains an expression for [email protected] Log, the inverse of Exp. This warning message can be ignored.In[2]: DSolveBy @xD ãx2 [email protected]@xDD, y, xF3 - x2Solve::ifun : Inverse functions are being used by Solve, so some solutions may not be found; use Reduce for complete solution information. àOut[2] ::y Ø FunctionB8x , -LogB12x3 - x2 -32ArcSinBx3F - [email protected]

14Differential Equation Solving with DSolveThe solution to this equation is given as an InverseFunction object, in order to get anexplicit expression for [email protected][3]: x2sol DSolveBy @xD ã9-x2, [email protected], [email protected]@xDD * [email protected]@xDDInverseFunction::ifun : Inverse functions are being used. Values may be lost for multivalued inverses. àInverseFunction::ifun : Inverse functions are being used. Values may be lost for multivalued inverses. àSolve::tdep :The equations appear to involve the variables to be solved for in an essentially non-algebraic way. àOut[3] ::[email protected] Ø [email protected]@Ò1D - [email protected]Ò1D [email protected]Ò1D &DB-Â1-3 x x3 x 9 ArcSinhB2-3 xF [email protected] 6Homogeneous EquationsHere is a homogeneous equation in which the total degree of both the numerator and thedenominator of the right-hand side is 2. The two parts of the solution list give branches of theintegral curves in the form y f HxL.In[1]: eqn y '@xD ã - Hx 2 - 3 [email protected] 2L ê Hx * [email protected];sol [email protected], y, xDOut[2] ::y Ø FunctionB8x , -x2 x6 [email protected] F , :y Ø FunctionB8x ,2x2 x6 [email protected] F 2This plots both branches together, showing the complete integral curves y2 C @1D x6 several values of [email protected][3]: tab1 [email protected]@xD ê. [email protected]@1DD ê. [email protected] Ø k, 8k, 0, 3, 0.5 D;In[4]: tab2 [email protected]@xD ê. [email protected]@2DD ê. [email protected] Ø k, 8k, 0, 3, 0.5 D;In[5]: [email protected]@[email protected], tab2DD, 8x, 0, 1.7 Dx22for42Out[5] 0.51.01.5-2-4If an initial condition is specified, DSolve picks the branch that passes through the initial point.The DSolve::bvnul message indicates that one branch of the general solution (the lower

Differential Equation Solving with DSolve15If an initial condition is specified, DSolve picks the branch that passes through the initial point.The DSolve::bvnul message indicates that one branch of the general solution (the lowerbranch in the previous graph) did not give a solution satisfying the given initial [email protected] ã 3.In[6]: [email protected], [email protected] ã 3 , [email protected], xDDSolve::bvnul :For some branches of the general solution, the given boundary conditions lead to an empty solution. àx2 I1 17 x4 MOut[6] ::[email protected] Ø 2Linear First-Order EquationsThe following is a linear first-order ODE because both [email protected] and y @xD occur in it with power 1 andy @xD is the highest derivative. Note that the solution contains the imaginary error function Erfi .In[1]: [email protected] '@xD x * [email protected] ã [email protected] xD, [email protected], xDOut[1] ::[email protected] Ø ‰[email protected] ‰9x222- -pErfiB23 xF 2Here is the solution for a more general linear first-order ODE. The K variables are used asdummy variables for integration. The Erfi term in the previous example comes from theintegral in the second term of the general solution as follows.In[2]: sol [email protected] '@xD [email protected] ã [email protected], [email protected], [email protected]@[email protected] „ [email protected] Out[2] ::[email protected] Ø ‰ [email protected] ‰ ‡ ‰1A more traditional form of the solution can be obtained by replacing [email protected] with a variable suchas t.In[3]: sol ê. [email protected] Ø t x-x-xtOut[3] ::[email protected] Ø ‰ [email protected] ‰ ‡ ‰ [email protected] „ t 1Inverse Linear EquationsIt may happen that a given ODE is not linear in yHxL but can be viewed as a linear ODE in xHyL. Inthis case, it is said to be an inverse linear ODE.

16Differential Equation Solving with DSolveThis is a inverse linear ODE. It is constructed by interchanging x and y in an earlier example.In[1]: [email protected] '@xD ã 1 ê H- x * [email protected] [email protected] * [email protected], [email protected], xDSolve::tdep :The equations appear to involve the variables to be solved for in an essentially non-algebraic way. àOut[1] SolveBx ã ‰[email protected]@1D ‰[email protected] -pErfiB3 [email protected], [email protected] EquationsA Bernoulli equation is a first-order equation of the formy HxL PHxL yHxL QHxLyHxLn .The problem of solving equations of this type was posed by James Bernoulli in 1695. A yearlater, in 1696, G. Leibniz showed that it can be reduced to a linear equation by a change ofvariable.Here is an example of a Bernoulli equation.In[1]: eqn y '@xD 11 x * [email protected] ã x 3 * [email protected] 3 33Out[1] 11 x [email protected] y @xD ã x [email protected][2]: sol [email protected], y, xD11Out[2] ::y Ø FunctionB8x , -F , :y Ø FunctionB8x ,21 11 x2 121 ‰11 x [email protected] 21 11 x2 121 ‰11 x [email protected] verifies that the solution is correct.In[3]: eqn ê. sol êê SimplifyOut[3] 8True, True In general, the solution to a Bernoulli equation will consist of n - 1 branches, where n is thedegree of yHxL in the equation.

Differential Equation Solving with DSolve17Here is an example of a Bernoulli equation with n 5. The solution has four branches.In[4]: [email protected] x * y '@xD - 7 x * [email protected] * [email protected] 5 - [email protected] ã 0, [email protected], xD71ë4 x1ë3Out[4] ::[email protected] Ø - , :[email protected] Ø -I12 x7ë3 7 [email protected] - 28 x7ë3 [email protected]ë4Â 71ë4 x1ë3:[email protected] Ø1ë4 ,I12 x7ë3 7 [email protected] - 28 x7ë3 [email protected]ë471ë4 x1ë3 , :[email protected] ØI12 x7ë3 7 [email protected] - 28 x7ë3 [email protected]Â 71ë4 x1ë3I12 x7ë3 7 [email protected] - 28 x7ë3 [email protected] 1ë4Riccati EquationsA Riccati equation is a first-order equation of the formy HxL f HxL gHxL yHxL hHxL yHxL2 .This equation was used by Count Riccati of Venice (1676 1754) to help in solving second-orderordinary differential equations.Sol

Introduction to Differential Equation Solving with DSolve The Mathematica function DSolve finds symbolic solutions to differential equations. (The Mathe- matica function NDSolve, on the other hand, is a general numerical differential equation solver.) DSolve can handle the following types of equations: † Ordinary Differential Equations (ODEs), in which there is a single independent variable .