keisoku

Euler's Method (First-Order ODE)

Enter dy/dx = f(x, y) with an initial condition and step size, and Euler's method computes the numerical solution. Shows the y value at the end point, a step-by-step table, and a graph of the solution curve.

Input

dy/dx=

Examples (tap to fill in)

y
x + y
x - y
x*y
-2*y
sin(x) - y

Operators: + - * / ^ (power) / Functions: sin cos tan asin acos atan sinh cosh tanh exp log (natural log) ln log10 sqrt cbrt abs pow(a,b) / Constants: pi (π), e / Variables: x and y.

Result

When dy/dx = y and y(0) = 1

y(1) ≈

2.593742

11.522.5300.10.20.30.40.50.60.70.80.91

y at the end point

2.593742

x = 1

Number of steps

10 steps

h = 0.1

Initial condition

y(0) = 1

Interval 0 → 1


Numerical solution progression

nxySlope f(x, y)
0011
10.11.11.1
20.21.211.21
30.31.3311.331
40.41.46411.4641
50.51.610511.61051
60.61.7715611.771561
70.71.9487171.948717
80.82.1435892.143589
90.92.3579482.357948
1012.5937422.593742

How it works

  • Enter the right-hand side f(x, y), initial values x0 and y0, step size h, and end x (xend); Euler's method y_{n+1} = y_n + h·f(x_n, y_n) then updates y in order from x0 to xend, computing the value at each step.
  • The right-hand side expression can use both variables x and y. Operators include + - * / and ^ (power); functions include sin, cos, tan, exp, log (natural log), ln, sqrt, abs, pow(a,b) and more; constants pi (π) and e are supported. Trigonometric arguments are treated in radians.
  • The main result shows the approximate value of y at the end x in large type, alongside the number of steps, step size, and initial condition. The table below traces x, y, and the slope f(x, y) for each step number n, while the graph follows the solution curve and each point.
  • Euler's method is the most basic first-order accurate solver, and an error proportional to the step size h remains. Halving h roughly halves the error but increases the number of steps. If accuracy matters, make h small enough.
  • If the step size is too large, the solution may oscillate or diverge (especially for rapidly decaying expressions such as -2y). A warning is shown when the value diverges, so reduce h or reconsider the interval.
  • The expressions you enter and the results are never sent anywhere; everything is processed inside your browser. Use it with confidence.