From Napkin Math to Full Simulation: Building a Supersonic Trebuchet Optimizer
Thereâs something delightfully medieval about using AI to design a trebuchetâand something thoroughly modern about wanting it to launch ball bearings at Mach 1.2. The siege engineers of old perfected their craft through decades of physical prototypes and battlefield iteration. I wanted to know in an afternoon whether their design could ever reach supersonic speeds, or whether physics would say ânoâ before I bent a single piece of metal.
Physics had opinions. Strong ones.
The Goal That Might Be Impossible
Hereâs the punchline: achieving 400 m/s with a purely gravitational trebuchet appears to be physically unrealistic at any buildable scale. The optimization framework I built exists precisely to quantify whyâand to find out what speeds are actually achievable.
For context, the trebuchets at Punkin Chunkin competitionsâpurpose-built machines with counterweights exceeding 10,000 poundsâlaunch pumpkins at roughly 50-70 m/s. Iâm asking for six times that velocity with a backyard-scale machine. Since energy requirements scale with velocity squared, I need 36 times the energy transfer efficiency of competition machines.
Thatâs the question worth answering: where exactly does the physics break down?
Starting with the Napkin
Iâd already done preliminary energy calculations. The physics are straightforwardâkinetic energy of a 3.544 gram projectile at 400 m/s works out to roughly 284 Joules. Working backwards through gravitational potential energy, accounting for roughly 15% losses to friction, air resistance, and sling dynamics, you need a counterweight around 32 kg dropping 1.5 meters.
Simple enough. But hereâs where trebuchets get interesting: the geometry matters enormously. Arm length, sling length, pivot position, counterweight drop pathâthese all interact in ways that are surprisingly hard to intuit. Two trebuchets with identical energy inputs can differ by a factor of three in release velocity depending on their proportions.
The Architecture That Emerged
When I described the problem to Claude, it immediately grasped that this wasnât a trivial optimization. The response laid out a multi-file MATLAB architecture: a core dynamics simulator using Lagrangian mechanics, an optimization script with parameter sweeps, visualization tools for validation, and energy tracking to verify efficiency assumptions.
Claude didnât offer to write a quick script. It recognized that simulating a trebuchet properly requires modeling it as a multi-body dynamical systemâthe counterweight, the arm, and the sling all have coupled equations of motion.
The Lagrangian approach tracks total energy in the system and derives motion from how that energy flows between components. For a trebuchet, this is cleaner than applying Newtonâs laws to each part because youâre fundamentally interested in energy transfer: gravitational potential energy becoming rotational kinetic energy becoming projectile velocity.
The Physics That Actually Matters
The core insight for trebuchet design is that youâre not just dropping a weight. Youâre orchestrating a carefully timed energy transfer:
- Counterweight drops, converting potential energy to rotational kinetic energy
- Arm accelerates, with the sling initially trailing behind
- Sling whips forward, adding effective arm length at exactly the right moment
- Release occurs when tangential velocity peaks
Get the geometry wrong and the release angle sends your projectile into the groundâor straight up. The dynamics simulator tracks both the arm angle and sling angle with their own coupled equations of motion, derived from the system Lagrangian:
% Kinetic energy terms
T_arm = 0.5 * I_arm * theta_dot^2;
T_cw = 0.5 * m_cw * v_cw^2;
T_proj = 0.5 * m_proj * (v_arm_tip + v_sling_relative)^2;
% Potential energy terms
V = m_cw * g * y_cw + m_proj * g * y_proj;
% Lagrangian: L = T - V
% Equations of motion: d/dt(dL/d(q_dot)) - dL/dq = 0
The sling isnât passively attachedâits angular acceleration depends on the armâs motion, and its inertia feeds back into the arm dynamics. This coupling is what makes trebuchet optimization non-trivial.
What the Simulations Showed
Hereâs where I have to be honest: I built the framework but havenât completed the full parameter sweeps yet. Preliminary runs with reasonable parameters (3m pivot height, 2m arm, 1.5m sling, 50kg counterweight) produced release velocities around 45-60 m/sâsolidly in the competition trebuchet range, nowhere near supersonic.
Scaling analysis suggests that reaching 400 m/s would require either a counterweight exceeding 2,000 kg with a 10+ meter drop height, mechanical advantage tricks that introduce their own losses, or supplementary energy storage like springs or pneumatics.
The framework now lets me ask precise questions: âWhatâs the maximum velocity achievable with a 3-meter structure and 100 kg counterweight?â The next session will sweep arm ratio, sling length, and counterweight mass to map the feasible design space.
Where AI Helpedâand Where It Didnât
The collaboration wasnât frictionless. Claudeâs initial implementation assumed a fixed-pivot counterweight, but real trebuchets often use a hanging counterweight on a hingeâthis changes the dynamics significantly. I had to point out that energy transfer efficiency depends on the counterweightâs path, not just its drop height.
There was also a moment where Claude generated event detection code for sling release that would have triggered at maximum arm angular velocity rather than maximum projectile tangential velocity. These arenât the same thing because the sling adds its own velocity contribution. Catching that required me to actually understand the physics, not just trust the output.
What worked well: Claude handled the tedious partsâsetting up the ODE solver options, managing event detection callbacks, structuring the parameter sweep loops. It also correctly derived the coupled equations of motion from the Lagrangian I specified, saving considerable algebra.
What required my input: Physical intuition about acceptable simplifications, catching dynamics errors, and knowing which results to sanity-check against the napkin math.
Practical Takeaways
If youâre tackling a physics simulation project with AI assistance:
-
Start with napkin math. Having preliminary calculations gave Claude concrete numbers to sanity-check against. When the simulation produced 55 m/s with parameters that napkin math predicted should yield 60 m/s, we knew we were in the right ballpark.
-
Let the architecture emerge from the problem. Donât force a structure. Describe what you need to learn, and let the tool organization follow from the physics.
-
Validate against known cases. Before trusting the trebuchet simulation, I ran it with the sling length set to zeroâreducing it to a simple catapultâand verified the release velocity matched the analytical solution.
-
Know when physics says âno.â Sometimes the most valuable output is learning that your goal requires rethinking the approach entirely.
Whatâs Next
The next session will run systematic parameter sweeps across three dimensions: arm pivot ratio (0.2 to 0.4), sling length as a multiple of arm length (0.5 to 2.0), and counterweight mass (20 to 200 kg). The output will be a surface plot showing maximum achievable velocity, plus identification of any practical designs that break 100 m/s.
If nothing in the parameter space gets close to supersonic, Iâll have quantified exactly whyâand can start exploring hybrid designs that add spring pre-tension or pneumatic assist.
The medieval engineers had to iterate through physical prototypes, learning from each collapsed frame and misfired projectile. I get to iterate through equations first, finding the walls before I hit them. Thatâs the real luxury of simulationâfailing fast and cheap, in service of eventually building something that works.