Omniadisce

Computational physics 6.2: A spring with Euler's method

Lesson Beginner

Join free to take this lesson

Anyone can look around, but taking a lesson needs a free account. With one, your answers are checked step by step and your progress is saved, so you can stop and pick up where you left off on any device.

10 steps · about 25 min

By the end you can

  • Write the spring's acceleration as a line of Python: a = -k / m * x
  • Simulate a mass on a spring with Euler's method and plot it against the exact A cos(ωt)
  • Work out the energy ½mv² + ½kx² and see it grow
  • Say whether a smaller dt cures the growth

Who it is for: Anyone who has done lesson 6.1, and physics lessons 9.3 (simple harmonic motion), 9.4 and 9.6 (energy in an oscillation).

The steps

  1. The spring, from physics unit 9
  2. Squeezed
  3. The pull back
  4. Euler's method for the spring
  5. Let it go
  6. What went wrong?
  7. The spring's energy
  8. Energy against time
  9. A smaller step
  10. Looks fine, is wrong

Discussion 0 comments

Log in to join the discussion.

× Enlarged view