Function Repository Resource:

SpringPendulumFormula

Source Notebook

Compute the final angle and spring length of a spring pendulum based on initial conditions

Contributed by: Jason Martinez

ResourceFunction["SpringPendulumFormula"][params,cond]

computes the angle and spring length based on system parameters params and initial conditions cond.

ResourceFunction["SpringPendulumFormula"][property]

returns the specified property of the spring pendulum formula.

Details and Options

To solve for the final angle and length of a spring pendulum, the following system parameters must be defined in params:
k"k"spring constant
m"m"mass
l0"l0"spring equalibrium length
Gravitational acceleration "g" can also be specified. If unspecified, it is assumed to be equal to "StandardAccelerationOfGravity".
Additionally, the following initial conditions must be defined in cond:
li"li"initial spring length
t"t"final time
θi"thetai"initial angle from vertical
Parameters can use the keys provided in the second columns or the full QuantityVariable format shown by ResourceFunction["SpringPendulumFormula"]["QuantityVariables"].
In addition to the final spring length and angle, the solutions for the angle and length evolutions ("AngleSolution" and "LengthSolution") from the t=0 to the final time t are provided.
Properties include:
"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

Examples

Basic Examples (2) 

Solve for the final spring length and final angle from the vertical for a spring pendulum:

In[1]:=
ResourceFunction[
 "SpringPendulumFormula"][<|"k" -> Quantity[100, "Newtons"/"Meters"], "l0" -> Quantity[1, "Meters"], "m" -> Quantity[1, "Kilograms"]|>, <|
  "thetai" -> Quantity[55, "AngularDegrees"], "li" -> Quantity[1, "Meters"], "t" -> Quantity[6.1`, "Seconds"]|>]
Out[1]=

Specify gravitational acceleration:

In[2]:=
ResourceFunction["SpringPendulumFormula"][
 Association["k" -> Quantity[100, "Newtons"/"Meters"], "l0" -> Quantity[1, "Meters"], "m" -> Quantity[1, "Kilograms"], "g" -> Entity["Planet", "Mars"][
    EntityProperty["Planet", "Gravity"]]], Association["thetai" -> Quantity[55, "AngularDegrees"], "li" -> Quantity[1, "Meters"], "t" -> Quantity[6.1`, "Seconds"]]]
Out[2]=

Scope (3) 

Examine the equations of motion for a spring pendulum:

In[3]:=
ResourceFunction["SpringPendulumFormula"]["Formula"]
Out[3]=

Find the quantity variables used by the SpringPendulumFormula:

In[4]:=
ResourceFunction["SpringPendulumFormula"]["QuantityVariables"]
Out[4]=

Obtain their formal names:

In[5]:=
ResourceFunction["SpringPendulumFormula"]["QuantityVariableNames"]
Out[5]=

Derive the physical quantities and unit dimensions of the variables:

In[6]:=
ResourceFunction[
 "SpringPendulumFormula"]["QuantityVariablePhysicalQuantities"]
Out[6]=
In[7]:=
ResourceFunction[
 "SpringPendulumFormula"]["QuantityVariableDimensions"]
Out[7]=

Examine a table combining all the information about the quantity variables used or derived by SpringPendulumFormula:

In[8]:=
ResourceFunction["SpringPendulumFormula"]["QuantityVariableTable"]
Out[8]=

Applications (1) 

Plot angle and length evolution over time:

In[9]:=
result = ResourceFunction["SpringPendulumFormula"][
   Association["k" -> Quantity[100, "Newtons"/"Meters"], "l0" -> Quantity[1, "Meters"], "m" -> Quantity[1, "Kilograms"]], Association["thetai" -> Quantity[55, "AngularDegrees"], "li" -> Quantity[1, "Meters"], "t" -> Quantity[6.1`, "Seconds"]]];
In[10]:=
Plot[result["AngleSolution"][t], {t, 0, 6.1}]
Out[10]=
In[11]:=
Plot[result["LengthSolution"][t], {t, 0, 6.1}]
Out[11]=

Version History

  • 1.0.0 – 04 November 2019

Related Resources

License Information