Simulation of the motion of a ball thrown at an angle

import math

# Set the initial state
position = (0, 0)
velocity = (10, 10)

# Set the time step
dt = 0.1

# Loop for 10 seconds
for t in range(10):
  # Update the position and velocity
  x, y = position
  vx, vy = velocity
  x += vx * dt
  y += vy * dt
  vx -= 9.8 * dt * math.sin(math.atan(vy / vx))
  vy -= 9.8 * dt * math.cos(math.atan(vy / vx))
  position = (x, y)
  velocity = (vx, vy)
  # Print the current state
  print(f"Time: {t * dt + 0.1}, Position: {position}, Velocity: {velocity}") # +0.1 since computers start at 0
Time: 0.1, Position: (1.0, 1.0), Velocity: (9.307035354437183, 9.33233702795688)
Time: 0.2, Position: (1.9307035354437183, 1.933233702795688), Velocity: (8.61313069605152, 8.667678122026405)
Time: 0.30000000000000004, Position: (2.7920166050488704, 2.8000015149983284), Velocity: (7.917982148527098, 8.006711376248763)
Time: 0.4, Position: (3.5838148199015802, 3.6006726526232047), Velocity: (7.22116725788158, 7.350366670524219)
Time: 0.5, Position: (4.305931545689738, 4.335709319675627), Velocity: (6.522085877077414, 6.699935112466445)
Time: 0.6, Position: (4.95814013339748, 5.005702830922272), Velocity: (5.819863696246738, 6.05726783162956)
Time: 0.7000000000000001, Position: (5.540126503022154, 5.611429614085228), Velocity: (5.113188994281593, 5.425123225490899)
Time: 0.8, Position: (6.051445402450313, 6.153941936634318), Velocity: (4.400024937635177, 4.807809268945024)
Time: 0.9, Position: (6.491447896213831, 6.634722863528821), Velocity: (3.6770798064811587, 4.2124550615465575)
Time: 1.0, Position: (6.859155876861947, 7.055968369683477), Velocity: (2.9387892334076637, 3.651734153436654)

Simulation Example: SimCity

 Simcity

One example of a simulation in a software or game that is popular among many people is a city-building game, such as SimCity. This type of simulation allows players to design and build their own virtual cities, complete with roads, buildings, and other infrastructure. The game uses complex algorithms and data sets to simulate the various systems and processes involved in city planning and management, such as traffic flow, resource management, and population growth. As the player interacts with the simulation, they are able to see how their decisions as a city planner affect the development and growth of their virtual city. The goal of a city-building game is to provide an engaging and entertaining experience that allows players to explore their creativity and problem-solving skills in a simulated environment.