First-Order ODE Solver
Solve first-order ordinary differential equations symbolically and numerically. Auto-detects separable, linear, exact, and autonomous forms, applies the right technique, and renders an interactive slope field with the solution curve overlaid.
Your ad blocker is preventing us from showing ads
MiniWebtool is free because of ads. If this tool helped you, please support us by going Premium (ad‑free + faster tools), or allowlist MiniWebtool.com and reload.
- Allow ads for MiniWebtool.com, then reload
- Or upgrade to Premium (ad‑free)
About First-Order ODE Solver
The First-Order ODE Solver takes an ordinary differential equation in the form dy/dx = f(x, y), automatically classifies its structure (separable, linear, autonomous, exact, or general), and produces both a symbolic closed-form solution where possible and a high-accuracy numerical solution everywhere. A live slope-field visualization with the solution curve overlaid makes the geometric meaning of the equation immediately obvious — solutions are exactly the curves tangent to every arrow.
What Is a First-Order ODE?
A first-order ordinary differential equation involves an unknown function y(x) and its first derivative y'(x) only. The standard explicit form is:
Combined with an initial condition y(x₀) = y₀, this defines an initial-value problem (IVP). The Picard-Lindelöf theorem guarantees a unique solution in some neighborhood of x₀ as long as f is Lipschitz continuous in y near (x₀, y₀). Geometrically, the IVP asks for the unique curve passing through (x₀, y₀) whose slope at every point matches f at that point — exactly the curve tangent to the slope field.
Six Classes the Solver Recognizes
| Class | Form | Standard solving technique | What this tool does |
|---|---|---|---|
| Pure integration | dy/dx = f(x) | Direct integration: y = ∫f(x) dx + C | Numerical integration (RK4 reduces to Simpson-like quadrature) |
| Linear (constant coeffs) | dy/dx = a·y + b | Closed form via integrating factor or characteristic root | Full symbolic answer + step-by-step derivation |
| Autonomous | dy/dx = f(y) | Separation: ∫dy/f(y) = x + C | Numerical solution + slope-field visualization |
| Separable | dy/dx = g(x)·h(y) | Separation: ∫dy/h(y) = ∫g(x) dx + C | Form detected via cross-product test; numerical solution shown |
| Linear (variable coeffs) | dy/dx + P(x)·y = Q(x) | Integrating factor μ(x) = e^∫P(x) dx | Form detected via finite-difference linearity test; numerical solution shown |
| General | Any other dy/dx = f(x, y) | Numerical methods (RK4, RK45, BDF, …) | Classical Runge-Kutta with 600 sub-steps |
Closed-Form Method: Linear With Constant Coefficients
When the right-hand side simplifies to dy/dx = a·y + b with constants a and b, the integrating factor μ(x) = e^(-a·x) gives an exact solution. The general solution is:
Applying the initial condition y(x₀) = y₀ pins down the constant C and yields the unique particular solution. This single class covers an enormous number of textbook problems:
- Exponential growth — dy/dx = k·y, particular solution y(t) = y₀·e^(k·t).
- Exponential decay — dy/dx = -k·y, half-life ln 2 / k.
- Newton's law of cooling — dy/dx = -k·(y - T_amb), the body temperature relaxes exponentially toward ambient.
- Charging an RC circuit — dV/dt = (1/RC)·(V_in - V), the capacitor voltage approaches the source.
- Drug clearance — first-order pharmacokinetics with elimination rate k.
Reading a Slope Field
At every grid point (x, y) the tool draws a short line segment whose slope equals f(x, y). Three useful observations:
- Equilibria are points where f(x, y) = 0 — the slope field is horizontal. For autonomous equations, these are fixed points y* satisfying f(y*) = 0; nearby trajectories either approach (stable) or run away from (unstable) y*.
- Isoclines are curves where f(x, y) equals a constant c, so all arrows along the curve have the same slope c.
- Solution curves never cross (when f is Lipschitz) — visually obvious because two crossing curves would need different slopes at the intersection.
Numerical Method: Classical Runge-Kutta (RK4)
Given (x_n, y_n), the next value is computed by averaging four slope estimates:
RK4 has local truncation error O(h⁵) and global error O(h⁴), giving roughly six-digit accuracy at the default step count for non-stiff equations. The solver integrates outward from the initial point in both x-directions and stops cleanly if the magnitude of y exceeds 10¹⁵ — typical for solutions that blow up in finite time, like dy/dx = y².
How to Use This Calculator
- Enter the right-hand side in the dy/dx = ... field. Use
xandyas variables,*for multiplication,^or**for powers, and standard functions likesin, cos, exp, log, sqrt. Constantspiandeare recognized. - Specify the initial condition (x₀, y₀) — the unique solution curve will pass through this point.
- Pick the x range over which to plot the slope field and the solution curve. The y range is auto-fit from the integrated solution.
- Click Solve & Visualize. The classifier runs first; if your equation matches a closed-form pattern (linear with constant coefficients), you get the symbolic answer. The slope field and solution curve are always rendered.
- Toggle the slope field on or off to focus on the solution curve, or replay the curve-drawing animation to see how integration progresses from the initial point.
Worked Example: Newton's Law of Cooling
A cup of coffee at 80 °C cools in a 20 °C room. The heat-transfer rate is proportional to the temperature difference:
This is linear with constant coefficients (a = -0.1, b = 2). The closed form is:
After 30 minutes: T(30) = 20 + 60·e⁻³ ≈ 22.99 °C. The slope-field view makes the limiting behavior obvious — every solution curve, regardless of starting temperature, asymptotes to the horizontal line T = 20.
Common Applications
- Population dynamics — exponential, logistic, Allee-effect models.
- Pharmacokinetics — drug absorption and elimination, half-life calculations.
- Heat transfer — Newton's law of cooling, lumped-capacitance models.
- RC and RL circuits — first-order linear electrical transients.
- Radioactive decay — single-isotope decay chains.
- Mixing tanks — concentration of a solute under inflow / outflow.
- Falling object with drag — terminal-velocity analysis dv/dt = g - kv.
Frequently Asked Questions
What is a first-order ordinary differential equation?
A first-order ordinary differential equation (ODE) is an equation of the form dy/dx = f(x, y) that involves the unknown function y(x) and its first derivative. Solving the ODE means finding the function y(x) whose derivative matches the right-hand side. With an initial condition y(x₀) = y₀ the solution is unique under mild regularity assumptions (Picard-Lindelöf theorem).
What is a slope field?
A slope field (or direction field) plots a small line segment at each grid point (x, y) whose slope equals f(x, y). Solution curves of the ODE are exactly the curves that are tangent to these segments at every point. The slope field gives instant visual intuition for the global behavior of solutions without solving the equation symbolically.
Which classes of first-order ODEs does this tool solve?
The tool auto-classifies the equation into one of: integrable (depends only on x, solved by direct integration), linear with constant coefficients y' = a·y + b (full closed-form provided), autonomous (depends only on y), separable (factors as g(x)·h(y)), linear with variable coefficients (P(x)·y + Q(x)), or general. For every class, a high-accuracy Runge-Kutta numerical solution and slope-field visualization are produced.
What numerical method is used?
The classical fourth-order Runge-Kutta method (RK4) is applied with 300 sub-steps in each direction from the initial point. RK4 has local truncation error O(h⁵) and is the standard workhorse for non-stiff ODEs at this scale. The solver detects divergence (overflow or NaN) and stops integration cleanly so the plot remains valid.
What is the integrating-factor method for linear ODEs?
For a linear first-order ODE y' + P(x)·y = Q(x), multiply both sides by the integrating factor μ(x) = e^∫P(x) dx. The left side becomes the exact derivative d/dx[μ·y], so y(x) = (1/μ(x)) · (∫μ(x)·Q(x) dx + C). When P and Q are constants this collapses to the closed form y = -b/a + C·e^(a·x), which the tool returns automatically.
Can this tool handle stiff equations or systems of ODEs?
This solver is intended for non-stiff first-order scalar ODEs. Very stiff problems (where the solution has multiple time scales differing by many orders of magnitude) may need an implicit method like backward Euler or Rosenbrock; coupled systems require a vector-valued solver. For those cases use a dedicated package such as SciPy's solve_ivp or specialized stiff-ODE solvers.
Further Reading
- Ordinary differential equation — Wikipedia
- Slope field — Wikipedia
- Runge-Kutta methods — Wikipedia
- Integrating factor — Wikipedia
- Picard-Lindelöf theorem — Wikipedia
Reference this content, page, or tool as:
"First-Order ODE Solver" at https://MiniWebtool.com// from MiniWebtool, https://MiniWebtool.com/
by miniwebtool team. Updated: Apr 22, 2026
You can also try our AI Math Solver GPT to solve your math problems through natural language question and answer.