Euler's Method (Second-Order ODE)
Solve second-order ordinary differential equations of the form y''=f(x, y, y') numerically by converting them to a first-order system and applying Euler's method. Just enter the initial conditions and step size to get the approximate y at the endpoint, a graph of the solution, and a table of (x, y, y') at each step.
Input
Examples (tap to load)
Variables on the right-hand side: x (independent variable), y (solution), v (= y'). Operators: + - * / ^ (power). Functions: sin cos tan exp log (natural log) ln log10 sqrt abs pow, and more. Constants: pi (π), e. Trig functions take angles in radians.
Result
Approximate y at x = 6.25
y ≒ 1.168029
y' = -y (here y' ≒ 0.0449)
Steps
125 steps
Step size h
0.05
Initial conditions
y(0) = 1
y'(0) = 0
Solution progression (sample)
| n | x | y | y' (v) |
|---|---|---|---|
| 0 | 0 | 1 | 0 |
| 9 | 0.45 | 0.910786 | -0.439539 |
| 18 | 0.9 | 0.636337 | -0.800653 |
| 27 | 1.35 | 0.227648 | -1.008918 |
| 36 | 1.8 | -0.23612 | -1.018969 |
| 45 | 2.25 | -0.662932 | -0.824279 |
| 54 | 2.7 | -0.966093 | -0.459357 |
| 63 | 3.15 | -1.081809 | 0.00626 |
| 71 | 3.55 | -1.004095 | 0.430994 |
| 80 | 4 | -0.725077 | 0.833883 |
| 89 | 4.45 | -0.293866 | 1.078189 |
| 98 | 4.9 | 0.206258 | 1.111165 |
| 107 | 5.35 | 0.676257 | 0.921376 |
| 116 | 5.8 | 1.020907 | 0.541935 |
| 125 | 6.25 | 1.168029 | 0.044858 |
How it works
- Enter the right-hand side f(x, y, y'), the initial values x0, y0, y'0, the step size h, and the endpoint xend. The tool sets v=y' to rewrite y''=f(x, y, y') as a first-order system and integrates it step by step with Euler's method, showing the approximate y at the endpoint in large type.
- On the right-hand side you can use the variables x (independent variable), y (solution), and v (= y'). Supported symbols are + - * / and ^ (power), parentheses, and unary minus, including implicit multiplication such as 2x or 2sin(x).
- Supported functions include sin, cos, tan, asin, acos, atan, sinh, cosh, tanh, exp, log (natural log), ln, log10, sqrt, cbrt, abs, and pow(base, exponent); the constants pi (π) and e are available. Trig functions take angles in radians.
- The results show a graph of the solution y(x) (with the endpoint marked in color) alongside a sampled table of (x, y, y') values at each step. A smaller step size h yields better approximation accuracy.
- Tapping a preset such as simple harmonic motion y''=−y, damped oscillation y''=−0.2y'−y, or free fall y''=−9.8 fills in the equation and initial conditions at once.
- Your equation and initial conditions are never sent anywhere; everything is computed in your browser. The expression is evaluated safely with a custom parser that does not use eval.
Related calculators
Function Graph Plotter f(x)
NumericalType an expression such as sin(x) or x^2-2 and instantly plot its graph over a chosen x range. Maximum, minimum, zeros, and sample point values are shown alongside.
Open calculator →Graph Two Functions f(x) and g(x)
NumericalPlot two expressions f(x) and g(x) on the same axes in distinct colors, and automatically find their max, min, and intersection points.
Open calculator →Data Point f(x) Graph Plotter
NumericalJust paste your (x, y) data points to instantly draw a line-and-point chart. See the point count plus the minimum, maximum, and average of y at the same time.
Open calculator →Plot Data Points f(x), g(x)
NumericalPaste two sets of (x, y) data points and get f(x) and g(x) drawn as color-coded overlaid line graphs, with each series' point count and min/max.
Open calculator →