How to | Use Derivatives for Setting Up Differential Equations
The Wolfram Language's functions for solving differential equations can be applied to many different classes of differential equations, including ordinary differential equations (ODEs), partial differential equations (PDEs), differential-algebraic equations (DAEs), and boundary value problems (BVPs). Using derivatives to set up these equations for solving in the Wolfram Language is essential.
For an ODE, you can express the derivative of a function of with respect to in several ways.
Use D to set up the ODE for solving and then store the equation as ode:
Use TraditionalForm to see the ODE as it would appear in a mathematics textbook or journal article:
Once the ODE is set up, use DSolve to solve it symbolically:
The solution f[t] is represented as a rule in a nested list. For information on getting this solution out of the list and using it, see How to: Use Rule Solutions.
Most of the time, ODEs are accompanied by boundary and initial conditions. Thus, evaluation of derivatives of functions for specific values of variables needs to be used frequently. This can be done in several ways. Here, is used as an example.
Use /. (shorthand for ReplaceAll) to substitute for . The Wolfram Language first evaluates D, then performs the replacement: