Question
can someone write me a wing101 python code for this please

Question: For a projectile launched with a velocity vIm/s) at an angle to the horizontal 6 Iradl, the horizontal distance tra
import math def horizontal distance (v, theta, del h: (num, num, num) -> (num) This function recieves initial velocity,
Question: For a projectile launched with a velocity vIm/s) at an angle to the horizontal 6 Iradl, the horizontal distance travelled (also called the range) is given by where the altitude of the landing position is Δh higher than that of the launch position and g is the gravitational acceleration (use 9.81 m/s^2). Note: θ in theformula is in radians write a Python function that accepts ν, θ and Alt, as inputs and returns the calculated range as an output using the provided starter code "lab2.ру" Sample Inputs and Outputs: For testing your code, use your function to calculate the range for a set of inputs and print the range as the example below Inputs horizontal_distance (100, 20, 40), where v = 100 theta 20 del h 40 #ve locity in meters / second theta in degrees #delta h in meters Output The range is: 515.5652309241808 Note: Your function should return a number. Your testing code should return a string as the above. Hint: Be careful with your units. You can obtain T by calculating the inverse cosine of -1, as math.acos(-1.0) or directly getting it value by math.pi TO DO: Download the file lab2.py and complete the functions inside
import math def horizontal distance (v, theta, del h: " " "(num, num, num) -> (num) This function recieves initial velocity, launch angle, and altitute change in the landing position and returns the horizontal range of a projectile is in [m/s] theta is in [degrees] del h is in ml >>> range - horizontal _distance (100, 20, 40) >>> range 515.5652309241808 return range " " " THIS CAN TEST YOUR CODE""" velocity = 100 angle - 20 delta h = 40 range = horizontal-distance ( velocity, angle, delta_h) print("\nThe range is: " + str(range))
0 0
Add a comment Improve this question Transcribed image text
Answer #1

'''

Python program to calculate the horizontal_distance for given initial velocity,

launch angle and altitude changes in the landing position

'''

import math

              

              

def horizontal_distance(v, theta, del_h):

               """ (num,num,num) -> (num)        

               This function receives initial velocity, launch angle , and altitude changes

               in the landing position and returns the horizontal range of the projectile

              

               v is in [m/s]

               theta is in [degrees]

               del_h is in [m]

              

               """

               g = 9.81

              

               # math.radians(angle) - convert the degree to radians

               range = v*math.cos(math.radians(theta))*(((v*math.sin(math.radians(theta)))/g) + math.sqrt((((v**2)*(math.sin(math.radians(theta))**2))/(g**2)) - ((2*del_h)/g)))

              

               return range

              

velocity = 100

angle = 20

delta_h = 40

range = horizontal_distance(velocity, angle, delta_h)

print("\nThe range is : "+str(range))          

#end of program             

Code Screenshot:

2Python program to calculate the horizontal_distance for given initial velocity 3 launch angle and altitude changes in the la

Output:

D:Ipython\myprograms>python horizontal range.py The range is: 515.565230924

Add a comment
Know the answer?
Add Answer to:
can someone write me a wing101 python code for this please Question: For a projectile launched with a velocity vIm/s) at an angle to the horizontal 6 Iradl, the horizontal distance travelled (al...
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