Non-linear ODE Solver

Non-linear ODE Solver

Non-linear ODE Solver numerically solves a non-linear ODE \( y’ = f(x, y) \) using the Runge-Kutta 4th order method, displaying steps with MathJax and visualizing the solution with p5.js.

Non-linear ODE Solver

Non-linear ODE Solver numerically solves a first-order non-linear ODE \( y’ = f(x, y) \) using the Runge-Kutta 4th order method. Input the ODE, initial condition, solution range, and step size to see the solution with MathJax-rendered steps and a p5.js visualization. Results are copyable, with sharing and embedding options for differential equation students.

Example 1: Non-linear ODE \( y’ = -y^2 \)

ODE: \( y’ = -y^2 \), Initial condition: \( y(0) = 1 \), Range: \([0, 1]\), Step size: \( h = 0.1 \).
Step 1: Define the ODE and parameters.
\( y’ = -y^2 \), \( y(0) = 1 \), \( [0, 1] \), \( h = 0.1 \).
Step 2: Apply Runge-Kutta 4th order method.
For \( x_0 = 0 \), \( y_0 = 1 \):
\( k_1 = -y_0^2 = -1 \),
\( k_2 = -(y_0 + 0.5 h k_1)^2 = -(1 + 0.5 \cdot 0.1 \cdot (-1))^2 = -0.9025 \),
\( k_3 = -(y_0 + 0.5 h k_2)^2 = -0.9115 \),
\( k_K_4 = -(y_0 + h k_3)^2 = -0.8281 \),
\( y_1 = y_0 + \frac{h}{6} (k_1 + 2k_2 + 2k_3 + k_4) \approx 0.9091 \).
Step 3: Iterate for subsequent points.
(Table of points shown in output.)
Step 4: Conclusion.
The numerical solution is approximated over \([0, 1]\).

Example 2: Non-linear ODE \( y’ = x y \)

ODE: \( y’ = x y \), Initial condition: \( y(0) = 1 \), Range: \([0, 1]\), Step size: \( h = 0.1 \).
Step 1: Define the ODE and parameters.
\( y’ = x y \), \( y(0) = 1 \), \( [0, 1] \), \( h = 0.1 \).
Step 2: Apply Runge-Kutta 4th order method.
For \( x_0 = 0 \), \( y_0 = 1 \):
\( k_1 = x_0 y_0 = 0 \),
\( k_2 = (x_0 + 0.5 h)(y_0 + 0.5 h k_1) = 0.05 \cdot 1 = 0.05 \),
\( k_3 = (x_0 + 0.5 h)(y_0 + 0.5 h k_2) \approx 0.05 \),
\( k_4 = (x_0 + h)(y_0 + h k_3) \approx 0.1 \),
\( y_1 = y_0 + \frac{h}{6} (k_1 + 2k_2 + 2k_3 + k_4) \approx 1.0050 \).
Step 3: Iterate for subsequent points.
(Table of points shown in output.)
Step 4: Conclusion.
The numerical solution is approximated over \([0, 1]\).

Related Calculators

  1. Quadratic Residue Checker
  2. Diophantine Equation Solver
  3. Modular Exponentiation Solver
  4. Stokes Flow Simulator
  5. Determinant Calculator
  6. Mid-Point Calculator
  7. More Math Calculators
error: Content is protected !!