Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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.

Your solution should seek to optimize distance traveled by varying the angle of launch (090) and the amount of propellant (0.050.12). You may have some suspicions about the best-case scenario, but you should adopt a hill-climbing procedure to be certain.

This problem is _convex_, meaning that a hill-climbing approach should be able to find the globally optimal solution. This makes it a great candidate for this optimization technique.

Use 0.05 kg as the initial guess for the propellant mass. Use a starting height of 5m5m and assume an acceleration due to gravity of g=?9.8m?s?2g=?9.8m?s?2. Use a starting angle of 0. Treat drag and xx and yy components as in hw10, as well as collision with the ground.

It's worth noting that the physics in hw10 were a bit off. The calculation for the force in the xxxx-direction was specified there as Fx=?CDv2xFx=?CDv2xFx=?CDvx2Fx=?CDv2x; it should rather have been based on the component of total velocity, Fx=?CDv2||vxv||Fx=?CDv2??vxv??Fx=?CDv2|vxv|Fx=?CDv2??vxv??. This means that if you have a line like

ax = -( 0.5*rho*C*A/mass ) * vx[ j-1 ] ** 2 

you should replace it with something like

v = np.sqrt( vx[ j-1 ]**2 + vy[ i,j-1 ]**2 ) ax = -( 0.5*rho*C*A/mass ) * v**2 * ( vx[ i,j-1 ] / v ) 

for hw11. You will need to perform this transformation for the y-component as well.

For a given launch (with angle and propellant), calculate the distance Callista travels in ten seconds with 1,000 time steps (so 1,001 states including the initial condition).

Next, change the launch angle iteratively in steps of 1 until distance is maximized. Accept the change if it improves on the solution; if it does not, end this step.

Next, change the mass of propellant iteratively in steps of 0.001 kg used until distance is maximized.

We could cycle repeatedly to guarantee optimality. In this case, one cycle of each does pretty well, yielding a distance within about 0.5% of the true value.

You may vary the angle of launch from 090 and the amount of propellant between 0.050.12 kg. When no improvement is possible, the hill-climbing solution is complete.

Finally, your code should define three variables max_dist, the maximum distance traveled; max_angle, the corresponding launch angle; and max_m_prop, the amount of propellant which should be used in the attempt.

(Note that you will need to convert from degrees to radians before using the numpy sin and cos functions.)

Your solution should include result variables max_dist, max_angle, and max_m_prop. Assume that dist is provided.

Starter code (click to view)

guess_dist = 0 # m guess_angle = 0 # deg guess_m_prop = 0.05 # kg max_dist = 0.0 # change angle iteratively until improvement stops old_guess_dist = guess_dist - 1 while guess_dist >= old_guess_dist: old_guess_dist = guess_dist guess_angle += ??? guess_dist = dist( guess_angle,guess_m_prop ) # ??? # then change m_prop iteratively until improvement stops old_guess_dist = guess_dist - 1 while guess_dist >= old_guess_dist: pass # similar to the above but in guess_m_prop # now you should know max_dist, max_angle, max_m_prop 

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Machine Performance Modeling Methodologies And Evaluation Strategies Lncs 257

Authors: Francesca Cesarini ,Silvio Salza

1st Edition

3540179429, 978-3540179429

More Books

Students also viewed these Databases questions

Question

2. Identify and choose outcomes to evaluate a training program.

Answered: 1 week ago

Question

6. Conduct a cost-benefit analysis for a training program.

Answered: 1 week ago