This is documentation for Mathematica 4, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.1)
Wolfram Research, Inc.

Solving EquationsPower Series

1.5.8 Differential Equations

Solving an ordinary differential equation.

Here is the solution to the differential equation . C[1] is a coefficient which must be determined from boundary conditions.

In[1]:= DSolve[ y'[x] == a y[x] + 1, y[x], x ]

Out[1]=

If you include an appropriate initial condition, there are no undetermined coefficients in the solution.

In[2]:= DSolve[ {y'[x] == a y[x] + 1, y[0] == 0}, y[x], x ]

Out[2]=

Whereas algebraic equations such as are equations for variables, differential equations such as 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 in the form y''[x] + y'[x] == y[x]. You cannot write it as y'' + y' == y.

Mathematica 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[1], C[2], etc.

Here is a pair of simultaneous differential equations, with no initial or boundary conditions. The solution you get involves two undetermined coefficients.

In[3]:= DSolve[ {x'[t] == y[t], y'[t] == x[t]},

{x[t], y[t]}, t ]

Out[3]=

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".

In[4]:= DSolve[ y'[x] == x + y[x], y, x ]

Out[4]=

You can now use the replacement operator to apply this solution to expressions involving y.

In[5]:= y''[x] + y[x] /. %

Out[5]=

Section 2.2.5 explains how the "pure function" indicated by & that appears in the result from DSolve works.

Solving EquationsPower Series