Tutorials › Calculus I › Constructing Euler Inputs from an Initial-Value Problem

Euler's Method and Numerical Solutions · Tutorial 1421 of 1495

Constructing Euler Inputs from an Initial-Value Problem

Identify the three essential inputs for a forward Euler calculation by expressing a first-order initial-value problem in explicit form.

Advanced 9 min read

What You'll Learn

  • Identify the independent variable and dependent variable in a first-order initial-value problem.
  • Extract the initial point and initial value from the condition.
  • Express the differential equation as a slope function.
  • Isolate the derivative carefully and note any domain restrictions.
  • Check that the extracted inputs match the original problem.

From an Initial-Value Problem to Its Inputs

A first-order differential equation describes how a dependent variable changes as an independent variable changes. An initial-value problem adds a specified value of the dependent variable at a particular independent-variable value. Before applying a numerical method, these pieces must be identified clearly.

For forward Euler, the relevant information is the starting point, the starting value, and a function that gives the slope at any point. The equation must be expressed so that the derivative is isolated. This tutorial focuses on recognizing and constructing those inputs; it does not calculate successive numerical approximations.

Definition: A first-order initial-value problem in explicit form is \(y'=f(x,y)\), \(y(x_0)=y_0\). Here \(x\) is the independent variable, \(y\) is the dependent variable, \(f\) is the slope function, and \((x_0,y_0)\) is the initial point and value.

When the independent variable represents time, it is common to write \(t\) instead of \(x\), and \(y'(t)\) or \(\frac{dy}{dt}\) for the derivative. The same structure then reads \(y'=f(t,y)\), \(y(t_0)=y_0\). The letters can change, but the roles do not.

Recognizing Each Part

The independent variable is the quantity with respect to which the derivative is taken. In \(\frac{dy}{dt}\), it is \(t\); in \(\frac{dy}{dx}\), it is \(x\). The dependent variable is the quantity whose value changes as the independent variable changes. In these examples it is \(y\), though models often use names such as \(P\) for population or \(C\) for concentration.

The initial condition specifies the dependent variable’s value at one independent-variable value. For example, \(y(2)=5\) says that the initial point is \(x_0=2\) and the initial value is \(y_0=5\). The independent variable and its initial value must be read together: \(2\) is the starting input, while \(5\) is the starting output.

The slope function is the right-hand side of the differential equation once the derivative is isolated. If \(y'=f(x,y)\), then at a point \((x,y)\), the derivative—and therefore the slope prescribed by the equation—is \(f(x,y)\). The function may depend on \(x\), on \(y\), or on both.

Key takeaway: Put the equation in the form \(y'=f(x,y)\), then record \(x_0\), \(y_0\), and \(f\). The initial condition supplies \(x_0\) and \(y_0\); the explicit differential equation supplies \(f\).

Why Explicit Form Gives the Slope

A solution to the initial-value problem is a differentiable function \(y(x)\) that satisfies both the differential equation and the initial condition. The differential equation says that, at every point on that solution, its derivative equals the value of \(f\) at the current coordinates. In particular, at the initial point, the slope is determined by substituting the initial coordinates into \(f\).

$$ y'(x_0)=f(x_0,y(x_0))=f(x_0,y_0). $$

This follows directly from the two defining conditions: the differential equation gives \(y'(x)=f(x,y(x))\), and the initial condition gives \(y(x_0)=y_0\). Substitution of \(x=x_0\) into the first equality therefore gives the displayed result. It explains why the initial point and slope function together determine the starting slope, without requiring us to solve the differential equation.

Units are also a useful check. If \(x\) is measured in days and \(y\) in grams, then \(dy/dx\) and the values of \(f\) must have units of grams per day. A mismatch can reveal an incorrect rate conversion or a mistaken interpretation of the variables.

Worked Examples

Worked Example: Extracting Inputs from a Growth Model

A population \(P\), measured in people, satisfies \(\frac{dP}{dt}=0.08P\), where \(t\) is measured in years. The census value is \(P(0)=250\). Identify the initial point, initial value, and slope function, and calculate the initial slope.

The independent variable is \(t\), measured in years. The dependent variable is \(P\), measured in people. The initial condition gives \(t_0=0\) and \(P_0=250\).

The derivative is already isolated, so the slope function is \(f(t,P)=0.08P\). Its units are people per year, since \(0.08\) has units of inverse years and \(P\) has units of people.

$$ f(0,250)=0.08(250)=20\ \text{people per year}. $$

Thus the inputs are \(t_0=0\), \(P_0=250\), and \(f(t,P)=0.08P\). Check: the original equation gives \(\frac{dP}{dt}=0.08(250)=20\) people per year when \(P=250\), agreeing with the slope calculated from the extracted function. The initial condition is also preserved as \(P(0)=250\).

Worked Example: Converting a Decay Model into Slope-Function Form

A substance has concentration \(C\), measured in milligrams per litre, and decays with a half-life of 8 days. Its initial concentration is \(C(0)=160\). Use the exponential decay model to identify the initial-value problem and its inputs.

For exponential decay with half-life \(T\), the rate constant is \(k=\frac{\ln 2}{T}\), and the differential equation is \(C'=-kC\). The negative sign represents decreasing concentration. With \(T=8\) days, \(k=\frac{\ln 2}{8}\) per day. Therefore the explicit equation is

$$ \frac{dC}{dt}=-\frac{\ln 2}{8}C. $$

The independent variable is time \(t\) in days, and the dependent variable is concentration \(C\). The initial condition gives \(t_0=0\) days and \(C_0=160\) milligrams per litre. The slope function is \(f(t,C)=-\frac{\ln 2}{8}C\), in concentration units per day.

At the initial point, the slope is

$$ f(0,160)=-\frac{\ln 2}{8}(160)=-20\ln 2\ \text{milligrams per litre per day}. $$

Check: substituting \(C=160\) into the stated differential equation gives \(\frac{dC}{dt}=-\frac{\ln 2}{8}(160)=-20\ln 2\), the same initial slope. Also, the condition \(C(0)=160\) matches the extracted initial value. The negative slope is consistent with decay.

Worked Example: Isolating a Derivative Before Identifying Inputs

Consider \((1+y^2)\frac{dy}{dx}=x-y\), with \(y(1)=2\). Put the equation in explicit form and identify the inputs.

The independent variable is \(x\), and the dependent variable is \(y\). The initial condition gives \(x_0=1\) and \(y_0=2\). To obtain the slope function, divide both sides by \(1+y^2\):

$$ \frac{dy}{dx}=\frac{x-y}{1+y^2}. $$

This division is valid for every real \(y\), because \(1+y^2\geq 1>0\). Thus \(f(x,y)=\frac{x-y}{1+y^2}\) is defined for every real pair \((x,y)\).

The slope at the initial point is

$$ f(1,2)=\frac{1-2}{1+2^2} =\frac{-1}{5} =-\frac{1}{5}. $$

Therefore the inputs are \(x_0=1\), \(y_0=2\), and \(f(x,y)=\frac{x-y}{1+y^2}\). Check: substituting \(x=1\) and \(y=2\) into the original equation gives \(5\frac{dy}{dx}=-1\), hence \(\frac{dy}{dx}=-\frac{1}{5}\), the same value. The initial condition remains \(y(1)=2\).

Conditions and Careful Interpretation

An equation is in explicit first-order form only when it specifies the first derivative as a function of the independent and dependent variables. For instance, an equation that contains \((1+y^2)y'\) is not yet written in that form, even if it can be rearranged into it. Before dividing by an expression, check whether it can be zero. If it can, division may exclude points or branches where the original equation was meaningful; the rearranged equation would then need a stated domain restriction.

A first-order initial-value problem normally specifies one initial value for its dependent variable. The condition \(y(x_0)=y_0\) gives one point on a solution. It does not state the slope directly; the slope at that point is found from \(f(x_0,y_0)\). Nor does the condition alone provide the slope function: that comes from the differential equation.

When the slope function depends only on the dependent variable, as in \(P'=0.08P\), it is called autonomous. When it depends explicitly on the independent variable as well, it is nonautonomous. For example, \(y'=x-y\) depends on both \(x\) and \(y\). This distinction is useful for describing the equation, but both cases use the same input format \(y'=f(x,y)\), \(y(x_0)=y_0\).

Common Mistake: Swapping the Initial Coordinates

A frequent error is to read \(y(1)=2\) as \(x_0=2\), \(y_0=1\). That reverses the input and output: the expression \(y(1)\) means the value of \(y\) when the input is \(1\). The correction is \(x_0=1\), \(y_0=2\).

For the equation in the preceding example, this mistake also changes the calculated initial slope. The incorrect substitution would produce

$$ f(2,1)=\frac{2-1}{1+1^2}=\frac{1}{2}, $$

whereas the correct substitution is

$$ f(1,2)=\frac{1-2}{1+2^2}=-\frac{1}{5}. $$

These values differ in both sign and magnitude. To avoid this error, translate \(y(x_0)=y_0\) into words: “when the independent variable is \(x_0\), the dependent variable is \(y_0\).” Then substitute the pair in that order into the slope function.

A Reliable Input-Extraction Process

1
Name the variables.
Identify which variable is independent and which quantity depends on it. Keep the units attached to each quantity.
2
Read the initial condition.
From \(y(x_0)=y_0\), record the input \(x_0\) and the corresponding value \(y_0\), without reversing them.
3
Isolate the derivative.
Rewrite the equation as \(y'=f(x,y)\). Check that any division used is valid on the domain under consideration.
4
Check the result.
Substitute \((x_0,y_0)\) into \(f\) to find the initial slope. Confirm that the initial condition and units agree with the original model.

These steps separate the information supplied by the initial condition from the information supplied by the differential equation. The initial condition fixes the starting point; the slope function describes the derivative rule. Together they put a first-order IVP into the form needed for a forward Euler calculation. A step size is a separate numerical choice, not part of the IVP’s initial data.

Check Your Understanding

For each problem, identify the independent variable, dependent variable, initial point and value, and slope function. Where requested, calculate the initial slope.

  1. For \(y'=3x-y\), \(y(0)=4\), what are \(x_0\), \(y_0\), and \(f(x,y)\)? What is \(f(x_0,y_0)\)?
  2. For \(\frac{dQ}{dt}=-0.2Q\), \(Q(5)=10\), identify the starting time, starting value, and slope function.
  3. Rewrite \((2+x^2)y'=y+1\), \(y(-1)=3\), in explicit form. What is the initial slope, and why is the division valid?
  4. A model is written \(P'=kP\), \(P(2)=500\), where \(k\) is a constant. Identify the input data symbolically and state the units of \(f\) if \(P\) is measured in people and time in years.
  5. For \(y'=x+y\), \(y(2)=-1\), a learner records \(x_0=-1\) and \(y_0=2\). Explain the error and calculate the correct initial slope.

Test yourself: Calculus I final exam practice

Ready to check what you know? Work a full-length practice final, then open the complete worked solutions.

Want all 1,114 practice problems?

This tutorial covers one topic. Calc Pass covers the full Calculus AB & BC curriculum (the core of Calculus I and II): full review, every practice question, and step-by-step solutions to each one.

QR code to download the Calc Pass app

Get the Calc Pass App

Scan to download and practice on the go, with instant scoring.

Calc Pass Volume 1: 1,114 Practice Questions book cover

Vol. 1: 1,114 Questions

The complete practice question bank, organized by AB & BC topic.

View on Amazon
Calc Pass Volume 2: Solutions Manual book cover

Vol. 2: Solutions Manual

Fully worked solutions to every question in Volume 1.

View on Amazon