SamplePublisher`GrassmannCalculus`
UnpackNewtonianDynamics |
|
| | ||||
Details and Options
Examples
(1)
Basic Examples
(1)
In[1]:=
<<GrassmannCalculus`
The abstract Newtonian equations expresses the paradigm: the particle configuration determines the forces and the forces determine the particles' motion.
In[2]:=
MakeDotDisplay |
Out[2]=
m v |
v r |
Here UnpackDynamicEquations expands the abstract equations into detailed equations for two particles in 3-space. It returns a Mathematica Association, which we convert to Normal form and display as a column of entries.
In[3]:=
dynamicAssociation=
[{m,r,v,F},2,{x,y,z},t];dynamicAssociation//Normal//Column
UnpackNewtonianDynamics |
Out[3]=
Newtonian{m v r |
ParticleEquationsm1 v1 v2 r1 r2 |
CoordinateEquations{m1 ′ vx1 ′ vy1 ′ vz1 ′ vx2 ′ vy2 ′ vz2 ′ x1 ′ y1 ′ z1 ′ x2 ′ y2 ′ z2 |
ParticlePositions{r1,r2} |
ParticleDotPositions r1 r2 |
ParticleVelocities{v1,v2} |
ParticleDotVelocities v1 v2 |
ParticleForces{F1[r],F2[r]} |
CoordinatePositions{{x1,y1,z1},{x2,y2,z2}} |
CoordinateDotPositions x1 y1 z1 x2 y2 z2 |
CoordinateVelocities{{vx1,vy1,vz1},{vx2,vy2,vz2}} |
CoordinateDotVelocities vx1 vy1 vz1 vx2 vy2 vz2 |
CoordinateForces{{Fx1[r],Fy1[r],Fz1[r]},{Fx2[r],Fy2[r],Fz2[r]}} |
The Keys in the association are the left hand side of the Rules and are all Strings.
In[4]:=
Keys[dynamicAssociation]//FullForm
Out[4]//FullForm=
List["Newtonian","ParticleEquations","CoordinateEquations","ParticlePositions","ParticleDotPositions","ParticleVelocities","ParticleDotVelocities","ParticleForces","CoordinatePositions","CoordinateDotPositions","CoordinateVelocities","CoordinateDotVelocities","CoordinateForces"]
The "CoordinateEquations" key gives us the detailed differential equations.
In[5]:=
(dequations1=dynamicAssociation["CoordinateEquations"])//Column
Out[5]=
m1 ′ vx1 |
m1 ′ vy1 |
m1 ′ vz1 |
m2 ′ vx2 |
m2 ′ vy2 |
m2 ′ vz2 |
vx1[t] ′ x1 |
vy1[t] ′ y1 |
vz1[t] ′ z1 |
vx2[t] ′ x2 |
vy2[t] ′ y2 |
vz2[t] ′ z2 |
We must specify the forces and initial conditions. Let's consider the case of two bullets shot at , and the second bullet shot at a different time and at right angles so as to intercept the first bullet. The forces on the bullets will be earth's gravity.
45°
In[6]:=
forceRules=Thread[Flatten[dynamicAssociation["CoordinateForces"]]{0,0,-m1g,0,0,-m2g}](dequations2=dequations1/.forceRules)//Column
Out[6]=
{Fx1[r]0,Fy1[r]0,Fz1[r]-gm1,Fx2[r]0,Fy2[r]0,Fz2[r]-gm2}
Out[6]=
m1 ′ vx1 |
m1 ′ vy1 |
m1 ′ vz1 |
m2 ′ vx2 |
m2 ′ vy2 |
m2 ′ vz2 |
vx1[t] ′ x1 |
vy1[t] ′ y1 |
vz1[t] ′ z1 |
vx2[t] ′ x2 |
vy2[t] ′ y2 |
vz2[t] ′ z2 |
Select the equations for the first particle and specify initial conditions.
In[7]:=
d1eqns=dequations2〚{1,2,3,7,8,9}〛initialPositions=Thread[Through[dynamicAssociation["CoordinatePositions"]〚1〛[0]]{-10,0,0}]initialVelocities=Thread[Through[dynamicAssociation["CoordinateVelocities"]〚1〛[0]]{10,0,10}]
Out[7]=
{m1[t]0,m1[t]0,m1[t]-gm1,vx1[t][t],vy1[t][t],vz1[t][t]}
′
vx1
′
vy1
′
vz1
′
x1
′
y1
′
z1
Out[7]=
{x1[0]-10,y1[0]0,z1[0]0}
Out[7]=
{vx1[0]10,vy1[0]0,vz1[0]10}
In[8]:=
(d1Solutions=DSolve[Flatten[Join[d1eqns,initialPositions,initialVelocities]],{x1,y1,z1,vx1,vy1,vz1},t]〚1〛)//Column
Out[8]=
vx1Function[{t},10] |
x1Function[{t},10(-1+t)] |
vy1Function[{t},0] |
y1Function[{t},0] |
vz1Function[{t},10-gt] |
z1Function{t}, 1 2 2 t |
In[9]:=
Solve[z1[t]0/.d1Solutions,t]
Out[9]=
{t0},t
20
g
|
""

