projectile_motion.nbt 451 B

123456789
  1. # https://en.wikipedia.org/wiki/Projectile_motion
  2. fn max_height(v: Velocity, θ: Angle) -> Length = v² · sin(θ)^2 / (2 · g0)
  3. fn max_distance(v: Velocity, θ: Angle) -> Length = v² · sin(2 θ) / g0
  4. fn time_of_flight(v: Velocity, θ: Angle) -> Time = 2 v · sin(θ) / g0
  5. assert_eq(max_height(10 m/s, 45 deg), 2.55 m, 1 cm)
  6. assert_eq(max_distance(10 m/s, 45 deg), 10.20 m, 1 cm)
  7. assert_eq(time_of_flight(10 m/s, 45 deg), 1.44 s, 10 ms)