Euler's method
About this app
Explicit Euler step by step: read off the slope at the starting point, follow the tangent for one step size h, new point. The dashed solution curve through each point shows how the method jumps onto neighbouring curves and errors add up. Enter your own right-hand side f(x, y) or pick a preset (slide example, oscillation, growth, decay, logistic); slide the step size, compare with h/2 and h/4, read the error in a log-log plot — order 1, special cases and instability for too large h.
The method
The explicit Euler method approximates an initial value problem y′ = f(x, y), y(x₀) = y₀ with small straight steps. With xₖ = x₀ + k·h it computes yₖ₊₁ = yₖ + h·f(xₖ, yₖ): read the slope at the start of the step and follow it for one step size h. The new point lies on the tangent, not on the exact solution, and therefore on a neighbouring solution curve. The small errors accumulate. At the end the global error is roughly proportional to h: the method has order 1.
What the app shows
The plane shows the slope field, a finely computed reference solution and the Euler polygon. A dashed curve through each computed point shows the solution it actually lies on. You can type any right-hand side f(x, y), such as x*y or sin(x) − y, or pick a preset: slide example, oscillation, growth, decay, logistic. Start value, end of the interval and step size are adjustable. The calculation panel explains each step, and the error panel compares h, h/2 and h/4 and plots the error on a log-log scale.
Try it yourself
Press “Step” and watch the point jump from curve to curve. Turn on the comparison with h/2 and h/4: for “growth” the error halves with the step size. Then choose y′ = −2y and a step size above 1: the approximation oscillates and grows although the exact solution decays. That is instability. For some presets the error falls faster than expected; the app explains these special cases.
Frequently asked questions
- How does the explicit Euler method work?
- Start at the initial value (x₀, y₀) and repeatedly compute yₖ₊₁ = yₖ + h·f(xₖ, yₖ). Each step follows the slope at the current point in a straight line over the step size h. The result is a polygonal path approximating the solution.
- What is the order of accuracy of Euler’s method?
- The explicit Euler method has global order 1: halving the step size roughly halves the final error. The local error per step is of order h². On a log-log plot the global error is a line with slope 1.
- Why does Euler’s method become unstable?
- For decaying solutions such as y′ = −λy with λ > 0, each step multiplies by 1 − h·λ. If its absolute value exceeds 1, i.e. h > 2/λ, the values grow even though the exact solution decays. For y′ = −2y the threshold is h = 1.
- Can I enter my own differential equations?
- Yes. You write f using x and y, for example x*y or sin(x) − y; pi, e and functions such as sin, cos, exp, sqrt and ln are allowed. The app flags invalid input with a hint.
Subject: Numerics
More from Numerics
A VisuApp by heyprof: interactive, free in your browser, no sign-up. What is a VisuApp? · All apps