Separable ODE Solver
Numerically solve separable first-order ODEs dy/dx = f(x)·g(y) using the RK4 method and plot the solution curve.
Presets:
ODE: dy/dx = f(x) · g(y)
Solution Table
| x | y |
|---|---|
| Press "Solve ODE" to compute the solution. | |
Solution Curve
Summary
Numerically solve separable first-order ODEs dy/dx = f(x)·g(y) using the RK4 method and plot the solution curve.
How it works
- Write the ODE in separable form dy/dx = f(x)·g(y) and type the two factors into the f(x) and g(y) inputs (math.js parses sin, cos, exp, log, sqrt, ^, etc.).
- Set the initial point (x0, y0), the x range [xmin, xmax], and a step size h — smaller h gives more accuracy.
- For each step the tool computes F(x, y) = f(x)·g(y) and four RK4 slopes k1 = h·F(xn, yn), k2 = h·F(xn + h/2, yn + k1/2), k3 = h·F(xn + h/2, yn + k2/2), k4 = h·F(xn + h, yn + k3).
- It advances with yn+1 = yn + (k1 + 2k2 + 2k3 + k4) / 6 — 4th-order accuracy with global error O(h^4).
- Solution values are listed step-by-step and plotted as y(x); a blowup ( |y| > 1e6 ) stops the run and warns you of a singularity.
Use cases
- Solve population growth models where dy/dx = r·y.
- Analyze exponential decay problems in physics or chemistry.
- Explore solution curves for dy/dx = x/y (circular-arc families).
- Verify hand-calculated separable ODE solutions numerically.
- Visualize how changing initial conditions shifts the solution curve.
Frequently Asked Questions
Last updated: 2026-06-13 ·
Reviewed by Nham Vu