Verification of the Solution
The solution given by DSolve can be verified using various methods. The easiest method involves substituting the solution back into the equation. If the result is True, the solution is valid.
In this simple example, the solution is verified by substitution. Note that the first argument to DSolve
is assigned to eqn
for convenience in later work.
In this example, the equation and an initial condition are verified by substitution.
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.
Here is the general solution for a second-order inhomogeneous equation.
This substitutes the solution back into the equation.
The solution can be verified using Simplify
Here is a linear PDE whose solution can be verified using Simplify
If the equation involves special functions, it may be necessary to use FullSimplify to verify the solution.
Here is an example of this type involving Bessel's functions.
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.
Here is an example where numerical verification is useful.
Although numerical checks cannot verify a solution with certainty, more rigorous checks can be made by using higher precision or by allowing the variables to take complex values.
This verifies the previous solution with higher precision.
This uses complex random values to verify the previous solution.
The previous methods are of use only when the solution is available in explicit form. The final example shows how to verify the solution of a first-order ODE when it is given in implicit form.
This solves a first-order ODE.
This verifies the solution by simplifying its derivative.