Wolfram Function Repository
Instant-use add-on functions for the Wolfram Language
Function Repository Resource:
Compute the final angles and spring length of a coupled pendulum based on initial conditions
| ResourceFunction["CoupledPendulumFormula"][parameters,initalcond] computes the angles and spring length based on system parameters and initial conditions initialcond. | |
| ResourceFunction["CoupledPendulumFormula"][property] returns the specified property of the coupled pendulum formula. | 
| d | pivot distance | 
| k | spring constant | 
| l0 | spring equalibrium length | 
| l1 | pendulum 1 length | 
| l2 | pendulum 2 length | 
| m1 | pendulum 1 mass | 
| m2 | pendulum 2 mass | 
| li | initial spring length | 
| t | time | 
| θ1,i | pendulum 1 initial angle from vertical | 
| θ2,i | pendulum 2 initial angle from vertical | 
| "Formula" | equations for spring pendulum | 
| "QuantityVariableDimensions" | list of base dimensions for all variables | 
| "QuantityVariableNames" | English names for all variables | 
| "QuantityVariablePhysicalQuantities" | physical quantities for all variables | 
| "QuantityVariables" | list of all variables | 
| "QuantityVariableTable" | details on all variables | 
Solve for the final spring length and final angles from the vertical for a coupled pendulum:
| In[1]:= | ![ResourceFunction["CoupledPendulumFormula"][
 Association["d" -> Quantity[2, "Meters"], "k" -> Quantity[150, "Newtons"/"Meters"], "l1" -> Quantity[2, "Meters"], "l2" -> Quantity[2, "Meters"], "l0" -> Quantity[2, "Meters"], "m1" -> Quantity[5, "Kilograms"], "m2" -> Quantity[5, "Kilograms"]], Association["theta1i" -> Quantity[20, "AngularDegrees"], "theta2i" -> Quantity[30, "AngularDegrees"], "t" -> Quantity[12, "Seconds"]]]](https://www.wolframcloud.com/obj/resourcesystem/images/9bb/9bb31a31-4733-4e63-982c-2f65d81ff47d/76257884cf0daa67.png)  | 
| Out[1]= |   | 
Specify gravitational acceleration:
| In[2]:= | ![ResourceFunction["CoupledPendulumFormula"][
 Association["d" -> Quantity[2, "Meters"], "k" -> Quantity[150, "Newtons"/"Meters"], "l1" -> Quantity[2, "Meters"], "l2" -> Quantity[2, "Meters"], "l0" -> Quantity[2, "Meters"], "m1" -> Quantity[5, "Kilograms"], "m2" -> Quantity[5, "Kilograms"], "g" -> Entity["Planet", "Mars"][
    EntityProperty["Planet", "Gravity"]]], Association["theta1i" -> Quantity[20, "AngularDegrees"], "theta2i" -> Quantity[30, "AngularDegrees"], "t" -> Quantity[12, "Seconds"]]]](https://www.wolframcloud.com/obj/resourcesystem/images/9bb/9bb31a31-4733-4e63-982c-2f65d81ff47d/0831951d439f3386.png)  | 
| Out[2]= |   | 
Examine the equations of motion for a coupled pendulum:
| In[3]:= | ![ResourceFunction["CoupledPendulumFormula"]["Formula"]](https://www.wolframcloud.com/obj/resourcesystem/images/9bb/9bb31a31-4733-4e63-982c-2f65d81ff47d/7ffc25bb317a68ea.png)  | 
| Out[3]= |   | 
Find the quantity variables used by the CoupledPendulumFormula:
| In[4]:= | ![ResourceFunction["CoupledPendulumFormula"]["QuantityVariables"]](https://www.wolframcloud.com/obj/resourcesystem/images/9bb/9bb31a31-4733-4e63-982c-2f65d81ff47d/3e5c0a1ec72eee3f.png)  | 
| Out[4]= |   | 
Obtain their formal names:
| In[5]:= | ![ResourceFunction["CoupledPendulumFormula"]["QuantityVariableNames"]](https://www.wolframcloud.com/obj/resourcesystem/images/9bb/9bb31a31-4733-4e63-982c-2f65d81ff47d/79a4adc607126799.png)  | 
| Out[5]= |   | 
Derive the physical quantities and unit dimensions of the variables:
| In[6]:= | ![ResourceFunction[
 "CoupledPendulumFormula"]["QuantityVariablePhysicalQuantities"]](https://www.wolframcloud.com/obj/resourcesystem/images/9bb/9bb31a31-4733-4e63-982c-2f65d81ff47d/05b87782dcc21af2.png)  | 
| Out[6]= |   | 
| In[7]:= | ![ResourceFunction[
 "CoupledPendulumFormula"]["QuantityVariableDimensions"]](https://www.wolframcloud.com/obj/resourcesystem/images/9bb/9bb31a31-4733-4e63-982c-2f65d81ff47d/1f75bde82d845147.png)  | 
| Out[7]= |   | 
Examine a table combining all the information about the quantity variables used or derived by CoupledPendulumFormula:
| In[8]:= | ![ResourceFunction["CoupledPendulumFormula"]["QuantityVariableTable"]](https://www.wolframcloud.com/obj/resourcesystem/images/9bb/9bb31a31-4733-4e63-982c-2f65d81ff47d/243989486d9daa71.png)  | 
| Out[8]= |   | 
See how the pendulum angles and spring length evolve over time:
 
  | In[9]:= | ![Plot[{result["Angle1Solution"][t], result["Angle2Solution"][t]}, {t, 0, 12}]](https://www.wolframcloud.com/obj/resourcesystem/images/9bb/9bb31a31-4733-4e63-982c-2f65d81ff47d/71e4d6e3bc92b423.png)  | 
| Out[9]= |   | 
| In[10]:= | ![Plot[result["SpringLengthSolution"][t], {t, 0, 12}]](https://www.wolframcloud.com/obj/resourcesystem/images/9bb/9bb31a31-4733-4e63-982c-2f65d81ff47d/0f3f2dc976d05bf2.png)  | 
| Out[10]= |   | 
This work is licensed under a Creative Commons Attribution 4.0 International License