Hacks

import matplotlib.pyplot as plt
import numpy as np

# pendulum parameters
GRAVITY = 9.81  # m/s^2
LENGTH = 1  # m
MASS = 1  # kg

# initial state
THETA = np.pi / 4  # radians
OMEGA = 0  # radians/second

# simulation parameters
DELTA_T = 0.001  # seconds
TOTAL_TIME = 10  # seconds

# calculate the acceleration of the pendulum
def acceleration(theta: float) -> float:
    return -(GRAVITY / LENGTH) * np.sin(theta)

# initialize the state of the pendulum
theta = THETA
omega = OMEGA
time = 0

# create empty lists to store the data
theta_data = []
omega_data = []
time_data = []

# simulate the pendulum
while time < TOTAL_TIME:
    # append the current state to the data lists
    theta_data.append(theta)
    omega_data.append(omega)
    time_data.append(time)

    # calculate the next state
    omega += acceleration(theta) * DELTA_T
    theta += omega * DELTA_T
    time += DELTA_T

# plot the data
plt.plot(time_data, theta_data)
plt.xlabel('Time (s)')
plt.ylabel('Angle (rad)')
plt.show()

In this simulation, the angle and angular velocity of the pendulum are calculated at each time step using the equations of motion for a simple pendulum. The data is then plotted using matplotlib to visualize the pendulum's motion.

Simulation in Video games

Microsoft Flight Sim

Microsoft Flight Simulator is a series of amateur flight simulator programs for Microsoft Windows operating systems. The simulator is used for training pilots and for entertainment purposes. It allows users to fly various types of aircraft in different environments and weather conditions. The simulator includes a realistic flight model and detailed 3D graphics to provide an immersive experience. Microsoft Flight Simulator is groundbreaking because it is one of the longest-running and most successful flight simulator programs. I learned about this because my friend who aspires to become a commercial jet pilot flies on microsoft flight simulator during his free time, and he gave me a tour of his flight setup which was a pretty good replica of a pilot's cockpit.