WOLFRAM LANGUAGE TUTORIAL
Symbolic Parameters and Inexact Quantities
The differential equations that arise in practice are of two types.
- 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.
Here is an example of the first type.
Here is an example of the second type. This equation has a symbolic parameter
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.
Here is a plot of the previous solution for different values of the parameter
It should be noted that the presence of symbolic parameters can lead to fairly complicated output.
This is seen in the following example (equation 2.14, page 401 of [K59
However, for some special values of the parameters, the solution might be significantly simpler.
For these values of
, the solution is much more simple.
Occasionally, a solution is valid for most, but not all, values of the parameters.
Since the input in this example is not valid at
, the solution has the same limitation.
Of course, there is a simple remedy in this case: setting
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".
Here is a simple example showing all three kinds of numbers.
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.
These equations contain the inexact number 3. and 3.`40, respectively.
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.
Here is a system of linear ODEs that all have exact coefficients. Note that even with a fairly small value of
, the calculation takes a long time to finish.
This verifies the solution. Since the solution is complicated, a numerical verification method is used.
If a single inexact quantity is introduced (in the function )
, the solution is returned more quickly.
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.
This equation contains inexact quantities.
Here the equation is converted to exact form before being solved.