|DSolve[eqns,y[x],x]||solve a differential equation for y[x], taking x as the independent variable|
|DSolve[eqns,y,x]||give a solution for y in pure function form|
Solving an ordinary differential equation.
Here is the solution to the differential equation y (x)=ay (x)+1
is a coefficient which must be determined from boundary conditions.
If you include an appropriate initial condition, there are no undetermined coefficients in the solution.
Whereas algebraic equations such as x2+x=1
are equations for variables
, differential equations such as y (x)+y (x)=y (x)
are equations for functions
. In Mathematica
, you must always give differential equations explicitly in terms of functions such as y[x]
, and you must specify the variables such as x
on which the functions depend. As a result, you must write an equation such as y (x)+y (x)=y (x)
in the form y''[x]+y'[x]y[x]
. You cannot write it as y''+y'y
can solve both linear and nonlinear ordinary differential equations, as well as lists of simultaneous equations. If you do not specify enough initial or boundary conditions, Mathematica
will give solutions that involve an appropriate number of undetermined coefficients. Each time you use DSolve
, it names the undetermined coefficients C
Here is a pair of simultaneous differential equations, with no initial or boundary conditions. The solution you get involves two undetermined coefficients.
When you ask DSolve
to get you a solution for y[x]
, the rules it returns specify how to replace y[x]
in any expression. However, these rules do not specify how to replace objects such as y'[x]
. If you want to manipulate solutions that you get from DSolve
, you will often find it better to ask for solutions for y
, rather than for y[x]
This gives the solution for y
as a "pure function".
You can now use the replacement operator to apply this solution to expressions involving y
|Out= |"Pure Functions"
explains how the "pure function" that appears in the result from DSolve
Note that DSolve
can handle combinations of algebraic and differential equations. It can also handle partial differential equations, in which there is more than one independent variable.