Unit 3 Section 16 Hacks
WHAT QUESTIONS
3: What is not a reason to use a pseudo-random number generator when making a simulation?
A: To mock imperfections from the real world
B: To save resources
C: To make the simulation more accurate
4: Which of the following is the least likely factor to be removed from a flight(air traffic) simulation for functionality?
A: Weather
B: Other aircraft
C: Imperfections on aircraft
Experiment/Calculation or Simulation
5: What is not (usually) a difference between a experiment and a simulation?
A: Resources and time needed
B: Factors considered
C: Situation considered
For each situation answer: Would it make more sense to use a simulation or a experiment/calculation?
6: A car company needs to know how safe it's customers will be if it's new car crashes
A: Simulation
B: Experiment/calculation
7: A environmental group wants an accurate guess on the impact the greenhouse effect will have on the environment
A: Simulation
B: Experiment/calculation
9: A teacher want's to find the average score from a final
A: Simulation
B: Experiment/calculation
Lesson Takeaway
Simulations are useful for a variety of purposes in coding. Some of the benefits of using simulations include:
- Testing and debugging: Simulations can be used to test and debug code by allowing developers to see how their code behaves in different scenarios. This can be especially useful when working with complex systems or when trying to identify and fix issues that might not be immediately apparent.
- Modeling and prediction: Simulations can be used to model and predict the behavior of real-world systems, allowing developers to better understand and predict how a system will behave under different conditions.
- Expense: Simulations can also help reduce the cost for testing since less equipment is required to test code.
Overall, simulations are an important tool that can help developers to design, test, and optimize their code, and to better understand and predict the behavior of complex systems.
g = 9.8 ## Gravity in m/s^2
dt = 0.25 ## This is the step value for time in s
x = 50 ## Inital position in m
v = 0 ## Inital velocity in m/s
for t in range(10): ## For the first 10 values
x = x + v * dt ## This calculates the position and velocity ## xf = xi + vt
v = v - g * dt ## vf = vi + at
x = round(x, 3) ## Rounds to 3 decimal places
v = round(v, 3)
print("Time:", t+dt," ", "Position:", x," ", "Velocity:", v)