2026-03-09

Differential Equations

Ordinary differential equations, also known as ODE’s, are some of the most common problems in physics, with some ranging from extremely simple all the way to an unsolvable problem without drastic assumptions.

In this presentation, I will explore some of the work of Leonhard Euler, a prolific and influential Swiss mathematician from the 18th century. More specifically, I will outline a common method for solving ODE’s numerically named after him: the Euler Method

Problem Setup

  • You are given an equation for the derivative of some function
  • The goal is to find the value of the unknown function at a given input
  • You are given the initial values of the problem, i.e. the value of the unknown function at a certain input value (usually x = 0)
  • You are also given a “step size” which will be useful in determining the accuracy of the estimation
  • Then, you are given a “target” input value, for which you need to find the output of

The Method

  • This will be done by taking the initial value given earlier, and adding the derivative at the initial input to it multiplied by your defined step size
  • Doing this step will produce the value of the function 1 step size higher than when you started, so in order to get to the desired output, just repeat the previous step for increasing input values
  • IMPORTANT: Only increase your input by the given step size
  • The following slide will include notation and an example to follow

Example

  • Lets say we want to estimate the value of \(y = x^2\) at the input \(x = 2\)
  • The derivative of the function is \(\frac{dy}{dx} = 2x\), the initial value given is \(y(1,1) = 1\), and the step size is given as \(h = 0.1\)
  • Euler’s equation looks like this: \(y_{n+1} = y_n + hf(x_n)\), where \(f(x_n)\) is the derivative of \(y_n\) evaluated at \(x_n\)
  • To find the first value, starting one increment after \(y(1)\), we will add the step size to \(x_1\) to find \(x_2\), which in this case is \(x_2 = 1.1\)
  • Next, we will evaluate \(y_2 = y_1 + hf(1.1)\), which, when everything is substituted in, looks like \(y_2 = 1 + 0.1[2(1.1)]\)

Exaample continued

  • This expression simplifies to \(y(1.1) = 1.22\), or \(y_2 = 1.22\)
  • To compare this to the actual value, which is \(x^2\), \(1.1^2 = 1.21\), it can be seen that this method is relatively accurate
  • This process will be done 9 more times, until the end result of \(y(2)\) is reached, which I will do with R code in the next slides
  • The value that I will compare the result of the estimation to is \(y(2) = 2^2 = 4\)

R Code for the Engine

h <- 0.1
x <- seq(1, 2, by = h)
y_est <- numeric(length(x))
y_est[1] <- 1

for (i in 1:(length(x) - 1)){
  y_est[i+1] <- y_est[i] + h * (2*x[i])
}

y_exact <- x^2

df <- data.frame(x = x, estimated = y_est, exact = y_exact)

Estimation Plot

Exact Plot

Combined Plot