Skip to content

2014-9: Going Ballistic

The following formula gives the horizontal distance a projectile travels:

Where: v is the initial velocity, θ is the trajectory in degrees, d is the horizontal distance and G is the gravitational constant.

Write a dfn which calculates the distance (in meters) a projectile travels given an initial velocity in meters per second and a trajectory in degrees. Use 9.8 meters per second squared as the gravitational constant.

Examples:

      100 (your_function) 45 ⍝ 100 meters per second and 45 degree trajectory
1020.408163
      0 (your_function) 45 ⍝ no velocity = no distance
0
      100 (your_function) 90 ⍝ shooting straight up = no distance
1.249639591E¯13
your_function ←

Solutions

Video Thumbnail YouTube

Chat transcript Code on GitHub