Skip to content
Tactiverge

□ Mechanics · numerical integration

Euler integration of a falling object

Step a falling object's velocity forward in time with air drag and watch it approach terminal velocity.

  • Level 4 · Systems Engineer
  • 5 tests
  • technically checked

Your task

A dropped sensor pod accelerates under gravity, but air drag grows with speed. A simple linear drag model gives

dv/dt = g − c·v, with g = 9.81 m/s².

Euler's method steps it forward: v[n+1] = v[n] + dt × (g − c·v[n]), starting from v[0] = 0.

Write:

  • fallVelocities(dt, steps, c): an array of steps + 1 velocities.
  • terminalVelocity(c): the speed where acceleration is zero, g / c.

Run the starter to plot the velocity curve.

Hints (0 of 2 shown)

    What gets checked

    • fallVelocities(0.5, 4, 0.2) → [0, 4.905, 9.3195, 13.29255, 16.868295]
    • terminalVelocity(0.2) → ≈ 49.05 (± 1e-9)

    Plus 3 hidden tests for edge cases. They run in the sandbox like the others; only the result is shown.

    Tab indents · Esc then Tab leaves the editor · Ctrl/⌘ Enter runs · Ctrl/⌘ Shift Enter checks · Ctrl/⌘ / comments

    Starting the sandbox…

    Press Run to see what your program prints.

    Your code runs only in this browser, inside an isolated sandbox with no network access, and stops after 3 s. Nothing you type is sent to Tactiverge; drafts and progress are saved in this browser only.