Question: The answer for the previous question is: import numpy as np m = 90 # number of angles n = 1000 # number of time

The answer for the previous question is: import numpy as np mThe answer for the previous question is:

import numpy as np

m = 90 # number of angles n = 1000 # number of time steps to simulate rho = 1.225 # kg/m^3 g = -9.8 # m/s^2 start = 0.0 # seconds end = 10 # seconds initial_velocity = 70 # meters/second initial_height = 5

# object A = .8 # surface area m^2 C = 1.4 # drag coefficient mass = 65 # mass of object in kg

# parameters of simulation angles = np.linspace( 1,m,m ) radians = np.radians( angles )

#initalize variables t = np.linspace( start,end,n+1 ) vx = np.zeros( ( m,n+1 ) ) vy = np.zeros( ( m,n+1 ) ) x = np.zeros( ( m,n+1 ) ) y = np.zeros( ( m,n+1 ) )

for i in range(m): y[ i,0 ] = initial_height vx[ i,0 ] = initial_velocity * np.cos( radians[ i ] ) vy[ i,0 ] = initial_velocity * np.sin( radians[ i ] )

for i in range( m ): for j in range( 1,n+1 ): if y[ i,j-1 ] best_d: best_d = x[ i,-1 ] best_a = angles[ i ]

Screenshot for formatting:

= 90 # number of angles n = 1000 # number of

Calculating a trajectory 5 points Callista "Cherry Bomb" Davidson is at it again. Her scheme this week is to break last week's world record. To this end, she has purchased a new cannon rig. which can accommodate greater, perhaps even dangerous, amounts of propellant. Since there are so many variables to track, rather than try to brute-force a solution, she asks you to optimize the launch for her again First, define a figure-of-merit function dist( angle,m_prop) which accepts the angle of launch and the mass of propellant used m_prop (in kilograms) and returns the distance traveled (in m). This will be very similar to much of your code from hwle. In order to have consistent results, please use the reference answer from hw10 to compose dist A reference case for dist is. assert np.isclose( dist( 30,0.10),143.9611 For this particular cannon and Callista's weight, consider the initial velocity to be a function of propellant as follows 0.45 65 kg Your solution should include a function dist. Starter code (eliek to view def dist(angle,m_prop) pass Calculating a trajectory 5 points Callista "Cherry Bomb" Davidson is at it again. Her scheme this week is to break last week's world record. To this end, she has purchased a new cannon rig. which can accommodate greater, perhaps even dangerous, amounts of propellant. Since there are so many variables to track, rather than try to brute-force a solution, she asks you to optimize the launch for her again First, define a figure-of-merit function dist( angle,m_prop) which accepts the angle of launch and the mass of propellant used m_prop (in kilograms) and returns the distance traveled (in m). This will be very similar to much of your code from hwle. In order to have consistent results, please use the reference answer from hw10 to compose dist A reference case for dist is. assert np.isclose( dist( 30,0.10),143.9611 For this particular cannon and Callista's weight, consider the initial velocity to be a function of propellant as follows 0.45 65 kg Your solution should include a function dist. Starter code (eliek to view def dist(angle,m_prop) pass

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!