subject

When Callista hits the ground, she stops. To simulate this, if her altitude is ever less than 0, set her velocity in all directions to zero, her height to zero, and her x location to its previous value. Her x location should then remain the same until the end of the simulation. In other words, when she hits the ground, she stops moving until the 10 seconds we are simulating are over. For each angle, you will need to simulate all 1,000 time steps. Each time you update the state variables, first compute her acceleration (using her previous speed to compute the drag,) then her velocity (using her current acceleration,) then her location (using her current velocity.)
Final answer
After the simulation is complete, we are not yet finished. Callista needs to know the optimum angle in integer degrees (being a cannonball not a mathematician).
?Above was the info about the code and what is needed in the code, and now the question I'm really asking is to FILL IN THE BLANKS IN THE STARTER CODE THAT IS GIVEN BELOW :
# 0. Place your necessary imports here. You may find it useful to be able to plot when debugging and visualizing your result.
import numpy as np
# 1. Create a 1D vector named `t` and 2D arrays named `vx`, `vy`, `x`, and `y` to hold the state variables, of size 90 x 1001.
t = ???
# 2. Store the angles from 1 to 90 degrees as radians in a variable called `radians`. Use this to initialize the state variables for `vx` and `vy`.
m = 90 # angles to fire at
angles = ???
radians = angles * 2*np. pi/360
# 3. Define properties like gravity, Callista's surface area, and Callista's mass, and any other parameters you may need as they come up.
A = 0.8 # m^2
g = 9.8 # m/s^2
# etc. Note that I expect an `initial_height` and `initial_velocity` below.
# 4. At this point, you should have defined `t`, `x`, `y`, `vx`, `vy`, `radians`, and the properties you need. Now, initialize the starting condition in each array:
for i in range(m):
y[ i ][ 0 ] = initial_height
vx[ i ][ 0 ] = initial_velocity * np. cos( radians[ i ] )
vy[ i ][ 0 ] = ??? # (see "Angles" above)
# 5. Now you are ready to begin the simulation proper. You will need two loops, one over every angle, and one over every time step for that angle's launch.
for i in ???: # loop over each angle
for j in ???: # loop over each time step
# check that the location isn't below the ground; if so, adjust as specified above
# calculate the acceleration including drag
# calculate the change in position at time `ts` using the current velocities (`vx[ i ][ j ]`) and the previous positions (`x[ i ][ j-1 ]`). This is slightly different from the previous example you solved in an earlier homework.
# 6. The purpose of these calculations was to show which angle yielded the farthest distance. Find this out and store the result in a variable named `best_angle`.

ansver
Answers: 1

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 05:00, mathman783
Which two editions of windows 7 support 64 bit cpus? choose two out of professional, business, starter, or home premium.
Answers: 1
image
Computers and Technology, 23.06.2019 05:30, savyblue1724707
Sally is editing her science report about living things. she needs to copy a paragraph from her original report. order the steps sally needs to do to copy the text to her new document.
Answers: 1
image
Computers and Technology, 23.06.2019 15:00, lopez7512
What is the total resistance in a circuit that contains three 60 ohm resistors connected in a series? a. 20 ohms b. 120 ohms c. 60 ohms d. 180 ohms
Answers: 2
image
Computers and Technology, 23.06.2019 18:00, yedida
File account. java (see previous exercise) contains a definition for a simple bank account class with methods to withdraw, deposit, get the balance and account number, and return a string representation. note that the constructor for this class creates a random account number. save this class to your directory and study it to see how it works. then write the following additional code: 1. suppose the bank wants to keep track of how many accounts exist. a. declare a private static integer variable numaccounts to hold this value. like all instance and static variables, it will be initialized (to 0, since it’s an int) automatically. b. add code to the constructor to increment this variable every time an account is created. c. add a static method getnumaccounts that returns the total number of accounts. think about why this method should be static - its information is not related to any particular account. d. file testaccounts1.java contains a simple program that creates the specified number of bank accounts then uses the getnumaccounts method to find how many accounts were created. save it to your directory, then use it to test your modified account class.
Answers: 3
You know the right answer?
When Callista hits the ground, she stops. To simulate this, if her altitude is ever less than 0, set...

Questions in other subjects:

Konu
Mathematics, 15.01.2020 18:31