Question

Question: Write a python code to calculate the range (max horizontal distance), maximum height, time in...

Question: Write a python code to calculate the range (max horizontal distance), maximum height, time in the air of a projectile. You input the launch angle and the initial velocity of the projectile into the program. The only acceleration on the object is due to gravity.

units: meters, seconds

0 0
Add a comment Improve this question Transcribed image text
Answer #1

import math

##take inputs
##assuming all inputs are in SI units
launch_angle=float(input('Enter the launch angle(in degrees):'))
##convert angle to radians, since python takes radians as argument
launch_angle_radians=math.radians(launch_angle)
initial_velocity=float(input('Enter the initial velocity:'))
g=9.81#accleration due to gravity
#range (max horizontal distance), maximum height, time in the air of a projectile
max_horizontal_range=(initial_velocity**2)/g ##Rmax=(u*u)/g, occurs at 45degrees
horizontal_range=(initial_velocity**2)*math.sin(2*launch_angle_radians)/g##occurs at give angle
max_height=((initial_velocity**2)*(math.sin(launch_angle_radians)))/(2*g)# h=(usin(theta))^2 /2g
time_in_air=(2*initial_velocity*math.sin(launch_angle_radians))/g

print('Max Horizontal distance(Range)=',max_horizontal_range)#
print('Horizontal diatace=',horizontal_range)
print('Max height=',max_height)
print('Time in air=',time_in_air)

#You input the launch angle and the initial velocity of the projectile into the program

Add a comment
Know the answer?
Add Answer to:
Question: Write a python code to calculate the range (max horizontal distance), maximum height, time in...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT