Katherine Johnson and Numerically Approximating a Solution to a Differential Equation with Euler’s Method using MATLAB

Euler’s method is used for numerical approximation of a solution to a differential equation that can’t be solved for an explicit solution using elementary methods, such as substitution for homogeneous equations or Bernoulli equations (Henry Edwards et al., 2022). Katherine Johnson used Euler’s method to solve real-world problems at NASA (Meyers, 2017). Personally, I disagree with her claim that math is either absolutely right or absolutely wrong, though. 

The algorithm for Euler’s method is to first pick an initial point 

of the particular solution you want to compute (Henry Edwards et al., 2022). Then, one chooses a horizontal step-size h, which is the horizontal distance between the approximated points of the solution. The formula to calculate the (n+1)-th point is the following (Henry Edwards et al., 2022):

where

One must be careful when using Euler’s method because there is a local error when moving away from the initial point, which is a vertical distance from the approximated point to the actual point of the particular solution curve (Henry Edwards et al., 2022). As one moves further from the initial point, the error accumulates, and it is called cumulative error (Henry Edwards et al., 2022). The remedy for this is to choose a sufficiently small step size, which will reduce the error (Henry Edwards et al., 2022). However, there is typically a tradeoff when picking h because when h is too small, it may take thousands of years to compute even with a computer (Henry Edwards et al., 2022).

Katherine Johnson was an African American applied mathematician who worked at NASA (Meyers, 2017). She suggested to use Euler’s method to solve differential equations related to the trajectory of astronaut John Glenn’s space capsule. Despite the method being “ancient”, as described by one of her male colleagues, she rebutted that “it works numerically” (Meyers, 2017).

When Katherine Johnson claims “math: you’re either right or wrong — and that I liked about it” (National Geographic, 2021, 0:45) , I tend to disagree. I disagree because sometimes oversimplified models can enable one to capture important insights into the problem. For example, the Lotka-Volterra predator-prey model allows one to see that predator-prey populations oscillate; however, the models typically do not allow one to actually predict the populations in nature (Chasnov, 2022; Clark & Neuhauser, 2022). This is a case in mathematics where it is possible to be partially correct. 

In conclusion, Euler’s method is an old yet effective way to numerically approximate solutions to differential equations. It has been used to solve real-world problems in NASA by applied mathematicians like Katherine Johnson to calculate trajectories of a space capsule. Also, despite Katherine Johnson’s claim that one is either right or wrong in math, I think that it is possible to be partially correct in math in the case of oversimplified models that allow one to gain further insights into problems like the Lotka-Volterra predator-prey model.

Using MATLAB to Obtain a Numerical Approximation of a Solution

Next, MATLAB will be used to solve the following differential equation:

with initial condition y(0) = -3.

The following is the MATLAB code to do so:

% Euler's Method for solving:
% y' = x + (1/5)y
% y(0) = -3

clc;
clear;

% Step size
h = 1;

% Interval
x0 = 0;
xn = 5;

% Initial condition
y0 = -3;

% Number of steps
n = (xn - x0)/h;

% Arrays to store values
x = zeros(1, n+1);
y = zeros(1, n+1);

% Initial values
x(1) = x0;
y(1) = y0;

% Euler's Method loop
for i = 1:n
    x(i+1) = x(i) + h;
    y(i+1) = y(i) + h * ( x(i) + (1/5)*y(i) );
end

% Display results
disp('   x          y');
disp([x' y']);

% Plot the approximation
plot(x, y, '-', 'LineWidth', 1.5);
xlabel('x');
ylabel('y');
title('Euler Method Approximation');
grid on;

References

Chasnov, J. R. (2022, January 5). 1.4: The Lotka-Volterra predator-prey model. Mathematics LibreTexts; Libretexts. https://math.libretexts.org/Bookshelves/Applied_Mathematics/Mathematical_Biology_%28Chasnov%29/01%3A_Population_Dynamics/1.04%3A_The_Lotka-Volterra_Predator-Prey_Model

Clark, A. T., & Neuhauser, C. (2018). Harnessing uncertainty to approximate mechanistic models of interspecific interactions. Theoretical Population Biology123, 35–44. https://doi.org/10.1016/j.tpb.2018.05.002

Henry Edwards, C., Penney, D. E., & Calvis., D. (2022). Differential Equations and Boundary Value Problems: Computing and Modeling (6th Edition).

Meyers, C. (2017, February 24). Exploring the math in “hidden figures.” AIP. https://www.aip.org/inside-science/exploring-the-math-in-hidden-figures