Please turn in this assignment (and all future assignments for this course) by emailing them to me . Please use the subject of "Physics 222 HW9" for these assignments (if you use the link above, the subject will be added automatically). Please attach the source code to any programs that you write for this assignment. If you write more than one program, attach each separately. When answering the questions themselves feel free to answer directly in the body of your message (or attach your answers). I may take off points for assignments that are not sent to me in the correct form.
In this problem, you will write a progam to find the maximum height reached by a model rocket. In this problem use floating point variables that are at least 8 bytes in size (double). The relevant force equation is :
F = m(t)a = -m(t)g -k v|v| +T(t)where T(t)=b t(1-t) is the time-dependant thrust for times from 0 to 1 second, with the thrust being 0 at all other times and b is a constant in N/s2. k is the drag coefficient, k= 1/2 Cw ρ A, where Cw=1.0 is a constant, A is the area in m2, and ρ = 1.225 kg/m3 is the density of air. The "-k v|v|" takes care of the direction on the air resistance force - the sign of that term will always point against the direction of current motion. Since the loss of mass of the rocket engine is responsible for the thrust, dm/dt is proportional to -T(t). Following through some of the math (available from the Rocket lab), we find that:
m(t) = minitial + (mfinal - minitial)*(3t2 - 2t3).
mi = minitial + (mfinal - minitial)* (3ti2 - 2ti3).
To solve for the velocity numerically, we solve the force equation
above for acceleration, and then find its difference
vi= vi-1+ Δt *(-g - k*vi-1*abs(vi-1)/mi + Ti/mi)After finding the speed, you will be able to find the height from:
xi = xi-1 + Δt viOf course to solve either of the above, you will already have to have forms for Ti and mi. You will also need to save an array of times.
Think carefully about what condition must be met in order to find the maximum height.
Your program should read in the following input data from the supplied files below: Δt, b, surface area, initial mass, and final mass. The files are: rocket_1a, rocket_1b, rocket_1c, rocket_1d, rocket_2, rocket_3, and rocket_4.
Your program should write to an output file the input data it read from the input file, followed by the maximum height and the time at which it happened, and three columns of data: the time, position, and velocity for each time that the program calculated. Your program should also plot the position versus time and velocity versus time using PLPlot.
For this program send output files from running your program with each input file, plots from the rocket_3 case, and answers to the questions above.