Question: To determine position using this equation you will write a program in Python that simulates the projectile's motion in the following way. Make the assumption

To determine position using this equation you will write a program in Python that simulates the projectile's motion in the following way. Make the assumption (I know, they're hard to get away from when you're building models.) that in a very short period of time, At, the velocity is constant. This means that you can calculate position in the following way s(t+At) = s(t) + v(t). At where v(t) may be calculated at each time step using: v(t+At) = v(t)-g(s(t)). At Write a module in Python that contains the following functions: 1) g(h) - where h is altitude and the function returns the value of acceleration due to gravity at altitude h. 2) s_next (s_current, v_current, delta_t) - which returns s(t+At) using the equation above where S_current is s(t), v_current is v(t), and delta_tis At. 3) v_next(s_current, v_current, delta_t) - which returns v(t+At) using the equation above. 4) s_sim(t, v_init, s_init, delta_t) - which returns the projectile's position at time t from now. This function uses functions 1-3 above to return the simulation's estimate of the projectile's position at time t given the initial values of position and velocity and the constant delta t. 5) s_standard(t,v_init) - which returns the position using equation (1) and and initial position = 0. 6) plot_trajectories(v_init, s_init, delta_t) which plots the entire trajectories of the two methods and the difference in value between them. To determine position using this equation you will write a program in Python that simulates the projectile's motion in the following way. Make the assumption (I know, they're hard to get away from when you're building models.) that in a very short period of time, At, the velocity is constant. This means that you can calculate position in the following way s(t+At) = s(t) + v(t). At where v(t) may be calculated at each time step using: v(t+At) = v(t)-g(s(t)). At Write a module in Python that contains the following functions: 1) g(h) - where h is altitude and the function returns the value of acceleration due to gravity at altitude h. 2) s_next (s_current, v_current, delta_t) - which returns s(t+At) using the equation above where S_current is s(t), v_current is v(t), and delta_tis At. 3) v_next(s_current, v_current, delta_t) - which returns v(t+At) using the equation above. 4) s_sim(t, v_init, s_init, delta_t) - which returns the projectile's position at time t from now. This function uses functions 1-3 above to return the simulation's estimate of the projectile's position at time t given the initial values of position and velocity and the constant delta t. 5) s_standard(t,v_init) - which returns the position using equation (1) and and initial position = 0. 6) plot_trajectories(v_init, s_init, delta_t) which plots the entire trajectories of the two methods and the difference in value between them
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
