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
  • 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

  • Could somebody help me with this question for the coding on MATLAB? Thank you Projectile Motion...

    Could somebody help me with this question for the coding on MATLAB? Thank you Projectile Motion The distance a projectile travels when fired at an angle Θ is a function of time and can be divided into horizontal distance, dVotcos(O) and the vertical distance is dy Vot sin(0)-0.5gt2. Suppose a projectile is fired at an initial velocity of 100 m/s and a launch angle of /4 radians (45°). Use ezplot to graph horizontal distance on the x -axis and vertical...

  • EXPLORE A projectile is launched with a launch angle of 30° with respect to the horizontal...

    EXPLORE A projectile is launched with a launch angle of 30° with respect to the horizontal direction and with an initial speed of 10 m/s. s0 (A) How do the vertical and horizontal components of the projectile's velocity vary with time? 40 35 (B) How long does it remain in flight? 25 (C) For a given launch speed, what launch angle produces the longest time of flight? 15 10 toy CONCEPTUALIZE Consider the projectile to be a point mass that...

  • Please help me correct my MATLAB script code for this problem, thank you!! A projectile PA is launched from point A towards the east with an initial launch velocity voa and an initial...

    Please help me correct my MATLAB script code for this problem, thank you!! A projectile PA is launched from point A towards the east with an initial launch velocity voa and an initial lauw angle of 0x. The impact point of the projectile Pa is a point B in a valley with an ordinate, yon, located below the clevation of point A. The launch from point A is instantaneously detected at point B, and a counter projectile P launched simultaneously...

  • 1 2 A projectile PA is launched from point A towards the east with an initial launch velocity ves and an initial launch angle of 8aA. The impact point of the projectile Pa is a point B in a valle...

    1 2 A projectile PA is launched from point A towards the east with an initial launch velocity ves and an initial launch angle of 8aA. The impact point of the projectile Pa is a point B in a valley with an ordinate, you, located below the elevation of point A. The launch from point A is instantaneously detected at point B, and a counter projectile Pa ts launched simultaneously towards the west to intercept the incoming projectile PA. Projectile...

  • Please help me with no 48 a. What is the wheel's angular velocity, in rpm, 10...

    Please help me with no 48 a. What is the wheel's angular velocity, in rpm, 10 s later? b. How many revolutions does the wheel make during this time? an e 43. Starting from rest, a DVD steadily accelerates to 500 rpm in 1.0s, rotates at this angular speed for 3.0 s, then steadily deceler- ates to a halt in 2.0s. How many revolutions does it make? ie y Problems 44.l A spaceship maneuvering near Planet Zeta is located at...

  • I want the math lab code for theses problems in a unique way

    I want the math lab code for theses problems in a unique way Theory A projectile is launched from point A up an incline plane that makes an angle of 10 with the horizontal. The mountain is 6,000 m high. Vo 10° Figure 1: Flightpath of a projectile. If we neglect the air resistance, the flight path of a projectile launched at an initial speed vo and an angle θ of departure relative to the horizontal is a parabola (see...

  • Please can someone help me to finish this program? It is a C programming not a...

    Please can someone help me to finish this program? It is a C programming not a C++, when programming the program in linux I keep getting expected expression before || token, also please check if everything else is fine, maybe there is something else worng in my program and may ask me later to fix it, I am concern about the sin and cosine. The program is supposed to do all this: 1.Display a welcome message. 2.Prompt for the height...

  • can you answer both #1 (a&B) and #2 please 1. Write MATLAB code to do the...

    can you answer both #1 (a&B) and #2 please 1. Write MATLAB code to do the following: (4 pts) a) Find the area of the circles where r=[7, 8, 10] using A = tr2 b) Find the distance traveled by a ball falling in the air is given by the equation x=x0+vot+ at?. Calculate the position of the ball at time t = 5s, XO = 10m, vo= 15 m/s, and a = 9.81 m/sec^2. Write MATLAB code to accomplish...

  • can someone please help me write a python code for this urgently, asap Question: Write a Python function, minmp,...

    can someone please help me write a python code for this urgently, asap Question: Write a Python function, minmp, that is passed a file name and a metal alloy's formula unit structure*". The file will contain metal elements and their properties. The function will return a tuple of the element from the formula with the lowest melting point and that melting point Write a second function, molform, that will be called by the first function, to take the metal alloy's...

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