In Regards to a Physics Simulator
A few peers of mine have been working on an open-source physics simulator. It seems quite promising on the conceptual side, since it tells exactly what inputs are required of the problem and shows how those inputs can be used to solve any given problem of its type. Here's a preview of the code for solving ramp problems (assuming ideal physics).
# @Filename: Ramp Print.py
# @Time: 2/6/2024 11:43 AM
# Description: Calculates the Forces involved with pushing a Box up a ramp and prints the results into a console.
import math
Acceleration = 0
Gravity = 9.8
while True:
Angle = float(input("Input Ramp Angle in Degrees: "))
Angle = math.radians(Angle)
Mass = float(input("Input Mass of box in Kilograms: "))
Friction_Coefficient_Static = float(input("Input Coefficient of Static Friction: "))
Friction_Coefficient_Kinetic = float(input("Input Coefficient of Kinetic Friction: "))
Parallel_Force = float(input("Input force in Newtons: "))
Force_Gravity = Mass * Gravity
Force_Gravity_A = round(Force_Gravity * math.sin(Angle), 10) #Parallel
Force_Gravity_B = round(Force_Gravity * math.cos(Angle), 10) #Perpendicular
Force_Normal = Force_Gravity_B
Friction_Force_Static = round(Friction_Coefficient_Static * Force_Normal, 10)
Friction_Force_Kinetic = round(Friction_Coefficient_Kinetic * Force_Normal, 10)
Parallel_Forces = Parallel_Force - Force_Gravity_A
if(abs(Parallel_Forces) <= Friction_Force_Static):
Acceleration = 0
elif(Parallel_Forces < 0):
Acceleration = round((Parallel_Forces + Friction_Force_Kinetic) / Mass, 10)
else:
Acceleration = round((Parallel_Forces - Friction_Force_Kinetic) / Mass, 10)
print("\nThe Force of Gravity is:", Force_Gravity, "Newtons")
print("The Normal Force is:", Force_Normal, "Newtons")
print("The Force of Gravity acting parallel to the ramp is:", Force_Gravity_A, "Newtons")
print("The Max Force of Static Friction is:", Friction_Force_Static, "Newtons")
print("The Force of Kinetic Friction is:", Friction_Force_Kinetic, "Newtons")
print("The Acceleration of the Box is:", Acceleration, "Meters per second squared")
Quit = input("Quit? (y/n)").lower()
if Quit == 'y' or Quit == 'yes':
break