Exercise 2: Simulating a Ball Thrown Upward — Possible Solution ==================================================================== GIVEN ------------------------------ x0=0, v0=15 m/s, a=-9.8 m/s^2, dt=0.5, 2 steps (covering t=0 to t=1) STEP 1: EULER STEP 1 (t=0 to t=0.5) ------------------------------ x_new = x + v*dt = 0 + 15*0.5 = 7.5 v_new = v + a*dt = 15 + (-9.8)*0.5 = 15 - 4.9 = 10.1 After step 1: x=7.5, v=10.1 STEP 2: EULER STEP 2 (t=0.5 to t=1.0) ------------------------------ x_new = x + v*dt = 7.5 + 10.1*0.5 = 7.5 + 5.05 = 12.55 v_new = v + a*dt = 10.1 + (-9.8)*0.5 = 10.1 - 4.9 = 5.2 After step 2: x=12.55, v=5.2 STEP 3: COMPARE TO THE EXACT FORMULA AT t=1 ------------------------------ x(1) = x0 + v0*t + 0.5*a*t^2 = 0 + 15*1 + 0.5*(-9.8)*1^2 = 15 - 4.9 = 10.1 RESULT ------------------------------ Euler's method (2 steps, dt=0.5): x=12.55 Exact analytical solution: x=10.1 Error: |12.55 - 10.1| = 2.45 This is a noticeably larger error than this chapter's own worked example, which used a much finer dt=0.01 - directly consistent with this chapter's own verified finding that Euler's method's error shrinks linearly with dt. A large, coarse dt=0.5 here produces a correspondingly large error. WHY THIS WORKS AS AN ANSWER ------------------------------ Both Euler steps are computed explicitly showing the position and velocity update separately at each step (using the OLD velocity for the position update, matching this chapter's own method exactly), and the resulting error is explicitly connected back to this chapter's own dt-vs-error finding to explain why it's larger than the chapter's own more finely-stepped example, rather than treated as an unexplained discrepancy.