IntroductionThe Mathematica function DSolve finds symbolic solutions to differential equations. (The Mathematica 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 t and one or more dependent variables (t). DSolve is equipped with a wide variety of techniques for solving single ODEs as well as systems of ODEs. Partial Differential Equations (PDEs), in which there are two or more independent variables x and t and one dependent variable u(x, t). 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 PDEs found 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 with PDEs, it is difficult to find exact solutions to DAEs, but DSolve can solve many examples of such systems that occur in applications. Finding symbolic solutions to ordinary differential equations.
DSolve
returns results as lists of rules. This makes it possible to return multiple solutions to an equation. For a system of equations, possibly multiple solution sets are grouped together. You can 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 the equation is returned. In[1]:=  |
Out[1]=
|
You can pick out a specific solution by using /. (ReplaceAll). In[2]:=  |
Out[2]=
|
A general solution contains arbitrary parameters C[i] which can be varied to produce particular solutions for the equation. When an adequate number of initial conditions are specified, DSolve returns particular solutions to the given equations. Here, the initial condition y[0] 1 is specified, and DSolve returns a particular solution for the problem. In[3]:=  |
Out[3]=
|
This plots the solution. ReplaceAll (/.) is used in the Plot command to substitute the solution for y[x]. In[4]:=  |
Finding symbolic solutions to ordinary differential equations as pure functions. When the second argument to DSolve is specified as y instead of y[x], the solution is returned as a 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 a later section. The solution to this differential equation is given as a pure function. In[5]:=  |
Out[6]=
|
This verifies the solution. In[7]:=  |
Out[7]=
|
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]:=  |
Out[9]=
|
This substitutes a random value for the independent variable and shows that the solutions are correct at that point. In[10]:=  |
Out[10]=
|
This plots the solutions. In[11]:=  |
Finding symbolic solutions to partial differential equations. While general solutions to ordinary differential equations involve arbitrary constants, general solutions to partial differential equations involve arbitrary functions. DSolve labels these arbitrary functions as C[i]. Here is the general solution to a linear first-order PDE. In the solution, C[1] labels an arbitrary function of . In[12]:=  |
Out[13]=
|
This obtains a particular solution to the PDE for a specific choice of C[1]. In[14]:=  |
Out[14]=
|
Here is a plot of the surface for this solution. In[15]:=  |
DSolve can also solve differential-algebraic equations. The syntax is the same as for a system of ordinary differential equations. This solves a DAE. In[16]:=  |
Out[17]=
|
This verifies the solutions. In[18]:=  |
Out[18]=
|
A plot of the solutions shows that their sum satisfies the algebraic relation . In[19]:=  |
|