keisoku

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

y''=

Examples (tap to load)

Simple harmonic y''=-y
Damped oscillation y''=-0.2v-y
Free fall y''=-9.8

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)

-1.5-1-0.500.511.50123456

Steps

125 steps

Step size h

0.05

Initial conditions

y(0) = 1

y'(0) = 0


Solution progression (sample)

nxyy' (v)
0010
90.450.910786-0.439539
180.90.636337-0.800653
271.350.227648-1.008918
361.8-0.23612-1.018969
452.25-0.662932-0.824279
542.7-0.966093-0.459357
633.15-1.0818090.00626
713.55-1.0040950.430994
804-0.7250770.833883
894.45-0.2938661.078189
984.90.2062581.111165
1075.350.6762570.921376
1165.81.0209070.541935
1256.251.1680290.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.