Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Base code: def simulateFallFriction(mass, deltaT, simulationTime, surfaceArea): numSteps = (int)(simulationTime / deltaT) velocityList = [] elapsedTimeList = [] lengthList = [] accelerationList = [] velocity

Base code:

def simulateFallFriction(mass, deltaT, simulationTime, surfaceArea): numSteps = (int)(simulationTime / deltaT) velocityList = [] elapsedTimeList = [] lengthList = [] accelerationList = [] velocity = 0 length = 0 g = 9.81 Fgravity = mass * g Ffriction = -0.65 * surfaceArea *velocity *abs(velocity) acceleration=(Fgravity+Ffriction)/mass #initializing values ends for i in range(0, numSteps): elapsedTime = deltaT * i elapsedTimeList.append(elapsedTime) lengthList.append(length) velocityList.append(velocity) accelerationList.append(acceleration) Fgravity = mass * g Ffriction = -0.65 * surfaceArea * velocity * abs(velocity) acceleration = (Fgravity + Ffriction)/mass velocity += acceleration * deltaT length += velocity * deltaT retTuple = (elapsedTimeList, lengthList, velocityList, accelerationList) return retTuple

tup = simulateFallFriction(70, 0.01, 60, 0.2) #mass 70kg, deltaT = 0.01, simulationTime = 60s surfaceArea = 0.2 square metres plt.plot(tup[0],tup[1]) plt.title('Free Fall - With Friction') plt.xlabel('Time (s)') plt.ylabel('Fall length (m)') plt.show();

image text in transcribed Use Python 3.6

Step 3 In this part of the assignment, we will add the effect of the spring (bungee cord) on the falling object, so that Julie-Ann can see a fairly realistic simulation of her bungee jump. Copy the function from step 2, and rename it simulateBungeeJumper to start. We'll have a new argument for this function unstretchedBungeeLength: The length (in m) of the bungee/spring Updating the length and velocity: Updating the length and the velocity will use the same procedure as before, but now the acceleration is not a constant, since it depends on air friction (which itself is dependent upon velocity) Updating the acceleration We now have three forces acting on our falling object 1. the force due to gravity (we'll call this Fweight) 2. the force due to air friction (we'll call this Ffriction) 3. the force due to spring resistance (we'll call this Fspring) The force applied to a spring stretched by a displacement (d) is given by Hooke's Law: Fspring -kd (Hooke's Law) In this formula, k is the spring constant, which depends on the stretchiness of the bungee cor example, we'll use k 21.7 for the spring constant. In the formula, d represents how much the spring has stretched (i.e. length). We'll test the function with an unstretched bungee length of 30m. As before, write some Python code to call your function and collect the returned lists. Again, plot the length values vs. the elapsed time values in MatPlotLib, using green triangles for markers. Sample Output: Bu 120 100 20 10 20 30 50

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

More Books

Students also viewed these Databases questions

Question

Draw a schematic diagram of I.C. engines and name the parts.

Answered: 1 week ago

Question

design a simple disciplinary and grievance procedure.

Answered: 1 week ago