DSolve can solve linear ordinary
differential equations of any order
with constant coefficients. It can also solve many linear equations
up to
second order with nonconstant coefficients. DSolve includes general
procedures for many of the nonlinear ordinary differential equations whose solutions
are given in standard reference books such as Erich Kamke's
All most users will have to do is just type in the differential equation
or the system of differential equations. As opposed to many numerical
differential equation solvers,
In this case, you can usually just type in the equation and evaluate the DSolve statement.
DSolve also works for higher-order equations.
DSolve works as well for first-order equations with nonlinear coefficients.
Just for the fun of it, let's give
These equations are handled pretty much the same as ordinary differential equations without initial conditions. Just enter the initial conditions as part of the list of equations.
Solving systems of ordinary differential equations is the same as solving a single ODE. Simply enter the list of equations and run DSolve on it.
The theory of partial differential equations is less fully developed than the theory of ordinary
differential equations; specifically, there is no equivalent of the Cauchy-Kovalevskaya Theorem. This means that
DSolve can find general solutions to partial differential equations like the wave equation in the following example. Once again, just enter the equation and call DSolve.
Return to Top
In
NDSolve requires the differential equation(s), a sufficient set of initial conditions, and the range to solve for as inputs. The /. shortcut in the Plot command inserts the solution for the function .
NDSolve can solve a significant number of boundary-value problems. Just add the boundary conditions as additional equations.
In this example,
Here is a graph of the solution.
In this example, NDSolve solves the heat
equation with the left end held at fixed temperature , the right end () held at fixed temperature
, and an initial heat profile given by a
quadratic in
A more interesting example is when time-dependent boundary conditions are added. For example, entering the following produces a plot of a solution with the temperature at the left edge varying sinusoidally.
NDSolve can also handle systems of partial differential equations. The notation means "replace the functions and with the results of NDSolve."
Return to Top
The easiest way to check results in
/.symsol replaces with the solution found by DSolve.
The solution satisfies the differential equation.
The solution found by NDSolve satisfies the equation in very good approximation. The rather high difference at the beginning is an artifact of the numerical differentiation. See the next section for how to arrive at even more-accurate solutions.
One way to get a very precise solution of an ODE is to give a sufficiently high value for the WorkingPrecision option. Note that AccuracyGoal and PrecisionGoal default to 10 less than the value of WorkingPrecision when it is greater than $MachinePrecision. Let's compare the result of an earlier calculation to the same one running with higher precision.
The following plot shows the logarithm of the difference between the numerical solution and the differential equation with the default setting of WorkingPrecision (black) and with WorkingPrecision set to 22 (red).
As you can see, the numerical errors are significantly smaller when the higher working precision is used. The rather high first value is an artifact.
Most nonlinear partial differential equations do not allow for general
solutions. In these cases it is advisable to use the tools in the Calculus`DSolveIntegrals` standard add-on package to attempt to find complete integrals or differential invariants.
Gerd Baumann of the University of Ulm in Germany has submitted a number of packages that deal with Lie and Lie-Baecklund symmetries. Lie symmetry methods can be used to construct solutions for linear and especially for nonlinear systems of differential equations. |