Question

Engr 135 Program #6 Spring 2019 Cannon Muzzle Velocity& Projectile Impact Point Part I- Cannon Muzzle Velocity We wish to det
0 0
Add a comment Improve this question Transcribed image text
Answer #1

THE CODE FOR THE ABOVE QUESTION IS :

# standard acceleration of gravity in meters per second square
from math import sqrt, sin, cos, radians

# declaring our global variables
g = 9.80
Vmuzzle = 0


def part_I():
    global g, Vmuzzle
    Y0 = float(input('Enter the height of the projectile in meters: '))
    Xf = float(input('Enter the impact point of the projectile in meters: '))

    # calculating time taken to hit the ground
    # S = Uy.t + (1/2).g.t^2
    # Uy is 0 initially
    # so t = square_root (2*S/g)
    t = sqrt(2 * Y0 / g)

    # velocity is distance / time
    Vmuzzle = Xf / t

    print('Height of projectile:', Y0, 'meters')
    print('Impact point of projectile:', Xf, 'meters')
    print('Average muzzle velocity of projectile:', round(Vmuzzle, 2), 'meters per second')


def part_II():
    global g, Vmuzzle
    Y0 = float(input('Enter the height of the projectile in meters: '))
    theta = float(input('Enter the angle of the projectile in degrees: '))

    # Vertical component of velocity Vy = Vmuzzle.sin(theta)
    # Horizontal component of velocity Vx = Vmuzzle.cos(theta)
    Vy = Vmuzzle * sin(radians(theta))
    Vx = Vmuzzle * cos(radians(theta))

    # total flight time = time it goes up + time it takes to come down
    # time it goes up = 2 * (Vy / g)
    t_up = 2 * (Vy / g)

    # time it takes to come down can be found by solving for time in the equation
    # (1/2).g.t^2 + Vy.t - S = 0
    # we will discard this root as time is never negative
    # t2 = -Vy/g - sqrt(Vy**2 + 2*Y0*g)/g
    t_down = -Vy / g + sqrt(Vy ** 2 + 2 * Y0 * g) / g

    t_total = t_up + t_down
    Xf = Vx * t_total

    print('Height of projectile:', Y0, 'meters')
    print('Angle of projectile:', theta, 'degrees')
    print('Downrange impact point of projectile:', round(Xf, 2), 'meters')


if __name__ == '__main__':
    part_I()
    print()
    part_II()

Screenshot of the code:
# standard acceleration of gravity in meters per second square from math import sqrt, sin, cos, radians # declaring our globa
42 43 # time it takes to come down can be found by solving for time in the equation we will discard this root as time is neve

SAMPLE OUTPUT :
Enter the height of the projectile in meters: 60 Enter the impact point of the projectile in meters: 87 Height of projectile:

Add a comment
Know the answer?
Add Answer to:
Engr 135 Program #6 Spring 2019 Cannon Muzzle Velocity& Projectile Impact Point Part I- Cannon Muzzle...
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