Euler uses one slope at the start. Explicit midpoint first predicts the state halfway through the interval, evaluates a slope there, and uses that slope for the full step. For y′=y, y=1 and h=1/4, the first slope is 1, the predicted midpoint state is 9/8, and the new value is 1+(1/4)(9/8)=41/32. This incorporates some curvature without solving an implicit equation.
Predict
Predict whether averaging endpoint slopes is the same algorithm. Heun evaluates a slope at the Euler-predicted endpoint and averages it with the initial slope. On y′=λy, Heun and explicit midpoint give the same amplification polynomial, but for a nonlinear or time-dependent f their intermediate states and final results can differ. Equal order does not mean identical method or identical error constants.
Experiment
Compare the two second-order constructions.
Method
First stage
Second stage location
Final slope combination
Midpoint
f(t,y)
(t+h/2,y+hk₁/2)
k₂
Heun
f(t,y)
(t+h,y+hk₁)
(k₁+k₂)/2
Use y′=t+y² at t=0,y=1,h=1/10 to calculate both steps. Preserve each stage state separately; overwriting y before all needed stages are formed changes the method.
Understand
For smooth f, the exact solution expansion is y(t+h)=y+hf+(h²/2)(f_t+f_yf)+O(h³). Expanding the explicit midpoint slope at its time and state gives f+(h/2)(f_t+f_yf)+O(h²). Multiplying by h proves agreement through h² and an O(h³) local defect. Under suitable Lipschitz bounds and a fixed interval, the global error is O(h²). Heun satisfies the same second-order conditions by its average. This proof explains the cancellation rather than inferring order solely from a plot of two numerical runs.
Apply
Classical RK4 defines k₁=f(t,y), k₂=f(t+h/2,y+hk₁/2), k₃=f(t+h/2,y+hk₂/2), k₄=f(t+h,y+hk₃), then y_new=y+h(k₁+2k₂+2k₃+k₄)/6. Its coefficients satisfy the general fourth-order conditions for sufficiently smooth ODEs, giving local defect O(h⁵) and global error O(h⁴) under stability. On the linear test equation, direct substitution gives R(z)=1+z+z²/2+z³/6+z⁴/24. Matching that exponential series is a valuable implementation check, but it does not by itself establish all nonlinear order conditions. A full derivation of the general order-four conditions is additional depth beyond the second-order proof supplied here.
On the linear test equation, explicit midpoint and Heun both have R(z)=1+z+z²/2. Derive this by inserting k₁=λy into each second-stage formula and collecting powers. It is a useful exact test because a mistaken half-step time or state coefficient changes the polynomial. For a general nonautonomous equation, time-stage locations matter separately, so testing only y′=λy can miss an implementation that evaluates every stage at the initial time.
Continue
More stages cost more function evaluations, so compare accuracy at a stated work budget. High order is not a guarantee of stability for a large step, and nonsmooth right-hand sides can reduce the observed order. Event locations and discontinuities require separate treatment. Next, absolute-stability regions show why an accurate local Taylor approximation can still amplify decaying modes disastrously. Written RK designs should include exact stage tests, coupled systems, nonfinite checks and an honest boundary between mathematical order and observed implementation behavior.
Drafts save locally as you type. Reveal worked solutions when useful; the site remembers that exposure. Automatic matches check the requested answer, while written arguments require review against the rubric.
For y′=y, y₀=1 and h=1/2, compute one explicit midpoint step.
Integers, fractions and finite decimals are accepted. Expressions such as sqrt(2) are not parsed by this checker.
For y′=y, y₀=1 and h=1, compute one classical RK4 step.
Integers, fractions and finite decimals are accepted. Expressions such as sqrt(2) are not parsed by this checker.
Write Heun’s predictor-corrector step and explain that it is explicit.
Structure your argument and preserve revisions
These optional planning fields save locally. Recording your response saves an immutable copy of the argument and these fields. Older records may contain only first/latest responses; missing intermediate revisions are not reconstructed.
Each field allows 2,000 characters. Keep a specific claim, state where it applies, cite the facts you use, and explain what still needs checking. Blank fields are allowed and are not evidence of mastery.
For smooth scalar f, verify explicit midpoint matches the exact Taylor expansion through h².
Structure your argument and preserve revisions
These optional planning fields save locally. Recording your response saves an immutable copy of the argument and these fields. Older records may contain only first/latest responses; missing intermediate revisions are not reconstructed.
Each field allows 2,000 characters. Keep a specific claim, state where it applies, cite the facts you use, and explain what still needs checking. Blank fields are allowed and are not evidence of mastery.
Why does matching e^z through z⁴ on y′=λy not by itself prove fourth order for every nonlinear ODE?
Structure your argument and preserve revisions
These optional planning fields save locally. Recording your response saves an immutable copy of the argument and these fields. Older records may contain only first/latest responses; missing intermediate revisions are not reconstructed.
Each field allows 2,000 characters. Keep a specific claim, state where it applies, cite the facts you use, and explain what still needs checking. Blank fields are allowed and are not evidence of mastery.
Specify tests for a four-stage RK4 implementation.
Structure your argument and preserve revisions
These optional planning fields save locally. Recording your response saves an immutable copy of the argument and these fields. Older records may contain only first/latest responses; missing intermediate revisions are not reconstructed.
Each field allows 2,000 characters. Keep a specific claim, state where it applies, cite the facts you use, and explain what still needs checking. Blank fields are allowed and are not evidence of mastery.
Reflect and continue
Before marking this lesson complete, explain one key idea without the worked solution and identify a condition that matters. Marking complete records participation, not independent mastery.