How to |
Solve a Differential Equation
s differential equation solving functions can be applied to many different classes of differential equations, automatically selecting the appropriate algorithms without needing pre-processing by the user.
to solve the differential equation
with independent variable
The solution given by DSolve
is a list of lists of rules. The outermost list encompasses all the solutions available, and each smaller list is a particular solution.
If you want to use a solution as a function, first assign the rule to something, in this case, solution
Now, use Part
to take the first part of the solution using the short form solution[]
. Replace y[x]
(the short form of ReplaceAll
) and then use = to define the function f[x]
evaluates like any normal function:
To specify initial conditions, enclose the equation and the initial conditions (
) in a list:
If not enough initial conditions are given, constants C[n]
To indicate which functions should be solved for, use a second list:
Here the solutions are not elementary functions:
You can use DSolve
, and Plot
together to graph the solutions to an underspecified differential equation for various values of the constant.
First, solve the differential equation using DSolve
and set the result to solution
Use = and /.
to define a function g[x]
Define a table of functions t[x]
for integer values of C
between 1 and 10:
to plot the table over the range