Symbolic mechanics: from optimal trebuchets to simple chaotic machines

Philip Todd

Saltire Software

Apps accompanying the talk are available at       http://euclidsmuse.com/app?id=662

Abstract

Mechanical Expressions is a new symbolic mechanics system which inputs geometric descriptions of a mechanical system and outputs symbolic expressions for static, kinematic and dynamic quantities.  These mathematical expressions may be exported to Mathematica for further analysis.  We illustratethis interaction between Mechanical Expressions and Mathematica in the context of some simple mechanical models.  In particular we use ParametricNDSolveValue[] and Manipulate[] to give a compelling demonstration of the onset of chaos.

Optimal Trebuchet

Ignoring the sling, a trebuchet is a compound pendulum. It has the same design as a metronome, moving relative positions of the mass can quicken or slow it down.

 A problem one might ask is this:  for a given large mass M and a given small mass m, and a given beam length, what is the best location for the pivot?

Mechanical Expressions is able to generate an expression for the acceleration in the angle, which can be pasted into Mathematica.

(Cos[θ]*(((M*(-1))+(x*M*2)+(((M*(-1))+(m*(-1)))*(x)^(2))))^((-1))*(M+(((M*(-1))+(m*(-1)))*x))*g*(a)^((-1))*(-1))

We can differentiate:

(∂_x)(-((g (M+(-m-M) x) Cos[θ])/(a (-M+2 M x+(-m-M) (x^2)))))

And solve for x:

Solve[((g (M+(-m-M) x) (2 M+2 (-m-M) x) Cos[θ])/(a (((-M+2 M x+(-m-M) (x^2)))^2)))-((g (-m-M) Cos[θ])/(a (-M+2 M x+(-m-M) (x^2))))==0,x]

This can be exported as COntent MathML and pasted into Mechanical Expressions

ExportString[((m M+(M^2)-((((m^3) M+2 (m^2) (M^2)+m (M^3)))^(1/2)))/((m^2)+2 m M+(M^2))),"MathML","Presentation"->False,"Content"->True]

Archimedes might have been amused by the fact that the acceleration is identical to that of a simple pendulum whose length is a times the ratio of the geometric mean of m and M to their arithmetic mean.

He would certainly have thought of this geometrically as a ratio of two lengths in this diagram:

Simply Chaotic

As an example of a simple chaotic machine, a mass m acts as a pendulum, and is attached with a spring to a mass M which is allowed to slide along a horizontal rod.  A simple model of the machine has symbolic variables for geometric parameters and also for the physical quantities: mass, spring rate and natural length.

Equations for the acceleration of the model geometric parameters are generated automatically by Mechanical Expressions and may be cut and pasted into Mathematica. The full range of Mathematica’s differential equation solving and visualization capabilities may then be applied.

acct=((Sin[θ]*(m)^((-1))*k*d*(L)^((-1)))+(Sin[θ]*(((L)^(2)+(d)^(2)+(Cos[θ]*d*L*2)))^((-1/2))*(m)^((-1))*k*d*(L)^((-1))*(-1))+(Cos[θ]*g*(L)^((-1))))/.{g->9.8,ω->ω[t],θ->θ[t],d->d[t],m->1,M->1,L->1}

accx=(((d*(-1))+(Cos[θ]*L*(-1)))*(((L)^(2)+(d)^(2)+(Cos[θ]*d*L*2)))^((-1/2))*((-1)+(((L)^(2)+(d)^(2)+(Cos[θ]*d*L*2)))^(1/2))*k*(M)^((-1)))/.{g->9.8,ω->ω[t],θ->θ[t],d->d[t],M->1,m->1,L->1}

For example, applying ParametricNDSolveValue[] and Manipulate[] gives a compelling demonstration of the onset of chaos in this simple device.

pfun=ParametricNDSolveValue[{v'[t]==accx,d'[t]==v[t],ω'[t]==acct,θ'[t]==ω[t],d[0]==1,v[0]==0,θ[0]==0,ω[0]==0},{d,θ,v,ω},{t,0,40},{k}]

fq[xx_]:=pfun[xx]

Manipulate[Plot[fq[k][[2]][x],{x,0.`,40.`}],{k,1,50}]

The chaotic motion itself may be visualized in a Dynamic  element in Mathematica, or exported as a JavaScript app directly from Mechanical Expressions.

Manipulate[ParametricPlot[{fq[k][[2]][x],fq[k][[1]][x]},{x,0.`,40.`}],{k,1,50}]

More..

Mechanical Expressions is currently in open Beta and downloadable from :

www.mechanicalexpressions.com