fhat. GitHub Workspace

Explicit midpoint

A cheap second-order step for smooth, non-stiff ODEs.

errorO(h2)cost2 f / stepexplicit

Also known as modified Euler, RK2 midpoint

Placeholderv0.1.2Example

Use with your agent

Use the fhat method "explicit-midpoint" (https://fhat.dev/methods/explicit-midpoint/SKILL.md) for this problem. Check first whether it applies.

Placeholder (demo). Description only: there is no reference implementation or verification for this entry yet. It belongs to a demonstration set of textbook methods.

What it does

Takes a half step with Euler to estimate the midpoint, then uses the slope there for the full step: k=yn+h2f(tn,yn)k = y_n + \tfrac{h}{2} f(t_n, y_n), yn+1=yn+h f(tn+h2,k)y_{n+1} = y_n + h\, f(t_n + \tfrac{h}{2}, k). Second order, two evaluations of ff per step. Note that "RK2" also refers to other two-stage methods such as Heun's method; this entry is the midpoint variant.

When to use

  • Smooth, non-stiff problems over short to moderate times where a simple fixed-step second-order method is enough.

When not to use (and what to use instead)

Situation Use instead
Long runs of a conservative mechanical system: energy grows stormer-verlet (same order, one force evaluation per step, bounded energy error)
Higher accuracy rk4, or dormand-prince-rk45 with error control
Stiff problem backward-euler or implicit-midpoint

Key facts

Order 2, explicit, not symplectic, not time-reversible, conditionally stable, two evaluations per step.

Sources

The methods shown are examples. More research methods are coming.