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

Another question on Computers and Technology

question
Computers and Technology, 23.06.2019 21:20
In microsoft word, when you highlight existing text you want to replace, you're in              a.  advanced mode.    b.  automatic mode.    c.  basic mode.    d.  typeover mode
Answers: 1
question
Computers and Technology, 24.06.2019 15:00
When a presentation is being planned, it is important to ensure that it covers all available information. appeals to the audience. uses multimedia tools. entertains the audience.
Answers: 1
question
Computers and Technology, 25.06.2019 02:30
How to delete a question in
Answers: 2
question
Computers and Technology, 25.06.2019 05:10
Write a program that asks for 'name' from the user and then asks for a number and stores the two in a dictionary (called 'the_dict') as key-value pair. the program then asks if the user wants to enter more data (more data (y/n)? ) and depending on user choice, either asks for another name-number pair or exits and stores the dictionary key, values in a list of tuples and prints the list. note: ignore the case where the name is already in the dictionary. example: name: pranshu number: 517-244-2426 more data (y/n)? y name: rich number: 517-842-5425 more data (y/n)? y name: alireza number: 517-432-5224 more data (y/n)? n [('alireza', '517-432-5224'), ('pranshu', '517-244-2426'), ('rich', '517-842-5425')]
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
question
Mathematics, 18.09.2020 01:01
question
Social Studies, 18.09.2020 01:01
question
Mathematics, 18.09.2020 01:01
question
Mathematics, 18.09.2020 01:01
question
Mathematics, 18.09.2020 01:01
question
Mathematics, 18.09.2020 01:01
question
Mathematics, 18.09.2020 01:01
question
Mathematics, 18.09.2020 01:01
question
Mathematics, 18.09.2020 01:01
question
Mathematics, 18.09.2020 01:01
question
English, 18.09.2020 01:01
question
Mathematics, 18.09.2020 01:01
question
Mathematics, 18.09.2020 01:01
question
Mathematics, 18.09.2020 01:01
question
Mathematics, 18.09.2020 01:01
question
Mathematics, 18.09.2020 01:01
question
Mathematics, 18.09.2020 01:01
question
Mathematics, 18.09.2020 01:01
question
Mathematics, 18.09.2020 01:01
question
Mathematics, 18.09.2020 01:01
Questions on the website: 13722360