Projectile Motion Equations
This notebook derives the equations for the projectile’s position, velocity and acceleration as a function of the trebuchet’s angle parameters
[1]:
from sympy import Function, cos, diff, simplify, sin, symbols
# Define the trebuchet angle variables (time-dependent)
t = symbols("t")
theta = Function("theta")(t) # Arm angle
psi = Function("psi")(t) # Sling angle
# Define the trebuchet lengths
l2, l3 = symbols("l2 l3") # Length of arm and sling
# Define the position of the projectile
px = -l2 * cos(theta) + l3 * cos(psi)
py = -l2 * sin(theta) + l3 * sin(psi)
# Derive the velocity components by differentiating position with respect to time
vx = simplify(diff(px, t))
vy = simplify(diff(py, t))
# Derive the acceleration components by differentiating velocity with respect to time
ax = simplify(diff(vx, t))
ay = simplify(diff(vy, t))
# Output the results
print("Projectile Position:")
print(f"px: {px}")
print(f"py: {py}\n")
print("Projectile Velocity:")
print(f"vx: {vx}")
print(f"vy: {vy}\n")
print("Projectile Acceleration:")
print(f"ax: {ax}")
print(f"ay: {ay}")
Projectile Position:
px: -l2*cos(theta(t)) + l3*cos(psi(t))
py: -l2*sin(theta(t)) + l3*sin(psi(t))
Projectile Velocity:
vx: l2*sin(theta(t))*Derivative(theta(t), t) - l3*sin(psi(t))*Derivative(psi(t), t)
vy: -l2*cos(theta(t))*Derivative(theta(t), t) + l3*cos(psi(t))*Derivative(psi(t), t)
Projectile Acceleration:
ax: l2*sin(theta(t))*Derivative(theta(t), (t, 2)) + l2*cos(theta(t))*Derivative(theta(t), t)**2 - l3*sin(psi(t))*Derivative(psi(t), (t, 2)) - l3*cos(psi(t))*Derivative(psi(t), t)**2
ay: l2*sin(theta(t))*Derivative(theta(t), t)**2 - l2*cos(theta(t))*Derivative(theta(t), (t, 2)) - l3*sin(psi(t))*Derivative(psi(t), t)**2 + l3*cos(psi(t))*Derivative(psi(t), (t, 2))