Working with DSolve: A User's Guide
|Setting Up the Problem||Symbolic Parameters and Inexact Quantities|
|Verification of the Solution||Is the Problem Well-Posed?|
|Plotting the Solution|
The aim of these tutorials is to provide a self-contained working guide for solving different types of problems with DSolve.
The first step in using DSolve is to set up the problem correctly. The next step is to use DSolve to get an expression for the solution. Once the solution has been found, it can be verified using symbolic or numerical techniques, or it can be plotted using a Wolfram System function such as Plot, Plot3D, or ContourPlot. Plots often reveal information about the solution that might not be evident from its closed-form expression.
If no boundary conditions are specified for a problem, the output from DSolve is some form of a general solution containing arbitrary parameters. The GeneratedParameters option can be used to label these arbitrary parameters.
In many applications, differential equations contain symbolic parameters, such as the rate of growth in the logistic equation. A differential equation can also contain inexact quantities, such as machine numbers arising from previous calculations. Both symbolic parameters and inexact quantities are allowed by DSolve, but it is good to be aware of their presence and interpret the solution correctly.
When DSolve makes any assumptions or encounters difficulty during a calculation, it issues a warning message outlining the problem. These messages can usually be ignored, but sometimes they point to serious limitations in the answer given for the problem.
It is helpful to analyze the statement of the problem for possible ambiguities—in other words, to make sure that the problem is well posed—so that meaningful answers can be obtained from DSolve.
The first argument given to DSolve is the differential equation, the second argument is the unknown function, and the last argument identifies the independent variable.
The output of DSolve is a list of solutions for the differential equation. The extra list is required since some equations have multiple solutions. Here, since the equation is of order 1 and is linear, there is only one solution: y[x]->+-5 x C. The solution has an undetermined constant C because no initial condition was specified. The solution can be extracted from the list of solutions using a part specification.
If the solution will be used in further work, it is best to specify the unknown function using rather than . This gives the solution using pure functions of the type Function[x,expr].
To solve a system of equations, the first argument to DSolve must be a list of the equations and the second argument must be a list of the unknown functions.
For a partial differential equation, the third argument to DSolve is a list of the independent variables for the equation.
Sometimes the result of the substitution is more complicated than True or False. Such examples can be verified by using Simplify to simplify the result of the substitution. If the simplified result is True, the solution is valid.
If the equation involves special functions, it may be necessary to use FullSimplify to verify the solution.
If the solution is large or if Simplify and FullSimplify do not succeed in verifying the solution, a numerical check can be made by using RandomReal or RandomComplex to generate values for all the variables and parameters in the problem. It is advisable in such cases to repeat the check with several sets of random values.
A plot of the solution given by DSolve can give useful information about the nature of the solution, for instance, whether it is oscillatory in nature. It can also serve as a means of solution verification if the shape of the graph is known from theory or from plotting the vector field associated with the differential equation. A few examples that use different Wolfram Language graphics functions follow.
To change the name of the undetermined parameter, use the GeneratedParameters option.
- Equations in which the only variables are the independent and dependent variables. Thus, all the variables that appear in the first argument to DSolve are also in the second or third arguments.
- Equations in which there are other symbolic quantities, such as mass or the spring constant. The solution in this case depends on the independent variables, the dependent variables, and the additional symbolic parameters.
DSolve is equipped to deal with both types of equations. It is extremely useful to have the solution available for all possible values of the parameters in the second type of equation.
In summary, the ability to solve differential equations with symbolic parameters is a powerful and essential feature of any symbolic solver such as DSolve. However, the following points should be noted.
- The solution might be complicated, and such calculations often require significant time and memory.
- The answer might not be valid for certain exceptional values of the parameters.
- The solution might be easy to verify symbolically for some special values of the parameters, but in the general case a numerical verification method is preferable.
Numerical quantities in the Wolfram Language can be of three types: infinite precision, machine precision, or arbitrary precision. The first type of number is referred to as "exact", while the remaining two types represent incomplete information and are therefore called "inexact".
Since DSolve is a symbolic solver, the algorithms used by it are primarily based on the assumption of exact input. However, equations that contain inexact quantities are handled by DSolve in the usual way.
Inexact input could arise, for example, when the coefficients in the equations are derived from a previous calculation and are known only approximately. In such cases, it might not be practical to convert the equations to exact form, as this could slow down the calculation significantly.
Thus, it is often desirable to continue working with inexact quantities even within a symbolic function such as DSolve. However, it should be noted that the solution obtained in such cases could have a certain amount of numerical error and should be checked carefully. It is therefore recommended that if the problem size is not too large (for instance, if there are fewer than five equations), the input should be converted to exact form using the Rationalize function.
DSolve returns a general solution for a problem if no initial or boundary conditions are specified.
However, if initial or boundary conditions are specified, the output from DSolve must satisfy both the underlying differential equation as well as the given conditions.
In such cases, it is useful to check whether DSolve has been asked a reasonable question—in other words, to check whether the problem is well-posed. An initial or boundary value problem is said to be well-posed if a solution for it is guaranteed to exist in some well-known class of functions (for example, analytic functions), if the solution is unique, and if the solution depends continuously on the data. Given an ODE of order (or a system of first-order equations) and initial conditions, there are standard existence and uniqueness theorems that show that the problem is well-posed under a specified set of conditions. The right-hand side of the first-order linear ODE in the previous example is a polynomial in and hence infinitely differentiable. This is sufficient to apply Picard's existence and uniqueness theorem, which only requires that the right-hand side be Lipschitz-continuous.
Most problems that arise in practice are well-posed since they are derived from sound theoretical principles. However, as a note of caution, the following are examples where DSolve might have difficulty finding a satisfactory solution to the problem.
Finally, it is possible that a problem has a solution, but that DSolve fails to find it because the general solution is in implicit form or involves higher transcendental functions.
This concludes the discussion of the basic principles for effectively working with DSolve. See the list of "references" that were found to be useful either during the development of DSolve or during the preparation of this documentation.