Differentail Equation Calculator






Differential Equation Calculator


Differential Equation Calculator

Solve first-order ordinary differential equations (ODEs) using numerical methods.



Use ‘x’ and ‘y’ as variables. Example: Population growth `0.1 * y` or cooling `-0.07 * (y – 20)`.


The starting ‘x’ value of your function.


The starting ‘y’ value of your function.


The ‘x’ value where you want to find the corresponding ‘y’ value.


Higher steps increase accuracy but also calculation time. Unit is dimensionless.


What is a Differential Equation?

A differential equation is a mathematical equation that relates a function with its derivatives. In essence, instead of solving for a number, you’re solving for a function. These equations describe how a quantity changes. For instance, in physics, a differential equation might describe an object’s velocity (the derivative of position) over time. They are fundamental in science and engineering, used to model everything from planetary motion to stock market fluctuations.

This differential equation calculator uses a numerical method to find approximate solutions to first-order ordinary differential equations, which are equations involving the first derivative of a single independent variable.

The Formula and Explanation: Euler’s Method

This calculator uses Euler’s method, a foundational numerical procedure for solving ordinary differential equations (ODEs). Given an initial point (x₀, y₀) and a differential equation dy/dx = f(x, y), Euler’s method finds the approximate value of y at a later point x by taking many small steps.

The core formula for each step is:

yi+1 = yi + h * f(xi, yi)

Where:

  • yi+1 is the next approximated y-value.
  • yi is the current y-value.
  • h is the step size, calculated as (x_target – x₀) / n.
  • f(xi, yi) is the value of the derivative at the current point (xi, yi).

We essentially “walk” along the slope of the function in small increments to build the solution curve. Check out this Integral Calculator to understand the reverse process.

Variables Table

Variable Meaning Unit Typical Range
dy/dx = f(x, y) The differential equation defining the rate of change. Unitless Any valid mathematical expression involving x and y.
(x₀, y₀) The initial condition or starting point of the solution. Unitless Any real numbers.
h The step size for the numerical method. Unitless A small positive number (e.g., 0.1, 0.01).
n The total number of steps. Unitless 10 to 1,000,000+.

Practical Examples

Example 1: Logistic Population Growth

A common model for population growth that is limited by carrying capacity is the logistic equation. Let’s model a population with an initial size of 10, a growth rate of 10%, and a carrying capacity of 200.

  • Equation (Inputs): `dy/dx = 0.1 * y * (1 – y / 200)`
  • Initial Conditions (Inputs): x₀ = 0, y₀ = 10
  • Evaluation Point (Input): x = 50
  • Result: Using the differential equation calculator, the population is approximately 149.38 after 50 time units.

Example 2: Newton’s Law of Cooling

Let’s model an object with an initial temperature of 100°C placed in a room with an ambient temperature of 20°C. The cooling constant is -0.07.

  • Equation (Inputs): `dy/dx = -0.07 * (y – 20)`
  • Initial Conditions (Inputs): x₀ = 0, y₀ = 100
  • Evaluation Point (Input): x = 30
  • Result: After 30 minutes, the object’s temperature is approximately 29.78°C. For more on rates of change, see our Rate of Change Calculator.

How to Use This Differential Equation Calculator

  1. Enter the Equation: Type your first-order differential equation into the `dy/dx = f(x, y)` field. Make sure your equation is a valid JavaScript expression using the variables `x` and `y`.
  2. Set Initial Conditions: Input your starting point in the `x₀` and `y₀` fields. This is the known point `y(x₀) = y₀` on the function’s curve.
  3. Define Evaluation Point: Enter the target `x` value for which you want to find the solution `y(x)`.
  4. Set Number of Steps: Choose the number of steps (`n`). A higher number increases accuracy but takes longer. 1000 is a good starting point. Since this is a pure math calculator, all inputs are unitless.
  5. Calculate: Click the “Calculate” button to see the result, a table of the first few calculation steps, and a plot of the solution. You can learn more about functions with our Linear Algebra Calculator.

Key Factors That Affect the Solution

  • The Equation Itself: The function f(x, y) fundamentally determines the behavior of the solution.
  • Initial Conditions: A different starting point (x₀, y₀) will lead to an entirely different solution curve.
  • Step Size (h): This is the most critical factor for accuracy in a numerical method. A smaller step size (i.e., more steps `n`) reduces the error in Euler’s method.
  • Type of Equation: The stiffness of an equation (where solutions change rapidly) can pose challenges for simple numerical methods like Euler’s.
  • Numerical Method Used: This calculator uses Euler’s method, but more advanced methods like Runge-Kutta can provide higher accuracy for the same number of steps. Our Advanced Math Solver may use different techniques.
  • Floating-Point Precision: For a very large number of steps, the tiny errors inherent in computer floating-point arithmetic can accumulate.

Frequently Asked Questions (FAQ)

What is a first-order ODE?
It is a differential equation that only involves the first derivative of the unknown function, like dy/dx, and not higher-order derivatives like d²y/dx².
Why are the inputs unitless?
This is a general mathematical tool. The units depend on the context of the problem you are modeling. For a population model, ‘x’ might be ‘years’ and ‘y’ might be ‘thousands of individuals’. For a cooling problem, ‘x’ could be ‘minutes’ and ‘y’ could be ‘degrees Celsius’.
How can I improve the accuracy of the result?
Increase the “Number of Steps (n)”. Doubling the steps will roughly halve the error of the Euler method.
What does a “NaN” result mean?
“NaN” stands for “Not a Number”. This error occurs if your equation is mathematically invalid (e.g., division by zero, square root of a negative number) or contains a syntax error.
Can this calculator solve second-order equations?
No, this tool is specifically designed for first-order ODEs. Second-order equations (like those in simple harmonic motion) require different methods, though they can often be rewritten as a system of two first-order equations.
Is Euler’s method always the best choice?
No, it is the simplest method but not the most accurate. Methods like the fourth-order Runge-Kutta (RK4) are much more accurate for the same step size and are standard in scientific computing. Our Matrix Calculator uses precise, not numerical, methods.
Why does the graph look jagged with few steps?
Because Euler’s method approximates a curve with a series of short, straight lines. With few steps, those lines are long and the approximation is coarse. More steps create a smoother, more accurate curve.
What are some real-world applications of differential equations?
They are used everywhere: modeling disease spread, designing electrical circuits, calculating investment growth, predicting weather patterns, and in aerospace engineering for rocket trajectories.

© 2026 Your Company. All rights reserved. This differential equation calculator is for educational purposes.



Leave a Reply

Your email address will not be published. Required fields are marked *