System of ODEs Solver
Solve a two-equation first-order system in t with Euler or RK4, printing both components at every step.
System of ODEs Solver
Solve a two-equation first-order system in t with Euler or RK4, printing both components at every step.
How this page computes
The page integrates a pair of coupled first-order equations, dx/dt = f(t, x, y) and dy/dt = g(t, x, y), with Euler or RK4. Both right-hand sides are evaluated at the same state, which is what makes the coupling real.
For dx/dt = −y and dy/dt = x from (1, 0), the exact solution is (cos t, sin t), so at t = 1 it is about (0.5403, 0.8415). RK4 with ten steps reproduces that to six decimals.
Each right-hand side may use t, x and y. A name outside those is refused by name, and a non-finite slope stops the walk with the step printed.
The calculation runs entirely in this browser tab; nothing is uploaded.
The page solves two coupled equations at once, because a pair cannot be solved one at a time without losing the coupling. For dx/dt = −y and dy/dt = x from (1, 0), the solution is a circle, and RK4 reaches (0.540302967117, 0.8414704778) at t = 1.
Both right-hand sides read the same state at each stage, so the rotation is preserved rather than integrated as two independent decays. The method, step and step count are printed with the table.
How to use System of ODEs Solver
Type dx/dt on the first line and dy/dt on the second, using t, x and y.
Set the initial state (x0, y0), the step and the step count, then choose RK4 or Euler.
Press Run. Read the x and y columns; the final line repeats both endpoint values.
How the method works
A coupled system has one state vector, and every stage of an integrator evaluates both components at that same state. That is why the two equations cannot be run separately: the x slope depends on y and the y slope depends on x.
On a rotation, Euler spirals outward because each step uses a slope that is already stale. RK4's four stages correct most of that, so the circle stays a circle to the printed precision.
What to Expect
Best for
- A two-equation first-order system
- A rotation, predator-prey model or coupled decay
- Comparing Euler and RK4 coupling error
Not ideal for
- Three or more equations
- A stiff system that needs an implicit method
- A boundary-value problem
What this tool keeps
- Both right-hand sides and the initial state exactly as typed
What may need cleanup
- Nothing when the walk is finite; the refusal names the step when it is not
Common errors
- A count other than two equations is refused with the count
- A right-hand side using another variable is refused by name
- A non-finite slope is refused with the step
Example use cases
- Solve the rotation (-y, x) from (1, 0)
- Solve a coupled decay
- See Euler spiral outward on a circle
Sample input
dx/dt = -y, dy/dt = x, x(0) = 1, y(0) = 0, h = 0.1, 10 steps, RK4
Sample output
final x(1) ≈ 0.540302967117, y(1) ≈ 0.8414704778
Who this is for
- Students meeting systems of ODEs
- Readers checking a coupled model
Frequently asked questions
Why two lines and not one?
Each equation is a separate right-hand side, and a one-line format would need a separator a visitor could guess wrong. One equation per line is the format the page states and reads.
Why does Euler drift off the circle?
Euler steps along the tangent for the whole step, so the new point lies outside the circle. RK4 samples four slopes and stays much closer, which is the difference the table shows.
Can I solve a single equation here?
No. This page is for a pair; a single first-order equation has its own pages, and a second-order equation is the second-order page.
Build custom tools for your store
Join the SDK program to create useful ecommerce utilities for your store.