Numerical Differential Equations

Objective

We show how to solve differential equations in Excel using numerical methods. For now, we restrict ourselves to equations that can be expressed in the following form

y′ = f(x, y(x))          y(x0) = y0

Here we are assuming that y is equal to a function x, and for simplicity, we assume this function is y(x). We also specify an initial condition, namely when x = x0, then y = y0.

Topics

Analytic Approach

Example 1: Solve the following differential equation and find the value y(2).

y′ + 2xy = 0          y(o) = 3

To solve the equation analytically, we multiply both sides of the equation by exp x2, to get

Step 1

= y ⋅ 2x ⋅ exp(x2) + exp(x2) y′

Thus, the equation becomes

Step 2

Taking the integral of both sides, yields

exp(x2)y = c

Since y(0) = 3, we see that

c = exp(02) ⋅ 3 = 3

Thus, our equation becomes

exp(x2)y = 3

Solving for y, we get

y = exp(–x2)

Finally,

y(2) = exp(–22) = exp(–4) = .054947

Numerical Solutions

As you can see from the above example, to find an analytic solution various tricks may need to be used. Also, sometimes no analytic solution is possible. From this point on, we will restrict ourselves to numerical solutions. We will explore Euler’s forward method, Euler’s backward method, the trapezoid method, and the Runge-Kutta method.

In order to implement these methods in Excel we will use the Real Statistics lambda capabilities. See also Numerical Differentiation and Numerical Integration.

References

Strang, G., Herman, E., Seeburger, P. (2025) Introduction to differential equations
https://math.libretexts.org/Courses/Monroe_Community_College/MTH_211_Calculus_II/Chapter_8%3A_Introduction_to_Differential_Equations/8.1%3A_Basics_of_Differential_Equations

Atkinson, K., Han, W., Stewart, D. (2009) Numerical solutions to ordinary differential equations. Wiley-Interscience
https://homepage.math.uiowa.edu/~atkinson/papers/NAODE_Book.pdf

Wilson, H. J. (2025) Ordinary differential equations
https://www.ucl.ac.uk/~ucahhwi/GM01/ODE_extra.pdf

Wikipedia (2025) Numerical methods for ordinary differential equations
https://en.wikipedia.org/wiki/Numerical_methods_for_ordinary_differential_equations

Leave a Comment