This chapter describes how to solve both ordinary and partial differential equations having real-valued solutions. Mathcad Standard comes with the rkfixed function, a general-purpose Runge-Kutta solver that can be used on nth order differential equations with initial conditions or on systems of differential equations. Mathcad Professional includes a variety of additional, more specialized functions for solving differential equations. Some of these exploit properties of the differential equation to improve speed and accuracy. Others are useful when you intend to plot the solution rather than simply evaluate it at an endpoint.

The following sections make up this chapter:

**Solving ordinary differential equations**

Using the rkfixed function to solve an nth order ordinary differential equation with initial conditions. This section is a prerequisite for all other sections in this .

**Systems of differential equations**

How to adapt the rkfixed function to solve systems of differential equations with initial conditions.

**Specialized differential equation solvers**

A description of additional differential equation solving functions and when you may want to use them.

**Boundary value problems**

How to solve boundary value problems involving multivariate functions.

**Solving ordinary differential equations**

In a differential equation, you solve for an unknown function rather than just a number. For ordinary differential equations, the unknown function is a function of one variable. Partial differential equations are differential equations in which the unknown is a function of two or more variables.

Mathcad has a variety of functions for returning the solution to an ordinary differential equation. Each of these functions solves differential equations numerically. You’ll always get back a matrix containing the values of the function evaluated over a set of points. These functions differ in the particular algorithm each uses for solving differential equations. Despite these differences however, each of these functions requires you to specify at least three things:

• The initial conditions.

• A range of points over which you want the solution to be evaluated.

• The differential equation itself, written in the particular form discussed in this

This section shows how to solve a single ordinary differential equation using the function rkfixed. It begins with an example of how to solve a simple first order differential equation and then proceeds to show how to solve higher order differential equations.

**First order differential equations**

A first order differential equation is one in which the highest order derivative of the unknown function is the first derivative. Figure 16-1 shows an example of how to solve the relatively simple differential equation:

The function rkfixed in Figure 16-1 uses the fourth order Runge- Kutta method to return a two-column matrix in which:

• The left-hand column contains the points at which the solution to the differential equation is evaluated.

• The right-hand column contains the corresponding values of the solution.

**Higher order equations**

The procedure for solving higher order differential equations is an extension of that used for second order differential equations. The main difference is that:

• The function D is now a vector with n elements