Help   Copyright (c) 2009-2018 Motion Genesis LLC.  All rights reserved.

Interface (type HELP INTERFACE for quick tips):
 !  Clear  Echo  Help  List  GetMemory  Pause  Run  Quit  Save  if
----------------------------------------------------------------------------
Pre-defined symbols and syntax  (type  HELP SYNTAX  for more help):
 Pi   t   imaginary   &   %   %%   0>   0>>   1>>   >   >>    :=
----------------------------------------------------------------------------
Mathematical Functions  (type  HELP MathFunctions  for more help):
 abs   exp    log   log10   factorial  squared  sqrt   Spline
 cos   sin    tan   cosh    sinh       tanh     acos   asin   atan   atan2
 ceil  floor  int   round   sign       max      min           randomInteger
 cosDegrees   sinDegrees    tanDegrees acosDegrees     ...    atan2Degrees
----------------------------------------------------------------------------
Mathematical commands (work on scalars, vectors, and matrices):
 D Dt DtDt  Epsilon        Evaluate EvaluateToNumber Exclude   Include
 Integrate  GetCoefficient GetRhs   GetTaylorSeries  Linearize ReplaceString
----------------------------------------------------------------------------
Mathematical simplification (work on scalars, vectors, and matrices):
 Expand  Explicit  Factor  FactorLinear  FactorQuadratic  Zee
----------------------------------------------------------------------------
Roots, solving equations, and setting ordinary derivatives
 GetLinearRoots  GetQuadraticRoots  GetPolynomialRoots  ...
 Solve           SolveDt            SolveSetInput       SolveSetInputDt
 SetDt  SolveQuadraticPositiveRoot  SolveQuadraticPositiveRootDt ...
----------------------------------------------------------------------------
Mathematical declarations:
 Constant   Variable   Specified   Pi   ImaginaryNumber   IndependentVariable
 SetGeneralizedSpeed   SetGeneralizedCoordinate
----------------------------------------------------------------------------
Physical declarations:
 NewtonianFrame   RigidBody   RigidFrame   Point   Particle    System
----------------------------------------------------------------------------
Mass, center of mass, inertia, and charge:
 GetMass              SetMass              GetCharge           SetCharge
 GetCmPosition        GetCmVelocity        GetCmAcceleration
 GetInertiaDyadic     GetInertiaMatrix     GetMomentOfInertia
 GetProductOfInertia  GetRadiusOfGyration  GetInertiaVector    SetInertia
----------------------------------------------------------------------------
Vectors and dyadics:
 Cross                   Dot                          Dyadic   Express
 GetAngleBetweenVectors  GetAngleBetweenUnitVectors   GetBasisVector
 GetMagnitude            GetMagnitudeSquared
 GetUnitVector           Vector
----------------------------------------------------------------------------
Matrices:
 GetColumns     GetDeterminant      GetDiagonalMatrix   GetEigen
 GetElement     GetIdentityMatrix   GetInverse          GetRows    GetTrace
 GetTranspose   GetZeroMatrix       Matrix              Convolve   SVD
----------------------------------------------------------------------------
Rotational kinematics (rotation matrices, angular velocity/acceleration):
 Rotate                  RotateX  RotateY  RotateZ   RotateNegativeX  ...
 GetRotationMatrix       SetRotationMatrix           SetRotationMatrixODE
 GetAngularVelocity      SetAngularVelocity          GetAngularSpeed ...
 GetAngularAcceleration  SetAngularAcceleration SetAngularVelocityAcceleration
----------------------------------------------------------------------------
Translational kinematics (position, velocity, and acceleration)
 Translate        SetPositionVelocity        SetVelocityAcceleration
 SetPosition      GetPosition   GetDistance  GetDistanceSquared
 SetVelocity      GetVelocity   GetSpeed     GetElongation
 SetAcceleration  GetAcceleration
----------------------------------------------------------------------------
Forces:
 AddForce              AddForceDamper AddForceElectrostatic  AddForceGravity
 AddForceInverseSquare AddForceSpring AddForceLinearActuator GetResultantForce
----------------------------------------------------------------------------
Torque and Moments:
 AddTorque   AddTorqueDamper   GetMomentOfForces   GetResultantTorque
----------------------------------------------------------------------------
Potential energy and dissipation functions
 GetForceGravityPotentialEnergy         GetForceSpringPotentialEnergy
 GetForceElectrostaticPotentialEnergy   GetForceInverseSquarePotentialEnergy
----------------------------------------------------------------------------
Kinetic energy and Angular/linear momentum (also see Gyrostat):
 GetKineticEnergy GetAngularMomentum GetLinearMomentum GetGeneralizedMomentum
----------------------------------------------------------------------------
Statics and dynamics commands:
 GetStatics    GetStaticsKane    GetStaticsLagrange    Constrain
 GetDynamics   GetDynamicsKane   GetDynamicsLagrange
----------------------------------------------------------------------------
Units and unit conversions:
 ConvertUnits   GetUnitSystem   SetUnitSystem
----------------------------------------------------------------------------
Code languages and commands: .c,  .m,  .f,  .for,  ...
 ODE   Solve   Input   Output   OutputPlot   Plot   Animate
----------------------------------------------------------------------------
Defaults  (type  DEFAULTS  for a list of defaults):
 SetAutoDifferentiate  SetAutoEpsilon     SetAutoExpress     SetAutoFactor
 SetAutoLinearize      SetAutoOverwrite   SetAutoRhs         SetAutoSimplify
 SetAutoTaylorSeries   SetAutoZee         SetBasisSubscripts SetCmSymbol
 SetComplex            SetDigits          SetDefaults        AUTOLEV
 SetLineStepping       SetLineWidth       SetPauseOnWarning  SetUnitSystem
 SetWorkingDirectory   GetEnvironmentValue
----------------------------------------------------------------------------
Type  HELP NAME  for help with NAME; e.g.,  HELP SYNTAX


>
>    >>    >>>

 Purpose:  >    at the end of a name identifies the name as a vector.
           >>   at the end of a name identifies the name as a dyadic.
           >>>  at the end of a name identifies the name as a triadic.

Syntax 1:  nameA>    is treated as a vector.
Syntax 2:  nameB>>   is treated as a dyadic.
Syntax 3:  nameC>>   is treated as a triadic or higher-order polyadic.

 Related:  0>  0>>  1>>  Vector  Dyadic

   (1) %--------------------------------------------------------------------
   (2) % Example:  >    >>    >>>
   (3) %--------------------------------------------------------------------
   (4) RigidFrame  A
   (5) someVector> = 2*Ax> + 3*Ay> + 4*Az>
-> (6) someVector> = 2*Ax> + 3*Ay> + 4*Az>

   (7) someDyadic> = 2*Ax>*Ax> + 3*Ay>*Az>
-> (8) someDyadic> = 2*Ax>*Ax> + 3*Ay>*Az>

   (9) someTriadic> = 2*Ax>*Ax>*Ax> + 3*Ax>*Ay>*Az>
-> (10) someTriadic> = 2*Ax>*Ax>*Ax> + 3*Ax>*Ay>*Az>



0>
0>    0>>    0>>>    0>>>>    ...  etc

 Purpose:  0>    is the zero vector  (0 magnitude and a direction).
           0>>   is the zero dyadic  (0 magnitude and two directions).
           0>>>  is the zero triadic (0 magnitude and three directions).

Syntax 1:  0>            Note:  0>    is a vector, NOT equal to scalar 0.
Syntax 2:  0>>           Note:  0>>   is equivalent to 0> * 0>
Syntax 3:  0>>>          Note:  0>>>  is equivalent to 0> * 0> * 0>
Syntax 4:  0>>>>         Note:  0>>>> is equivalent to 0> * 0> * 0> * 0>

 Related:  >  >>  >>>  0>  0>>  1>>  Vector Dyadic

   (1) %--------------------------------------------------------------------
   (2) % Example:  0>    0>>    0>>>
   (3) %--------------------------------------------------------------------
   (4) RigidFrame A
   (5) someVector> = Cross(  Ax>,  Ax>  )
-> (6) someVector> = 0>

   (7) someDyadic>> = Cross(  Ax> * Ay>,  Ay>  )
-> (8) someDyadic>> = 0>*0>

   (9) someTriadic>>> = Cross(  Ax> * Ay> * Az>,  Az>  )
-> (10) someTriadic>>> = 0>*0>*0>



1>>
1>>

 Purpose:  1>>  is the unit dyadic whose defining property is
           Dot( 1>>, anyVector> ) = anyVector>

  Syntax:  1>>

 Related:  >  >>  >>>  0>  0>>  1>>  Vector Dyadic

   (1) %--------------------------------------------------------------------
   (2) % Example:  1>>
   (3) %--------------------------------------------------------------------
   (4) RigidFrame A
   (5) someVector> = Dot( 1>>, 2*Ax> + 3*Ay> + 4*Az> )
-> (6) someVector> = 2*Ax> + 3*Ay> + 4*Az>
   (7) someDyadic>> = Cross( 1>>, Ax> )
-> (8) someDyadic>> = -Ay>*Az> + Az>*Ay>



!
!

 Purpose:  Opens an operating system command shell or
           issues an operating system command.

Syntax 1:  !
Syntax 2:  !OperatingSystemCommand

   Input:  OperatingSystemCommand -- a command that can be interpreted
           by the operating system (e.g., Windows, OSX, Unix, etc).
           For example, to display the time, type: !time
           To list the files in the current Windows directory, type: !dir
           To list the files in the current Unix directory, type: !ls

Output 1:  Opens an operating system command shell.
           Note:  Type EXIT at the operating system prompt to exit from
           the operating system shell and return to the program workspace.

Output 2:  Passes OperatingSystemCommand to the operating system.

  Remark:  Since OperatingSystemCommand may include the  ;  character
           it must appear on its own input line -- and not on a line
           that has multiple statements separated by a ;, e.g., not as
           !dir *.txt;  !dir *.tex

 Related:  !  %  &  Clear  List  Pause  Quit  Run  Save  GetDefaults

--------------------------------------------------------------------
 Example:  !
--------------------------------------------------------------------
   (1) !dir



%
 %  or  %%

 Purpose:  Marks the beginning of a comment.
           Marks the beginning of a comment that is to be incorporated
           in a C, Fortran, or MATLAB programs.

Syntax 1:  % Put your comment here

Syntax 2:  %% Put a comment to be placed in code here.

 Remark:   A regular comment is a sequence of characters beginning with  %
           Characters following  %  are otherwise ignored.
           A code comment is a sequence of characters beginning with  %%
           Characters after  %%  are written to C, Fortran, or MATLAB codes.

 Related:  !  %  &  Clear  List  Pause  Quit  Run  Save  GetDefaults

--------------------------------------------------------------------
 Example:  %
--------------------------------------------------------------------
   (1) %    File: SomeFileName.txt
   (2) % Purpose: Biomechanic analysis of human motion in deep space

--------------------------------------------------------------------
 Example:  %%
--------------------------------------------------------------------
   (1) %%  This line is written as a comment in C, Fortran, or MATLAB programs.
   (2) %%  if( x == 2 )
   (3) %%    y = sin(x+2);
   (4) %%  else
   (5) %%    y = cos(x+3);



&
 &

 Purpose:  The ampersand  &  is the multi-line continuation symbol.
           It instructs the program to read the next line in a file.
           & is not useful for keyboard input.

 Example:  a =  0 +  1 +  2 +  3 +  4 +  5 +  6 +  7 +  8   &
             + 10 + 11 + 12 + 13 + 14 + 15 + 16 + 17 + 18   &
             + 20 + 21 + 22 + 23 + 24 + 25 + 26 + 27 + 28   &

 Example:  Fred = [ 10, 20, 30, 40;   &
                    14, 22, 33, 41;   &
                    80, 92, 75, 56]

 Related:  !  %  &  Clear  List  Pause  Quit  Run  Save  GetDefaults



+
 + or -
 Purpose:  Adds or subtracts scalars, matrices, vectors, dyadics, etc.
           + declares a real scalar as inherently non-negative.
           - declares a real scalar as inherently non-positive.

Syntax 1:  a + b   returns a plus  b  (the sum of a and b).
           a - b   returns a minus b  (the difference of a and b).
Syntax 2:  Constant J+
Syntax 3:  Constant K-

 Input 1:  a, b -- scalars or matrices or vectors or dyadics or ...
 Input 2:  J:  a scalar name which is regarded as inherently non-negative.
 Input 3:  K:  a scalar name which is regarded as inherently non-positive,
           which affects simplification with abs, sqrt, etc.

  Remark:  Sign can combine with  ceil  or  floor  for if statements, e.g.:
           isPositive    = ceil(  sign(t)/2 )
           isNonNegative = ceil(  sign(t)/2 + 1E-14 )
           isNegative    = floor( sign(t)/2 )

 Related:  +  -  Sign  Constant  Variable  Specified  abs  sqrt

--------------------------------------------------------------------
 Example:  +  or  -
--------------------------------------------------------------------
   (1) sum = 2 + 2
 ->(2) sum = 4
   (3) diff = 9 - 2
 ->(4) diff = 7
   (5) Constant  J+
   (6) y = abs(J) + abs(J) + sqrt(J^2)
 ->(7) y = 3*J
   (8) Constant  K-
   (9) y = abs(K) + abs(K) + sqrt(K^2)
 ->(10) y = -3*L



=
=   :=   +=   *=   /=   ^=    SetDt  SetNoDt

 Purpose:  Assignment operators.

Syntax 1:  A  = B
Syntax 2:  A := B
Syntax 3:  A += B
Syntax 4:  A *= B
Syntax 5:  A /= B
Syntax 6:  A ^= B
Syntax 7:  SetDt( A = B )
Syntax 8:  SetNoDt( A = B )

   Input:  A -- the name of a scalar, vector, dyadic, triadic, or matrix.
           B -- a scalar, vector, dyadic, triadic or matrix expression.

Output 1:  Assigns A = B.
Output 2:  Assigns A = B,          overwriting any previous assignment of A.
Output 3:  Assigns A = Rhs(A) + B, overwriting any previous assignment of A.
Output 4:  Assigns A = Rhs(A) * B, overwriting any previous assignment of A.
Output 5:  Assigns A = Rhs(A) / B, overwriting any previous assignment of A.
Output 6:  Assigns A = Rhs(A) ^ B, overwriting any previous assignment of A.
Output 7:  Assigns A = B  and tries to differentiate to assign A', A'', etc.
Output 8:  Assigns A = B  and does not differentiate to assign A', A'', etc.

 Related:  SetAutoDifferentiate  SetAutoOverwrite
           SetDt  Solve  SolveDt  SolveSetInput  SolveSetInputDt  ...
           SolveQuadraticPositiveRoot  SolveQuadraticPositiveRootDt  ...
           SetDt  SetNoDt   =   :=   +=   *=   /=   ^=

   (1) %--------------------------------------------------------------------
   (2) % Example 1:  :=  (assign overwrite operator)
   (3) %--------------------------------------------------------------------
   (4) x = sin(t)
-> (5) x = sin(t)

   (6) x := t^5
-> (7) x = t^5

   (8) %--------------------------------------------------------------------
   (9) % Example 2:  +=  (assign addition operator)
   (10) %--------------------------------------------------------------------
   (11) x += 2
-> (12) x = 2 + t^5

   (13) %--------------------------------------------------------------------
   (14) % Example 3:  *=  (assign multiply operator)
   (15) %--------------------------------------------------------------------
   (16) x *= 3
-> (17) x = 6 + 3*t^5

   (18) %--------------------------------------------------------------------
   (19) % Example 4:  /=  (assign divide operator)
   (20) %--------------------------------------------------------------------
   (21) x /= 10
-> (22) x = 0.6 + 0.3*t^5

   (23) %--------------------------------------------------------------------
   (24) % Example 5:  ^=  (assign power operator)
   (25) %--------------------------------------------------------------------
   (26) x ^= 0.5
-> (27) x = 0.5477226*sqrt(2+t^5)



AbsError
absError  relError  tInitial  tFinal  tStep  printIntScreen  printIntFile

absError:  Controls numerical integration error (for ODEs) and
           allowed error in solutions to nonlinear algebraic equations.
           absError is a small positive number compared to variables
           being numerically integrated (e.g. via the ODE command)
           or numerically solved (e.g., via the Solve command).

           For numerically integration, absError should be set to
           10^(-8) * xSmall,  where xSmall is the estimated smallest
           maximum absolute value of the variables being integrated.
           The default value of absError (e.g., absError = 1.0E-7) can
           be changed (with optional units) via the Input command, e.g.,
           Input  absError = 1.0E-5

relError:  To override the usually _adequate_ default value, set relError
           to  10^(-d),  where d is the desired number of accurate digits
           for numerical integration (e.g., ODE command).  For example:
           Input  relError = 1.0E-7

           relError is a small non-negative number (0 <= relError <= 0.01),
           has no units, and is generally less than  10^(-n)  where n is
           governed by the SetDigits command (i.e., the number of significant
           digits displayed by the program and the code it generates).

tInitial:  For numerical integration (e.g., ODE command), the default
           initial (start) value of the independent variable (time t) is
           tInitial = 0  and can be changed via the Input command, e.g.,
           Input  tInitial = -3.2 sec

tFinal:    For numerical integration (e.g., ODE command), the default
           final (stop) value of the independent variable (time t) is
           tFinal = 0  and can be changed via the Input command, e.g.,
           Input  tFinal = 5.4 sec

tStep:     For numerical integration (e.g., ODE command), the maximum
           numerical integration stepsize (time-step) is a positive or
           negative number (forward or backward integration) and its
           default value, e.g., 0.01*(tFinal-tInitial), can be changed via
           Input  tStep = 0.002 seconds

printIntScreen:  For numerical integration (e.g., ODE), this nonnegative
           integer (which has no units and a default value of 1) affects the
           interval = tStep * printIntScreen  for OUTPUT to the screen.
           To suppress screen Output, set printIntScreen = 0 via
           Input  printIntScreen = 0

printIntFile:   Similar to printIntScreen (no units and default value of 1)
           except  tStep * printIntFile  affects Output to Files.
           To suppress OUTPUT to files, set  printIntFile = 0  via
           Input  printIntFile = 0

  Remark:  For FORTRAN codes, printIntScreen also controls printIntFile and
           printIntScreen = 0  is identical to printIntScreen = 1.

  Remark:  Solutions are approximate.  Acccuracy tends to improve as the
           input value assigned to absError and/or relError gets smaller.

 Related:  ODE  Solve  Input  Output  OutputPlot  Plot  Animate
           absError  tInitial  tFinal  tStep  printIntScreen  printIntFile
           Solve  SolveDt  SolveSetInput  SolveSetInputDt  ...

   (1) %--------------------------------------------------------------------
   (2) % Example: absError, relError, tInitial, tFinal, tStep, ...
   (3) %--------------------------------------------------------------------
   (4) Variable x'' = 2*sin(x) 
-> (5) x'' = 2*sin(x)

   (6) Input x = 1 m,  x' = 0 m/s
   (7) Input absError = 1E-5 cm,  relError = 1E-7
   (8) Input tInitial = -3 sec,  tFinal = 2 sec,  tStep = 0.02 sec
   (9) Input printIntScreen = 1,  printIntFile = 0
   (10) Output  t sec,  x m,  x' m/s,  x'' m/s^2
   (11) ODE() odePendulumExample



abs
abs

 Purpose:  Returns the absolute value of a real scalar expression
           or the modulus of a complex expression.

  Syntax:  abs( scalarExpression )

   Input:  scalarExpression -- a real or complex scalar expression.

  Output:  Returns the absolute value of scalarExpression

  Remark:  Use GetMagnitude to find the magnitude of a vector.

 Related:  ImaginaryNumber  MathFunctions

   (1) %--------------------------------------------------------------------
   (2) % Example 1: abs   (real scalar expressions)
   (3) %--------------------------------------------------------------------
   (4) A = abs( -3 )
-> (5) A = 3

   (6) B = abs(3+t)
-> (7) B = abs(3+t)

   (8) %--------------------------------------------------------------------
   (9) % Example 2: abs   (complex scalar expressions)
   (10) %--------------------------------------------------------------------
   (11) C = abs( 4 + 3*GetImaginaryNumber() )
-> (12) C = 5

   (13) D = abs( t - 3*GetImaginaryNumber() )
-> (14) D = abs(t-3*imaginary)



acos
acos

 Purpose:  Returns the inverse cosine of a scalar expression.

Syntax 1:  acos( scalarExpression )
Syntax 2:  acosDegrees( realNumber )

   Input:  scalarExpression -- a real or complex scalar expression.
           realNumber -- expression that resolves to a real number.

Output 1:  Radian measure of the inverse cosine of scalarExpression.
Output 2:  Degree measure of the inverse cosine of realNumber.

 Related:  ConvertUnits  ImaginaryNumber  MathFunctions
           cos  sin  tan  acos  asin  atan  atan2  cosDegrees  ...

   (1) %--------------------------------------------------------------------
   (2) % Example 1: acos   (real scalar expressions)
   (3) %--------------------------------------------------------------------
   (4) angleInRadians = acos( 0.5 ) 
-> (5) angleInRadians = 1.047198

   (6) angleInDegrees = acosDegrees( 0.5 )  
-> (7) angleInDegrees = 60

   (8) Arad = acos(0.5+2*t) 
-> (9) Arad = acos(0.5+2*t)

   (10) Adeg = acos(0.5+2*t) * ConvertUnits(rad,deg) 
-> (11) Adeg = 57.29578*acos(0.5+2*t)

   (12) %--------------------------------------------------------------------
   (13) % Example 2: acos   (complex scalar expressions)
   (14) %--------------------------------------------------------------------
   (15) B = acos( 3*GetImaginaryNumber() )
-> (16) B = 1.570796 - 1.818446*imaginary

   (17) C = acos( t - 3*GetImaginaryNumber() )
-> (18) C = acos(t-3*imaginary)



asin
asin

 Purpose:  Returns the inverse sine of a scalar expression.

Syntax 1:  asin( scalarExpression )
Syntax 2:  asinDegrees( realNumber )

   Input:  scalarExpression -- a real or complex scalar expression.
           realNumber -- expression that resolves to a real number.

Output 1:  Radian measure of the inverse sine of scalarExpression.
Output 2:  Degree measure of the inverse sine of realNumber.

 Related:  ConvertUnits  ImaginaryNumber  MathFunctions
           cos  sin  tan  acos  asin  atan  atan2  cosDegrees  ...

   (1) %--------------------------------------------------------------------
   (2) % Example 1: asin   (real scalar expressions)
   (3) %--------------------------------------------------------------------
   (4) angleInRadians = asin( 0.5 ) 
-> (5) angleInRadians = 0.5235988

   (6) angleInDegrees = asinDegrees( 0.5 ) 
-> (7) angleInDegrees = 30

   (8) Arad = asin(0.5+2*t)
-> (9) Arad = asin(0.5+2*t)

   (10) Adeg = asin(0.5+2*t) * ConvertUnits(rad,deg)
-> (11) Adeg = 57.29578*asin(0.5+2*t)

   (12) %--------------------------------------------------------------------
   (13) % Example 2: asin   (complex scalar expressions)
   (14) %--------------------------------------------------------------------
   (15) B = asin( 3*GetImaginaryNumber() )
-> (16) B = 1.818446*imaginary

   (17) C = asin( t - 3*GetImaginaryNumber() )
-> (18) C = asin(t-3*imaginary)



atan
atan

 Purpose:  Returns the inverse tangent of a scalar expression.

Syntax 1:  atan( scalarExpression )
Syntax 2:  atanDegrees( realNumber )

   Input:  scalarExpression -- a real or complex scalar expression.
           realNumber -- expression that resolves to a real number.

Output 1:  Radian measure of the inverse tangent of scalarExpression.
Output 2:  Degree measure of the inverse tangent of realNumber.

 Related:  ConvertUnits  ImaginaryNumber  MathFunctions
           cos  sin  tan  acos  asin  atan  atan2  cosDegrees  ...

   (1) %--------------------------------------------------------------------
   (2) % Example 1: atan   (real scalar expressions)
   (3) %--------------------------------------------------------------------
   (4) angleInRadians = atan( 1.0 ) 
-> (5) angleInRadians = 0.7853982

   (6) angleInDegrees = atanDegrees( 1.0 ) 
-> (7) angleInDegrees = 45

   (8) Arad = atan(0.5+2*t)
-> (9) Arad = atan(0.5+2*t)

   (10) Adeg = atan(0.5+2*t) * ConvertUnits(rad,deg)
-> (11) Adeg = 57.29578*atan(0.5+2*t)

   (12) %--------------------------------------------------------------------
   (13) % Example 2: atan   (complex scalar expressions)
   (14) %--------------------------------------------------------------------
   (15) B = atan( 3*GetImaginaryNumber() )
-> (16) B = 0.25*imaginary

   (17) C = atan( t - 3*GetImaginaryNumber() )
-> (18) C = atan(t-3*imaginary)



atan2
atan2

 Purpose:  Returns the two-argument inverse tangent.

Syntax 1:  atan2( y, x )
Syntax 2:  atan2Degrees( y, x )

   Input:  y -- an expression that resolves to a real number
           x -- an expression that resolves to a real number

  Output:  Returns the angle theta that satisfies the equations

           sin(theta) = y/(x^2+y^2)
           cos(theta) = x/(x^2+y^2)

Output 1:  theta in radians in the range -pi  to pi.
Output 2:  theta in degrees in the range -180 to 180.

  Remark:  y and x cannot both be equal to zero.

 Related:  ConvertUnits  ImaginaryNumber  MathFunctions
           cos  sin  tan  acos  asin  atan  atan2  cosDegrees  ...

   (1) %--------------------------------------------------------------------
   (2) % Example: atan2   
   (3) %--------------------------------------------------------------------
   (4) angleInRadians = atan2(  3,  3 ) 
-> (5) angleInRadians = 0.7853982

   (6) angleInDegrees = atan2Degrees(  3,  3 ) 
-> (7) angleInDegrees = 45

   (8) angleQuadrant2 = atan2Degrees(  3, -3 )
-> (9) angleQuadrant2 = 135

   (10) angleQuadrant3 = atan2Degrees( -3, -3 ) 
-> (11) angleQuadrant3 = -135

   (12) angleQuadrant4 = atan2Degrees( -3,  3 ) 
-> (13) angleQuadrant4 = -45

   (14) angle4Degrees  = atan2( -3, 3 ) * ConvertUnits( rad, deg )
-> (15) angle4Degrees = -45



AddForce
AddForce   ResetForce

 Purpose:  Adds (or resets) force on a point or particle.

Syntax 1:  Q.AddForce(       forceVector )
Syntax 2:  Q.AddForce(   P,  forceVector )
Syntax 3:  Q.ResetForce(     forceVector )
Syntax 4:  Q.ResetForce( P,  forceVector )

   Input:  Q -- the name of a  point  or  particle
           P -- the name of a  point  or  particle
           forceVector -- a force vector

Output 1:  forceVector is added to Force_Q  (accumulates force on Q).
Output 2:  forceVector is added to Force_Q_P>, i.e.,
           accumulates force on two points with action/reaction.
Output 3:  Force_Q>    is reset to  forceVector.
Output 4:  Force_Q_P>  is reset to  forceVector.

  Remark:  Syntax 1 is for  "external"  forces applied to Q.
           Force_Q>  denotes the resultant of contact and distance
           forces on Q that are external to the system.
           "External" means external to all objects in the System, which
           may include the NewtonianFrame (and objects welded to it).

           Syntax 2 is for  "action/reaction"  forces applied to Q from A
           that fully obey Newton's 3rd law (action/reaction), meaning
           forceVector  MUST  be parallel to the line joining P and Q.
           Force_Q_P>  denotes the resultant force on Q from A.

           Avoid Syntax 2 if forceVector is not parallel to line PQ.
           Instead use:  Q.AddForce( forceVector );  P.AddForce( -forceVector )

  Remark:  Alternate ways to apply a force  Vec>  to point Q include:
           Force_Q>  = Vec>    % Resets  Force_Q>  to    Vec>
           Force_Q> += Vec>    % Adds        Vec>  to    Force_Q>
           Force_Q> -= Vec>    % Subtracts   Vec>  from  Force_Q>

  Remark:  If Q is a point of a RigidFrame or RigidBody B, declare it as
           Point Q(B).   This accounts for forces/moments on B.

 Related:  AddForce  AddForceDamper  AddForceElectrostatic  AddForceGravity
           AddForceInverseSquare  AddForceLinearActuator  AddForceSpring
           AddTorque  AddTorqueDamper
           GetMomentOfForces  GetResultantForce  GetResultantTorque
           GetForceGravityPotentialEnergy  GetForceSpringPotentialEnergy
           GetStatics   GetStaticsKane   GetStaticsLagrange
           GetDynamics  GetDynamicsKane  GetDynamicsLagrange

   (1) %--------------------------------------------------------------------
   (2) % Example 1: AddForce  (add force to a point or particle)
   (3) %--------------------------------------------------------------------
   (4) RigidBody  A, B    
   (5) Ao.AddForce( Ax> + 2*Ay> )               
-> (6) Force_Ao> = Ax> + 2*Ay>

   (7) Ao.AddForce( 3*Az> )               
-> (8) Force_Ao> = Ax> + 2*Ay> + 3*Az>

   (9) Acm.AddForce( 4*Ax> + 5*Ay>  + 6*Az> )               
-> (10) Force_Acm> = 4*Ax> + 5*Ay> + 6*Az>

   (11) ResultantForceOnA> = A.GetResultantForce()
-> (12) ResultantForceOnA> = 5*Ax> + 7*Ay> + 9*Az>

   (13) %--------------------------------------------------------------------
   (14) % Example 2: AddForce (action/reaction with two points/particles)
   (15) %--------------------------------------------------------------------
   (16) Ao.AddForce( Bo,  3*Az> )   
-> (17) Force_Ao_Bo> = 3*Az>

   (18) ResultantForceBoFromAo> = Bo.GetResultantForce( Ao )
-> (19) ResultantForceBoFromAo> = -3*Az>

   (20) ResultantForceOnAo> = Ao.GetResultantForce()
-> (21) ResultantForceOnAo> = Ax> + 2*Ay> + 6*Az>

   (22) Acm.AddForce( Bcm,  6*Az> ) 
-> (23) Force_Acm_Bcm> = 6*Az>

   (24) ResultantForceOnA> := A.GetResultantForce()
-> (25) ResultantForceOnA> = 5*Ax> + 7*Ay> + 18*Az>

   (26) ResultantForceOnB> := B.GetResultantForce()
-> (27) ResultantForceOnB> = -9*Az>

   (28) ResultantForceOnS> := System.GetResultantForce()
-> (29) ResultantForceOnS> = 5*Ax> + 7*Ay> + 9*Az>

   (30) %--------------------------------------------------------------------
   (31) % Example 3+4: ResetForce (reset force on a point or particle)
   (32) %--------------------------------------------------------------------
   (33) Ao.ResetForce( sin(t)*Ax> )               
-> (34) Force_Ao> = sin(t)*Ax>

   (35) Ao.ResetForce( Bo,  cos(t)*Az> )   
-> (36) Force_Ao_Bo> = cos(t)*Az>



AddForceDamper
AddForceDamper

 Purpose:  Applies damper forces between two points.

Syntax 1:  Q.AddForceDamper( P, b )
Syntax 2:  Q.AddForceDamper( P, b, elongationExponent )

   Input:  Q -- the name of a point.
           P -- the name of a point.
           b -- the damper constant (scalar)
           elongationExponent -- the exponent on the damper's elongation

Output 1:  Adds a damper force on Q from P whose magnitude is equal to
           b * elongation  where elongation is the time-derivative of
           the distance between Q and P.

Output 2:  Adds a damper force on Q from P whose magnitude is equal to
           b * elongation^elongationExponent.

  Remark:  Q's position vector from P must be available.

  Remark:  If Q is a point of a RigidFrame or RigidBody B, declare it as
           Point Q(B).   This accounts for forces/moments on B.

 Related:  AddForce  AddForceDamper  AddForceElectrostatic  AddForceGravity
           AddForceInverseSquare  AddForceLinearActuator  AddForceSpring
           AddTorque  AddTorqueDamper
           GetMomentOfForces  GetResultantForce  GetResultantTorque
           GetForceGravityPotentialEnergy  GetForceSpringPotentialEnergy
           GetStatics   GetStaticsKane   GetStaticsLagrange
           GetDynamics  GetDynamicsKane  GetDynamicsLagrange

   (1) %--------------------------------------------------------------------
   (2) % Example 1: AddForceDamper 
   (3) %--------------------------------------------------------------------
   (4) NewtonianFrame N
   (5) Particle  P1
   (6) Variable  x', y'
   (7) Constant  b
   (8) P1.SetPositionVelocity( No, x*Nx> )
-> (9) p_No_P1> = x*Nx>
-> (10) v_P1_N> = x'*Nx>

   (11) P1.AddForceDamper( No, b )
-> (12) Force_P1_No> = -b*x'*Nx>

   (13) %--------------------------------------------------------------------
   (14) % Example 2: AddForceDamper 
   (15) %--------------------------------------------------------------------
   (16) Particle  Q1
   (17) Q1.SetPositionVelocity( P1, y*Ny> )
-> (18) p_P1_Q1> = y*Ny>
-> (19) v_Q1_N> = x'*Nx> + y'*Ny>

   (20) Q1.AddForceDamper( P1, b )
-> (21) Force_Q1_P1> = -b*y'*Ny>

   (22) Q1.AddForceDamper( No, b )
-> (23) Force_Q1_No> = -b*x*(x*x'+y*y')/(x^2+y^2)*Nx> - b*y*(x*x'+y*y')/(x^2+y^2)*Ny>

   (24) %--------------------------------------------------------------------
   (25) % Example 3: AddForceDamper 
   (26) %--------------------------------------------------------------------
   (27) Particle  P2
   (28) P2.SetPositionVelocity( No, x*Nx> )
-> (29) p_No_P2> = x*Nx>
-> (30) v_P2_N> = x'*Nx>

   (31) P2.AddForceDamper( No, b, 3 )
-> (32) Force_P2_No> = -b*x'^3*Nx>

   (33) %--------------------------------------------------------------------
   (34) % Example 4: AddForceDamper 
   (35) %--------------------------------------------------------------------
   (36) Particle  Q2
   (37) Q2.SetPositionVelocity( P2, y*Ny> )
-> (38) p_P2_Q2> = y*Ny>
-> (39) v_Q2_N> = x'*Nx> + y'*Ny>

   (40) Q2.AddForceDamper( P2, b, 2 )
-> (41) Force_Q2_P2> = -b*y^3*y'^2/abs(y)^3*Ny>



AddForceElectrostatic
AddForceElectrostatic

 Purpose:  Applies an inverse-square electrostatic force on two points.

  Syntax:  Q.AddForceElectrostatic( P, k )

   Input:  Q -- the name of a point
           P -- the name of a point
           k -- scalar representing the electrostatic proportionality
                constant, approximately 8.9875518E+09 N*m^2/Coulomb^2.

  Output:  Adds an inverse-square-law electrostatic force to Q from P.

  Remark:  Ensure charges are assigned to Q and P with the commands:
           Q.SetCharge(...)  and  P.SetCharge(...).

  Remark:  The NIST approximation for k is 8.9875518E+09 N*m^2/Coulomb^2.

  Remark:  If Q is a point of a RigidFrame or RigidBody B, declare it as
           Point Q(B).   This accounts for forces/moments on B.

 Related:  AddForce  AddForceDamper  AddForceElectrostatic  AddForceGravity
           AddForceInverseSquare  AddForceLinearActuator  AddForceSpring
           AddTorque  AddTorqueDamper
           GetMomentOfForces  GetResultantForce  GetResultantTorque
           GetForceGravityPotentialEnergy  GetForceSpringPotentialEnergy
           GetForceElectrostaticPotentialEnergy  GetCharge  SetCharge
           GetStatics   GetStaticsKane   GetStaticsLagrange
           GetDynamics  GetDynamicsKane  GetDynamicsLagrange

   (1) %--------------------------------------------------------------------
   (2) % Example 1: AddForceElectrostatic  (horizontal 1D)
   (3) %--------------------------------------------------------------------
   (4) NewtonianFrame N
   (5) Particle  A
   (6) Variable  xA
   (7) Constant  k
   (8) No.SetCharge( chargeN )
   (9) A.SetCharge(  chargeA )
   (10) A.SetPosition( No, xA*Nx> )
-> (11) p_No_A> = xA*Nx>

   (12) A.AddForceElectrostatic( No, k )
-> (13) Force_A_No> = chargeA*chargeN*k*xA/abs(xA)^3*Nx>

   (14) %--------------------------------------------------------------------
   (15) % Example 2: AddForceElectrostatic  (planar 2D)
   (16) %--------------------------------------------------------------------
   (17) Particle  P, Q
   (18) Variable  x, y
   (19) P.SetCharge( 10 )
   (20) Q.SetCharge( 20 )
   (21) Q.SetPosition( P, x*Nx> + y*Ny> )
-> (22) p_P_Q> = x*Nx> + y*Ny>

   (23) Q.AddForceElectrostatic( P, k )
-> (24) Force_Q_P> = 200*k*x/(x^2+y^2)^1.5*Nx> + 200*k*y/(x^2+y^2)^1.5*Ny>



AddForceGravity
AddForceGravity

 Purpose:  Applies a force associated with the resultant force produced
           by a uniform parallel gravitational field, to the mass center
           of a massive object (e.g., a Particle or RigidBody) or to all
           particles and/or mass centers of all rigid bodies in a System.

           Applies an inverse-square law gravitational force on a
           Particle from another Particle.

Syntax 1:  Object.AddForceGravity( gravityVector )
Syntax 2:  Q.AddForceGravity( P, G )

   Input:  Object -- the name of a Particle, RigidBody, or System

           gravityVector -- A vector whose magnitude is equal to the
                            local gravitational acceleration constant
                            and whose direction is locally downward.

           Q -- the name of a Particle
           P -- the name of a Particle
           G -- a scalar representing the universal gravitational constant.
                currently estimated by NIST as 6.6732E-11 N m^2 kg^(-2).

Output 1:  Adds a uniform local gravity force to Object (e.g, a Particle or
           the mass center of a RigidBody or all massive objects in a System),
           and returns the sum of all gravity forces added to Object.

Output 2:  Adds a universal gravitational force (inverse square law) to
           Particle Q from Particle P, and returns the force added to Q.
           Note: Q's position vector from P must be available.

  Remark:  Ensure mass is assigned to appropriate particles and bodies
           before issuing an AddForceGravity command.

           NIST defines Earth's gravity acceleration as 9.80665 m/sec^2.
           The NIST approximation for G is 6.6732E-11 N m^2 kg^(-2).
           The mass of the Earth is approximately 5.97E24 kg.
           The mass of the Moon  is approximately 7.34E22 kg.

  Remark:  If Q is a point of a RigidFrame or RigidBody B, declare it as
           Point Q(B).   This accounts for forces/moments on B.

 Related:  AddForce  AddForceDamper  AddForceElectrostatic  AddForceGravity
           AddForceInverseSquare  AddForceLinearActuator  AddForceSpring
           AddTorque  AddTorqueDamper
           GetMomentOfForces  GetResultantForce  GetResultantTorque
           GetForceGravityPotentialEnergy  GetForceSpringPotentialEnergy
           GetStatics   GetStaticsKane   GetStaticsLagrange
           GetDynamics  GetDynamicsKane  GetDynamicsLagrange

   (1) %--------------------------------------------------------------------
   (2) % Example 1: AddForceGravity  (Uniform "local" gravity) 
   (3) %--------------------------------------------------------------------
   (4) NewtonianFrame N
   (5) Particle  P, Q
   (6) RigidBody B
   (7) P.SetMass( mP )
   (8) Q.SetMass( mQ )
   (9) B.SetMass( mB )
   (10) System.AddForceGravity( -9.8*Ny> )
-> (11) Force_Bcm> = -9.8*mB*Ny>
-> (12) Force_P> = -9.8*mP*Ny>
-> (13) Force_Q> = -9.8*mQ*Ny>

   (14) ResultantGravityForce> = System.GetResultantForce()
-> (15) ResultantGravityForce> = (-9.8*mB-9.8*mP-9.8*mQ)*Ny>

   (16) %--------------------------------------------------------------------
   (17) % Example 2: AddForceGravity  (Inverse-square "universal" gravity) 
   (18) %--------------------------------------------------------------------
   (19) Constant  G
   (20) Variable  x, y
   (21) Q.SetPosition( P, x*Nx> + y*Ny> )
-> (22) p_P_Q> = x*Nx> + y*Ny>

   (23) Q.AddForceGravity( P, G )
-> (24) Force_Q_P> = -mP*mQ*G*x/(x^2+y^2)^1.5*Nx> - mP*mQ*G*y/(x^2+y^2)^1.5*Ny>



AddForceInverseSquare
AddForceInverseSquare

 Purpose:  Applies an inverse-square force on a point from another point.

  Syntax:  Q.AddForceInverseSquare( P, coef )

   Input:  Q -- the name of a point
           P -- the name of a point
           coef -- a scalar expression

  Output:  Adds an inverse square force to point Q from point P, and
           returns the force added to particle Q.
           Note: Q's position vector from P must be available.

  Remark:  The force is calculated as:
           coef / Q.GetDistanceSquared(P) * Q.GetUnitVector(P)

  Remark:  A positive coef corresponds to a repulsive force,
           i.e., a force that pushes Q away from P, whereas
           a negative coef corresponds to an attractive force,
           i.e., a force that pulls Q towards P.

  Remark:  If Q is a point of a RigidFrame or RigidBody B, declare it as
           Point Q(B).   This accounts for forces/moments on B.

 Related:  AddForce  AddForceDamper  AddForceElectrostatic  AddForceGravity
           AddForceInverseSquare  AddForceLinearActuator  AddForceSpring
           AddTorque  AddTorqueDamper
           GetMomentOfForces  GetResultantForce  GetResultantTorque
           GetForceGravityPotentialEnergy  GetForceSpringPotentialEnergy
           GetForceElectrostaticPotentialEnergy
           GetStatics   GetStaticsKane   GetStaticsLagrange
           GetDynamics  GetDynamicsKane  GetDynamicsLagrange

   (1) %--------------------------------------------------------------------
   (2) % Example: AddForceInverseSquare
   (3) %--------------------------------------------------------------------
   (4) NewtonianFrame N
   (5) Particle  P, Q
   (6) Variable  x, y
   (7) Q.SetPosition( P, x*Nx> + y*Ny> )
-> (8) p_P_Q> = x*Nx> + y*Ny>

   (9) Q.AddForceInverseSquare( P, 8 )
-> (10) Force_Q_P> = 8*x/(x^2+y^2)^1.5*Nx> + 8*y/(x^2+y^2)^1.5*Ny>



AddForceLinearActuator
AddForceLinearActuator

 Purpose:  Applies a linear actuator force between two points.

Syntax:    Q.AddForceLinearActuator( P, FActuator )

   Input:  Q -- the name of a point.
           P -- the name of a point.
           FActuator -- scalar measure of the force on Q from P.

  Output:  Adds a force on Q from P whose magnitude is FActuator.
           When FActuator is positive, the actuator pushes Q away from P,
           i.e., the actuator force is directed towards Q from P.

  Remark:  Q's position vector from P must be available.

  Remark:  If Q is a point of a RigidFrame or RigidBody B, declare it as
           Point Q(B).   This accounts for forces/moments on B.

 Related:  AddForce  AddForceDamper  AddForceElectrostatic  AddForceGravity
           AddForceInverseSquare  AddForceLinearActuator  AddForceSpring
           AddTorque  AddTorqueDamper
           GetMomentOfForces  GetResultantForce  GetResultantTorque
           GetForceGravityPotentialEnergy  GetForceSpringPotentialEnergy
           GetStatics   GetStaticsKane   GetStaticsLagrange
           GetDynamics  GetDynamicsKane  GetDynamicsLagrange

   (1) %--------------------------------------------------------------------
   (2) % Example 1: AddForceLinearActuator  (on particle A from point No)
   (3) %--------------------------------------------------------------------
   (4) NewtonianFrame N
   (5) Particle  A
   (6) Variable  xA
   (7) Specified Fx
   (8) A.SetPosition( No, xA*Nx> )
-> (9) p_No_A> = xA*Nx>

   (10) A.AddForceLinearActuator( No, Fx )
-> (11) Force_A_No> = Fx*xA/abs(xA)*Nx>

   (12) %--------------------------------------------------------------------
   (13) % Example 2: AddForceLinearActuator  (on particle Q from particle P)
   (14) %--------------------------------------------------------------------
   (15) Particle  P, Q
   (16) Variable  x, y
   (17) Specified F
   (18) Q.SetPosition( P, x*Nx> + y*Ny> )
-> (19) p_P_Q> = x*Nx> + y*Ny>

   (20) Q.AddForceLinearActuator( P, F )
-> (21) Force_Q_P> = F*x/sqrt(x^2+y^2)*Nx> + F*y/sqrt(x^2+y^2)*Ny>



AddForceSpring
AddForceSpring

 Purpose:  Applies spring forces between two points.

Syntax 1:  Q.AddForceSpring( P, k, Ln )
Syntax 2:  Q.AddForceSpring( P, k, Ln, stretchExponent )

   Input:  Q -- the name of a point.
           P -- the name of a point.
           k -- the spring constant (scalar)
           Ln -- the spring's natural length (scalar)
           stretchExponent -- the exponent on the spring's stretch (scalar)

Output 1:  Adds a spring force on Q from P whose magnitude is k * stretch
           where stretch = L-Ln  and  L  is the distance between Q and P.
           The spring pulls Q towards P (spring force is directed from Q to P).

Output 2:  Adds a spring force on Q from P whose magnitude is equal to
           k * stretch^stretchExponent.

  Remark:  Q's position vector from P must be available.

  Remark:  If Q is a point of a RigidFrame or RigidBody B, declare it as
           Point Q(B).   This accounts for forces/moments on B.

 Related:  AddForce  AddForceDamper  AddForceElectrostatic  AddForceGravity
           AddForceInverseSquare  AddForceLinearActuator  AddForceSpring
           AddTorque  AddTorqueDamper
           GetMomentOfForces  GetResultantForce  GetResultantTorque
           GetForceGravityPotentialEnergy  GetForceSpringPotentialEnergy
           GetStatics   GetStaticsKane   GetStaticsLagrange
           GetDynamics  GetDynamicsKane  GetDynamicsLagrange

   (1) %--------------------------------------------------------------------
   (2) % Example 1: AddForceSpring  (natural length is 0)
   (3) %--------------------------------------------------------------------
   (4) NewtonianFrame N
   (5) Particle  P1, Q1
   (6) Variable  x, y
   (7) Constant  k, Ln
   (8) Q1.SetPosition( P1, x*Nx> )
-> (9) p_P1_Q1> = x*Nx>

   (10) Q1.AddForceSpring( P1, k, 0 )
-> (11) Force_Q1_P1> = -k*x*Nx>

   (12) %--------------------------------------------------------------------
   (13) % Example 2: AddForceSpring  (natural length Ln)
   (14) %--------------------------------------------------------------------
   (15) Particle  P2, Q2
   (16) Q2.SetPosition( P2, x*Nx> )
-> (17) p_P2_Q2> = x*Nx>

   (18) Q2.AddForceSpring( P2, k, Ln )
-> (19) Force_Q2_P2> = -k*x*(1-Ln/abs(x))*Nx>

   (20) %--------------------------------------------------------------------
   (21) % Example 3: AddForceSpring  (natural length Ln and exponent 3)
   (22) %--------------------------------------------------------------------
   (23) Particle  P3, Q3
   (24) Q3.SetPosition( P3, y*Ny> )
-> (25) p_P3_Q3> = y*Ny>

   (26) Q3.AddForceSpring( P3, k, Ln, 3 )
-> (27) Force_Q3_P3> = k*y*(Ln-abs(y))^3/abs(y)*Ny>

   (28) %--------------------------------------------------------------------
   (29) % Example 4: AddForceSpring  (position vector with two components)
   (30) %--------------------------------------------------------------------
   (31) Particle  P4, Q4
   (32) Q4.SetPosition( P4, x*Nx> + y*Ny> )
-> (33) p_P4_Q4> = x*Nx> + y*Ny>

   (34) Q4.AddForceSpring( P4, k, Ln )
-> (35) Force_Q4_P4> = -k*x*(1-Ln/sqrt(x^2+y^2))*Nx> - k*y*(1-Ln/sqrt(x^2+y^2))*Ny>



AddTorque
AddTorque  ResetTorque

 Purpose:  Adds (or resets) torque to a RigidFrame or RigidBody.

Syntax 1:  B.AddTorque(       torqueVector )
Syntax 2:  B.AddTorque(   A,  torqueVector )
Syntax 3:  B.ResetTorque(     torqueVector )
Syntax 4:  B.ResetTorque( A,  torqueVector )

   Input:  B -- the name of a  RigidFrame  or  RigidBody.
           A -- the name of a  RigidFrame  or  RigidBody.
           torqueVector -- a torque vector

Output 1:  Adds torqueVector to Torque_B>   (accumulates torque on B)
Output 2:  Adds torqueVector to Torque_B_A> (accumulates torque on B from A)
Output 3:  Torque_B>    is reset to  torqueVector.
Output 4:  Torque_B_A>  is reset to  torqueVector.

  Remark:  Syntax 1 is for  "external"  torques on B.
           Torque_B>  denotes the resultant torque associated with contact
           and distance forces on B that are external to the system.
           "External" means external to all objects in the System, which
           may include the NewtonianFrame (and objects welded to it).

           Syntax 2 is for  "action/reaction"  torques on B from A.
           Torque_B_A>  denotes the torque associated with contact
           and distance forces on B from A.

  Remark:  Alternate ways to apply a torque  Vec>  to B include:
           Torque_B>  = Vec>    % Resets  Torque_B>  to    Vec>
           Torque_B> += Vec>    % Adds        Vec>   to    Torque_B>
           Torque_B> -= Vec>    % Subtracts   Vec>   from  Torque_B>

 Related:  AddForce  AddForceDamper  AddForceElectrostatic  AddForceGravity
           AddForceInverseSquare  AddForceLinearActuator  AddForceSpring
           AddTorque  AddTorqueDamper
           GetMomentOfForces  GetResultantForce  GetResultantTorque
           GetForceGravityPotentialEnergy  GetForceSpringPotentialEnergy
           GetStatics   GetStaticsKane   GetStaticsLagrange
           GetDynamics  GetDynamicsKane  GetDynamicsLagrange

   (1) %--------------------------------------------------------------------
   (2) % Example 1: AddTorque  (add torque to a RigidFrame or RigidBody)
   (3) %--------------------------------------------------------------------
   (4) RigidBody  B
   (5) B.AddTorque( Bx> + 2*By> )
-> (6) Torque_B> = Bx> + 2*By>

   (7) B.AddTorque( 3*Bz> )
-> (8) Torque_B> = Bx> + 2*By> + 3*Bz>

   (9) %--------------------------------------------------------------------
   (10) % Example 2: AddTorque (action/reaction with two rigid objects) 
   (11) %--------------------------------------------------------------------
   (12) RigidFrame A
   (13) B.AddTorque( A,  Ax> + 2*Ay> )
-> (14) Torque_B_A> = Ax> + 2*Ay>

   (15) ResultantTorqueOnA> := A.GetResultantTorque()
-> (16) ResultantTorqueOnA> = -Ax> - 2*Ay>

   (17) ResultantTorqueOnB> := B.GetResultantTorque()
-> (18) ResultantTorqueOnB> = Ax> + 2*Ay> + Bx> + 2*By> + 3*Bz>

   (19) %--------------------------------------------------------------------
   (20) % Example: ResetTorque (reset torque on a RigidFrame or RigidBody)
   (21) %--------------------------------------------------------------------
   (22) B.ResetTorque( sin(t)*Bx> )               
-> (23) Torque_B> = sin(t)*Bx>

   (24) B.ResetTorque( A,  cos(t)*Az> )   
-> (25) Torque_B_A> = cos(t)*Az>



AddTorqueDamper
AddTorqueDamper

 Purpose:  Adds damper torque to a RigidFrame or RigidBody.

Syntax 1:  B.AddTorqueDamper( A, b )
Syntax 2:  B.AddTorqueDamper( A, b, angularRateExponent )

   Input:  B -- the name of a RigidFrame or RigidBody.
           A -- the name of another RigidFrame or RigidBody.
           b -- the damper constant (scalar)
           angularRateExponent -- the exponent on the damper's angular rate

Output 1:  Adds a damper torque on B from A equal to -b * w_B_A>.

Output 2:  Adds a damper torque on B from A whose magnitude is equal to
           b * angularRate^angularRateExponent  where angularRate is the
           magnitude of B's angular velocity in A.  The direction of the
           damper torque is opposite B's angular velocity in A.

 Related:  AddForce  AddForceDamper  AddForceElectrostatic  AddForceGravity
           AddForceInverseSquare  AddForceLinearActuator  AddForceSpring
           AddTorque  AddTorqueDamper
           GetMomentOfForces  GetResultantForce  GetResultantTorque
           GetForceGravityPotentialEnergy  GetForceSpringPotentialEnergy
           GetStatics   GetStaticsKane   GetStaticsLagrange
           GetDynamics  GetDynamicsKane  GetDynamicsLagrange

   (1) %--------------------------------------------------------------------
   (2) % Example 1: AddTorqueDamper  
   (3) %--------------------------------------------------------------------
   (4) NewtonianFrame N
   (5) RigidBody A
   (6) Variable  qA'
   (7) Constant  b    % Damping constant
   (8) A.SetAngularVelocity( N, qA'*Az> )
-> (9) w_A_N> = qA'*Az>

   (10) A.AddTorqueDamper( N, b )
-> (11) Torque_A_N> = -b*qA'*Az>

   (12) %--------------------------------------------------------------------
   (13) % Example 2: AddTorqueDamper  (with angular-rate exponent) 
   (14) %--------------------------------------------------------------------
   (15) RigidBody B
   (16) Variable  qB'
   (17) B.SetAngularVelocity( A, qB'*By> )
-> (18) w_B_A> = qB'*By>

   (19) B.AddTorqueDamper( A, b, 3 )
-> (20) Torque_B_A> = -b*qB'^3*By>

   (21) %--------------------------------------------------------------------
   (22) % Example 3: AddTorqueDamper  (angular-velocity with three components) 
   (23) %--------------------------------------------------------------------
   (24) RigidBody  C
   (25) Variable   wx, wy, wz
   (26) C.SetAngularVelocity( N, wx*Cx> + wy*Cy> + wz*Cz> )
-> (27) w_C_N> = wx*Cx> + wy*Cy> + wz*Cz>

   (28) C.AddTorqueDamper( N, b, 2 )
-> (29) Torque_C_N> = -b*wx*sqrt(wx^2+wy^2+wz^2)*Cx> - b*wy*sqrt(wx^2+wy^2+wz^2)*Cy>
        - b*wz*sqrt(wx^2+wy^2+wz^2)*Cz>



Animate
Animate

 Purpose:  Creates output for objects to be animated by a computer graphic
           visualization program, e.g., MGView (Web) or ANIMAKE (Windows/PC).

Syntax 1:  Animate( N, O,  A,B,C, ... )
Syntax 2:  Animate( N, O )
Syntax 3:  Animate()

   Input:  N -- the name of a RigidFrame or RigidBody
           O -- the name of a Point or Particle
           A,B,C -- names of Point, Particle, RigidFrame, or RigidBody

Output 1:  If  A  is a RigidFrame or RigidBody, calculates rotation matrix N_A,
           position vector p_O_Ao>, and corresponding Output statements.

           If  A  is a Point or Particle, calculates position vector p_O_A> and
           creates corresponding Output statements.

Output 2:  Rotation matrices for all rigid frames/bodies Xi (i=1,2, ...) and
           position vectors from point O to points Xio (i=1,2, ...)
           and corresponding Output statements.

Output 3:  Same as Output 2 where N is the NewtonianFrame and O is
           the NewtonianFrame origin (e.g., No).

 Related:  ODE  Solve  Input  Output  OutputPlot  Plot  Animate
           ConvertUnits  GetUnitSystem  SetUnitSystem  SetDigits

   (1) %--------------------------------------------------------------------
   (2) % Example: Animate  (double pendulum on a cart)
   (3) %--------------------------------------------------------------------
   (4) NewtonianFrame N             
   (5) Particle       A        % Cart
   (6) RigidBody      B, C     % Two pendulums
   (7) Point          BC       % Pin-joint Point connecting B and C
   (8) Variable       xA'      % Differential equation governs xA
   (9) %--------------------------------
   (10) %   Rotational kinematics
   (11) B.SetRotationMatrixZ( N, t )
-> (12) B_N = [cos(t), sin(t), 0;  -sin(t), cos(t), 0;  0, 0, 1]

   (13) C.SetRotationMatrixZ( B, 2*t )
-> (14) C_B = [cos(2*t), sin(2*t), 0;  -sin(2*t), cos(2*t), 0;  0, 0, 1]

   (15) %--------------------------------
   (16) %   Translational kinematics
   (17) xA' = exp(sin(t));      % Actuator connects A to No
-> (18) xA' = exp(sin(t))

   (19) A.SetPosition( No, xA*Nx> )
-> (20) p_No_A> = xA*Nx>

   (21) Bo.SetPosition( A, -0.5*By> )
-> (22) p_A_Bo> = -0.5*By>

   (23) BC.SetPosition( A, -By> )
-> (24) p_A_BC> = -By>

   (25) Co.SetPosition( BC, -0.5*Cy> )
-> (26) p_BC_Co> = -0.5*Cy>

   (27) %--------------------------------
   (28) Animate( N, No, A,B,C )
-> (29) p_No_A = [xA;  0;  0]
-> (30) p_No_Bo = [0.5*sin(t) + xA;  -0.5*cos(t);  0]
-> (31) p_No_Co = [sin(t) + 0.5*sin(3*t) + xA;  -cos(t) - 0.5*cos(3*t);  0]
-> (32) N_C = [cos(3*t), -sin(3*t), 0;  sin(3*t), cos(3*t), 0;  0, 0, 1]

   (33) Input xA = 0.234, tFinal=0.2
   (34) ODE() DoublePendulumOnCart

   (35) %--------------------------------
   (36) %   In response to the ODE command, Output is listed on screen:
   (37) %   Note: Units of GetLengthUnit may be associated with P_No_A[i], ...
   (38) %
   (39) %Output 1: t, P_No_A[1],  P_No_A[2],  P_No_A[3]  
   (40) %Output 2: t, P_No_Bo[1], P_No_Bo[2], P_No_Bo[3],
   (41) %          N_B[1,1] NoUnits, N_B[1,2] NoUnits, N_B[1,3] NoUnits,
   (42) %          N_B[2,1] NoUnits, N_B[2,2] NoUnits, N_B[2,3] NoUnits,
   (43) %          N_B[3,1] NoUnits, N_B[3,2] NoUnits, N_B[3,3] NoUnits
   (44) %Output 3: t, P_No_Co[1], P_No_Co[2], P_No_Co[3],
   (45) %          N_C[1,1] NoUnits, N_C[1,2] NoUnits, N_C[1,3] NoUnits,
   (46) %          N_C[2,1] NoUnits, N_C[2,2] NoUnits, N_C[2,3] NoUnits,
   (47) %          N_C[3,1] NoUnits, N_C[3,2] NoUnits, N_C[3,3] NoUnits


ceil
ceil

 Purpose:  Returns the ceiling of a real scalar expression.

  Syntax:  ceil( realScalarExpression )

   Input:  realScalarExpression -- a real scalar expression.

  Output:  Ceiling of realScalarExpression, i.e., the smallest
           integer greater than or equal to realScalarExpresion.

  Remark:  Sign can combine with  ceil  or  floor  for if statements, e.g.:
           isPositive    = ceil(  sign(t)/2 )
           isNonNegative = ceil(  sign(t)/2 + 1E-14 )
           isNegative    = floor( sign(t)/2 )

 Related:  ceil  floor  int  max  min  round  sign  MathFunctions

   (1) %--------------------------------------------------------------------
   (2) % Example: ceil 
   (3) %--------------------------------------------------------------------
   (4) A = ceil(  2.9999 ) 
-> (5) A = 3

   (6) B = ceil(  3.0001 ) 
-> (7) B = 4

   (8) C = ceil( -2.9999 ) 
-> (9) C = -2

   (10) D = ceil( -3.0001 ) 
-> (11) D = -3

   (12) E = ceil( 2.9 + t ) 
-> (13) E = ceil(2.9+t)

   (14) isPositiveA = Evaluate( ceil( sign(t)/2 ),  t =  200   )
-> (15) isPositiveA = 1

   (16) isPositiveB = Evaluate( ceil( sign(t)/2 ),  t = -200   )
-> (17) isPositiveB = 0

   (18) isPositiveC = Evaluate( ceil( sign(t)/2 ),  t =  0     )
-> (19) isPositiveC = 0

   (20) isPositiveD = Evaluate( ceil( sign(t)/2 ),  t =  1E-21 )
-> (21) isPositiveD = 1

   (22) isPositiveE = Evaluate( ceil( sign(t)/2 ),  t = -1E-21 )
-> (23) isPositiveE = 0

   (24) isNonNegativeA = Evaluate( ceil( sign(t)/2 + 1E-200 ),  t =  0     )
-> (25) isNonNegativeA = 1

   (26) isNonNegativeB = Evaluate( ceil( sign(t)/2 + 1E-200 ),  t =  1E-21 )
-> (27) isNonNegativeB = 1

   (28) isNonNegativeC = Evaluate( ceil( sign(t)/2 + 1E-200 ),  t = -1E-21 )
-> (29) isNonNegativeC = 0



Clear
Clear

 Purpose:  Clears the workspace by restarting the program.
           Re-runs designated lines from the workspace.

Syntax 1:  Clear
Syntax 2:  Clear lineNumber

   Input:  lineNumber -- designates the first line number to be
           deleted after the program restarts.  lineNumber must
           be smaller than the current line number.

Output 1:  Clears the workspace and restarts the program.

Output 2:  Restarts the program and re-executes all input lines
           preceding line lineNumber.

  Remark:  The CLEAR command may not be available on all computers.

 Related:  !  %  &  Clear  List  Pause  Quit  Run  Save  GetDefaults
           ClearInput  ClearOutput  ClearOutputPlot  ClearOutputEncode

--------------------------------------------------------------------
 Example:  Clear
--------------------------------------------------------------------
   (1) a = 2
-> (2) a = 2

   (3) b = 3
-> (4) b = 3

   (5) Clear



Constant
Constant  or  ConstantEncode

 Purpose:  Declares the names of constants.

Syntax 1:  Constant        A,  B,  C+,  D-,  ...
Syntax 2:  Constant        g = 9.8 m/s^2
Syntax 3:  Constant        I = m*L^2
Syntax 4:  ConstantEncode  switchLogic = 1 noUnits
Syntax 5:  Constant        (displays all names declared as Constant)

   Input:  A -- name that starts with a letter, followed by a reasonable
                number of alphanumeric characters (similarly for B).
           A, B, ... are regarded as REAL until SetComplex is ON.

           C+ -- declares C as real and non-negative.
           D- -- declares D as real and non-positive.
           Helps simplification such as  abs(C) = C  or  abs(D) = -D.

Output 2:  g = 9.8  m/s^2  -- declares g as a constant with INPUT 9.8 m/s^2.
Output 3:  I = m*L^2       -- declares I as a constant assigned to m*L^2.
                        (m*L^2 should be a number or a constant expression).

Output 3:  ConstantEncode forces MATLAB(R), C, and Fortran programs to include
           quantities that may not otherwise appear due to code-optimization.

  Remark:  The name  a{i}bb    declares a1bb ... aibb  (i is positive integer).
           The name  a{i:j}bb  declares aibb ... ajbb  (i >= 0  and  i <= j).
           The name  a{m,n}bb  declares amnbb     (m, n are integers 0 to 9).
           The name  a{m:x,n:y}  declares amn ... axy    (m <= x and n <= y).

  Remark:  The SetMass command automatically declares its argument as a
           non-negative constant if the name has not already been declared.

           The SetInertia command automatically declares the arguments
           corresponding to moments of inertia as non-negative constants
           if the names of such arguments have not already been declared.
           Undeclared arguments corresponding to products of inertia are
           automatically declared as constants.

  Remark:  The default name of the independent variable is t.

 Related:  Constant  ImaginaryNumber  Specified  Variable
           SetGeneralizedCoordinate  SetGeneralizedSpeed

   (1) %--------------------------------------------------------------------
   (2) % Example: Constant
   (3) %--------------------------------------------------------------------
   (4) Constant A, B, C+, D-, E{0:3}, F{1:3,1:3}
   (5) Constant I = C * D^2
-> (6) I = C*D^2

   (7) absSimplify = abs(C) + abs(D)
-> (8) absSimplify = C - D

   (9) RigidBody B
   (10) B.SetMass( m )
   (11) B.SetInertia( Bcm, Ixx, Iyy, Izz )


ConvertUnits
ConvertUnits

 Purpose:  Calculates units conversion factors.

Syntax 1:  ConvertUnits(   Units1, Units2 )
           ConvertUnits( s Units1, Units2 )
Syntax 2:  ConvertUnits(   Units1, GetUnitSystem )
           ConvertUnits( s Units1, GetUnitSystem )
Syntax 3:  ConvertUnits(   GetUnitSystem, Units2 )
           ConvertUnits( s GetUnitSystem, Units2 )

   Input:  Units1, Units2 -- expressions consisting of names of units
                             together with the operators *, /, and ^

           s -- a scalar expression, e.g., a number, constant, variable, etc.

Output 1:  Conversion factor from Units1 to Units2 or
           s * ConvertUnits( Units1 * Units2)

Output 2:  Conversion factor from Units1 to the units of SetUnitSystem or
           s * ConvertUnits( Units1 * GetUnitSystem )

Output 3:  Conversion factor from the units of SetUnitSystem to Units2 or
           s * ConvertUnits( GetUnitSystem, Units2 )

  Remark:  Units expressions may include the following names:
           GetMassUnit, GetLengthUnit, GetTimeUnit, GetAngleUnit,
           which stand for, respectively, the current name assigned by
           SetUnitSystem to the units of mass, length, and time, and
           "radian" (which is always associated with GetAngleUnit).

 Related:  ODE  Solve  Input  Output  OutputPlot  Plot  Animate
           ConvertUnits  GetUnitSystem  SetUnitSystem
           GetMassUnit   GetLengthUnit  GetTimeUnit  GetAngleUnit

   (1) %--------------------------------------------------------------------
   (2) %Example 1: ConvertUnits 
   (3) %--------------------------------------------------------------------
   (4) InchesToCentimeter = ConvertUnits( inch, cm )
-> (5) InchesToCentimeter = 2.54

   (6) OunceMassToMilligram = ConvertUnits( ozm, mg )
-> (7) OunceMassToMilligram = 28349.52

   (8) PoundForceToNewton = ConvertUnits( lbf, Newton )
-> (9) PoundForceToNewton = 4.448222

   (10) Convert60MPHToMetersPerSecond = 60 * ConvertUnits( MPH, m/sec )
-> (11) Convert60MPHToMetersPerSecond = 26.8224

   (12) %--------------------------------------------------------------------
   (13) %Example 2: ConvertUnits 
   (14) %--------------------------------------------------------------------
   (15) Convert60MPHToMetersPerSecond := ConvertUnits( (30+30) MPH, m/sec )
-> (16) Convert60MPHToMetersPerSecond = 26.8224

   (17) ConvertTMinutesToSeconds = ConvertUnits( t minutes, seconds )
-> (18) ConvertTMinutesToSeconds = 60*t



Convolve
Convolve

 Purpose:  Convolves two one-dimensional matrices

  Syntax:  Convolve( M, N )

   Input:  M -- one-dimensional matrix having m elements.
           N -- one-dimensional matrix having n element.

  Output:  One-dimensional matrix of m + n - 1 elements,  whose ith-element
           is the sum of the products of the jth element of M and the kth
           element of N such that j + k - 1 = i

  Remark:  If M and N are expressions (not matrices) returns the
           the product of M and N, i.e., returns M*N.

   (1) %--------------------------------------------------------------------
   (2) % Example: Convolve
   (3) %--------------------------------------------------------------------
   (4) Constant  m1,m2,m3, n1,n2
   (5) y = Convolve( [m1,m2,m3], [n1,n2] )
-> (6) y = [m1*n1, m1*n2 + m2*n1, m2*n2 + m3*n1, m3*n2]



cos
cos

 Purpose:  Returns the cosine of a scalar expression.

Syntax 1:  cos( scalarExpressionRad )
Syntax 2:  cosDegrees( realNumberDeg )

   Input:  scalarExpressionRad -- the radian measure of a real or
                                  complex scalar expression.
           realNumberDeg -- expression that resolves to a real number.

Output 1:  Cosine of scalarExpressionRad.
Output 2:  Cosine of realNumberDeg.

 Related:  ConvertUnits  ImaginaryNumber  MathFunctions
           cos  sin  tan  acos  asin  atan  atan2  cosDegrees  ...

   (1) %--------------------------------------------------------------------
   (2) % Example 1: cos   (real scalar expressions)
   (3) %--------------------------------------------------------------------
   (4) A = cos( pi/3 ) 
-> (5) A = 0.5

   (6) B = cosDegrees( 60 ) 
-> (7) B = 0.5

   (8) C = cos(t) + cos( t * ConvertUnits(deg,rad) )
-> (9) C = cos(t) + cos(0.01745329*t)

   (10) D = cos(0.5+2*t)
-> (11) D = sin(2.070796+2*t)

   (12) %--------------------------------------------------------------------
   (13) % Example 2: cos   (complex scalar expressions)
   (14) %--------------------------------------------------------------------
   (15) E = cos( 2 + 3*GetImaginaryNumber() )
-> (16) E = -4.189626 - 9.109228*imaginary

   (17) F = cos( 3*GetImaginaryNumber() + t )
-> (18) F = cos(3*imaginary+t)



cosh
cosh,  sinh,  tanh

 Purpose:  Returns the hyperbolic cosine, sine, or tangent.

Syntax 1:  cosh( scalarExpression )
Syntax 2:  sinh( scalarExpression )
Syntax 3:  tanh( scalarExpression )

   Input:  scalarExpression -- a real or complex scalar expression.

Output 1:  Hyperbolic cosine  of scalarExpression.
Output 2:  Hyperbolic sine    of scalarExpression.
Output 3:  Hyperbolic tangent of scalarExpression.

 Related:  ImaginaryNumber  MathFunctions
           cos  sin  tan  acos  asin  atan  atan2  cosDegrees  ...

   (1) %--------------------------------------------------------------------
   (2) % Example 1: cosh, sinh, tanh   (real scalar expressions)
   (3) %--------------------------------------------------------------------
   (4) A = sinh(2) + cosh(3) + tanh(4)
-> (5) A = 14.69385

   (6) B = sinh(1+2*t) + cosh(3+4*t) + tanh(5+6*t)
-> (7) B = sinh(1+2*t) + cosh(3+4*t) + tanh(5+6*t)

   (8) %--------------------------------------------------------------------
   (9) % Example 2: cosh, sinh, tanh   (complex scalar expressions)
   (10) %--------------------------------------------------------------------
   (11) C = cosh( 2 + 3*GetImaginaryNumber() ) 
-> (12) C = -3.724546 + 0.5118226*imaginary

   (13) D = sinh( 2 + 3*GetImaginaryNumber() )
-> (14) D = -3.590565 + 0.5309211*imaginary

   (15) E = tanh( 2 + 3*GetImaginaryNumber() )
-> (16) E = 0.9653859 - 0.009884375*imaginary

   (17) F = sinh(3*imaginary+t) + cosh(3*imaginary+t)
-> (18) F = sinh(3*imaginary+t) + cosh(3*imaginary+t)



CROSS
Cross   or    Dot

 Purpose:  Forms the cross-product or dot-product for vectors, dyadics, etc.

Syntax 1:  Cross( A, B )
Syntax 2:    Dot( A, B )

   Input:  A -- a vector, dyadic, triadic, or a matrix of these.
           B -- a vector, dyadic, triadic, or a matrix of these.

Output 1:  Cross-product of A and B.
Output 2:    Dot-product of A and B.

  Remark:  When A and B are matrices, perform operations in the order defined
           by matrix multiplication. For the 2x3 matrix A and 3x5 matrix B,
           Cross( A, B )  returns a 2x5 matrix (similarly for Dot).

 Related:  GetMagnitude           GetMagnitudeSquared
           GetDistance            GetDistanceSquared
           GetSpeed               GetSpeedSquared
           GetAngularSpeed        GetAngularSpeedSquared      ConvertUnits
           GetAngleBetweenVectors GetAngleBetweenUnitVectors  Rotate
           GetUnitVector          Vector  Dyadic  Matrix Cross  Dot

   (1) %--------------------------------------------------------------------
   (2) % Example 1: Cross( vector, vector )     Dot( vector, vector )
   (3) %--------------------------------------------------------------------
   (4) RigidFrame A
   (5) Constant   x, y, z
   (6) v> = x*Ax> + y*Ay> + z*Az>
-> (7) v> = x*Ax> + y*Ay> + z*Az>

   (8) w> =   Ax> + 2*Ay> + 3*Az>
-> (9) w> = Ax> + 2*Ay> + 3*Az>

   (10) vCrossw> = Cross( v>, w> )
-> (11) vCrossw> = (3*y-2*z)*Ax> + (z-3*x)*Ay> + (2*x-y)*Az>

   (12) vDotw = Dot(  v>,  w>  )
-> (13) vDotw = x + 2*y + 3*z

   (14) %--------------------------------------------------------------------
   (15) % Example 2: Cross( vector, dyadic )     Dot(  vector, dyadic )
   (16) %--------------------------------------------------------------------
   (17) d>> = Ay>*Ax> - 2*Az>*Az>
-> (18) d>> = Ay>*Ax> - 2*Az>*Az>

   (19) dCrossv>> = Cross( d>>, v> )
-> (20) dCrossv>> = -z*Ay>*Ay> + y*Ay>*Az> + 2*y*Az>*Ax> - 2*x*Az>*Ay>

   (21) dDotv> = Dot( d>>, v> )
-> (22) dDotv> = x*Ay> - 2*z*Az>

   (23) %--------------------------------------------------------------------
   (24) % Example 3: Cross( MatrixOfVectors, MixedMatrixWithDyadicAndVector )
   (25) %--------------------------------------------------------------------
   (26) MCrossN = Cross(  [Ax>; Ay>],  [Ax>, Ay>*Az>]  )
-> (27) MCrossN = [0>, Az>*Az>;  -Az>, 0>*0>]

   (28) MDotN   =   Dot(  [Ax>; Ay>],  [Ax>, Ay>*Az>]  )
-> (29) MDotN = [1, 0>;  0, Az>]



D
D

 Purpose:  Forms the partial derivative of a scalar, vector, dyadic, etc., or
           matrix of scalars, vectors, etc., with respect to a name (e.g.,
           a variable) or a matrix of names (possibly in a reference frame).

Syntax 1:  D( scalarOrMatrixExpression, X )
Syntax 2:  D( tensorOrMatrixExpression, X, refFrame )

   Input:  scalarOrMatrixExpression -- a scalar or matrix of scalar expressions.
           tensorOrMatrixExpression -- a scalar, vector, dyadic, etc., or
                                       matrix of such expressions.
           X -- the name of a scalar orf a matrix of scalar names.
           refFrame -- a reference frame (e.g., RigidFrame or RigidBody).

 Output 1: Partial derivative of scalarOrMatrixExpression with respect to X.
 Output 2: Partial derivative of tensorOrMatrixExpression with respect to X in
           refFrame.

 Related:  D  Dt  DtDt  Integrate  MathFunctions

   (1) %--------------------------------------------------------------------
   (2) % Example 1:  D( scalarExpression, name )
   (3) %--------------------------------------------------------------------
   (4) Variable x, y
   (5) s = sin(t) + 3*x + y^2 
-> (6) s = sin(t) + 3*x + y^2

   (7) Ds_dx = D( s, x )
-> (8) Ds_dx = 3

   (9) Ds_dt = D( s, t )
-> (10) Ds_dt = cos(t)

   (11) y = exp(t)
-> (12) y = exp(t)

   (13) Ds_dt := D( s, t )
-> (14) Ds_dt = cos(t) + 2*exp(t)*y

   (15) %--------------------------------------------------------------------
   (16) % Example 2:  D( matrixExpression, name )
   (17) %--------------------------------------------------------------------
   (18) m = [1, 2*t;  3*x, 4*y^2]
-> (19) m = [1, 2*t;  3*x, 4*y^2]

   (20) Dm_dx = d( m, x )
-> (21) Dm_dx = [0, 0;  3, 0]

   (22) Dm_dt = d( m, t )
-> (23) Dm_dt = [0, 2;  0, 8*exp(t)*y]

   (24) %--------------------------------------------------------------------
   (25) % Example 3:  D( scalarExpression, matrixOfNames )
   (26) %--------------------------------------------------------------------
   (27) Ds_dxyt = D( s, [x,y,t] )
-> (28) Ds_dxyt = [3, 2*y, cos(t) + 2*exp(t)*y]

   (29) %--------------------------------------------------------------------
   (30) % Example 4:  D( matrixExpression, matrixOfNames )
   (31) %--------------------------------------------------------------------
   (32) Dsmdxyt = D( m, [x;y] )
-> (33) Dsmdxyt = [0;  3 + 8*y]

   (34) %--------------------------------------------------------------------
   (35) % Example 5:  D( vectorExpression, name, refFrame )
   (36) %--------------------------------------------------------------------
   (37) RigidFrame A
   (38) v> = Vector( A, 3*x, y^2, 0 )
-> (39) v> = 3*x*Ax> + y^2*Ay>

   (40) Dv_dy_InA> = D( v>, y, A )
-> (41) Dv_dy_InA> = 2*y*Ay>



Dt
Dt

 Purpose:  Forms the ordinary derivative of a scalar, vector, dyadic, etc., or
           matrix of scalars, vectors, etc., (possibly in a reference frame).

Syntax 1:  Dt(     scalarOrMatrixExpression )
Syntax 2:  Dt(     vectorOrMatrixExpression,  refFrame )
Syntax 3:  DtDt(   scalarOrMatrixExpression )
Syntax 4:  DtDt(   vectorOrMatrixExpression,  refFrame )
Syntax 5:  DtDtDt( scalarOrMatrixExpression )
Syntax 6:  DtDtDt( vectorOrMatrixExpression,  refFrame )

   Input:  scalarOrMatrixExpression -- a scalar expression or
                                       matrix of scalar expressions.
           tensorOrMatrixExpression -- a scalar, vector, dyadic, etc., or
                                       matrix of such expressions.
           refFrame -- a reference frame (e.g., RigidFrame or RigidBody)

Output 1:  1st-ordinary derivative of scalarOrMatrixExpression.
Output 2:  1st-ordinary derivative of tensorOrMatrixExpression in refFrame.
Output 3:  2nd-ordinary derivative of scalarOrMatrixExpression.
Output 4:  2nd-ordinary derivative of tensorOrMatrixExpression in refFrame.
Output 5:  3rd-ordinary derivative of scalarOrMatrixExpression.
Output 6:  3rd-ordinary derivative of tensorOrMatrixExpression in refFrame.

  Remark:  The prime symbol ' denotes implicit ordinary differentiation with
           respect to the independent variable (which is t by default).
           For example, x' denotes dx/dt (e.g., ordinary time-derivative of x).

  Remark:  DtDt is preferable to DDt.  DtDtDt is preferable to DDDt.

 Related:  D  Dt  DtDt  DtDtDt  Integrate  MathFunctions
           SetDt  Solve  SolveDt  SolveSetInput  SolveSetInputDt  ...
           SolveQuadraticPositiveRoot  SolveQuadraticPositiveRootDt  ...

   (1) %--------------------------------------------------------------------
   (2) % Example 1:  Dt( scalarExpression, name )
   (3) %--------------------------------------------------------------------
   (4) s = sin(t)
-> (5) s = sin(t)

   (6) s1stDerivative = Dt( s )
-> (7) s1stDerivative = cos(t)

   (8) s2ndDerivative = DtDt( s )
-> (9) s2ndDerivative = -sin(t)

   (10) s3rdDerivative = DtDtDt( s )
-> (11) s3rdDerivative = -cos(t)

   (12) %--------------------------------------------------------------------
   (13) % Example 2:  Dt( matrixExpression, name )
   (14) %--------------------------------------------------------------------
   (15) Variable  x'', y''
   (16) m = [1, 2*t;  3*x, 4*y^2]
-> (17) m = [1, 2*t;  3*x, 4*y^2]

   (18) m1stDerivative = Dt( m )
-> (19) m1stDerivative = [0, 2;  3*x', 8*y*y']

   (20) m2ndDerivative = DtDt( m )
-> (21) m2ndDerivative = [0, 0;  3*x'', 8*y'^2 + 8*y*y'']

   (22) %--------------------------------------------------------------------
   (23) % Example 3:  Dt( vectorExpression, refFrame )
   (24) %--------------------------------------------------------------------
   (25) RigidFrame A
   (26) v> = Vector( A, 3*x, y^2, 0 )
-> (27) v> = 3*x*Ax> + y^2*Ay>

   (28) v1stDerivativeInA> = Dt( v>, A )
-> (29) v1stDerivativeInA> = 3*x'*Ax> + 2*y*y'*Ay>

   (30) v2ndDerivativeInA> = DtDt( v>, A )
-> (31) v2ndDerivativeInA> = 3*x''*Ax> + (2*y'^2+2*y*y'')*Ay>

   (32) %--------------------------------------------------------------------
   (33) % Example 4:  Dt( tensorExpression, refFrame )
   (34) %--------------------------------------------------------------------
   (35) DtOfTensorInA = Dt( [s, v>], A )
-> (36) DtOfTensorInA = [cos(t), 3*x'*Ax> + 2*y*y'*Ay>]



Dyadic
Dyadic

 Purpose:  Constructs a dyadic.

Syntax 1:  Dyadic( A,  xx, yy, zz )
Syntax 2:  Dyadic( A,  xx,xy,xz, yx,yy,yz, zx,zy,zz )
Syntax 3:  Dyadic( A,  threeElementMatrix )
Syntax 4:  Dyadic( A,  nineElementMatrix )
Syntax 5:  Dyadic( A,  dyadic>>   )

   Input:  A -- the name of a RigidFrame or RigidBody
           xx, xy, xz, ..., zz -- scalar expressions
           threeElementMatrix -- 3x1  or  1x3 matrix of scalars
           nineElementMatrix --  9x1  or  1x9  or  3x3 matrix

Output 1:   xx*Ax>*Ax> + yy*Ay>*Ay> + zz*Az>*Az>

Output 2:   xx*Ax>*Ax> + xy*Ax>*Ay> + xz*Ax>*Az>
          + yx*Ay>*Ax> + yy*Ay>*Ay> + yz*Ay>*Az>
          + zx*Az>*Ax> + zy*Az>*Ay> + zz*Az>*Az>

Output 3:  3x3  matrix whose elements are the Ai>*Aj>
           (i,j = x,y,z) measures of dyadic>>

Output 3:  Similar to Output 1.
Output 4:  Similar to Output 2.

 Related:  >  >>  >>>  0> 0>> 1>>  Dyadic  Matrix  Vector  Express

   (1) %--------------------------------------------------------------------
   (2) % Example 1:  Dyadic( A,  xx, yy, zz )
   (3) %--------------------------------------------------------------------
   (4) RigidFrame A, B
   (5) Constant   xx, yy, zz
   (6) dyadic1>> = Dyadic( A, xx, yy, zz )
-> (7) dyadic1>> = xx*Ax>*Ax> + yy*Ay>*Ay> + zz*Az>*Az>

   (8) %--------------------------------------------------------------------
   (9) % Example 2:  Dyadic( A,  xx,xy,xz, yx,yy,yz,  zx,zy,zz )
   (10) %--------------------------------------------------------------------
   (11) Constant   xy, xz, yx, yz, zx, zy
   (12) dyadic2>> = Dyadic( A, xx,xy,xz, yx,yy,yz, zx,zy,zz )
-> (13) dyadic2>> = xx*Ax>*Ax> + xy*Ax>*Ay> + xz*Ax>*Az> + yx*Ay>*Ax> + yy*Ay>*Ay>
        + yz*Ay>*Az> + zx*Az>*Ax> + zy*Az>*Ay> + zz*Az>*Az>

   (14) %--------------------------------------------------------------------
   (15) % Example 3:  Dyadic( A,  threeElementMatrix )
   (16) %--------------------------------------------------------------------
   (17) dyadic3>> = Dyadic( A, [xx; yy; zz] )
-> (18) dyadic3>> = xx*Ax>*Ax> + yy*Ay>*Ay> + zz*Az>*Az>

   (19) %--------------------------------------------------------------------
   (20) % Example 4:  Dyadic( nineElementMatrix )
   (21) %--------------------------------------------------------------------
   (22) dyadic4>> = Dyadic( A, [1, 2, 3;  4, 5, 6;  7, 8, 9] )
-> (23) dyadic4>> = Ax>*Ax> + 2*Ax>*Ay> + 3*Ax>*Az> + 4*Ay>*Ax> + 5*Ay>*Ay>
        + 6*Ay>*Az> + 7*Az>*Ax> + 8*Az>*Ay> + 9*Az>*Az>

   (24) %--------------------------------------------------------------------
   (25) % Example 5:  Dyadic( A,  dyadic>> )
   (26) %--------------------------------------------------------------------
   (27) B.SetRotationMatrixZ( A, t ) 
-> (28) B_A = [cos(t), sin(t), 0;  -sin(t), cos(t), 0;  0, 0, 1]

   (29) matrix1 = Dyadic( A,  2*Ax>*Ax> + 3*Ay>*Ay> + 4*Ax>*Ay> + 5*Ay>*Ax> )
-> (30) matrix1 = [2, 4, 0;  5, 3, 0;  0, 0, 0]

   (31) matrix2 = Dyadic( B,  Ax>*Bz> + 2*Ay>*Bz> + 3*Az>*Bx> + 4*Bz>*Bz> )
-> (32) matrix2 = [0, 0, cos(t) + 2*sin(t);  0, 0, 2*cos(t) - sin(t);  3, 0, 4]



Echo
Echo

 Purpose:  Display messages on the screen.

  Syntax:  ECHO( MSG )

   Input:  MSG -- A string of characters that may include special
           character sequences which have a special effect, i.e.,

           SEQUENCE         EFFECT
           ------------------------------------------------------
           \a               Audible beep
           \p               Pauses program using the SetPause setting
           \p=n             Pauses n milliseconds (n = 0, 200, 3000, ...)
           \k               Reads input from the keyboard (not file)
           \0               Terminates printing of MSG
           \n               Prints a newline character
           \e               Puts a newline character, indents 7 spaces
           \w               Puts a newline character, indents 9 spaces
           \#               Prints the # character
           \\               Prints the \ character
           #CMSymbol#       Prints the name assigned to CMSymbol.
           #NewtonianFrame# If  a  NewtonianFrame has been declared,
                            prints  the  name of that frame,
                            otherwise #NewtonianFrame# is printed.

  Output:  MSG is printed to the screen

  Remark:  To prevent the removal of extra spaces, put the message in
           quotes, e.g., Echo( "Hello World! ).   The ECHO command is
           helpful when creating external commands (.a and .r files).

  Related: SetBeepSoundOnError

 Example:

   (1) Echo( Renee says 1 + 1 = 2 )
Renee says 1+1=2

   (1) Echo("Renee says 1 + 1 = 2" )
Renee says 1 + 1 = 2

   (1) Echo(\k\a"Error: Wrong arguments to the myFunction command" )
Error: Wrong arguments to the myFunction command



Encode
ConstantEncode  SpecifiedEncode  OutputEncode

 Purpose:  Instructs MATLAB(R), C, and Fortran programs to incorporate
           additional inputs, outputs, or calculations that may
           not otherwise appear because of code-optimization.

Syntax 1:  ConstantEncode  -- type  HELP CONSTANT   for information.
Syntax 2:  SpecifiedEncode -- type  HELP SPECIFIED  for information.
Syntax 3:  OutputEncode    -- type  HELP OUTPUT     for information.

  Remark:  Type  ConstantEncode to list the quantities previously
           named in a ConstantEncode declaration.
           Similarly type  SpecifiedEncode  or  OutputEncode.

 Related:  ODE  Solve  Input  Output  OutputPlot  Plot  Animate
           ConvertUnits  GetUnitSystem  SetUnitSystem  SetDigits
           Constant  Specified  Output

   (1) %--------------------------------------------------------------------
   (2) % Example 1: ConstantEncode
   (3) %--------------------------------------------------------------------
   (4) % ConstantEncode  a, b, c
   (5) %
   (6) %--------------------------------------------------------------------
   (7) % Example 2: SpecifiedEncode
   (8) %--------------------------------------------------------------------
   (9) % SpecifiedEncode  slipStickTest, Fx, vx, theta''
   (10) %
   (11) %--------------------------------------------------------------------
   (12) % Example 3: OutputEncode  
   (13) %--------------------------------------------------------------------
   (14) Variables  x'' = cos(t)
-> (15) x'' = cos(t)

   (16) SetUnitSystem( kg, m, sec )
   (17) Input  x = 3 miles,  x' = 0 ft/sec,  tFinal = 10 sec
   (18) OutputEncode  t seconds, x inches, x ft,  2*x km,  sin(x) noUnits
   (19) ODE()  EncodeExample.m



Epsilon
Epsilon

 Purpose:  Rounds numbers that are suitably close to an integer.

  Syntax:  Epsilon( mathExpression, n )

   Input:  mathExpression -- A scalar, vector, matrix, ... expression.

           n -- a number greater than or equal to zero, and less
                than or equal to 0.5, i.e.,  0 <= n <= 0.5

  Output:  In mathExpression, rounds any number that is within n of an
           integer to this integer.  Replaces number of the form x.y with:
           (a) x,   if 0.y is less than or equal to n
           (b) x+1, if 0.y is greater than n and greater than or equal to 1-n
           (c) No rounding occurs when 0.y is greater than n and less than 1-n.

 Remark:   If SetAutoEpsilon(d) has also been employed,
           n should be greater than or equal to d.

 Related:  Epsilon  Evaluate  Expand  Explicit
           Factor  FactorLinear  FactorQuadratic  ReplaceString
           SetAutoEpsilon  SetDigits

   (1) %--------------------------------------------------------------------
   (2) % Example 1:  Epsilon   (scalar expressions)
   (3) %--------------------------------------------------------------------
   (4) mathExpression = 0.002 + 0.02*t + 0.2*sin(t)
-> (5) mathExpression = 0.002 + 0.02*t + 0.2*sin(t)

   (6) e1 = Epsilon( mathExpression, 0.001 )
-> (7) e1 = 0.002 + 0.02*t + 0.2*sin(t)

   (8) e2 = Epsilon( mathExpression, 0.003 )
-> (9) e2 = 0.02*t + 0.2*sin(t)

   (10) e3 = Epsilon( mathExpression, 0.03 )
-> (11) e3 = 0.2*sin(t)

   (12) e4 = Epsilon( mathExpression, 0.3 )
-> (13) e4 = 0

   (14) %--------------------------------------------------------------------
   (15) % Example 2:  Epsilon  (vector expressions)
   (16) %--------------------------------------------------------------------
   (17) RigidFrame  N
   (18) v> = Vector( N, 0.02*sin(t), 0.2*cos(t), 3.101 )
-> (19) v> = 0.02*sin(t)*Nx> + 0.2*cos(t)*Ny> + 3.101*Nz>

   (20) v1> = Epsilon( v>, 0.01 )
-> (21) v1> = 0.02*sin(t)*Nx> + 0.2*cos(t)*Ny> + 3.101*Nz>

   (22) v2> = Epsilon( v>, 0.1 )
-> (23) v2> = 0.2*cos(t)*Ny> + 3.101*Nz>

   (24) v3> = Epsilon( v>, 0.2 )
-> (25) v3> = 3*Nz>

   (26) %--------------------------------------------------------------------
   (27) % Example 3:  Epsilon  (matrix expression) 
   (28) %--------------------------------------------------------------------
   (29) m = [mathExpression; v>]
-> (30) m = [mathExpression;  0.02*sin(t)*Nx> + 0.2*cos(t)*Ny> + 3.101*Nz>]

   (31) m1 = Epsilon( m, 0.03 )
-> (32) m1 = [mathExpression;  0.2*cos(t)*Ny> + 3.101*Nz>]

   (33) m2 = Epsilon( m, 0.5 )
-> (34) m2 = [mathExpression;  3*Nz>]



Evaluate
Evaluate,  EvaluateAtInput,  EvaluateToNumber

 Purpose:  Evaluates an expression by replacing designated symbols.

Syntax 1:  Evaluate( mathExpression, name1=rhs1, name2=rhs2, ... )
Syntax 2:  EvaluateAtInput( mathExpression )
           EvaluateAtInput( mathExpression, name1=rhs1, name2=rhs2, ... )
Syntax 3:  EvaluateToNumber( mathExpression )
           EvaluateToNumber( mathExpression, name1=rhs1, name2=rhs2, ... )

   Input:  mathExpression -- A scalar, vector, matrix, ... expression.
           namei -- The name of a symbol (e.g., a constant or variable).
           rhsi -- An expression to substitute for namei. (i=1,2,...),
                   with optional units (e.g., x = 3 deg).

Output 1:  Returns mathExpression evaluated with rhsi substituted
           for namei wherever namei appears in mathExpression.

Output 2:  In addition to making substitutions described in Output 1 (above),
           evaluates an expression using values assigned in Input statements.
           When a previous Input statement has been issued of the form:

           Input x=xValue, y=yValue deg, z=zValue km/hour

           returns mathExpression evaluated with xValue substituted for x,
           yValue * ConvertUnits(deg,rad)               substituted for y,
           zValue * ConvertUnits(km/hr, GetUnitSystem)  substituted for z.

Output 3:  In addition to evaluating as described in Output 1 and 2,
           uses any assignment in the workspace of the form
           x = someNumber    (e.g., x = 2.3).

 Remark:   The units conversion factor used for arguments of the form
           x = 3 km/hour   depends on the current UnitSystem.

 Related:  Epsilon  Evaluate  EvaluateAtInput  Explicit  GetRhs
           Input  ReplaceString  SetAutoRhs  SetUnitSystem

   (1) %--------------------------------------------------------------------
   (2) % Example 1: Evaluate   (scalar expression)
   (3) %--------------------------------------------------------------------
   (4) Variable  x, y
   (5) z = x^2*cos(y) - sin(t)
-> (6) z = x^2*cos(y) - sin(t)

   (7) zEvaluated1 = Evaluate( z, x=2, y=60 deg, t=30 deg )
-> (8) zEvaluated1 = 1.5

   (9) zEvaluated2 = Evaluate( z, x=t, y=t^3 )
-> (10) zEvaluated2 = t^2*cos(t^3) - sin(t)

   (11) %--------------------------------------------------------------------
   (12) % Example 2: Evaluate   (vector expression)
   (13) %--------------------------------------------------------------------
   (14) RigidBody   B
   (15) v> = Vector( B, x, y, z )
-> (16) v> = x*Bx> + y*By> + z*Bz>

   (17) vEvaluated1> = Evaluate( v>, x=1 km, y=2 m, z=3 cm )
-> (18) vEvaluated1> = 1000*Bx> + 2*By> + 0.03*Bz>

   (19) vEvaluated2> = Evaluate( v>, x=t km, y=t^3 m )
-> (20) vEvaluated2> = 1000*t*Bx> + t^3*By> + (1000000*t^2*cos(t^3)-sin(t))*Bz>

   (21) %--------------------------------------------------------------------
   (22) % Example 3: Evaluate   (matrix expression)
   (23) %--------------------------------------------------------------------
   (24) matrix[1] = v>
-> (25) matrix[1] = x*Bx> + y*By> + z*Bz>

   (26) matrix[2] = z
-> (27) matrix[2] = z

   (28) matrix[3] = x + y + z
-> (29) matrix[3] = x + y + z

   (30) matrixEvaluated1 = Evaluate( matrix, x=1 km, y=2, z=3 cm )
-> (31) matrixEvaluated1 = [1000*Bx> + 2*By> + 0.03*Bz>;  0.03;  1002.03]

   (32) matrixEvaluated2 = Evaluate( matrix, x=t, y=t^3 )
-> (33) matrixEvaluated2[1] = t*Bx> + t^3*By> + (t^2*cos(t^3)-sin(t))*Bz>
-> (34) matrixEvaluated2[2] = t^2*cos(t^3) - sin(t)
-> (35) matrixEvaluated2[3] = t + t^3 + t^2*cos(t^3) - sin(t)

   (36) %--------------------------------------------------------------------
   (37) % Example 4: EvaluateAtInput 
   (38) %--------------------------------------------------------------------
   (39) s = sin(y) + cos(t)*x^2
-> (40) s = sin(y) + cos(t)*x^2

   (41) Input x=4, y=150 deg
   (42) sEvaluated2 = EvaluateAtInput( s )
-> (43) sEvaluated2 = 0.5 + 16*cos(t)

   (44) sEvaluated3 = EvaluateAtInput( s, x=t^2 )
-> (45) sEvaluated3 = 0.5 + t^4*cos(t)

   (46) sEvaluated4 = EvaluateAtInput( s, x=t^2, y=t deg )
-> (47) sEvaluated4 = sin(0.01745329*t) + t^4*cos(t)

   (48) %--------------------------------------------------------------------
   (49) % Example 5: EvaluateToNumber 
   (50) %--------------------------------------------------------------------
   (51) t = 2
-> (52) t = 2

   (53) sEvaluatedToNumber = EvaluateToNumber( s, y = log(2)*GetImaginaryNumber() )
-> (54) sEvaluatedToNumber = -6.658349 + 0.75*imaginary



exp
exp

 Purpose:  Returns the exponential function of a scalar expression.

  Syntax:  exp( scalarExpression )

   Input:  scalarExpression -- a real or complex scalar expression.

  Output:  Exponential function of scalarExpression, i.e., the number
           e (2.71828...) raised to the power scalarExpression.

 Related:  ImaginaryNumber  MathFunctions

   (1) %--------------------------------------------------------------------
   (2) % Example 1: exp   (real scalar expressions)
   (3) %--------------------------------------------------------------------
   (4) A = exp( 2 ) 
-> (5) A = 7.389056

   (6) B = exp(2*t)
-> (7) B = exp(2*t)

   (8) C = exp(0.5+2*t)
-> (9) C = 1.648721*exp(2*t)

   (10) %--------------------------------------------------------------------
   (11) % Example 2: exp   (complex scalar expressions)
   (12) %--------------------------------------------------------------------
   (13) D = exp( 2 + 3*GetImaginaryNumber() )
-> (14) D = -7.31511 + 1.042744*imaginary

   (15) E = exp( 3*GetImaginaryNumber() + t )
-> (16) E = exp(3*imaginary+t)



Expand
Expand

 Purpose:  Produces an expression mathematically equivalent to a given expression,
           but usually containing fewer parentheses.

Syntax 1:  Expand( mathExpression )
Syntax 2:  Expand( mathExpression, n )
Syntax 3:  Expand( mathExpression, n:m )
Syntax 4:  Expand( mathExpression, X )
Syntax 5:  Expand( mathExpression, n, X )
Syntax 6:  Expand( mathExpression, n:m, X )

   Input:  mathExpression -- A scalar, vector, matrix, ... expression.

           n -- a positive integer
           m -- a positive integer

           X -- The name of a scalar symbol (e.g., a constant or variable)
                or a comma-separated list of names of scalars
                or a matrix of scalar names.

Output 1:  Expands parentheses enclosing terms raised to the power 1.
Output 2:  Expands parentheses enclosing terms raised to the power n.
Output 3:  Expands parentheses enclosing terms raised to powers n:m.
Output 4:  Expands parentheses enclosing terms raised to the power 1
           that also enclose one or more names contained in X.
Output 5:  Expands parentheses enclosing terms raised to the power n
           that also enclose one or more names contained in X.
Output 6:  Expands parentheses enclosing terms raised to powers n:m
           that also enclose one or more names contained in X.

  Remark:  Expand is a dual function.

  Remark:  Consider turning SetAutoFactor(OFF) so results are not
           re-factored after the Expand command.

 Related:  Epsilon  Evaluate  Expand  Explicit
           Factor  FactorLinear  FactorQuadratic  ReplaceString

   (1) %--------------------------------------------------------------------
   (2) % Example 1: Expand  (scalar expressions with certain powers)
   (3) %--------------------------------------------------------------------
   (4) Constant  a, b, c, x
   (5) y = (a+b)^2 + a*(x+c^2) + b*(11+c+a*b)
-> (6) y = (a+b)^2 + a*(x+c^2) + b*(11+c+a*b)

   (7) y1 = Expand( y )
-> (8) y1 = 11*b + a*x + b*c + a*b^2 + a*c^2 + (a+b)^2

   (9) y2 = Expand( y, 2 )
-> (10) y2 = a^2 + b^2 + 2*a*b + a*(x+c^2) + b*(11+c+a*b)

   (11) y3 = Expand( y, 1:2 )
-> (12) y3 = 11*b + a*x + a^2 + b*c + b^2 + 2*a*b + a*b^2 + a*c^2

   (13) %--------------------------------------------------------------------
   (14) % Example 2: Expand  (scalar expressions containing certain symbols)
   (15) %--------------------------------------------------------------------
   (16) y4 = Expand( y, a )
-> (17) y4 = 11*b + b*c + a*b^2 + (a+b)^2 + a*(x+c^2)

   (18) y5 = Expand( y, x )
-> (19) y5 = a*x + a*c^2 + (a+b)^2 + b*(11+c+a*b)

   (20) y6 = Expand( y, [a,x] )
-> (21) y6 = 11*b + a*x + b*c + a*b^2 + a*c^2 + (a+b)^2

   (22) %--------------------------------------------------------------------
   (23) % Example 3: Expand  (scalar expressions with certain powers/symbols)
   (24) %--------------------------------------------------------------------
   (25) y7 = Expand( y, 2, a )
-> (26) y7 = a^2 + b^2 + 2*a*b + a*(x+c^2) + b*(11+c+a*b)

   (27) y8 = Expand( y, 2, [a,x] )
-> (28) y8 = a^2 + b^2 + 2*a*b + a*(x+c^2) + b*(11+c+a*b)

   (29) %--------------------------------------------------------------------
   (30) % Example 4: Expand  (Expand is a dual command so it can overwrite y)
   (31) %--------------------------------------------------------------------
   (32) Expand( y, 1:2 )
-> (33) y = 11*b + a*x + a^2 + b*c + b^2 + 2*a*b + a*b^2 + a*c^2

   (34) %--------------------------------------------------------------------
   (35) % Example 5: Expand  (vector expressions with certain powers)
   (36) %--------------------------------------------------------------------
   (37) RigidFrame  N
   (38) v> = Vector( N, (a+b)^2, (a+b)^3, (a+b)^4 )
-> (39) v> = (a+b)^2*Nx> + (a+b)^3*Ny> + (a+b)^4*Nz>

   (40) Expand( v>, 2:3 )
-> (41) v> = (a^2+b^2+2*a*b)*Nx> + (a^3+b^3+3*a*b^2+3*b*a^2)*Ny> + (a+b)^4*Nz>

   (42) %--------------------------------------------------------------------
   (43) % Example 6: Expand  (matrix expressions with certain power)
   (44) %--------------------------------------------------------------------
   (45) m = [(a+2*b)^3, Vector( N, (a+b)^2, (a+b)^3, (a+b)^4 )]
-> (46) m = [(a+2*b)^3, (a+b)^2*Nx> + (a+b)^3*Ny> + (a+b)^4*Nz>]

   (47) Expand( m, 3 )
-> (48) m[1,1] = a^3 + 8*b^3 + 6*b*a^2 + 12*a*b^2
-> (49) m[1,2] = (a+b)^2*Nx> + (a^3+b^3+3*a*b^2+3*b*a^2)*Ny> + (a+b)^4*Nz>



Explicit
Explicit

 Purpose:  Substitutes the right-hand-side of all names in an expressions,
           repeating this process until no names that have a
           right-hand-side remain the expression.

Syntax 1:  Explicit( mathExpression )
Syntax 2:  Explicit( mathExpression, X )

   Input:  mathExpression -- A scalar, vector, matrix, ... expression.

           X -- The name of a scalar symbol (e.g., a constant or variable)
                or a comma-separated list of names of scalars
                or a matrix of scalar names.

Output 1:  Alternate representation of mathExpression that is explicit
           in names that do not have right-hand sides.

Output 2:  Alternate representation of mathExpression that is explicit in X.

  Remark:  Explicit is a dual function.

 Related:  Epsilon  Evaluate  Expand  Explicit
           Factor  FactorLinear  FactorQuadratic  ReplaceString
           GetRhs  SetAutoRhs  SetNoZeeSymbol

   (1) %--------------------------------------------------------------------
   (2) % Example 1: Explicit  (scalar expressions)
   (3) %--------------------------------------------------------------------
   (4) Constant  a, b, c
   (5) w = a + 2*b 
-> (6) w = a + 2*b

   (7) x = b + 5*c + w
-> (8) x = b + 5*c + w

   (9) y = sin(x) + cos(t)
-> (10) y = sin(x) + cos(t)

   (11) y1 = Explicit( y )
-> (12) y1 = sin(a+3*b+5*c) + cos(t)

   (13) %--------------------------------------------------------------------
   (14) % Example 2: Explicit  (scalar expressions containing certain symbols)
   (15) %--------------------------------------------------------------------
   (16) y2 = Explicit( y, c )
-> (17) y2 = sin(b+5*c+w) + cos(t)

   (18) %--------------------------------------------------------------------
   (19) % Example 3: Explicit  (Explicit is a dual command so it can overwrite y)
   (20) %--------------------------------------------------------------------
   (21) Explicit( y )
-> (22) y = sin(a+3*b+5*c) + cos(t)

   (23) %--------------------------------------------------------------------
   (24) % Example 4: Explicit  (vector expressions with certain powers)
   (25) %--------------------------------------------------------------------
   (26) RigidFrame  N
   (27) v> = Vector( N, w, x, y )
-> (28) v> = w*Nx> + x*Ny> + y*Nz>

   (29) Explicit( v>, [b,x] )
-> (30) v> = (a+2*b)*Nx> + x*Ny> + (sin(a+3*b+5*c)+cos(t))*Nz>

   (31) %--------------------------------------------------------------------
   (32) % Example 5: Explicit  (matrix expressions with certain power)
   (33) %--------------------------------------------------------------------
   (34) m = [ y, v> ]
-> (35) m = [y, (a+2*b)*Nx> + x*Ny> + (sin(a+3*b+5*c)+cos(t))*Nz>]

   (36) Explicit( m )
-> (37) m[1,1] = sin(a+3*b+5*c) + cos(t)
-> (38) m[1,2] = (a+2*b)*Nx> + (a+3*b+5*c)*Ny> + (sin(a+3*b+5*c)+cos(t))*Nz>



Express
Express

 Purpose:  Expresses a vector, dyadic, or other tensor in terms of
           basis vectors fixed in RigidFrame or RigidBody.

  Syntax:  Express( v, RefFrame )

   Input:  v -- a vector, dyadic, triadic or tensor expression or
                a matrix of such expressions.

           RefFrame -- name of a RigidFrame or RigidBody.

  Output:  v expressed in terms of the right-handed orthogonal unit vectors
           fixed in RefFrame, e.g., RefFramex>, RefFramey>, RefFramez>.

  Remark:  Express is a dual function.

   (1) %--------------------------------------------------------------------
   (2) % Example 1: Express   (vector expression)
   (3) %--------------------------------------------------------------------
   (4) RigidBody  A, B
   (5) Variable   q
   (6) B.RotateZ( A, q )
-> (7) B_A = [cos(q), sin(q), 0;  -sin(q), cos(q), 0;  0, 0, 1]

   (8) vA> = Vector( A, 2, 3, 4 )
-> (9) vA> = 2*Ax> + 3*Ay> + 4*Az>

   (10) vB> = Express( vA>, B ) 
-> (11) vB> = (2*cos(q)+3*sin(q))*Bx> + (3*cos(q)-2*sin(q))*By> + 4*Bz>

   (12) %--------------------------------------------------------------------
   (13) % Example 2: Express   (dyadic expression)
   (14) %--------------------------------------------------------------------
   (15) dA>> = Dyadic( A, 2, 3, 4 )
-> (16) dA>> = 2*Ax>*Ax> + 3*Ay>*Ay> + 4*Az>*Az>

   (17) dB>> = Express( dA>>, B )
-> (18) dB>> = (2+sin(q)^2)*Bx>*Bx> + sin(q)*cos(q)*Bx>*By> + sin(q)*cos(q)*By>*Bx>
        + (3-sin(q)^2)*By>*By> + 4*Bz>*Bz>

   (19) %--------------------------------------------------------------------
   (20) % Example 3: Express   (matrix expression)
   (21) %--------------------------------------------------------------------
   (22) m[1] = vA>
-> (23) m[1] = 2*Ax> + 3*Ay> + 4*Az>

   (24) m[2] = Vector( A, t, t^2, t^3 )
-> (25) m[2] = t*Ax> + t^2*Ay> + t^3*Az>

   (26) Express( m, B )
-> (27) m[1] = (2*cos(q)+3*sin(q))*Bx> + (3*cos(q)-2*sin(q))*By> + 4*Bz>
-> (28) m[2] = t*(cos(q)+t*sin(q))*Bx> - t*(sin(q)-t*cos(q))*By> + t^3*Bz>



Factor
Factor     (see also FactorLinear and FactorQuadratic)

 Purpose:  Useful to simplify results or compare results with another analyst.
           Rearranges expression by regrouping on certain factors.

  Syntax:  Factor( mathExpression, X )

   Input:  mathExpression -- A scalar, vector, matrix, ... expression.

           X -- A factor (e.g., a constant, variable, x^2, x+2, sin(x+y), etc.)
                or a comma-separated list of names of factors
                or a matrix of factors.

  Output:  mathExpression factored on X.

  Remark:  Factor is a dual function.

 Related:  Epsilon  Evaluate  Expand  Explicit
           Factor  FactorLinear  FactorQuadratic  ReplaceString
           SetAutoFactor

   (1) %--------------------------------------------------------------------
   (2) % Example 1: Factor  (scalar expressions factored on one factor)
   (3) %--------------------------------------------------------------------
   (4) Constant  a, b, c
   (5) Variable  x
   (6) y = a + a*x + a*b*x + c*x^2 + c*x^3 + a*x^(2+b) 
-> (7) y = a + a*x + a*b*x + c*x^2 + c*x^3 + a*x^(2+b)

   (8) y1 = Factor( y, x )
-> (9) y1 = a + x*(a+a*b+c*x+c*x^2+a*x^(1+b))

   (10) y2 = Factor( y, a )
-> (11) y2 = c*x^2 + c*x^3 + a*(1+x+b*x+x^(2+b))

   (12) %--------------------------------------------------------------------
   (13) % Example 2: Factor  (scalar expression factored on multiple factors)
   (14) %--------------------------------------------------------------------
   (15) y3 = Factor( y, a,c )
-> (16) y3 = c*x^2*(1+x) + a*(1+x+b*x+x^(2+b))

   (17) %--------------------------------------------------------------------
   (18) % Example 3: Factor  (Factor is a dual command so it can overwrite y)
   (19) %--------------------------------------------------------------------
   (20) Factor( y, x)
-> (21) y = a + x*(a+a*b+c*x+c*x^2+a*x^(1+b))

   (22) %--------------------------------------------------------------------
   (23) % Example 4: Factor  (matrix expressions factored on one factor)
   (24) %--------------------------------------------------------------------
   (25) m = [a + a*x + b*x; c + a*x^2 + a*x^(2+b)]
-> (26) m = [a + a*x + b*x;  c + a*x^2 + a*x^(2+b)]

   (27) Factor( m, x )
-> (28) m = [a + (a+b)*x;  c + a*x^2*(1+x^b)]



FactorLinear
FactorLinear      FactorLinearShallow      (see also Factor)
FactorQuadratic   FactorQuadraticShallow

 Purpose:  Useful to simplify results or compare results with another analyst.
           Rearranges expression by regrouping terms in designated names.
           FactorLinear    rearranges terms in groups of degree 1.
           FactorQuadratic rearranges terms in groups of degree 1 and 2.

Syntax 1:  FactorLinear(           mathExpression, X )
           FactorQuadratic(        mathExpression, X )
Syntax 2:  FactorLinearShallow(    mathExpression, X )
           FactorQuadraticShallow( mathExpression, X )

   Input:  mathExpression -- A scalar, vector, matrix, ... expression.

           X -- The name of a scalar symbol (e.g., a constant or variable)
                or a comma-separated list of names of scalars
                or a matrix of scalar names.

Output 1:  Makes mathExpression explicit in X, then returns mathExpression:
           (a) grouped in terms of degree  1       in  X  for FactorLinear
           (b) grouped in terms of degree  1 or 2  in  X  for FactorQuadratic.

Output 2:  Does NOT  Explicit(mathExpression, X),  but returns mathExpression:
           (a) grouped in degree  1       in  X  for FactorLinearShallow
           (b) grouped in degree  1 or 2  in  X  for FactorQuadraticShallow.

  Remark:  With SetAutoZee(ON), mathExpression is returned with Zees for its:
           (a) coefficients of terms of degree 1       in X  (FactorLinear)
           (b) coefficients of terms of degree 1 and 2 in X  (FactorQuadratic).

  Remark:  All these functions are dual functions.

 Related:  Epsilon  Evaluate  Expand  Explicit
           Factor  FactorLinear  FactorQuadratic  ReplaceString
           GetQuadraticRoots  SolveQuadraticPositiveRoot

   (1) %--------------------------------------------------------------------
   (2) % Example 1: FactorLinear  (scalar expressions)
   (3) %--------------------------------------------------------------------
   (4) Constant  a, b, c, x
   (5) y = 7 + a*c + a*x + b*(11+c+x*t)
-> (6) y = 7 + a*c + a*x + b*(11+c+x*t)

   (7) y1 = FactorLinear( y, a )
-> (8) y1 = 7 + a*(c+x) + b*(11+c+x*t)

   (9) y2 = FactorLinear( y, x, c )
-> (10) y2 = 7 + 11*b + c*(a+b) + x*(a+b*t)

   (11) %--------------------------------------------------------------------
   (12) % Example 2: FactorLinear  (is a dual command so it overwrites y)
   (13) %--------------------------------------------------------------------
   (14) FactorLinear( y, [x,c] )
-> (15) y = 7 + 11*b + c*(a+b) + x*(a+b*t)

   (16) %--------------------------------------------------------------------
   (17) % Example 3: FactorQuadratic  (scalar expressions)
   (18) %--------------------------------------------------------------------
   (19) y3 = FactorQuadratic( y, a )
-> (20) y3 = 7 + 11*b + b*c + a*(c+x) + b*x*t

   (21) y4 = FactorQuadratic( y, b )
-> (22) y4 = 7 + a*c + a*x + b*(11+c+x*t)

   (23) y5 = FactorQuadratic( y, b, c )
-> (24) y5 = 7 + a*c + a*x + b*c + b*(11+x*t)

   (25) %--------------------------------------------------------------------
   (26) % Example 4: FactorQuadratic  (is a dual command so it overwrites y)
   (27) %--------------------------------------------------------------------
   (28) FactorQuadratic( y, [b, c] )
-> (29) y = 7 + a*c + a*x + b*c + b*(11+x*t)



factorial
factorial

 Purpose:  Returns the factorial of a non-negative integer.

  Syntax:  factorial( intExpression )

   Input:  intExpression -- a non-negative integer expression, i.e.,
           non-negative integer or a scalar expression which,
           when evaluated, produces a non-negative integer.

  Output:  1 * 2 * 3 *  ...  *  (intExpression-1)  *  intExpression

 Related:  ceil  floor  int  max  min  round  sign  MathFunctions

   (1) %--------------------------------------------------------------------
   (2) % Example: Factorial 
   (3) %--------------------------------------------------------------------
   (4) A = Factorial( 4 ) 
-> (5) A = 24

   (6) B = Factorial(2+t^2) 
-> (7) B = factorial(2+t^2)

   (8) C = Factorial( Evaluate(2+t^2,t=1) ) 
-> (9) C = 6



floor
floor

 Purpose:  Returns the floor of a real scalar expression.

  Syntax:  floor( realScalarExpression )

   Input:  realScalarExpression -- a real scalar expression.

  Output:  Floor of realScalarExpression, i.e., the largest
           integer less than or equal to realScalarExpresion.

  Remark:  Sign can combine with  ceil  or  floor  for if statements, e.g.:
           isPositive    = ceil(  sign(t)/2 )
           isNonNegative = ceil(  sign(t)/2 + 1E-14 )
           isNegative    = floor( sign(t)/2 )

 Related:  ceil  floor  int  max  min  round  sign  MathFunctions

   (1) %--------------------------------------------------------------------
   (2) % Example: floor 
   (3) %--------------------------------------------------------------------
   (4) A = floor(  2.9999 ) 
-> (5) A = 2

   (6) B = floor(  3.0001 ) 
-> (7) B = 3

   (8) C = floor( -2.9999 ) 
-> (9) C = -3

   (10) D = floor( -3.0001 ) 
-> (11) D = -4

   (12) E = floor( 2.9 + t ) 
-> (13) E = floor(2.9+t)

   (14) isNegativeA = Evaluate( floor( sign(t)/2 ),  t =  200   )
-> (15) isNegativeA = 0

   (16) isNegativeB = Evaluate( floor( sign(t)/2 ),  t = -200   )
-> (17) isNegativeB = -1

   (18) isNegativeC = Evaluate( floor( sign(t)/2 ),  t =  0     )
-> (19) isNegativeC = 0

   (20) isNegativeD = Evaluate( floor( sign(t)/2 ),  t =  1E-21 )
-> (21) isNegativeD = 0

   (22) isNegativeE = Evaluate( floor( sign(t)/2 ),  t = -1E-21 )
-> (23) isNegativeE = -1

   (24) isNonPositiveA = Evaluate( floor( sign(t)/2 - 1E-200 ),  t =  0     )
-> (25) isNonPositiveA = -1

   (26) isNonPositiveB = Evaluate( floor( sign(t)/2 - 1E-200 ),  t =  1E-21 )
-> (27) isNonPositiveB = 0

   (28) isNonPositiveC = Evaluate( floor( sign(t)/2 - 1E-200 ),  t = -1E-21 )
-> (29) isNonPositiveC = -1



Exclude
Exclude    ExcludeV    ExcludeA

 Purpose:  Forms the portion of an expression that remains when
           terms containing designated names are excluded.

Syntax 1:  Exclude(  ExpressionY, X )
Syntax 2:  ExcludeV( ExpressionY )
Syntax 3:  ExcludeA( ExpressionY )

   Input:  ExpressionY -- a scalar, vector, or dyadic expression or
           a matrix of scalars, vectors, and/or dyadics.

           X -- The name of a symbol (e.g., constant, variable, or unit vector)
                or a comma-separated list of names of symbols
                or a matrix of names of symbols.

Output 1:  All terms in ExpressionY that that do not contain X.

Output 2:  All terms in ExpressionY that do not contain independent generalized
           speeds (generalized speeds are named in the SetGeneralizedSpeed command).

Output 3:  All terms in ExpressionY that do not contain 1st-time-derivatives of
           independent generalized speeds.

  Remark:  To be Autolev compatible, use:
           ExcludeV( ExpressionY )  instead of  Exclude( ExpressionY, U  ),
           ExcludeA( ExpressionY )  instead of  Exclude( ExpressionY, U' ).

 Related:  D  Include  Exclude  GetCoefficient
           Epsilon  Evaluate  Expand  Explicit
           Factor  FactorLinear  FactorQuadratic  ReplaceString

   (1) %--------------------------------------------------------------------
   (2) % Example 1: Exclude  (scalar expressions)
   (3) %--------------------------------------------------------------------
   (4) Constant  a, b, c, x
   (5) y = 7 + a*x + a*c^2 + b*(11+c+a*b)
-> (6) y = 7 + a*x + a*c^2 + b*(11+c+a*b)

   (7) y1 = Exclude( y, a )
-> (8) y1 = 7 + b*(11+c)

   (9) y2 = Exclude( y, b )
-> (10) y2 = 7 + a*x + a*c^2

   (11) y3 = Exclude( y, c,x )
-> (12) y3 = 7 + b*(11+a*b)

   (13) %--------------------------------------------------------------------
   (14) % Example 2: Exclude  (vector expressions)
   (15) %--------------------------------------------------------------------
   (16) RigidFrame N
   (17) v> = Vector( N, a*sin(b), cos(b*c), x )
-> (18) v> = a*sin(b)*Nx> + cos(b*c)*Ny> + x*Nz>

   (19) v1> = Exclude( v>, a )
-> (20) v1> = cos(b*c)*Ny> + x*Nz>

   (21) v2> = Exclude( v>, b )
-> (22) v2> = x*Nz>

   (23) v3> = Exclude( v>, [c,x] )
-> (24) v3> = a*sin(b)*Nx>

   (25) %--------------------------------------------------------------------
   (26) % Example 3: Exclude  (matrix expressions)
   (27) %--------------------------------------------------------------------
   (28) Constant  b1, b2, b3
   (29) Variable  x1, x2, x3
   (30) Zero[1] = 2*x1 + 3*x2 + 4*x3 - b1
-> (31) Zero[1] = 2*x1 + 3*x2 + 4*x3 - b1

   (32) Zero[2] = 3*x1 + 4*x2 + 5*x3 - b2
-> (33) Zero[2] = 3*x1 + 4*x2 + 5*x3 - b2

   (34) Zero[3] = 6*x1 + 7*x2 + 9*x3 - b3
-> (35) Zero[3] = 6*x1 + 7*x2 + 9*x3 - b3

   (36) CoefficientMatrix = D( Zero, [x1, x2, x3] )     
-> (37) CoefficientMatrix = [2, 3, 4;  3, 4, 5;  6, 7, 9]

   (38) RemainderMatrix = Exclude( Zero, [x1, x2, x3] ) 
-> (39) RemainderMatrix = [-b1;  -b2;  -b3]



Include
Include    IncludeV    IncludeA

 Purpose:  Forms the portion of an expression that contains designated names

Syntax 1:  Include(  ExpressionY, X )
Syntax 2:  IncludeV( ExpressionY )
Syntax 3:  IncludeA( ExpressionY )

   Input:  ExpressionY -- a scalar, vector, or dyadic expression or
           a matrix of scalars, vectors, and/or dyadics.

           X -- The name of a symbol (e.g., constant, variable, or unit vector)
                or a comma-separated list of names of symbols,
                or a matrix of names of symbols,
                that appear linearly in ExpressionY.

Output 1:  All terms in ExpressionY that contain X.

Output 2:  All terms in ExpressionY that contain independent generalized
           speeds (generalized speeds are named in the SetGeneralizedSpeed command).

Output 3:  All terms in ExpressionY that contain 1st-time-derivatives of
           independent generalized speeds.

  Remark:  To be Autolev compatible, use:
           IncludeV( ExpressionY )  instead of  Include( ExpressionY, U  ),
           IncludeA( ExpressionY )  instead of  Include( ExpressionY, U' ).

 Related:  D  Include  Exclude  GetCoefficient
           Epsilon  Evaluate  Expand  Explicit
           Factor  FactorLinear  FactorQuadratic  ReplaceString

   (1) %--------------------------------------------------------------------
   (2) % Example 1: Include  (scalar expressions)
   (3) %--------------------------------------------------------------------
   (4) Constant  a, b, c, x
   (5) y = 7 + a*x + a*c^2 + (11+c+b*c)*t
-> (6) y = 7 + a*x + a*c^2 + (11+c+b*c)*t

   (7) y1 = Include( y, a )
-> (8) y1 = a*(x+c^2)

   (9) y2 = Include( y, b )
-> (10) y2 = b*c*t

   (11) y3 = Include( y, a,t )
-> (12) y3 = a*x + a*c^2 + (11+c+b*c)*t

   (13) y4 = Include( y, [a,t] )
-> (14) y4 = a*x + a*c^2 + (11+c+b*c)*t

   (15) %--------------------------------------------------------------------
   (16) % Example 2: Include  (vector expressions)
   (17) %--------------------------------------------------------------------
   (18) RigidFrame N
   (19) v> = Vector( N, a*sin(b), cos(b)*(a+c), x )
-> (20) v> = a*sin(b)*Nx> + cos(b)*(a+c)*Ny> + x*Nz>

   (21) v1> = Include( v>, a )
-> (22) v1> = a*sin(b)*Nx> + a*cos(b)*Ny>

   (23) v2> = Include( v>, c )
-> (24) v2> = c*cos(b)*Ny>

   (25) v3> = Include( v>, [c,x] )
-> (26) v3> = c*cos(b)*Ny> + x*Nz>

   (27) %--------------------------------------------------------------------
   (28) % Example 3: Include  (matrix expressions)
   (29) %--------------------------------------------------------------------
   (30) Constant  b1, b2, b3
   (31) Variable  x1, x2, x3
   (32) Zero[1] = 2*x1 + 3*x2 + 4*x3 - b1
-> (33) Zero[1] = 2*x1 + 3*x2 + 4*x3 - b1

   (34) Zero[2] = 3*x1 + 4*x2 + 5*x3 - b2
-> (35) Zero[2] = 3*x1 + 4*x2 + 5*x3 - b2

   (36) Zero[3] = 6*x1 + 7*x2 + 9*x3 - b3
-> (37) Zero[3] = 6*x1 + 7*x2 + 9*x3 - b3

   (38) x12PartOfMatrix = Include( Zero, x1,x2 ) 
-> (39) x12PartOfMatrix = [2*x1 + 3*x2;  3*x1 + 4*x2;  6*x1 + 7*x2]



if
if  else  elseif

 Purpose:  Controls whether or not certain lines are executed.
           If the logical expression contained within parentheses
           following the keywords  if  or  elseif  is true,
           the statements contained within braces are executed.
           Otherwise, the statements are skipped.

Syntax 1:  if( LogicalExpression )  { Statements }

Syntax 2:  if( LogicalExpression )  { StatementsA }
           else                     { StatementsB }

Syntax 3:  if(     LogicalExpressionA )  { StatementsA }
           elseif( LogicalExpressionB )  { StatementsB }

Syntax 4:  if(     LogicalExpressionA )  { StatementsA }
           elseif( LogicalExpressionB )  { StatementsB }
           elseif( LogicalExpressionC )  { StatementsC }
           else                          { StatementsD }

   Input:  LogicalExpression -- an expression that evaluates to true or false
           and which involves at least one of the comparative operators:

           ==   equal to
           <=   less than or equal to
           <    less than
           >=   greater than or equal to -- must be preceded by a blank space
           >    greater than             -- must be preceded by a blank space

           Use && (and) or || (or) to separate multiple logical expressions.

  Remark:  Use MATLAB, C, or Fortran to control the value assigned to a symbol.
           For example, the following shows how to make x = 0 after t = 1.

           Specified x = cos(pi/2*t)    % Valid until t = 1
           Variable y' = x              % Arbitrary differential equation
           Input   tFinal=4, y=0        % Arbitrary initial values
           Output  t, x,  y             % Arbitrary output
           %% if( t >= 1 ) x = 0;  end
           ODE()  example.m             % Creates MATLAB program

           Edit example.m to see the line marked with %% in the .m file.
           Un-comment this line and move it to immediately after the line
           x = cos(t) in the MATLAB code.  Hence the MATLAB code has

           x = cos(1.570796326794897*t);
           if( t >= 1 ) x = 0;  end

  Remark:  Combine sign with ceil or floor for if statements:
           isPositive      = ceil(  sign(t)/2 )          % Returns 0 or 1.
           isNonNegative   = ceil(  sign(t)/2 + 1E-14 )  % Returns 0 or 1.
           isNegative      = floor( sign(t)/2 )          % Returns 0 or 1.
           isTLessThan9    = ceil( sign(9-t) / 2 )       % Returns 0 or 1.
           isTGreaterThan9 = ceil( sign(t-9) / 2 )       % Returns 0 or 1.

 Related:  !  %  &  Clear  Save  Run  Quit  if  else  elseif
           ceil  floor  sign

--------------------------------------------------------------------
Example 1a: if
--------------------------------------------------------------------
 if( 5 >= 4 )  { x = 6*3 }

 % Results in x = 18

--------------------------------------------------------------------
Example 1b: if
--------------------------------------------------------------------
 if( (5 >= 6  ||  2*pi >= 6)  &&  8 < 9 )  { x = 6*3;  y=6*4 }

 % Results in x = 18   and  y = 24;

--------------------------------------------------------------------
Example 2: if  else
--------------------------------------------------------------------
 if( 5 >= 4 )  { x = 6*3;  y=6*4 }
 else          { x = 3;    y=4  }

 % Results in x = 3   and  y = 4;

--------------------------------------------------------------------
Example 3: if  elseif
--------------------------------------------------------------------
 if( 5 >= 6  )           { x = 6*3;  y=6*4 }
 elseif( sqrt(5) > 2 )   { x = 17 }

 % Results in x = 17

--------------------------------------------------------------------
Example 4: if  elseif  else
--------------------------------------------------------------------
 if( 5 >= 6  )           { x = 6*3;  y=6*4 }
 elseif( sqrt(5) > 9 )   { x = 17 }
 elseif( sqrt(5) < 2 )   { x = 16 }
 else
 {
    x = 6 * 3
    y = 6 * 4
 }

 % Results in x = 18  and  y = 24.

--------------------------------------------------------------------
Example 5:  Creating a scalar if.
--------------------------------------------------------------------
 isTLessThan5 = ceil( sign(5-t) / 2 )
 thrust = isTLessThan5 * 9   % if t < 5, thrust = 9 else thrust = 0.



INTERFACE
Interface with the Operating System:
 Issue a system command:             !
 Clear the workspace:                CLEAR
 Print a message on the screen:      ECHO
 List or change defaults:            GetDefaults
 Display the amount of memory used:  GetMemory
 Learn about the help system:        HELP
 List the input and responses:       LIST
 Pause the program:                  Pause
 Run/load a specific input file:     RUN
 Quit/exit the program:              QUIT
 Save input and responses:           SAVE



GetAcceleration
GetAcceleration

 Purpose:  Gets a point's acceleration in a reference frame.

  Syntax:  Q.GetAcceleration( refFrame )

   Input:  Q -- name of a point.
           refFrame -- name of a RigidFrame or RigidBody..

  Output:  Returns Q's acceleration in refFrame.

 Related:  Translate        SetPositionVelocity   SetVelocityAcceleration
           SetPosition      GetPosition   GetDistance
           SetVelocity      GetVelocity   GetSpeed   GetElongation
           SetAcceleration  GetAcceleration       GetAccelerationRelative

   (1) %--------------------------------------------------------------------
   (2) % Example: GetAcceleration 
   (3) %--------------------------------------------------------------------
   (4) RigidFrame N
   (5) Point      Q            
   (6) Variable   vx', vy'
   (7) Q.SetAcceleration( N, vx'*Nx> + vy'*Ny> )
-> (8) a_Q_N> = vx'*Nx> + vy'*Ny>

   (9) QAccelerationInN> = Q.GetAcceleration( N )   
-> (10) QAccelerationInN> = vx'*Nx> + vy'*Ny>



GetAngleBetweenVectors
GetAngleBetweenVectors   GetAngleBetweenUnitVectors

 Purpose:  Forms the angle between two vectors.

Syntax 1:  GetAngleBetweenVectors(        v>, w>  )
           GetAngleBetweenVectorsDegrees( v>, w>  )
Syntax 2:  GetAngleBetweenVectors(        v>, w>, senseVector>  )
           GetAngleBetweenVectorsDegrees( v>, w>, senseVector>  )
Syntax 3:  GetAngleBetweenUnitVectors(        uvec1>, uvec2>  )
           GetAngleBetweenUnitVectorsDegrees( uvec1>, uvec2>  )
Syntax 4:  GetAngleBetweenUnitVectors(        uvec1>, uvec2>, senseVector> )
           GetAngleBetweenUnitVectorsDegrees( uvec1>, uvec2>, senseVector> )

  Inputs:  v>,  w>  -- vectors
           uvec1>,  uvec2> -- unit vectors
           senseVector>  -- a vector providing a positive sense

Output 1:  Angle between  v>  and  w>          with range   0  <= Angle <= Pi.
Output 2:  Angle from     v>  to   w>          with range  -Pi <  Angle <= Pi.
Output 3:  Angle between  uvec1>  and  uvec2>  with range   0  <= Angle <= Pi.
Output 4:  Angle from     uvec1>  to   uvec2>  with range  -Pi <  Angle <= Pi.

  Remark:  "Degrees" variant of commands multiply return values by 180/Pi.
           Use return value with caution as the default units for angles
           are in radians for this program and C, MATLAB, and FORTRAN.

  Remark:  A negative angle can result if a senseVector> is provided and
           the cross-product of v> and w> has negative projection onto
           senseVector>, otherwise it is 0 or positive.

 Related:  GetMagnitude           GetMagnitudeSquared
           GetDistance            GetDistanceSquared
           GetSpeed               GetSpeedSquared
           GetAngularSpeed        GetAngularSpeedSquared
           GetAngleBetweenVectors GetAngleBetweenUnitVectors   ConvertUnits
           GetUnitVector          Vector   Dot   Rotate

   (1) %--------------------------------------------------------------------
   (2) % Example 1: GetAngleBetweenVectors 
   (3) %--------------------------------------------------------------------
   (4) RigidFrame A
   (5) v> = 2*Ax> + 3*Ay> + 4*Az>
-> (6) v> = 2*Ax> + 3*Ay> + 4*Az>

   (7) w> = 5*Ax> + 6*Ay> + 7*Az>
-> (8) w> = 5*Ax> + 6*Ay> + 7*Az>

   (9) thetaRadians = GetAngleBetweenVectors( v>, w> )
-> (10) thetaRadians = 0.1304772

   (11) thetaDegrees = GetAngleBetweenVectorsDegrees( v>, w> ) 
-> (12) thetaDegrees = 7.475791

   (13) thetaNegative = GetAngleBetweenVectors( v>, w>, Ax> )
-> (14) thetaNegative = -0.1304772

   (15) %--------------------------------------------------------------------
   (16) % Example 2: GetAngleBetweenVectors  (with sense)
   (17) %--------------------------------------------------------------------
   (18) f> = Ax> + 2*Ay>
-> (19) f> = Ax> + 2*Ay>

   (20) g> = Ax> + t*Ay>
-> (21) g> = Ax> + t*Ay>

   (22) theta = GetAngleBetweenVectors( f>, g> )
-> (23) theta = acos(0.4472136*(1+2*t)/sqrt(1+t^2))

   (24) thetaWithSense = GetAngleBetweenVectors( f>, g>, Az> )
-> (25) thetaWithSense = sign0IsPositive1(-2+t)*acos(0.4472136*(1+2*t)/sqrt(1+t^2))

   (26) %--------------------------------------------------------------------
   (27) % Example 3: GetAngleBetweenUnitVectors  
   (28) %--------------------------------------------------------------------
   (29) unitVector1> = Vector( A, 0.6, 0.8, 0 )
-> (30) unitVector1> = 0.6*Ax> + 0.8*Ay>

   (31) unitVector2> = Vector( A, 0,   0.6, 0.8 )
-> (32) unitVector2> = 0.6*Ay> + 0.8*Az>

   (33) angleRadians = GetAngleBetweenUnitVectors( unitVector1>, unitVector2> )
-> (34) angleRadians = 1.070142

   (35) angleDegrees = GetAngleBetweenUnitVectorsDegrees( unitVector1>, unitVector2> )
-> (36) angleDegrees = 61.3146

   (37) %--------------------------------------------------------------------
   (38) % Example 4: GetAngleBetweenUnitVectors  (with sense)
   (39) %--------------------------------------------------------------------
   (40) RigidFrame B
   (41) B.SetRotationMatrixZ( A, t )
-> (42) B_A = [cos(t), sin(t), 0;  -sin(t), cos(t), 0;  0, 0, 1]

   (43) angleWithSense = GetAngleBetweenUnitVectors( Bx>, unitVector2>, Az> )
-> (44) angleWithSense = sign0IsPositive1(0.6*cos(t))*acos(0.6*sin(t))



GetAngularAcceleration
GetAngularAcceleration

 Purpose:  Gets a rigid frame/body's angular acceleration in a reference frame.

  Syntax:  B.GetAngularAcceleration( A )

   Input:  B -- name of a RigidFrame or RigidBody.
           A -- name of another RigidFrame or RigidBody.

  Output:  Returns B's angular acceleration in A.

 Related:  GetAngularAcceleration  GetAngularVelocity  GetRotationMatrix
           SetAngularAcceleration  SetAngularVelocity  SetRotationMatrix

   (1) %--------------------------------------------------------------------
   (2) % Example: GetAngularAcceleration 
   (3) %--------------------------------------------------------------------
   (4) RigidFrame N             
   (5) RigidBody  B
   (6) Variable   wx', wy', wz'
   (7) B.SetAngularAcceleration( N, wx'*Bx> + wy'*By> + wz'*Bz> )
-> (8) alf_B_N> = wx'*Bx> + wy'*By> + wz'*Bz>

   (9) BAngularAccelerationInN> = B.GetAngularAcceleration( N )
-> (10) BAngularAccelerationInN> = wx'*Bx> + wy'*By> + wz'*Bz>



GetAngularMomentum
GetAngularMomentum

 Purpose:  Calculates an object's angular momentum about a point.

Syntax 1:  Object.GetAngularMomentum( aboutPoint )
Syntax 2:  Object.GetAngularMomentum( aboutPoint, refFrame )

   Input:  Object -- name of a Particle, RigidBody, or System.
           aboutPoint -- name of a point.
           refFrame -- name of a RigidFrame or RigidBody.

Output 1:  Object's angular momentum abointPoint in the NewtonianFrame.
Output 2:  Object's angular momentum abointPoint in refFrame.

  Remark:  A particle Q's angular momentum aboutPoint in refFrame is defined
           Cross( Q.GetPosition(aboutPoint), Q.GetLinearMomentum(refFrame) )

 Related:  GetAngularMomentum  GetLinearMomentum   GetGeneralizedMomentum
           GetKineticEnergy    GetMomentOfForces  GetResultantForce
           GetStatics   GetStaticsKane   GetStaticsLagrange
           GetDynamics  GetDynamicsKane  GetDynamicsLagrange

   (1) %--------------------------------------------------------------------
   (2) % Example 1: GetAngularMomentum  (point moving in a plane)
   (3) %--------------------------------------------------------------------
   (4) NewtonianFrame N             
   (5) Particle       Q   
   (6) Q.SetMass( mQ )
   (7) Variable       x'', y''
   (8) Q.Translate( No, x*Nx> + y*Ny> )
-> (9) p_No_Q> = x*Nx> + y*Ny>
-> (10) v_Q_N> = x'*Nx> + y'*Ny>
-> (11) a_Q_N> = x''*Nx> + y''*Ny>

   (12) QAngularMomentumAboutNo> = Q.GetAngularMomentum( No )
-> (13) QAngularMomentumAboutNo> = mQ*(x*y'-y*x')*Nz>

   (14) %--------------------------------------------------------------------
   (15) % Example 2: GetAngularMomentum  (rotating rigid body)
   (16) %--------------------------------------------------------------------
   (17) RigidBody  B  
   (18) B.SetMass( mB )
   (19) B.SetInertia( Bcm, Ixx, Iyy, Izz )
   (20) Variable   theta''
   (21) B.RotateZ( N, theta )
-> (22) B_N = [cos(theta), sin(theta), 0;  -sin(theta), cos(theta), 0;  0, 0, 1]
-> (23) w_B_N> = theta'*Bz>
-> (24) alf_B_N> = theta''*Bz>

   (25) BAngularMomentumAboutBcm> = B.GetAngularMomentum( Bcm )
-> (26) BAngularMomentumAboutBcm> = Izz*theta'*Bz>

   (27) %--------------------------------------------------------------------
   (28) % Example 3: GetAngularMomentum  (rotating/translating rigid body)
   (29) %--------------------------------------------------------------------
   (30) Bcm.Translate( No, x*Nx> + y*Ny> )
-> (31) p_No_Bcm> = x*Nx> + y*Ny>
-> (32) v_Bcm_N> = x'*Nx> + y'*Ny>
-> (33) a_Bcm_N> = x''*Nx> + y''*Ny>

   (34) BAngularMomentumAboutNo> = B.GetAngularMomentum( No )
-> (35) BAngularMomentumAboutNo> = (Izz*theta'+mB*(x*y'-y*x'))*Bz>



GetAngularSpeed
GetAngularSpeed  and   GetAngularSpeedSquared

 Purpose:  Gets a rigid frame/body's angular speed in a reference frame.

Syntax 1:  B.GetAngularSpeed( A )
Syntax 2:  B.GetAngularSpeedSquared( A )

   Input:  B -- name of a RigidFrame or RigidBody.
           A -- name of another RigidFrame or RigidBody.

Output 1:  Magnitude of B's angular velocity in A.
Output 2:  Square of the magnitude of B's angular velocity in A.

 Related:  GetMagnitude           GetMagnitudeSquared
           GetDistance            GetDistanceSquared
           GetSpeed               GetSpeedSquared
           GetAngularSpeed        GetAngularSpeedSquared
           GetAngleBetweenVectors GetAngleBetweenUnitVectors
           GetAngularVelocity     SetAngularVelocity       Rotate
           GetUnitVector          Vector   Dot

   (1) %--------------------------------------------------------------------
   (2) % Example: GetAngularSpeed  and  GetAngularSpeedSquared
   (3) %--------------------------------------------------------------------
   (4) RigidFrame A, B
   (5) Variable   wx, wy
   (6) B.SetAngularVelocity( A, wx*Ax> + wy*Ay> )
-> (7) w_B_A> = wx*Ax> + wy*Ay>

   (8) angularSpeed = B.GetAngularSpeed( A ) 
-> (9) angularSpeed = sqrt(wx^2+wy^2)

   (10) angularSpeedSquared = B.GetAngularSpeedSquared( A )  
-> (11) angularSpeedSquared = wx^2 + wy^2



GetAngularVelocity
GetAngularVelocity

 Purpose:  Gets a rigid frame/body's angular velocity in a reference frame.

  Syntax:  B.GetAngularVelocity( A )

   Input:  B -- name of a RigidFrame or RigidBody.
           A -- name of another RigidFrame or RigidBody.

  Output:  Returns B's angular velocity in A.

 Related:  GetAngularAcceleration  GetAngularVelocity  GetRotationMatrix
           SetAngularAcceleration  SetAngularVelocity  SetRotationMatrix

   (1) %--------------------------------------------------------------------
   (2) % Example: GetAngularVelocity 
   (3) %--------------------------------------------------------------------
   (4) RigidFrame N             
   (5) RigidBody  A, B
   (6) Variable   wx, wy, wz,  w1, w2, w3
   (7) A.SetAngularVelocity( N, wx*Ax> + wy*Ay> + wz*Az> )
-> (8) w_A_N> = wx*Ax> + wy*Ay> + wz*Az>

   (9) B.SetAngularVelocity( A, w1*Ax> + w2*Ay> + w3*Az> )
-> (10) w_B_A> = w1*Ax> + w2*Ay> + w3*Az>

   (11) BAngularVelocityInN> = B.GetAngularVelocity( N )
-> (12) BAngularVelocityInN> = (w1+wx)*Ax> + (w2+wy)*Ay> + (w3+wz)*Az>



GetBasisVector
GetBasisVector

 Purpose:  Returns a unit vector that was created when a RigidBody
           RigidFrame, or NewtonianFrame declaration was issued

  Syntax:  GetBasisVector( frameName, int123 )

   Input:  frameName -- name of a RigidFrame or RigidBody.
           int123 -- the number 1 or 2 or 3.

  Remark:  GetBasisVector is mostly used in .r and .a files.

 Related:  GetBasisVector  GetDefaults  SetBasisSubscripts

   (1) %--------------------------------------------------------------------
   (2) % Example 1:  GetBasisVector (default basis subscripts)
   (3) %--------------------------------------------------------------------
   (4) RigidBody A
   (5) AfirstBasisVector> := GetBasisVector( A, 1 )
-> (6) AfirstBasisVector> = Ax>

   (7) AthirdBasisVector> := GetBasisVector( A, 3 )
-> (8) AthirdBasisVector> = Az>

   (9) %--------------------------------------------------------------------
   (10) % Example 2:  GetBasisVector (vary basis subscripts)
   (11) %--------------------------------------------------------------------
   (12) SetBasisSubscripts( 1,2,3 )
   (13) AfirstBasisVector> := GetBasisVector( A, 1 )
-> (14) AfirstBasisVector> = A1>

   (15) AthirdBasisVector> := GetBasisVector( A, 3 )
-> (16) AthirdBasisVector> = A3>

   (17) %--------------------------------------------------------------------
   (18) % Example 3:  GetBasisVector (vary basis subscripts again)
   (19) %--------------------------------------------------------------------
   (20) SetBasisSubscripts( i,j,k )
   (21) AfirstBasisVector> := GetBasisVector( A, 1 )
-> (22) AfirstBasisVector> = Ai>

   (23) AthirdBasisVector> := GetBasisVector( A, 3 )
-> (24) AthirdBasisVector> = Ak>



GetCharge
GetCharge

 Purpose:  Gets the charge on an object.

  Syntax:  Object.GetCharge()

   Input:  Object -- The name of a point or particle.

  Output:  Returns the charge on Object.

 Related:  GetCharge  GetMass  SetCharge  SetMass
           AddForceElectrostatic

   (1) %--------------------------------------------------------------------
   (2) % Example: GetCharge
   (3) %--------------------------------------------------------------------
   (4) Point   P, Q             
   (5) P.SetCharge( 17 )   
   (6) Q.SetCharge( cQ ) 
   (7) chargeOnPAndQ = P.GetCharge() + Q.GetCharge()
-> (8) chargeOnPAndQ = 17 + cQ



GetCmAcceleration
GetCmAcceleration

 Purpose:  Gets a center of mass acceleration in a reference frame.

Syntax 1:  S.GetCmAcceleration( refFrame )
Syntax 2:  B.GetCmAcceleration( refFrame )
Syntax 3:  Q.GetCmAcceleration( refFrame )

   Input:  S -- name of a System.
           B -- name of a RigidBody.
           Q -- name of a Particle.
           refFrame -- name of a RigidFrame or RigidBody.

Output 1:  Acceleration of S's center of mass in refFrame.
Output 2:  Acceleration of B's center of mass in refFrame.
Output 3:  Acceleration of Q in refFrame.

 Related:  SetMass          GetMass         SetInertia
           GetCMPosition    GetCmVelocity   GetCmAcceleration
           Translate        SetPositionVelocity   SetVelocityAcceleration
           SetPosition      GetPosition     GetDistance
           SetVelocity      GetVelocity     GetSpeed   GetElongation
           SetAcceleration  GetAcceleration

   (1) %--------------------------------------------------------------------
   (2) % Example 1: GetCmAcceleration  (center of mass of rigid body)
   (3) %--------------------------------------------------------------------
   (4) NewtonianFrame N   
   (5) RigidBody  B 
   (6) B.SetMass( mB )
   (7) Variable   xB'', yB''
   (8) Bcm.Translate( No, xB*Nx> + yB*Ny> )
-> (9) p_No_Bcm> = xB*Nx> + yB*Ny>
-> (10) v_Bcm_N> = xB'*Nx> + yB'*Ny>
-> (11) a_Bcm_N> = xB''*Nx> + yB''*Ny>

   (12) BCmAccelerationInN> = B.GetCmAcceleration( N )
-> (13) BCmAccelerationInN> = xB''*Nx> + yB''*Ny>

   (14) %--------------------------------------------------------------------
   (15) % Example 2: GetCmAcceleration  (center of mass of system)
   (16) %--------------------------------------------------------------------
   (17) Particle   P
   (18) P.SetMass( mP )
   (19) Variable   xP'', yP''
   (20) P.Translate( No, xP*Nx> + yP*Ny> )
-> (21) p_No_P> = xP*Nx> + yP*Ny>
-> (22) v_P_N> = xP'*Nx> + yP'*Ny>
-> (23) a_P_N> = xP''*Nx> + yP''*Ny>

   (24) SystemCmAccelerationInN> = System.GetCmAcceleration( N )
-> (25) SystemCmAccelerationInN> = (mB*xB''+mP*xP'')/(mB+mP)*Nx> + (mB*yB''+mP*
        yP'')/(mB+mP)*Ny>



GetCmPosition
GetCmPosition

 Purpose:  Gets the center of mass position from another point.

Syntax 1:  S.GetCmPosition( fromPoint )
Syntax 2:  B.GetCmPosition( fromPoint )
Syntax 3:  Q.GetCmPosition( fromPoint )

   Input:  S -- name of a System.
           B -- name of a RigidBody.
           Q -- name of a Particle.
           fromPoint -- name of a point.

Output 1:  Position vector of S's center of mass from fromPoint.
Output 2:  Position vector of B's center of mass from fromPoint.
Output 3:  Position vector of Q from fromPoint.

 Remark:   The following are used for the CM command:
           (a) the mass of each particle and body
           (b) the position vector from P to each particle
           (c) the position vector from P to the mass center of each body.

 Related:  SetMass          GetMass         SetInertia
           GetCMPosition    GetCmVelocity   GetCmAcceleration
           Translate        SetPositionVelocity   SetVelocityAcceleration
           SetPosition      GetPosition   GetDistance
           SetVelocity      GetVelocity   GetSpeed   GetElongation
           SetAcceleration  GetAcceleration

   (1) %--------------------------------------------------------------------
   (2) % Example 1: GetCmPosition  (center of mass of rigid body)
   (3) %--------------------------------------------------------------------
   (4) NewtonianFrame N   
   (5) RigidBody  B 
   (6) B.SetMass( mB )
   (7) Variable   xB, yB
   (8) Bcm.SetPosition( No, xB*Nx> + yB*Ny> )
-> (9) p_No_Bcm> = xB*Nx> + yB*Ny>

   (10) BCmPositionFromNo> = B.GetCmPosition( No )
-> (11) BCmPositionFromNo> = xB*Nx> + yB*Ny>

   (12) %--------------------------------------------------------------------
   (13) % Example 2: GetCmPosition  (center of mass of system)
   (14) %--------------------------------------------------------------------
   (15) Particle   P
   (16) P.SetMass( mP )
   (17) Variable   xP, yP
   (18) P.SetPosition( No, xP*Nx> + yP*Ny> )
-> (19) p_No_P> = xP*Nx> + yP*Ny>

   (20) SystemCmPositionFromNo> = System.GetCmPosition( No )
-> (21) SystemCmPositionFromNo> = (mB*xB+mP*xP)/(mB+mP)*Nx> + (mB*yB+mP*yP)/(
        mB+mP)*Ny>



GetCmVelocity
GetCmVelocity

 Purpose:  Gets a center of mass velocity in a reference frame.

Syntax 1:  S.GetCmVelocity( refFrame )
Syntax 2:  B.GetCmVelocity( refFrame )
Syntax 3:  Q.GetCmVelocity( refFrame )

   Input:  S -- name of a System.
           B -- name of a RigidBody.
           Q -- name of a Particle.
           refFrame -- name of a RigidFrame or RigidBody.

Output 1:  Velocity of S's center of mass in refFrame.
Output 2:  Velocity of B's center of mass in refFrame.
Output 3:  Velocity of Q in refFrame.

 Related:  SetMass          GetMass         SetInertia
           GetCMPosition    GetCmVelocity   GetCmAcceleration
           Translate        SetPositionVelocity   SetVelocityAcceleration
           SetPosition      GetPosition   GetDistance
           SetVelocity      GetVelocity   GetSpeed   GetElongation
           SetAcceleration  GetAcceleration

   (1) %--------------------------------------------------------------------
   (2) % Example 1: GetCmVelocity  (center of mass of rigid body)
   (3) %--------------------------------------------------------------------
   (4) NewtonianFrame N   
   (5) RigidBody  B 
   (6) B.SetMass( mB )
   (7) Variable   xB', yB'
   (8) Bcm.SetVelocity( N, xB'*Nx> + yB'*Ny> )
-> (9) v_Bcm_N> = xB'*Nx> + yB'*Ny>

   (10) BCmVelocityInN> = B.GetCmVelocity( N )
-> (11) BCmVelocityInN> = xB'*Nx> + yB'*Ny>

   (12) %--------------------------------------------------------------------
   (13) % Example 2: GetCmVelocity  (center of mass of system)
   (14) %--------------------------------------------------------------------
   (15) Particle   P
   (16) P.SetMass( mP )
   (17) Variable   xP', yP'
   (18) P.SetVelocity( N, xP'*Nx> + yP'*Ny> )
-> (19) v_P_N> = xP'*Nx> + yP'*Ny>

   (20) SystemCmVelocityInN> = System.GetCmVelocity( N )
-> (21) SystemCmVelocityInN> = (mB*xB'+mP*xP')/(mB+mP)*Nx> + (mB*yB'+mP*yP')/(
        mB+mP)*Ny>



GetCoefficient
GetCoefficient    GetCoefficientShallow

 Purpose:  Gets the coefficient of a name or names in an expression.

Syntax 1:  GetCoefficient(        ExpressionY, X )
Syntax 2:  GetCoefficientShallow( ExpressionY, X )

   Input:  ExpressionY -- an expression or matrix of expressions.

           X -- a name that appears linearly in ExpressionY or a
           one-dimensional (row/column) matrix of names that
           appear linearly in ExpressionY.

Output 1:  Does a deep recursive examination of ExpressionY, searching for
           any  X  that appears directly or indirectly in  ExpressionY.

Output 2:  GetCoefficientShallow  does a shallow non-recursive search for
           any  X  that appears directly in  ExpressionY.
           Does not examine the right-hand-side of any symbol appearing
           in ExpressionY to see if it may contain X, i.e., ignores
           assignments made to symbols appearing in ExpressionY.

  Remark:  GetCoefficientShallow is Autolev compatible.
           With SetDefaults( AUTOLEV ), the command  Coef  is interpreted as
           GetCoefficientShallow, otherwise it is interpreted GetCoefficient.

  Remark:  Returns an expression or matrix of expressions (depends on whether
           ExpressionY and X are expressions or matrices of expressions).

 Related:  D  Include  Exclude  GetCoefficient GetCoefficientShallow

   (1) %--------------------------------------------------------------------
   (2) % Example 1: GetCoefficient  (Scalar expression, scalar name)
   (3) %--------------------------------------------------------------------
   (4) Variable  x, y
   (5) Expression = t*x - 2*y
-> (6) Expression = t*x - 2*y

   (7) coefX = GetCoefficient( Expression, x )
-> (8) coefX = t

   (9) coefY = GetCoefficient( Expression, y )
-> (10) coefY = -2

   (11) %--------------------------------------------------------------------
   (12) % Example 2: GetCoefficient  (Scalar expression, matrix of names)
   (13) %--------------------------------------------------------------------
   (14) CoefTY = GetCoefficient( Expression, t, y )
-> (15) CoefTY = [x;  -2]

   (16) CoefXY = GetCoefficient( Expression, [x;y] )
-> (17) CoefXY = [t;  -2]

   (18) %--------------------------------------------------------------------
   (19) % Example 3: GetCoefficient  (Matrix expression, scalar name)
   (20) %--------------------------------------------------------------------
   (21) Zero[1] = sin(t)*x - cos(t)*y
-> (22) Zero[1] = sin(t)*x - cos(t)*y

   (23) Zero[2] = cos(t)*x - 3*t^2*y
-> (24) Zero[2] = cos(t)*x - 3*t^2*y

   (25) Fred = GetCoefficient( Zero, x )
-> (26) Fred = [sin(t);  cos(t)]

   (27) Joe  = GetCoefficient( Zero, y )
-> (28) Joe = [-cos(t);  -3*t^2]

   (29) %--------------------------------------------------------------------
   (30) % Example 4: GetCoefficient  (Matrix expression, matrix of names)
   (31) %--------------------------------------------------------------------
   (32) Sally = GetCoefficient( Zero, x, y )
-> (33) Sally = [sin(t), -cos(t);  cos(t), -3*t^2]

   (34) Susan = GetCoefficient( Zero, [x,y] )
-> (35) Susan = [sin(t), -cos(t);  cos(t), -3*t^2]

   (36) %--------------------------------------------------------------------
   (37) % Example 5: GetCoefficientShallow  (Scalar expression, scalar name)
   (38) %--------------------------------------------------------------------
   (39) shallowCoefX1 = GetCoefficientShallow(        Expression,  x )
-> (40) shallowCoefX1 = 0

   (41) shallowCoefX2 = GetCoefficientShallow( GetRhs(Expression), x )
-> (42) shallowCoefX2 = t

   (43) shallowCoefX3 = GetCoefficientShallow(      x*Expression,  x )
-> (44) shallowCoefX3 = Expression

   (45) shallowCoefY1 = GetCoefficientShallow(        Expression,  y )
-> (46) shallowCoefY1 = 0

   (47) shallowCoefY2 = GetCoefficientShallow( GetRhs(Expression), y )
-> (48) shallowCoefY2 = -2

   (49) shallowCoefE1 = GetCoefficientShallow(   Expression, Expression )
-> (50) shallowCoefE1 = 1

   (51) shallowCoefE2 = GetCoefficientShallow( x*Expression, Expression )
-> (52) shallowCoefE2 = x



GetColumns
GetRows    or    GetColumns

 Purpose:  Reports the number of rows or columns of a matrix.
           Creates a matrix from designated rows or columns of a matrix.

Syntax 1:     GetRows( aMatrix )
Syntax 2:  GetColumns( aMatrix )
Syntax 3:     GetRows( aMatrix,  i,j,  n:m,  ... )
Syntax 4:  GetColumns( aMatrix,  i,j,  n:m,  ... )

   Input:  aMatrix -- a matrix.
           i,j,... -- positive integers.
           n:m        A range of positive integers from n to m.

  Remark:  i, j, n, and m must be positive integers that are less than
           or equal to the number of rows (or columns) of aMatrix.
           n may be larger, smaller, or equal to m.

Output 1:  Number of rows    in aMatrix.
Output 2:  Number of columns in aMatrix
Output 3:  Matrix whose rows    are the i, j, n:m rows    of aMatrix.
Output 4:  Matrix whose columns are the i, j, n:m columns of aMatrix.

  Remark:  To select various elements or submatrices, use e.g.,
           aMatrix[ 2, 3 ]  or  aMatrix[ 2:3, 1:5 ].  Try HELP GetElement.

 Related:  GetColumns  GetDeterminant  GetDiagonalMatrix  GetEigen
           GetElement  GetIdentityMatrix  GetInverse  GetRows  GetTrace
           GetTranspose  GetZeroMatrix  Solve

   (1) %--------------------------------------------------------------------
   (2) % Example 1: GetRows  or  GetColumns  (number of rows or columns in a matrix)
   (3) %--------------------------------------------------------------------
   (4) M = [1, 2, 3, 4;  5, 6, 7, 8;  9, 10, 11, 12]
-> (5) M = [1, 2, 3, 4;  5, 6, 7, 8;  9, 10, 11, 12]

   (6) numberOfRows = GetRows( M )
-> (7) numberOfRows = 3

   (8) numberOfColumns = GetColumns( M )
-> (9) numberOfColumns = 4

   (10) %--------------------------------------------------------------------
   (11) % Example 2: GetRows  or  GetColumns  (designated rows or columns in a matrix)
   (12) %--------------------------------------------------------------------
   (13) Rows3And1OfM = GetRows( M, 3,1 )
-> (14) Rows3And1OfM = [9, 10, 11, 12;  1, 2, 3, 4]

   (15) Columns3And1OfM = GetColumns( M, 4,1 )
-> (16) Columns3And1OfM = [4, 1;  8, 5;  12, 9]

   (17) %--------------------------------------------------------------------
   (18) % Example 3: GetRows  or  GetColumns  (range of rows or columns in a matrix)
   (19) %--------------------------------------------------------------------
   (20) RangeOfRowsOfM = GetRows( M, 1:2 )
-> (21) RangeOfRowsOfM = [1, 2, 3, 4;  5, 6, 7, 8]

   (22) RangeOfColumnsOfM = GetColumns( M, 2:3, 3:2 )
-> (23) RangeOfColumnsOfM = [2, 3, 3, 2;  6, 7, 7, 6;  10, 11, 11, 10]

   (24) %--------------------------------------------------------------------
   (25) % Example 4: GetRows  or  GetColumns  (submatrix)
   (26) %--------------------------------------------------------------------
   (27) Submatrix1 = M[ 1:2, 1:2 ]
-> (28) Submatrix1 = [1, 2;  5, 6]

   (29) Submatrix2 = M[ 3 : GetRow(M),  2 : GetColumn(M) ]
-> (30) Submatrix2 = [10, 11, 12]



GetComputerID
GetComputerID

 Purpose:  Generates license information.

  Syntax:  GetComputerID

 Related:  GetLicenseAgreement


GetLicenseAgreement
License

 Purpose:  Displays the program's license agreement and asks
           whether you would like to generate a license.

  Syntax:  License

 Related:  GetComputerID


GetDefaults
GetDefaults

  Syntax:  GetDefaults

  Output:  Displays the settings of default preferences.

  Remark:  To change a default setting, issue the corresponding command.
           Use HELP for more information, e.g., HELP SetDigits.

  Remark:  Some defaults can be set in the MGDefaultPreferences.txt
           file that resides in the program's MGToolbox folder, e.g.,
           SetScratchDirectory  and  SetWorkingDirectory.

 Related:  AUTOLEV  SetDefaults  SetPauseOnWarning



GetDeterminant
GetDeterminant

 Purpose:  Forms the determinant of a matrix.

Syntax 1:  GetDeterminant( squareMatrix )
Syntax 2:  GetDeterminant( Option, squareMatrix )

   Input:  squareMatrix -- a  square matrix
           Option -- MINORS or GAUSS

  Output:  Determinant of squareMatrix

  Remark:  The determinant is calculated by one of two methods.
           MINORS is advantageous for relatively small matrices
           whereas GAUSS may be better for relatively large ones.
           If neither MINORS or GAUSS is specified, a method is
           chosen based on the size and number of non-numerical
           elements in squareMatrix.

 Related:  GetColumns  GetDeterminant  GetDiagonalMatrix  GetEigen
           GetElement  GetIdentityMatrix  GetInverse  GetRows  GetTrace
           GetTranspose  GetZeroMatrix  Solve

   (1) %--------------------------------------------------------------------
   (2) % Example: GetDeterminant  
   (3) %--------------------------------------------------------------------
   (4) Constant a, b, c,  d, e, f,  g, h, i
   (5) M = [a, b, c;  d, e, f;  g, h, i]
-> (6) M = [a, b, c;  d, e, f;  g, h, i]

   (7) determinant = GetDeterminant( M )
-> (8) determinant = g*(b*f-c*e) + i*(a*e-b*d) - h*(a*f-c*d)

   (9) detWithMinors = GetDeterminant( MINORS, M )
-> (10) detWithMinors = g*(b*f-c*e) + i*(a*e-b*d) - h*(a*f-c*d)

   (11) detWithGauss  = GetDeterminant( GAUSS,  M )
-> (12) detWithGauss = (a*e-b*d)*(i-c*g/a-(f-c*d/a)*(h-b*g/a)/(e-b*d/a))



GetDiagonalMatrix
GetDiagonalMatrix

 Purpose:  Forms diagonal matrices.
           Forms a column matrix from diagonal elements of a matrix.

Syntax 1:  GetDiagonalMatrix( m, X )
Syntax 2:  GetDiagonalMatrix( numberOfRows, numberOfColumns, X )
Syntax 3:  GetDiagonalMatrix( oneDimensionalMatrix )
Syntax 4:  GetDiagonalMatrix( twoDimensionalMatrix )

   Input:  m -- positive integer
           numberOfRows -- positive integer
           numberOfColumns -- positive integer
           X -- an expression
           oneDimensionalMatrix -- a row or column matrix
           twoDimensionalMatrix -- a rectangular matrix

 Output 1: The m x m square matrix having X as every element on
           the diagonal and 0 elsewhere.

 Output 2: The numberOfRows x numberOfColumns matrix such that
           every i,i element is X while remaining elements are 0.
           (i is smaller than numberOfRows and numberOfCols).

 Output 3: The diagonal matrix whose diagonal elements are the
           elements of oneDimensionalMatrix.

 Output 4: The column matrix whose elements are the elements of
           twoDimensionalmatrix with equal row and column indices.

 Related:  GetColumns  GetDeterminant  GetDiagonalMatrix  GetEigen
           GetElement  GetIdentityMatrix  GetInverse  GetRows  GetTrace
           GetTranspose  GetZeroMatrix  Solve

   (1) %--------------------------------------------------------------------
   (2) % Example 1: GetDiagonalMatrix  (3x3 matrix with 15 on the diagonal)
   (3) %--------------------------------------------------------------------
   (4) M1 = GetDiagonalMatrix( 3, 15 )
-> (5) M1 = [15, 0, 0;  0, 15, 0;  0, 0, 15]

   (6) %--------------------------------------------------------------------
   (7) % Example 2: GetDiagonalMatrix  (2x3 matrix with 17 on the diagonal)
   (8) %--------------------------------------------------------------------
   (9) M2 = GetDiagonalMatrix( 2,3, 17 )
-> (10) M2 = [17, 0, 0;  0, 17, 0]

   (11) %--------------------------------------------------------------------
   (12) % Example 3: GetDiagonalMatrix  (3x3 matrix with 18,19,20 on diagonal)
   (13) M3 = GetDiagonalMatrix( [18,19,20] )
-> (14) M3 = [18, 0, 0;  0, 19, 0;  0, 0, 20]

   (15) %--------------------------------------------------------------------
   (16) % Example 4: GetDiagonalMatrix  (get diagonal elements of matrix)
   (17) %--------------------------------------------------------------------
   (18) Constant  A{1:3,1:4}
   (19) M4 = GetDiagonalMatrix( [A11,A12,A13,A14;A21,A22,A23,A24;A31,A32,A33,A34] )
-> (20) M4 = [A11;  A22;  A33]



GetDistance
GetDistance  and  GetDistanceSquared

 Purpose:  Gets the distance (or its square) between two points.

Syntax 1:  Q.GetDistance( P )
Syntax 2:  Q.GetDistanceSquared( P )

   Input:  Q -- The name of a point.
           P -- The name of another point.

Output 1:  Distance between Q and P.
Output 2:  Square of the distance between Q and P.

 Related:  GetMagnitude           GetMagnitudeSquared
           GetDistance            GetDistanceSquared
           GetSpeed               GetSpeedSquared
           GetAngularSpeed        GetAngularSpeedSquared
           GetAngleBetweenVectors GetAngleBetweenUnitVectors
           GetPosition            SetPosition       Translate
           GetVelocity            SetVelocity       SetPositionVelocity
           GetAcceleration        SetAcceleration   SetVelocityAcceleration
           GetUnitVector          GetElongation     Vector   Dot

   (1) %--------------------------------------------------------------------
   (2) % Example 1: GetDistance and GetDistanceSquared
   (3) %--------------------------------------------------------------------
   (4) RigidFrame N             
   (5) Point      P()
   (6) Variable   xP
   (7) P.SetPosition( No, xP*Nx> )
-> (8) p_No_P> = xP*Nx>

   (9) DistanceBetweenPAndNo = P.GetDistance( No )
-> (10) DistanceBetweenPAndNo = abs(xP)

   (11) DistanceSquaredPAndNo = P.GetDistanceSquared( No )
-> (12) DistanceSquaredPAndNo = xP^2

   (13) %--------------------------------------------------------------------
   (14) % Example 2: GetDistance and GetDistanceSquared
   (15) %--------------------------------------------------------------------
   (16) Particle   Q            
   (17) Variable   xQ, yQ
   (18) Q.SetPosition( P,  xQ*Nx> + yQ*Ny> )
-> (19) p_P_Q> = xQ*Nx> + yQ*Ny>

   (20) DistanceBetweenQAndP = Q.GetDistance( P )
-> (21) DistanceBetweenQAndP = sqrt(xQ^2+yQ^2)

   (22) DistanceBetweenQAndNo = Q.GetDistance( No )
-> (23) DistanceBetweenQAndNo = sqrt(yQ^2+(xP+xQ)^2)

   (24) DistanceSquaredQAndNo = Q.GetDistanceSquared( No )
-> (25) DistanceSquaredQAndNo = yQ^2 + (xP+xQ)^2



GetDynamics
GetDynamics   GetDynamicsKane    GetDynamicsLagrange

 Purpose:  Gets equations of motion (dynamics).

Syntax 1:  Object.GetDynamics()
Syntax 2:  Object.GetDynamics( aboutPoint )
Syntax 3:  System.GetDynamicsKane()
Syntax 4:  System.GetDynamicsLagrange()    IN DEVELOPMENT.  SEE SYNTAX.

   Input:  Object -- The name of a Particle, RigidBody, or System.
           aboutPoint -- The name of a point.

Output 1:  Newton's   equation of motion for Object (i.e., m*a - F).
Output 2:  Euler's    equation of motion for Object about aboutPoint.
Output 3:  Kane's     equation for dynamics for the entire System.
Output 4:  Lagrange's equation for dynamics for the entire System.

  Remark:  If Q is a point of a RigidFrame or RigidBody B, declare it as
           Point Q(B).   This accounts for forces/moments on B.

  Remark:  For Newton/Euler equations, type  Help Statics  or  Help Dynamics
           For Kane's       equations, type  Help Kane
           For Lagrange's   equations, type  Help Lagrange

 Related:  AddForce  AddTorque  SetMass  SetInertia  Rotate  Translate
           NewtonianFrame  Point  Particle  RigidFrame  RigidBody
           GetStatics   GetStaticsKane   GetStaticsLagrange
           GetDynamics  GetDynamicsKane  GetDynamicsLagrange
           SetGeneralizedCoordinate   SetGeneralizedSpeed

   (1) %--------------------------------------------------------------------
   (2) % Example 1: GetDynamics   (dynamics of a particle in free-fall)
   (3) %--------------------------------------------------------------------
   (4) NewtonianFrame N             
   (5) Particle       Q
   (6) Q.SetMass( mQ )
   (7) Variable  y''
   (8) Q.Translate( No, y*Ny> )
-> (9) p_No_Q> = y*Ny>
-> (10) v_Q_N> = y'*Ny>
-> (11) a_Q_N> = y''*Ny>

   (12) Constant  g
   (13) Q.AddForceGravity( -g*Ny> )
-> (14) Force_Q> = -mQ*g*Ny>

   (15) NewtonsVectorEqnForQ> = Q.GetDynamics()
-> (16) NewtonsVectorEqnForQ> = mQ*(g+y'')*Ny>

   (17) NewtonsScalarEqnForQ = Dot( NewtonsVectorEqnForQ>, Ny> )
-> (18) NewtonsScalarEqnForQ = mQ*(g+y'')

   (19) Solve(  NewtonsScalarEqnForQ,  y'' )
-> (20) y'' = -g

   (21) %--------------------------------------------------------------------
   (22) % Example 2: GetDynamics  (rigid-body pendulum with applied torque)
   (23) %--------------------------------------------------------------------
   (24) RigidBody      B            
   (25) Constant       L                 % Distance to B's center of mass
   (26) Variable       q''               % Pendulum angle 
   (27) Variable       Tz                % Torque is applied to B 
   (28) B.SetMass( m )
   (29) B.SetInertia( Bcm, Ixx, Iyy, Izz )
   (30) B.RotateZ( N, q )  
-> (31) B_N = [cos(q), sin(q), 0;  -sin(q), cos(q), 0;  0, 0, 1]
-> (32) w_B_N> = q'*Bz>
-> (33) alf_B_N> = q''*Bz>

   (34) Bcm.Translate( No, -L*By> )
-> (35) p_No_Bcm> = -L*By>
-> (36) v_Bcm_N> = L*q'*Bx>
-> (37) a_Bcm_N> = L*q''*Bx> + L*q'^2*By>

   (38) B.AddForceGravity( -g*Ny> )
-> (39) Force_Bcm> = -m*g*Ny>

   (40) B.AddTorque( Tz*Bz> )  
-> (41) Torque_B> = Tz*Bz>

   (42) EulersVectorEqnForBAboutNo> = B.GetDynamics( No )
-> (43) EulersVectorEqnForBAboutNo> = (m*g*L*sin(q)+Izz*q''+m*L^2*q''-Tz)*Bz>

   (44) EulersScalarEqnForBAboutNo = Dot( EulersVectorEqnForBAboutNo>, Nz> )
-> (45) EulersScalarEqnForBAboutNo = m*g*L*sin(q) + Izz*q'' + m*L^2*q'' - Tz

   (46) Solve( EulersScalarEqnForBAboutNo, q'' )
-> (47) q'' = (Tz-m*g*L*sin(q))/(Izz+m*L^2)



GetEffectiveForce
GetEffectiveForce

 Purpose:  Gets effective force in the NewtonianFrame (or a designated frame).

Syntax 1:  Object.GetEffectiveForce()
Syntax 2:  Object.GetEffectiveForce( refFrame )

   Input:  Object -- The name of a Particle, RigidBody, or System.
           refFrame -- The name of a RigidFrame or RigidBody

Output 1:  Effective force of Object in the NewtonianFrame.
Output 2:  Effective force of Object in refFrame.

  Remark:  A particle Q's effective force in refFrame is defined
           Q.GetMass() * Q.GetAcceleration(refFrame)

 Related:  GetAngularMomentum  GetLinearMomentum  GetGeneralizedMomentum
           GetKineticEnergy    GetMomentOfForces  GetResultantForce
           GetEffectiveForce  GetMomentOfEffectiveForce
           GetStatics   GetStaticsKane   GetStaticsLagrange
           GetDynamics  GetDynamicsKane  GetDynamicsLagrange

   (1) %--------------------------------------------------------------------
   (2) % Example 1: GetEffectiveForce  (particle moving in a plane)
   (3) %--------------------------------------------------------------------
   (4) NewtonianFrame N             
   (5) Particle       Q             
   (6) Q.SetMass( mQ )
   (7) Variable       x'', y'', z''    
   (8) Q.SetAcceleration( N, x''*Nx> + y''*Ny> + z''*Nz> )
-> (9) a_Q_N> = x''*Nx> + y''*Ny> + z''*Nz>

   (10) QEffectiveForce> = Q.GetEffectiveForce()
-> (11) QEffectiveForce> = mQ*x''*Nx> + mQ*y''*Ny> + mQ*z''*Nz>

   (12) %--------------------------------------------------------------------
   (13) % Example 2: GetEffectiveForce  (rigid body moving in a plane)
   (14) %--------------------------------------------------------------------
   (15) RigidBody  B             
   (16) B.SetMass( mB )
   (17) Variable   vx', vy', vz'    
   (18) Bcm.SetAcceleration( N, vx'*Nx> + vy'*Ny> + vz'*Nz> )
-> (19) a_Bcm_N> = vx'*Nx> + vy'*Ny> + vz'*Nz>

   (20) BEffectiveForce> = B.GetEffectiveForce()
-> (21) BEffectiveForce> = mB*vx'*Nx> + mB*vy'*Ny> + mB*vz'*Nz>

   (22) %--------------------------------------------------------------------
   (23) % Example 3: GetEffectiveForce  (linear momentum of a system)
   (24) %--------------------------------------------------------------------
   (25) SEffectiveForce> = System.GetEffectiveForce()
-> (26) SEffectiveForce> = (mB*vx'+mQ*x'')*Nx> + (mB*vy'+mQ*y'')*Ny> + (mB*vz'+
        mQ*z'')*Nz>



GetEigen
GetEigen

 Purpose:  Calculates the eigenvalues or the eigenvalues and
           eigenvectors of a real square matrix.

Syntax 1:  GetEigen( M )
Syntax 2:  GetEigen( M, eigenVectorMatrixName )

   Input:  M -- a square matrix whose elements are real numbers
                or a dyadic whose measures are real numbers.

           eigenVectorMatrixName -- the name of a square matrix whose
                columns are to be the eigenvectors of M

Output 1:  Returns the eigenvalues of M.
Output 2:  Returns the eigenvalues of M.  Assigns eigenVectorMatrixName.

  Remark:  The COLUMNS of eigenVectorMatrixName are the eigenvectors of M.

 Related:  GetColumns  GetDeterminant  GetDiagonalMatrix  GetEigen
           GetElement  GetIdentityMatrix  GetInverse  GetRows  GetTrace
           GetTranspose  GetZeroMatrix  Solve

   (1) %--------------------------------------------------------------------
   (2) % Example 1: GetEigen   (eigenvalues of a matrix)
   (3) %--------------------------------------------------------------------
   (4) A = [1, 2, 3;  4, 5, 6;  5, 3, 7]
-> (5) A = [1, 2, 3;  4, 5, 6;  5, 3, 7]

   (6) eigenValuesOfA = GetEigen( A )
-> (7) eigenValuesOfA = [-0.9412871;  1.542281;  12.39901]

   (8) %--------------------------------------------------------------------
   (9) % Example 2: GetEigen   (eigenvalues and eigenvectors of a matrix)
   (10) %--------------------------------------------------------------------
   (11) B = [1, 2;  3, 4]
-> (12) B = [1, 2;  3, 4]

   (13) eigenValuesOfB = GetEigen( B, eigenVectorsOfB )
-> (14) eigenVectorsOfB = [-0.8245648, -0.4159736;  0.5657675, -0.9093767]
-> (15) eigenValuesOfB = [-0.3722813;  5.372281]

   (16) %--------------------------------------------------------------------
   (17) % Example 3: GetEigen   (eigenvalues of a dyadic)
   (18) %--------------------------------------------------------------------
   (19) RigidFrame  F
   (20) D>> = Dyadic( F, A )
-> (21) D>> = Fx>*Fx> + 2*Fx>*Fy> + 3*Fx>*Fz> + 4*Fy>*Fx> + 5*Fy>*Fy> + 6*Fy>*Fz>
        + 5*Fz>*Fx> + 3*Fz>*Fy> + 7*Fz>*Fz>

   (22) eigenValuesOfD = GetEigen( D>> )
-> (23) eigenValuesOfD = [-0.9412871;  1.542281;  12.39901]

   (24) %--------------------------------------------------------------------
   (25) % Example 4: GetEigen   (eigenvalues and eigenvectors of a dyadic)
   (26) %--------------------------------------------------------------------
   (27) eigenValuesOf3D = GetEigen( 3*D>>, eigenVectorsOfD )
-> (28) eigenVectorsOfD = [0.8537881*Fx> - 0.05164451*Fy> - 0.5180529*Fz>;  
        -0.08917212*Fx> - 0.8360999*Fy> + 0.5412811*Fz>;  0.2947511*Fx> + 0.6929328*Fy> + 0.6580015*Fz>]

-> (29) eigenValuesOf3D = [-2.823861;  4.626843;  37.19702]



GetElement
GetElement []

 Purpose:  Returns a designated element of a matrix

Syntax 1:  namedMatrix2D[ rowIndex, colIndex ]
           GetElement( matrix2D, rowIndex, colIndex )
Syntax 2:  namedMatrix1D[ index ]
           GetElement( matrix1D, index )
Syntax 3:  namedMatrix2D[ rowStart : rowStop,  colStart : colStop ]
           GetElement( matrix2D,  rowStart : rowStop,  colStart : colStop )
Syntax 4:  namedMatrix1D[ indexStart : indexStop ]
           GetElement( matrix1D,  indexStart : indexStop )

   Input:  namedMatrix2D or matrix2D -- rectangular matrix   (two-dimensional).
           namedMatrix1D or matrix1D -- row or column matrix (one-dimensional).
           rowIndex -- integer identifying a row    in a 2D matrix.
           colIndex -- integer identifying a column in a 2D matrix.
           index  -- integer identifying ith element of a 1D matrix.
           rowStart : rowStop -- integers identifying rows in a 2D matrix.
           colStart : colStop -- integers identifying columns in a 2D matrix.
           indexStart : indexStop -- integer range for elements in a 1D matrix.

Output 1:  Element[ rowIndex, colIndex]  of namedMatrix2D or matrix2D.
Output 2:  Element[ index ]              of namedMatrix1D or matrix1D.
Output 3:  A sub-matrix of namedMatrix2D or matrix2D whose rows and columns are
           chosen by  rowStart : rowStop  and  colStart : colStop.
Output 4:  A sub-matrix of namedMatrix1D or matrix1D whose elements are
           chosen by  indexStart : indexStop.

  Remark:  To select various rows or columns, consider GetRows or GetColumns.

 Related:  GetColumns  GetDeterminant  GetDiagonalMatrix  GetEigen
           GetElement  GetIdentityMatrix  GetInverse  GetRows  GetTrace
           GetTranspose  GetZeroMatrix  Solve

   (1) %--------------------------------------------------------------------
   (2) % Example 1: GetElement of two-dimensional matrix -- uses [] syntax.
   (3) %--------------------------------------------------------------------
   (4) A = [1, 2, 3;  4,  5, 6; 7, 8, 9]
-> (5) A = [1, 2, 3;  4, 5, 6;  7, 8, 9]

   (6) A12 = A[ 1, 2 ]
-> (7) A12 = 2

   (8) ARange = A[ 1:2, 2:3 ]
-> (9) ARange = [2, 3;  5, 6]

   (10) %--------------------------------------------------------------------
   (11) % Example 2: GetElement (unnamed two-dimensional matrix)
   (12) %--------------------------------------------------------------------
   (13) AA12 = GetElement( A * A,  1, 2 )
-> (14) AA12 = 36

   (15) AARange = GetElements( A * A,  1:2, 2:3 )
-> (16) AARange = [36, 42;  81, 96]

   (17) %--------------------------------------------------------------------
   (18) % Example 3: GetElement of one-dimensional matrix -- uses [] syntax.
   (19) %--------------------------------------------------------------------
   (20) B = [t^2, sin(t), cos(t), tan(t)]
-> (21) B = [t^2, sin(t), cos(t), tan(t)]

   (22) B2 = B[ 2 ]
-> (23) B2 = sin(t)

   (24) BRange = B[ 2:4 ]
-> (25) BRange = [sin(t), cos(t), tan(t)]

   (26) %--------------------------------------------------------------------
   (27) % Example 4: GetElement (unnamed one-dimensional matrix)
   (28) %--------------------------------------------------------------------
   (29) BB2 = GetElement( B + B,  2 )
-> (30) BB2 = 2*sin(t)

   (31) BBRange = GetElement( B + B,  2:4 )
-> (32) BBRange = [2*sin(t), 2*cos(t), 2*tan(t)]



GetElongation
GetElongation

 Purpose:  Gets the time-derivative of the distance between two points.

  Syntax:  Q.GetElongation( P )

   Input:  Q -- The name of a point.
           P -- The name of another point.

  Output:  Time-derivative of the distance between Q and P.

 Related:  Translate        SetPositionVelocity   SetVelocityAcceleration
           SetPosition      GetPosition   GetDistance  GetDistanceSquared
           SetVelocity      GetVelocity   GetSpeed     GetElongation
           SetAcceleration  GetAcceleration

   (1) %--------------------------------------------------------------------
   (2) % Example 1: GetElongation 
   (3) %--------------------------------------------------------------------
   (4) RigidFrame N             
   (5) Point      P, Q
   (6) Variable   xP', xQ', yQ'
   (7) P.SetPosition( No, xP*Nx> )
-> (8) p_No_P> = xP*Nx>

   (9) ElongationBetweenPAndNo = P.GetElongation( No )
-> (10) ElongationBetweenPAndNo = xP*xP'/abs(xP)

   (11) %--------------------------------------------------------------------
   (12) % Example 2: GetElongation 
   (13) %--------------------------------------------------------------------
   (14) Q.SetPosition( P,  xQ*Nx> + yQ*Ny> )
-> (15) p_P_Q> = xQ*Nx> + yQ*Ny>

   (16) ElongationBetweenQAndP = Q.GetElongation( P )
-> (17) ElongationBetweenQAndP = (xQ*xQ'+yQ*yQ')/sqrt(xQ^2+yQ^2)



GetEnergyCheckKane
GetEnergyCheckKane  and  GetEnergyCheckSigmaR

 Purpose:  Returns an energy checking function associated with Kane's
           dynamical equations, which theoretically remains constant
           throughout numerical integration of equations of motion.

Syntax 1:  System.GetEnergyCheckKane()
Syntax 2:  System.GetEnergyCheckKane( WF )
Syntax 3:  Object.GetEnergyCheckSigmaR()
Syntax 4:  Object.GetEnergyCheckSigmaR( refFrame )

   Input:  WF -- an expression for the System's work function.

   Input:  Object -- The name of a Particle, RigidBody, or System.

Output 1:  Writes a differential equation of the form WChecki' = fi.
           Returns the associated energy checking function.

Output 2:  Same as Output 1.

Output 3:  Returns Object's SigmaR in the NewtonianFrame,
           a quantity defined by Mitiguy and Banerjee (see below)
           to construct the energy checking function.

Output 4:  Returns Object's SigmaR in refFrame.

  Remark:  Due to round-off and truncation errors and numerical
           integration inaccuracies, the value of a checking function
           tends to vary slightly during numerical integration; but,
           usually (depending on machine accuracy) the variations in
           the value of a checking function become ever smaller when
           appropriate changes are made in error bounds, integration
           stepsize, etc.  When such changes fail to lead to ever
           smaller variations in checking function values, integration
           results must be regarded as suspect or incorrect.

  Remark:  GetEnergyCheckKane uses the following quantities:
           (a) Mass of particles and bodies
           (b) Inertia scalars for rigid bodies
           (c) Velocities of particles or mass center of rigid bodies
           (d) Angular velocities of rigid bodies

  Remark:  The syntax NiCheck(SIGMA) was replaced by GetEnergyCheckSigmaR
           due to algorithm changes (see below).

  Remark:  The algorithm for GetEnergyCheckKane is more efficient than
           the older NiCheck algorithm for programs before Autolev 4.1.
           The newer Mitiguy/Banerjee numerical integration energy checking is
           available in the textbook: Mitiguy, Paul, Advanced Dynamics for
           Professional Mechanical, Aerospace, and BioMechanical Engineers.

   (1) %--------------------------------------------------------------------
   (2) % Example 1: GetEnergyCheckKane
   (3) %--------------------------------------------------------------------
   (4) NewtonianFrame  N
   (5) Particle        A
   (6) RigidBody       B
   (7) Constant        L = 1 m, g
   (8) Variable        x''
   (9) Specified       phi''
   (10) SetGeneralizedSpeed( x' )
   (11) SetDt( phi = 3*sin(2*t) )
-> (12) phi = 3*sin(2*t)
-> (13) phi' = 6*cos(2*t)
-> (14) phi'' = -12*sin(2*t)

   (15) A.SetMass( mA = 1 kg )
   (16) B.SetMass( mB = 1 kg )
   (17) B.SetInertia( Bcm, IB = 1 kg*m^2, 0, IB )
   (18) B.RotateZ( N, phi )
-> (19) B_N = [cos(phi), sin(phi), 0;  -sin(phi), cos(phi), 0;  0, 0, 1]
-> (20) w_B_N> = phi'*Bz>
-> (21) alf_B_N> = phi''*Bz>

   (22) A.Translate( No, x*Nx> )
-> (23) p_No_A> = x*Nx>
-> (24) v_A_N> = x'*Nx>
-> (25) a_A_N> = x''*Nx>

   (26) Bcm.Translate( A, 0.5*L*By> )
-> (27) p_A_Bcm> = 0.5*L*By>
-> (28) v_Bcm_N> = -0.5*L*phi'*Bx> + x'*Nx>
-> (29) a_Bcm_N> = -0.5*L*phi''*Bx> - 0.5*L*phi'^2*By> + x''*Nx>

   (30) System.AddForceGravity( -g*Ny> )
-> (31) Force_A> = -mA*g*Ny>
-> (32) Force_Bcm> = -mB*g*Ny>

   (33) Zero = System.GetDynamicsKane()
-> (34) Zero = [0.5*mB*L*(sin(phi)*phi'^2-cos(phi)*phi'') + (mA+mB)*x'']

   (35) EnergyCheck = System.GetEnergyCheckKane()
-> (36) WCheck1' = 0.5*mB*L*(sin(phi)*phi'^2-cos(phi)*phi'')*x'
-> (37) EnergyCheck = WCheck1 + 0.5*(mA+mB)*x'^2

   (38) sigmaB = B.GetEnergyCheckSigmaR()
-> (39) sigmaB = 0.5*mB*L*(sin(phi)*phi'^2-cos(phi)*phi'')*x'

   (40) Input  x = 0,  x' = 0
   (41) Input  tFinal = 10 s, tStep = 0.1, absError = 1E-9, relError = 1E-9
   (42) Output t sec, EnergyCheck Joules, x m, phi degrees, sigmaB
   (43) ODE( Zero, x'' ) GetEnergyCheckKane



GetEnvironmentValue
GetEnvironmentValue

 Purpose:  Displays the value of an operating system environment variable.

  Syntax:  GetEnvironmentValue( envName )

   Input:  envName -- the name of an operating system environment variable.

  Output:  Displays the value assigned to the operating system environment
           variable envName.  For example, on Microsoft Windows PCs,
           GetEnvironmentValue( COMPUTERNAME )
           displays the operating system value assigned to COMPUTERNAME.

  Remark:  If an environment variable, e.g., COMPUTERNAME is not set
           or is set improperly, it may be set as follows:

  Windows 2000 and XP:

           Click on Start, Settings, Control Panel, System, Advanced,
           Environment  Variables.  Under System Variables, click New ...
           Enter the Variable Name COMPUTERNAME and enter a Variable Value
           e.g., yourComputerName.  Click OK to exit each open dialogue box.

  Windows 95/98/Millenium:

           Add the following line to the file Autoexec.bat, which
           resides on the C:\ drive:

               SET COMPUTERNAME=yourComputerName

  Windows NT:

           Click on Start, Settings, Control Panel, System.
           Click on the Environment tab.  Enter the Variable COMPUTERNAME
           and a Value, e.g., yourComputerName. Click OK to exit.


  Unix and Macintosh OSX:

           To set the  HOSTNAME  environment variable, edit the
           file .cshrc and add the following line:

                setenv HOSTNAME yourComputerName

 Related:  GetDefaults  GetWorkingDirectory  SetWorkingDirectory
           GetEnvironmentValue   SetScratchDirectory

--------------------------------------------------------------------
 Example:

   (1) GetEnvironmentValue( ComputerName )

 The value JPComputer is assigned to the environment variable ComputerName



GetForceElectrostaticPotentialEnergy
GetForceElectrostaticPotentialEnergy

 Purpose:  Calculates potential energy associated with electrostatic forces.

  Syntax:  Q.GetForceElectrostaticPotentialEnergy( P, k )

   Input:  Q -- the name of a point
           P -- the name of a point
           k -- scalar representing the electrostatic proportionality
                constant, approximately 8.9875518E+09 N*m^2/Coulomb^2.

  Output:  A potential energy due to the inverse square law
           electrostatic force between P and Q.
           Note: Q's position vector from P must be available.

  Remark:  Ensure charges are assigned to Q and P with the commands:
           Q.SetCharge(...)  and  P.SetCharge(...).

  Remark:  The NIST approximation for k is 8.9875518E+09 N*m^2/Coulomb^2.

 Related:  AddForce  AddForceDamper  AddForceElectrostatic  AddForceGravity
           AddForceInverseSquare  AddForceLinearActuator  AddForceSpring
           AddTorque  AddTorqueDamper
           GetMomentOfForces  GetResultantForce  GetResultantTorque
           GetForceGravityPotentialEnergy  GetForceSpringPotentialEnergy
           GetForceElectrostaticPotentialEnergy  GetCharge  SetCharge
           GetForceInverseSquarePotentialEnergy
           GetStatics   GetStaticsKane   GetStaticsLagrange
           GetDynamics  GetDynamicsKane  GetDynamicsLagrange

   (1) %--------------------------------------------------------------------
   (2) % Example 1: GetForceElectrostaticPotentialEnergy  (horizontal 1D)
   (3) %--------------------------------------------------------------------
   (4) NewtonianFrame N
   (5) Particle  A
   (6) Variable  xA
   (7) Constant  k
   (8) No.SetCharge( chargeN )
   (9) A.SetCharge(  chargeA )
   (10) A.SetPosition( No, xA*Nx> )
-> (11) p_No_A> = xA*Nx>

   (12) potentialEnergy1 = A.GetForceElectrostaticPotentialEnergy( No, k )
-> (13) potentialEnergy1 = chargeA*chargeN*k/abs(xA)

   (14) %--------------------------------------------------------------------
   (15) % Example 2: GetForceElectrostaticPotentialEnergy  (planar 2D)
   (16) %--------------------------------------------------------------------
   (17) Particle  P, Q
   (18) Variable  x, y
   (19) P.SetCharge( 10 )
   (20) Q.SetCharge( 20 )
   (21) Q.SetPosition( P, x*Nx> + y*Ny> )
-> (22) p_P_Q> = x*Nx> + y*Ny>

   (23) potentialEnergy2 = Q.GetForceElectrostaticPotentialEnergy( P, k )
-> (24) potentialEnergy2 = 200*k/sqrt(x^2+y^2)



GetForceInverseSquarePotentialEnergy
GetForceInverseSquarePotentialEnergy

 Purpose:  Calculates potential energy associated with an inverse-square force.

  Syntax:  Q.GetForceInverseSquarePotentialEnergy( P, coef )

   Input:  Q -- the name of a point
           P -- the name of a point
           coef -- a scalar expression

  Output:  A potential energy due to an inverse square law
           force between P and Q.
           Note: Q's position vector from P must be available.

  Remark:  The potential energy is calculated as:
           coef / Q.GetDistance(P)

  Remark:  A positive coef corresponds to a repulsive force,
           i.e., a force that pushes Q away from P, whereas
           a negative coef corresponds to an attractive force,
           i.e., a force that pulls Q towards P.

 Related:  AddForce  AddForceDamper  AddForceElectrostatic  AddForceGravity
           AddForceInverseSquare  AddForceLinearActuator  AddForceSpring
           AddTorque  AddTorqueDamper
           GetMomentOfForces  GetResultantForce  GetResultantTorque
           GetForceGravityPotentialEnergy  GetForceSpringPotentialEnergy
           GetForceElectrostaticPotentialEnergy
           GetForceInverseSquarePotentialEnergy
           GetStatics   GetStaticsKane   GetStaticsLagrange
           GetDynamics  GetDynamicsKane  GetDynamicsLagrange

   (1) %--------------------------------------------------------------------
   (2) % Example: GetForceInverseSquarePotentialEnergy
   (3) %--------------------------------------------------------------------
   (4) NewtonianFrame N             
   (5) Particle   P, Q             
   (6) Variable   x, y
   (7) Constant   coef
   (8) Q.SetPosition( P, x*Nx> + y*Ny> )
-> (9) p_P_Q> = x*Nx> + y*Ny>

   (10) PotentialEnergy = Q.GetForceInverseSquarePotentialEnergy( P, coef )
-> (11) PotentialEnergy = coef/sqrt(x^2+y^2)



GetForceGravityPotentialEnergy
GetForceGravityPotentialEnergy

 Purpose:  Calculates potential energy associated with gravity forces.

Syntax 1:  Object.GetForceGravityPotentialEnergy( gravityVector, refPoint )
Syntax 2:  Q.GetForceGravityPotentialEnergy( P, G )

   Input:  Object -- The name of a Particle, RigidBody, or System.
           gravityVector -- A vector whose magnitude is equal to the
                            local gravitational acceleration constant
                            and whose direction is locally downward.
           refPoint -- The point above which potential energy is positive
                       and below which potential energy is negative.

           Q -- the name of a Particle
           P -- the name of a Particle
           G -- a scalar representing the universal gravitational
                constant, approximately 6.6732E-11 N m^2 kg^(-2).

Output 1:  Object's uniform gravitational potential energy for a given
           reference point, due to a uniform local gravitational force.

Output 2:  A potential energy due to the inverse square law
           gravitational force between P and Q.
           Note: Q's position vector from P must be available.

  Remark:  Ensure mass is assigned to appropriate particles and bodies
           before issuing an GetForceGravityPotentialEnergy command.

           NIST defines Earth's gravity acceleration as 9.80665 m/sec^2.
           The NIST approximation for G is 6.6732E-11 N m^2 kg^(-2).
           The mass of the Earth is approximately 5.97E24 kg.
           The mass of the Moon  is approximately 7.34E22 kg.

 Related:  AddForce  AddForceDamper  AddForceElectrostatic  AddForceGravity
           AddForceInverseSquare  AddForceLinearActuator  AddForceSpring
           AddTorque  AddTorqueDamper
           GetMomentOfForces  GetResultantForce  GetResultantTorque
           GetForceGravityPotentialEnergy  GetForceSpringPotentialEnergy
           GetStatics   GetStaticsKane   GetStaticsLagrange
           GetDynamics  GetDynamicsKane  GetDynamicsLagrange

   (1) %--------------------------------------------------------------------
   (2) % Example 1: GetForceGravityPotentialEnergy  (local gravity on a particle)
   (3) %--------------------------------------------------------------------
   (4) NewtonianFrame N             
   (5) Particle   Q             
   (6) Variable   xQ, yQ
   (7) Q.SetMass( mQ )
   (8) Q.SetPosition( No, xQ*Nx> + yQ*Ny> )
-> (9) p_No_Q> = xQ*Nx> + yQ*Ny>

   (10) QPotentialEnergy = Q.GetForceGravityPotentialEnergy( -9.81*Ny>, No )
-> (11) QPotentialEnergy = 9.81*mQ*yQ

   (12) %--------------------------------------------------------------------
   (13) % Example 2: GetForceGravityPotentialEnergy  (local gravity on rigid body)
   (14) %--------------------------------------------------------------------
   (15) RigidBody  B             
   (16) B.SetMass( mB )
   (17) Variable   xB, yB    
   (18) Bcm.SetPosition( No, xB*Nx> + yB*Ny> )
-> (19) p_No_Bcm> = xB*Nx> + yB*Ny>

   (20) BPotentialEnergy = B.GetPotentialEnergyGravity( -9.81*Ny>, No )
-> (21) BPotentialEnergy = 9.81*mB*yB

   (22) SPotentialEnergy = System.GetForceGravityPotentialEnergy( -9.81*Ny>, No )
-> (23) SPotentialEnergy = 9.81*mB*yB + 9.81*mQ*yQ

   (24) %--------------------------------------------------------------------
   (25) % Example 3: GetPotentialEnergyGravity  (universal gravity)
   (26) %--------------------------------------------------------------------
   (27) Constant   G       % Universal gravitational constant
   (28) Particle   P
   (29) Variable   x, y
   (30) P.SetMass( mP )
   (31) Q.SetPosition( P, x*Nx> + y*Ny> )
-> (32) p_P_Q> = x*Nx> + y*Ny>

   (33) InverseSquareLawPotentialEnergy = Q.GetForceGravityPotentialEnergy( P, G )
-> (34) InverseSquareLawPotentialEnergy = -mP*mQ*G/sqrt(x^2+y^2)



GetForceSpringPotentialEnergy
GetForceSpringPotentialEnergy

 Purpose:  Calculates potential energy associated with a spring force.

Syntax 1:  Q.GetForceSpringPotentialEnergy( P, k, Ln )
Syntax 2:  Q.GetForceSpringPotentialEnergy( P, k, Ln, stretchExponent )

   Input:  Q -- the name of a point.
           P -- the name of a point.
           k -- the spring constant (scalar)
           Ln -- the spring's natural length (scalar)
           stretchExponent -- the exponent on the spring's stretch (scalar)

Output 1:  Potential energy of a linear spring associated with a
           spring force on Q from P whose magnitude is equal to
           k * stretch   where  stretch = L - Ln  and
           L is the distance between Q and P.

Output 2:  Potential energy of a linear spring associated with a
           spring force on Q from P whose magnitude is equal to
           k * stretch^stretchExponent.

  Remark:  Q's position vector from P must be available.

 Related:  AddForce  AddForceDamper  AddForceElectrostatic  AddForceGravity
           AddForceInverseSquare  AddForceLinearActuator  AddForceSpring
           AddTorque  AddTorqueDamper
           GetMomentOfForces  GetResultantForce  GetResultantTorque
           GetForceGravityPotentialEnergy  GetForceSpringPotentialEnergy
           GetStatics   GetStaticsKane   GetStaticsLagrange
           GetDynamics  GetDynamicsKane  GetDynamicsLagrange

   (1) %--------------------------------------------------------------------
   (2) % Example 1: GetForceSpringPotentialEnergy  (natural length is 0)
   (3) %--------------------------------------------------------------------
   (4) NewtonianFrame N
   (5) Particle  P1, Q1
   (6) Variable  x, y
   (7) Constant  k, Ln
   (8) Q1.SetPosition( P1, x*Nx> )
-> (9) p_P1_Q1> = x*Nx>

   (10) PE1 = Q1.GetForceSpringPotentialEnergy( P1, k, 0 )
-> (11) PE1 = 0.5*k*x^2

   (12) %--------------------------------------------------------------------
   (13) % Example 2: GetForceSpringPotentialEnergy  (natural length is Ln)
   (14) %--------------------------------------------------------------------
   (15) Particle  P2, Q2
   (16) Q2.SetPosition( P2, x*Nx> )
-> (17) p_P2_Q2> = x*Nx>

   (18) PE2 = Q2.GetForceSpringPotentialEnergy( P2, k, Ln )
-> (19) PE2 = 0.5*k*(Ln-abs(x))^2

   (20) %--------------------------------------------------------------------
   (21) % Example 3: GetForceSpringPotentialEnergy (natural length is Ln; exponent 3)
   (22) %--------------------------------------------------------------------
   (23) Particle  P3, Q3
   (24) Q3.SetPosition( P3, x*Nx> )
-> (25) p_P3_Q3> = x*Nx>

   (26) PE3 = Q3.GetForceSpringPotentialEnergy( P3, k, Ln, 3 )
-> (27) PE3 = 0.25*k*(Ln-abs(x))^4

   (28) %--------------------------------------------------------------------
   (29) % Example 4: GetForceSpringPotentialEnergy  (natural length is Ln; exponent -1)
   (30) %--------------------------------------------------------------------
   (31) Particle  P4, Q4
   (32) Q4.SetPosition( P4, x*Nx> + y*Ny> )
-> (33) p_P4_Q4> = x*Nx> + y*Ny>

   (34) PE4 = Q4.GetForceSpringPotentialEnergy( P4, k, Ln, -1 )
-> (35) PE4 = k*log(sqrt(x^2+y^2)-Ln)



GetGeneralizedEffectiveForce
GetGeneralizedEffectiveForce

 Purpose:  Forms expressions for generalized effective forces or
           contributions to generalized effective forces.

  Syntax:  Object.GetGeneralizedEffectiveForce()

   Input:  Object -- The name of a Particle, RigidBody, or System.

  Output:  Column matrix, each element of which is the contribution of
           Object to a generalized effective force in the NewtonianFrame.

  Remark:  The results produced by this command depend on whether
           the command precedes or follows a CONSTRAIN command.

 Related:  GetGeneralizedEffectiveForce  GetGeneralizedForce
           GetMomentOfEffectiveForce   GetEffectiveForce
           GetAngularMomentum  GetLinearMomentum   GetGeneralizedMomentum
           GetKineticEnergy    GetMomentOfForces  GetResultantForce
           Gyrostat  SetGeneralizedCoordinate  SetGeneralizedSpeed
           SetMass  SetInertia  Rotate  Translate
           GetStatics   GetStaticsKane   GetStaticsLagrange
           GetDynamics  GetDynamicsKane  GetDynamicsLagrange

   (1) %--------------------------------------------------------------------
   (2) % Example 1: GetGeneralizedEffectiveForce
   (3) %--------------------------------------------------------------------
   (4) NewtonianFrame N
   (5) Particle  A
   (6) RigidBody B
   (7) A.SetMass( mA )
   (8) B.SetMass( mB )
   (9) B.SetInertia( Bcm, Ixx, Iyy, Izz )
   (10) Variable  w{1:3}', vA'
   (11) SetGeneralizedSpeed( w{1:3}, vA )
   (12) A.SetVelocity( N, vA*Nx> )
-> (13) v_A_N> = vA*Nx>

   (14) B.SetAngularVelocity( N, w1*Bx> + w2*By> + w3*Bz> )
-> (15) w_B_N> = w1*Bx> + w2*By> + w3*Bz>

   (16) Bcm.SetVelocity( N, 0> )
-> (17) v_Bcm_N> = 0>

   (18) FrEffectiveA = A.GetGeneralizedEffectiveForce()
-> (19) FrEffectiveA = [0;  0;  0;  mA*vA']

   (20) FrEffectiveB = B.GetGeneralizedEffectiveForce()
-> (21) FrEffectiveB[1] = Ixx*w1' - (Iyy-Izz)*w2*w3
-> (22) FrEffectiveB[2] = (Ixx-Izz)*w1*w3 + Iyy*w2'
-> (23) FrEffectiveB[3] = Izz*w3' - (Ixx-Iyy)*w1*w2
-> (24) FrEffectiveB[4] = 0

   (25) FrEffectiveS = System.GetGeneralizedEffectiveForce()
-> (26) FrEffectiveS[1] = Ixx*w1' - (Iyy-Izz)*w2*w3
-> (27) FrEffectiveS[2] = (Ixx-Izz)*w1*w3 + Iyy*w2'
-> (28) FrEffectiveS[3] = Izz*w3' - (Ixx-Iyy)*w1*w2
-> (29) FrEffectiveS[4] = mA*vA'



GetGeneralizedForce
GetGeneralizedForce

 Purpose:  Forms expressions for a system's generalized forces.

  Syntax:  System.GetGeneralizedForce()

  Output:  Column matrix, each element of which is the contribution of
           forces and torques to one generalized force in the NewtonianFrame.

  Remark:  The results produced by this command depend on whether
           the command precedes or follows a CONSTRAIN command.

 Related:  AddForce  AddForceDamper  AddForceElectrostatic  AddForceGravity
           AddForceInverseSquare  AddForceLinearActuator  AddForceSpring
           AddTorque  AddTorqueDamper
           GetGeneralizedEffectiveForce  GetGeneralizedForce
           GetGeneralizedMomentum  GetLinearMomentum  GetAngularMomentum
           SetGeneralizedCoordinate  SetGeneralizedSpeed
           SetMass  SetInertia  Rotate  Translate
           GetStatics   GetStaticsKane   GetStaticsLagrange
           GetDynamics  GetDynamicsKane  GetDynamicsLagrange

   (1) %--------------------------------------------------------------------
   (2) % Example 1: GetGeneralizedForce
   (3) %--------------------------------------------------------------------
   (4) NewtonianFrame N
   (5) Particle  A, B, C
   (6) Constant  k
   (7) Variable  q1', q2'
   (8) SetGeneralizedSpeed( q1', q2' )
   (9) A.SetVelocity( N, q1'*Nx> )
-> (10) v_A_N> = q1'*Nx>

   (11) B.SetVelocity( N, (q1'+q2')*Nx> )
-> (12) v_B_N> = (q1'+q2')*Nx>

   (13) C.SetVelocity( N,  2*q2'*Ny> )
-> (14) v_C_N> = 2*q2'*Ny>

   (15) A.AddForce( -k*q1*Nx> )
-> (16) Force_A> = -k*q1*Nx>

   (17) B.AddForce( A, -k*q2*Nx> )
-> (18) Force_B_A> = -k*q2*Nx>

   (19) C.AddForce( A, 3*Ny> )
-> (20) Force_C_A> = 3*Ny>

   (21) Fr = System.GetGeneralizedForce()
-> (22) Fr = [-k*q1;  6 - k*q2]



GetGeneralizedMomentum
GetGeneralizedMomentum

 Purpose:  Forms expressions for generalized momenta or
           contributions to generalized momenta.

  Syntax:  Object.GetGeneralizedMomentum()

   Input:  Object -- The name of a Particle, RigidBody, or System.

  Output:  Column matrix, each element of which is the contribution of
           Object to a generalized momenta in the NewtonianFrame.

  Remark:  The results produced by this command depend on whether
           the command precedes or follows a CONSTRAIN command.

 Related:  GetAngularMomentum  GetLinearMomentum   GetGeneralizedMomentum
           GetKineticEnergy    GetMomentOfForces  GetResultantForce
           Gyrostat  SetGeneralizedCoordinate  SetGeneralizedSpeed
           SetMass  SetInertia  Rotate  Translate
           GetStatics   GetStaticsKane   GetStaticsLagrange
           GetDynamics  GetDynamicsKane  GetDynamicsLagrange

   (1) %--------------------------------------------------------------------
   (2) % Example 1: GetGeneralizedMomentum
   (3) %--------------------------------------------------------------------
   (4) NewtonianFrame N
   (5) Particle  A
   (6) RigidBody B
   (7) A.SetMass( mA )
   (8) B.SetMass( mB )
   (9) B.SetInertia( Bcm, Ixx, Iyy, Izz )
   (10) Variable  w{1:3}', vA'
   (11) SetGeneralizedSpeed( w{1:3}, vA )
   (12) A.SetVelocity( N, vA*Nx> )
-> (13) v_A_N> = vA*Nx>

   (14) B.SetAngularVelocity( N, w1*Bx> + w2*By> + w3*Bz> )
-> (15) w_B_N> = w1*Bx> + w2*By> + w3*Bz>

   (16) Bcm.SetVelocity( N, 0> )
-> (17) v_Bcm_N> = 0>

   (18) generalizedMomentaA = A.GetGeneralizedMomentum()
-> (19) generalizedMomentaA = [0;  0;  0;  mA*vA]

   (20) generalizedMomentaB = B.GetGeneralizedMomentum()
-> (21) generalizedMomentaB = [Ixx*w1;  Iyy*w2;  Izz*w3;  0]

   (22) generalizedMomentaS = System.GetGeneralizedMomentum()
-> (23) generalizedMomentaS = [Ixx*w1;  Iyy*w2;  Izz*w3;  mA*vA]



GetIdentityMatrix
GetZeroMatrix     or    GetIdentityMatrix

 Purpose:  Forms a square or rectangular zero or identity matrix.

Syntax 1:  GetZeroMatrix( m )
Syntax 2:  GetZeroMatrix( m, n )
Syntax 3:  GetIdentityMatrix( m )
Syntax 4:  GetIdentityMatrix( m, n )

   Input:  m, n -- positive integers (m rows, n columns).

Output 1:  m x m  matrix with 0 as every element.
Output 2:  m x n  matrix with 0 as every element.

Output 3:  m x m diagonal matrix with the number 1 on each diagonal
                 element and 0 on every off-diagonal element.

Output 4:  m x n matrix with the number 1 for elements whose row and column
           indices are equal and the number 0 for the remaining elements.

 Related:  GetColumns  GetDeterminant  GetDiagonalMatrix  GetEigen
           GetElement  GetIdentityMatrix  GetInverse  GetRows  GetTrace
           GetTranspose  GetZeroMatrix  Solve

   (1) %--------------------------------------------------------------------
   (2) % Example: GetIdentityMatrix 
   (3) %--------------------------------------------------------------------
   (4) Ia = GetIdentityMatrix( 3 )
-> (5) Ia = [1, 0, 0;  0, 1, 0;  0, 0, 1]

   (6) Ib = GetIdentityMatrix( 3, 4 )
-> (7) Ib = [1, 0, 0, 0;  0, 1, 0, 0;  0, 0, 1, 0]

   (8) Ic = GetIdentityMatrix( 4, 3 )
-> (9) Ic = [1, 0, 0;  0, 1, 0;  0, 0, 1;  0, 0, 0]

   (10) %--------------------------------------------------------------------
   (11) % Example: GetZeroMatrix 
   (12) %--------------------------------------------------------------------
   (13) Za = GetZeroMatrix( 3 )
-> (14) Za = [0, 0, 0;  0, 0, 0;  0, 0, 0]

   (15) Zb = GetZeroMatrix( 2, 3 )
-> (16) Zb = [0, 0, 0;  0, 0, 0]

   (17) Zc = GetZeroMatrix( 3, 1 )
-> (18) Zc = [0;  0;  0]



GetInertiaDyadic
GetInertiaDyadic

 Purpose:  Gets an object's inertia dyadic about a point.

Syntax 1:  Object.GetInertiaDyadic( aboutPoint )
Syntax 2:  Object.GetInertiaDyadic( aboutPoint, expressBasis )

   Input:  Object       -- name of a Particle, RigidBody, or System.
           aboutPoint   -- name of a point or particle.
           expressBasis -- name of a RigidFrame or RigidBody.

Output 1:  Object's inertia dyadic about aboutPoint.
Output 2:  Object's inertia dyadic about aboutPoint expressed in expressBasis.

  Remark:  Products of inertia adhere to the "negative sign convention".
           Example: For a 1 kg particle whose position from a point P is
           2*Nx> + 3*Ny>, the product of inertia Ixy = -m*x*y = -6 kg*m^2.

 Related:  SetMass          GetMass         SetInertia
           GetCMPosition    GetCmVelocity   GetCmAcceleration
           GetInertiaDyadic  GetInertiaMatrix  GetMomentOfInertia
           GetProductOfInertia  GetRadiusOfGyration  GetInertiaVector

   (1) %--------------------------------------------------------------------
   (2) % Example 1: GetInertiaDyadic  (inertia dyadic of a rigid body)
   (3) %--------------------------------------------------------------------
   (4) RigidBody  B
   (5) B.SetInertia( Bcm, Ixx, Iyy, Izz )
   (6) BInertiaDyadicAboutBcm>> = B.GetInertiaDyadic( Bcm )
-> (7) BInertiaDyadicAboutBcm>> = Ixx*Bx>*Bx> + Iyy*By>*By> + Izz*Bz>*Bz>

   (8) %--------------------------------------------------------------------
   (9) % Example 2: GetInertiaDyadic  (inertia dyadic in designated basis)
   (10) %--------------------------------------------------------------------
   (11) RigidFrame A
   (12) Variable  theta
   (13) B.SetRotationMatrixZ( A, theta )
-> (14) B_A = [cos(theta), sin(theta), 0;  -sin(theta), cos(theta), 0;  0, 0, 1]

   (15) BInertiaDyadicAboutBcmExpressedInA>> = B.GetInertiaDyadic( Bcm, A )
-> (16) BInertiaDyadicAboutBcmExpressedInA>> = (Ixx*cos(theta)^2+Iyy*sin(theta)^2)
        *Ax>*Ax> + (Ixx-Iyy)*sin(theta)*cos(theta)*Ax>*Ay> + (Ixx-Iyy)*sin(the
        ta)*cos(theta)*Ay>*Ax> + (Iyy+(Ixx-Iyy)*sin(theta)^2)*Ay>*Ay> + Izz*Az>*Az>

   (17) %--------------------------------------------------------------------
   (18) % Example 3: GetInertiaDyadic  (inertia dyadic of a particle)
   (19) %--------------------------------------------------------------------
   (20) Particle   Q
   (21) Q.SetMass( mQ )
   (22) Variable   x, y, z
   (23) Q.SetPosition( Bo, x*Bx> + y*By> + z*Bz> )
-> (24) p_Bo_Q> = x*Bx> + y*By> + z*Bz>

   (25) QInertiaDyadicAboutBoExpressedInB>> = Q.GetInertiaDyadic( Bo, B )
-> (26) QInertiaDyadicAboutBoExpressedInB>> = mQ*(y^2+z^2)*Bx>*Bx> - mQ*x*y*Bx>*By>
        - mQ*x*z*Bx>*Bz> - mQ*x*y*By>*Bx> + mQ*(x^2+z^2)*By>*By> - mQ*y*z*By>*Bz>
        - mQ*x*z*Bz>*Bx> - mQ*y*z*Bz>*By> + mQ*(x^2+y^2)*Bz>*Bz>

   (27) %--------------------------------------------------------------------
   (28) % Example 4: GetInertiaDyadic  (inertia dyadic of a system)
   (29) %--------------------------------------------------------------------
   (30) B.SetMass( mB )
   (31) Bcm.SetPosition( Bo, 2*Bx> + 3*By> + 4*Bz> )
-> (32) p_Bo_Bcm> = 2*Bx> + 3*By> + 4*Bz>

   (33) SystemInertiaDyadicAboutBoExpressedInB>> = System.GetInertiaDyadic( Bo, B )
-> (34) SystemInertiaDyadicAboutBoExpressedInB>> = (Ixx+25*mB+mQ*(y^2+z^2))*Bx>*Bx>
        + (-6*mB-mQ*x*y)*Bx>*By> + (-8*mB-mQ*x*z)*Bx>*Bz> + (-6*mB-mQ*x*y)*By>*Bx>
        + (Iyy+20*mB+mQ*(x^2+z^2))*By>*By> + (-12*mB-mQ*y*z)*By>*Bz> + (-8*mB-
        mQ*x*z)*Bz>*Bx> + (-12*mB-mQ*y*z)*Bz>*By> + (Izz+13*mB+mQ*(x^2+y^2))*
        Bz>*Bz>



GetInertiaMatrix
GetInertiaMatrix

 Purpose:  Gets an object's inertia matrix about a point.

  Syntax:  Object.GetInertiaMatrix( aboutPoint, expressBasis )

   Input:  Object       -- name of a Particle, RigidBody, or System.
           aboutPoint   -- name of a Point or Particle.
           expressBasis -- name of a RigidFrame or RigidBody.

  Output:  Object's inertia matrix about aboutPoint expressed in expressBasis.

  Remark:  Products of inertia adhere to the "negative sign convention".
           Example: For a 1 kg particle whose position from a point P is
           2*Nx> + 3*Ny>, the product of inertia Ixy = -m*x*y = -6 kg*m^2.

 Related:  SetMass          GetMass         SetInertia
           GetCMPosition    GetCmVelocity   GetCmAcceleration
           GetInertiaDyadic  GetInertiaMatrix  GetMomentOfInertia
           GetProductOfInertia  GetRadiusOfGyration  GetInertiaVector

   (1) %--------------------------------------------------------------------
   (2) % Example 1: GetInertiaMatrix  (inertia matrix of a rigid body)
   (3) %--------------------------------------------------------------------
   (4) RigidBody  B
   (5) B.SetInertia( Bcm, Ixx, Iyy, Izz )
   (6) BInertiaMatrixAboutBcmInB = B.GetInertiaMatrix( Bcm, B )
-> (7) BInertiaMatrixAboutBcmInB = [Ixx, 0, 0;  0, Iyy, 0;  0, 0, Izz]

   (8) %--------------------------------------------------------------------
   (9) % Example 2: GetInertiaMatrix  (inertia matrix in another basis)
   (10) %--------------------------------------------------------------------
   (11) RigidFrame A
   (12) Variable  theta
   (13) B.SetRotationMatrixZ( A, theta )
-> (14) B_A = [cos(theta), sin(theta), 0;  -sin(theta), cos(theta), 0;  0, 0, 1]

   (15) BInertiaMatrixAboutBcmInA = B.GetInertiaMatrix( Bcm, A )
-> (16) BInertiaMatrixAboutBcmInA[1,1] = Ixx*cos(theta)^2 + Iyy*sin(theta)^2
-> (17) BInertiaMatrixAboutBcmInA[1,2] = (Ixx-Iyy)*sin(theta)*cos(theta)
-> (18) BInertiaMatrixAboutBcmInA[1,3] = 0
-> (19) BInertiaMatrixAboutBcmInA[2,1] = (Ixx-Iyy)*sin(theta)*cos(theta)
-> (20) BInertiaMatrixAboutBcmInA[2,2] = Iyy + (Ixx-Iyy)*sin(theta)^2
-> (21) BInertiaMatrixAboutBcmInA[2,3] = 0
-> (22) BInertiaMatrixAboutBcmInA[3,1] = 0
-> (23) BInertiaMatrixAboutBcmInA[3,2] = 0
-> (24) BInertiaMatrixAboutBcmInA[3,3] = Izz

   (25) %--------------------------------------------------------------------
   (26) % Example 3: GetInertiaMatrix  (inertia matrix of a particle)
   (27) %--------------------------------------------------------------------
   (28) Particle   Q
   (29) Q.SetMass( mQ )
   (30) Variable   x, y, z
   (31) Q.SetPosition( Bo, x*Bx> + y*By> + z*Bz> )
-> (32) p_Bo_Q> = x*Bx> + y*By> + z*Bz>

   (33) QInertiaMatrixAboutBoInB = Q.GetInertiaMatrix( Bo, B )
-> (34) QInertiaMatrixAboutBoInB[1,1] = mQ*(y^2+z^2)
-> (35) QInertiaMatrixAboutBoInB[1,2] = -mQ*x*y
-> (36) QInertiaMatrixAboutBoInB[1,3] = -mQ*x*z
-> (37) QInertiaMatrixAboutBoInB[2,1] = -mQ*x*y
-> (38) QInertiaMatrixAboutBoInB[2,2] = mQ*(x^2+z^2)
-> (39) QInertiaMatrixAboutBoInB[2,3] = -mQ*y*z
-> (40) QInertiaMatrixAboutBoInB[3,1] = -mQ*x*z
-> (41) QInertiaMatrixAboutBoInB[3,2] = -mQ*y*z
-> (42) QInertiaMatrixAboutBoInB[3,3] = mQ*(x^2+y^2)

   (43) %--------------------------------------------------------------------
   (44) % Example 4: GetInertiaDyadic  (inertia matrix of a system)
   (45) %--------------------------------------------------------------------
   (46) B.SetMass( mB )
   (47) Bcm.SetPosition( Bo, 2*Bx> + 3*By> + 4*Bz> )
-> (48) p_Bo_Bcm> = 2*Bx> + 3*By> + 4*Bz>

   (49) SystemInertiaMatrixAboutBoInB = System.GetInertiaMatrix( Bo, B )
-> (50) SystemInertiaMatrixAboutBoInB[1,1] = Ixx + 25*mB + mQ*(y^2+z^2)
-> (51) SystemInertiaMatrixAboutBoInB[1,2] = -6*mB - mQ*x*y
-> (52) SystemInertiaMatrixAboutBoInB[1,3] = -8*mB - mQ*x*z
-> (53) SystemInertiaMatrixAboutBoInB[2,1] = -6*mB - mQ*x*y
-> (54) SystemInertiaMatrixAboutBoInB[2,2] = Iyy + 20*mB + mQ*(x^2+z^2)
-> (55) SystemInertiaMatrixAboutBoInB[2,3] = -12*mB - mQ*y*z
-> (56) SystemInertiaMatrixAboutBoInB[3,1] = -8*mB - mQ*x*z
-> (57) SystemInertiaMatrixAboutBoInB[3,2] = -12*mB - mQ*y*z
-> (58) SystemInertiaMatrixAboutBoInB[3,3] = Izz + 13*mB + mQ*(x^2+y^2)



GetInertiaScalar
GetInertiaScalar

 Purpose:  Gets an object's inertia scalar about a point for
           two unit vectors.

  Syntax:  Object.GetInertiaScalar( aboutPoint, unitVectorA, unitVectorB )

   Input:  Object -- The name of a Particle, RigidBody, or System.
           aboutPoint -- The name of a point or particle.
           unitVectorA -- Unit vector or expression for a unit vector.
           unitVectorB -- Unit vector or expression for a unit vector.

  Output:  Object's inertia scalar about aboutPoint for the
           unit vectors unitVectorA and unitVectorB.

  Remark:  Products of inertia adhere to the "negative sign convention".
           Example: For a 1 kg particle whose position from a point P is
           2*Nx> + 3*Ny>, the product of inertia Ixy = -m*x*y = -6 kg*m^2.

 Related:  SetMass          GetMass         SetInertia
           GetCMPosition    GetCmVelocity   GetCmAcceleration
           GetInertiaDyadic  GetInertiaMatrix  GetMomentOfInertia
           GetProductOfInertia  GetRadiusOfGyration  GetInertiaVector

   (1) %--------------------------------------------------------------------
   (2) % Example 1: GetInertiaScalar  (inertia scalar of a rigid body)
   (3) %--------------------------------------------------------------------
   (4) RigidBody  B
   (5) B.SetInertia( Bcm, Ixx, Iyy, Izz )
   (6) BInertiaScalarAboutBcmForBxBx = B.GetInertiaScalar( Bcm, Bx>, Bx> )
-> (7) BInertiaScalarAboutBcmForBxBx = Ixx

   (8) %--------------------------------------------------------------------
   (9) % Example 2: GetInertiaScalar  (inertia scalar in another basis)
   (10) %--------------------------------------------------------------------
   (11) RigidFrame A
   (12) Variable  theta
   (13) B.SetRotationMatrixZ( A, theta )
-> (14) B_A = [cos(theta), sin(theta), 0;  -sin(theta), cos(theta), 0;  0, 0, 1]

   (15) BInertiaScalarAboutBcmForAxAx = B.GetInertiaScalar( Bcm, Ax>, Ay> )
-> (16) BInertiaScalarAboutBcmForAxAx = (Ixx-Iyy)*sin(theta)*cos(theta)

   (17) %--------------------------------------------------------------------
   (18) % Example 3: GetInertiaScalar  (inertia scalar of a particle)
   (19) %--------------------------------------------------------------------
   (20) Particle   Q
   (21) Q.SetMass( mQ )
   (22) Variable   x, y, z
   (23) Q.SetPosition( Bo, x*Bx> + y*By> + z*Bz> )
-> (24) p_Bo_Q> = x*Bx> + y*By> + z*Bz>

   (25) QInertiaScalarAboutBoForBxBx = Q.GetInertiaScalar( Bo, Bx>, Bx> )
-> (26) QInertiaScalarAboutBoForBxBx = mQ*(y^2+z^2)

   (27) QInertiaScalarAboutBoForByBz = Q.GetInertiaScalar( Bo, By>, Bz> )
-> (28) QInertiaScalarAboutBoForByBz = -mQ*y*z

   (29) %--------------------------------------------------------------------
   (30) % Example 4: GetInertiaScalar  (inertia scalar of a system)
   (31) %--------------------------------------------------------------------
   (32) B.SetMass( mB )
   (33) Bcm.SetPosition( Bo, 2*Bx> + 3*By> + 4*Bz> )
-> (34) p_Bo_Bcm> = 2*Bx> + 3*By> + 4*Bz>

   (35) SystemInertiaScalarAboutBoForByBy = System.GetInertiaScalar( Bo, By>, By> )
-> (36) SystemInertiaScalarAboutBoForByBy = Iyy + 20*mB + mQ*(x^2+z^2)

   (37) SystemInertiaScalarAboutBoForAyAy = System.GetInertiaScalar( Bo, Ay>, Ay> )
-> (38) SystemInertiaScalarAboutBoForAyAy = Iyy + 20*mB + mQ*(x^2+z^2) - sin(
        theta)*(Iyy*sin(theta)+12*mB*cos(theta)+mQ*x^2*sin(theta)+2*mQ*x*y*cos(
        theta)-5*mB*sin(theta)-Ixx*sin(theta)-mQ*y^2*sin(theta))



GetInertiaVector
GetInertiaVector

 Purpose:  Gets an object's inertia vector for a unit vector.

  Syntax:  Object.GetInertiaVector( aboutPoint, unitVector )

   Input:  Object -- The name of a Particle, RigidBody, or System.
           aboutPoint -- The name of a point or Particle.
           unitVector -- Unit vector or expression for a unit vector.

  Output:  Object's inertia vector aboutPoint for unitVector.

  Remark:  Products of inertia adhere to the "negative sign convention".
           Example: For a 1 kg particle whose position from a point P is
           2*Nx> + 3*Ny>, the product of inertia Ixy = -m*x*y = -6 kg*m^2.

 Related:  SetMass          GetMass         SetInertia
           GetCMPosition    GetCmVelocity   GetCmAcceleration
           GetInertiaDyadic  GetInertiaMatrix  GetMomentOfInertia
           GetProductOfInertia  GetRadiusOfGyration  GetInertiaVector

   (1) %--------------------------------------------------------------------
   (2) % Example 1: GetInertiaVector  (inertia vector of a rigid body)
   (3) %--------------------------------------------------------------------
   (4) RigidBody  B
   (5) B.SetInertia( Bcm, Ixx, Iyy, Izz )
   (6) BInertiaVectorAboutBcmForBx> = B.GetInertiaVector( Bcm, Bx> )
-> (7) BInertiaVectorAboutBcmForBx> = Ixx*Bx>

   (8) %--------------------------------------------------------------------
   (9) % Example 2: GetInertiaVector  (inertia vector for Ax>)
   (10) %--------------------------------------------------------------------
   (11) RigidFrame A
   (12) Variable  theta
   (13) B.SetRotationMatrixZ( A, theta )
-> (14) B_A = [cos(theta), sin(theta), 0;  -sin(theta), cos(theta), 0;  0, 0, 1]

   (15) BInertiaVectorAboutBcmForAx> = B.GetInertiaVector( Bcm, Ax> )
-> (16) BInertiaVectorAboutBcmForAx> = Ixx*cos(theta)*Bx> - Iyy*sin(theta)*By>

   (17) %--------------------------------------------------------------------
   (18) % Example 3: GetInertiaVector  (inertia vector of a particle)
   (19) %--------------------------------------------------------------------
   (20) Particle   Q
   (21) Q.SetMass( mQ )
   (22) Variable   x, y, z
   (23) Q.SetPosition( Bo, x*Bx> + y*By> + z*Bz> )
-> (24) p_Bo_Q> = x*Bx> + y*By> + z*Bz>

   (25) QInertiaVectorAboutBoForBx> = Q.GetInertiaVector( Bo, Bx> )
-> (26) QInertiaVectorAboutBoForBx> = mQ*(y^2+z^2)*Bx> - mQ*x*y*By> - mQ*x*z*Bz>

   (27) %--------------------------------------------------------------------
   (28) % Example 4: GetInertiaVector  (inertia vector of a system)
   (29) %--------------------------------------------------------------------
   (30) B.SetMass( mB )
   (31) Bcm.SetPosition( Bo, 2*Bx> + 3*By> + 4*Bz> )
-> (32) p_Bo_Bcm> = 2*Bx> + 3*By> + 4*Bz>

   (33) SInertiaVectorAboutBoForBx> = System.GetInertiaVector( Bo, Bx> )
-> (34) SInertiaVectorAboutBoForBx> = (Ixx+25*mB+mQ*(y^2+z^2))*Bx> + (-6*mB-mQ*
        x*y)*By> + (-8*mB-mQ*x*z)*Bz>



GetInverse
GetInverse

 Purpose:  Forms the inverse of a matrix or a dyadic.

Syntax 1:  GetInverse( squareMatrixOrDyadic )
Syntax 2:  GetDeterminant( Option, squareMatrixOrDyadic )

   Input:  squareMatrixOrDyadic -- a  square matrix or a dyadic
           Option -- MINORS or GAUSS

  Output:  Inverse of squareMatrixOrDyadic

  Remark:  Matrix inversion is calculated by one of two methods.
           MINORS is advantageous for relatively small matrices
           whereas GAUSS may be better for relatively large ones.
           If neither MINORS or GAUSS is specified, a method is
           chosen based on the size and number of non-numerical
           elements in the squareMatrixOfDyadic.

 Related:  GetColumns  GetDeterminant  GetDiagonalMatrix  GetEigen
           GetElement  GetIdentityMatrix  GetInverse  GetRows  GetTrace
           GetTranspose  GetZeroMatrix  Solve

   (1) %--------------------------------------------------------------------
   (2) % Example 1: GetInverse  (inverse of a matrix)
   (3) %--------------------------------------------------------------------
   (4) Constant  a, b, c, d
   (5) M = [a, b;  c, d]
-> (6) M = [a, b;  c, d]

   (7) inverse = GetInverse( M )
-> (8) inverse[1,1] = d/(a*d-b*c)
-> (9) inverse[1,2] = -b/(a*d-b*c)
-> (10) inverse[2,1] = -c/(a*d-b*c)
-> (11) inverse[2,2] = a/(a*d-b*c)

   (12) inverseWithMinors = GetInverse( MINORS, M )
-> (13) inverseWithMinors[1,1] = d/(a*d-b*c)
-> (14) inverseWithMinors[1,2] = -b/(a*d-b*c)
-> (15) inverseWithMinors[2,1] = -c/(a*d-b*c)
-> (16) inverseWithMinors[2,2] = a/(a*d-b*c)

   (17) inverseWithGauss  = GetInverse( GAUSS,  M )
-> (18) inverseWithGauss[1,1] = (1+b*c/(a*d-b*c))/a
-> (19) inverseWithGauss[1,2] = -b/(a*d-b*c)
-> (20) inverseWithGauss[2,1] = -c/(a*d-b*c)
-> (21) inverseWithGauss[2,2] = 1/(d-b*c/a)

   (22) %--------------------------------------------------------------------
   (23) % Example 2: GetInverse  (inverse of a dyadic)
   (24) %--------------------------------------------------------------------
   (25) RigidFrame F
   (26) D>> = 2*Fx>*Fy> - 3*Fy>*Fz> + Fz>*Fx>
-> (27) D>> = 2*Fx>*Fy> - 3*Fy>*Fz> + Fz>*Fx>

   (28) dyadicInverse>> = GetInverse( D>> )
-> (29) dyadicInverse>> = Fx>*Fz> + 0.5*Fy>*Fx> - 0.3333333*Fz>*Fy>



GetLinearMomentum
GetLinearMomentum

 Purpose:  Gets linear momentum in the NewtonianFrame (or a designated frame).

Syntax 1:  Object.GetLinearMomentum()
Syntax 2:  Object.GetLinearMomentum( refFrame )

   Input:  Object -- The name of a Particle, RigidBody, or System.
           refFrame -- The name of a RigidFrame or RigidBody

Output 1:  Object's linear momentum in the NewtonianFrame.
Output 2:  Object's linear momentum in refFrame.

  Remark:  A particle Q's linear momentum in refFrame is defined
           Q.GetMass() * Q.GetVelocity(refFrame)

 Related:  GetAngularMomentum  GetLinearMomentum   GetGeneralizedMomentum
           GetKineticEnergy    GetMomentOfForces  GetResultantForce
           Gyrostat  SetGeneralizedCoordinate  SetGeneralizedSpeed
           SetMass  SetInertia  Rotate  Translate
           GetStatics   GetStaticsKane   GetStaticsLagrange
           GetDynamics  GetDynamicsKane  GetDynamicsLagrange

   (1) %--------------------------------------------------------------------
   (2) % Example 1: GetLinearMomentum  (particle moving in a plane)
   (3) %--------------------------------------------------------------------
   (4) NewtonianFrame N             
   (5) Particle       Q             
   (6) Q.SetMass( mQ )
   (7) Variable       x', y', z'    
   (8) Q.SetVelocity( N, x'*Nx> + y'*Ny> + z'*Nz> )
-> (9) v_Q_N> = x'*Nx> + y'*Ny> + z'*Nz>

   (10) QLinearMomentum> = Q.GetLinearMomentum()
-> (11) QLinearMomentum> = mQ*x'*Nx> + mQ*y'*Ny> + mQ*z'*Nz>

   (12) %--------------------------------------------------------------------
   (13) % Example 2: GetLinearMomentum  (rigid body moving in a plane)
   (14) %--------------------------------------------------------------------
   (15) RigidBody  B             
   (16) B.SetMass( mB )
   (17) Variable   vx, vy, vz    
   (18) Bcm.SetVelocity( N, vx*Nx> + vy*Ny> + vz*Nz> )
-> (19) v_Bcm_N> = vx*Nx> + vy*Ny> + vz*Nz>

   (20) BLinearMomentum> = B.GetLinearMomentum()
-> (21) BLinearMomentum> = mB*vx*Nx> + mB*vy*Ny> + mB*vz*Nz>

   (22) %--------------------------------------------------------------------
   (23) % Example 3: GetLinearMomentum  (linear momentum of a system)
   (24) %--------------------------------------------------------------------
   (25) SLinearMomentum> = System.GetLinearMomentum()
-> (26) SLinearMomentum> = (mB*vx+mQ*x')*Nx> + (mB*vy+mQ*y')*Ny> + (mB*vz+mQ*
        z')*Nz>



GetKineticEnergy
GetKineticEnergy  or  GetKineticEnergyi (i = 0, 1, 2)

 Purpose:  Gets kinetic energy in the NewtonianFrame (or a designated frame).

Syntax 1:  Object.GetKineticEnergy()  or Object.GetKineticEnergy(  refFrame )
Syntax 2:  Object.GetKineticEnergy0() or Object.GetKineticEnergy0( refFrame )
Syntax 3:  Object.GetKineticEnergy1() or Object.GetKineticEnergy1( refFrame )
Syntax 4:  Object.GetKineticEnergy2() or Object.GetKineticEnergy2( refFrame )

   Input:  Object -- The name of a Particle, RigidBody, or System.
           refFrame -- The name of a RigidFrame or RigidBody

Output 1:  Object's kinetic energy in the NewtonianFrame (or refFrame).

Output 2:  Object's homogeneous kinetic energy function of degree n = 0 in
           quantities declared by SetGeneralizedSpeeds.

Output 3:  Same as Output 2 except n = 1.
Output 4:  Same as Output 2 except n = 2.

 Related:  GetAngularMomentum  GetLinearMomentum   GetGeneralizedMomentum
           GetKineticEnergy    GetMomentOfForces  GetResultantForce
           Gyrostat  SetGeneralizedCoordinate  SetGeneralizedSpeed
           SetMass  SetInertia  Rotate  Translate   GetPower
           GetStatics   GetStaticsKane   GetStaticsLagrange
           GetDynamics  GetDynamicsKane  GetDynamicsLagrange

   (1) %--------------------------------------------------------------------
   (2) % Example 1: GetKineticEnergy  (Kinetic energy of a particle)
   (3) %--------------------------------------------------------------------
   (4) NewtonianFrame N             
   (5) Particle       Q         
   (6) Specified      v1    
   (7) Variable       v2    
   (8) Q.SetMass( mQ )
   (9) Q.SetVelocity( N, (v1+v2)*Nx> )
-> (10) v_Q_N> = (v1+v2)*Nx>

   (11) QKineticEnergy = Q.GetKineticEnergy()
-> (12) QKineticEnergy = 0.5*mQ*(v1+v2)^2

   (13) %------------------------
   (14) SetGeneralizedSpeed( v2 )
   (15) QKineticEnergy0 = Q.GetKineticEnergy0()
-> (16) QKineticEnergy0 = 0.5*mQ*v1^2

   (17) QKineticEnergy1 = Q.GetKineticEnergy1()
-> (18) QKineticEnergy1 = mQ*v1*v2

   (19) QKineticEnergy2 = Q.GetKineticEnergy2()
-> (20) QKineticEnergy2 = 0.5*mQ*v2^2

   (21) %--------------------------------------------------------------------
   (22) % Example 2: GetKineticEnergy  (Kinetic energy of a rigid body)
   (23) %--------------------------------------------------------------------
   (24) RigidBody    B             
   (25) B.SetMass( mB )
   (26) B.SetInertia( Bcm, Ixx, Iyy, Izz )
   (27) Variable     vx, vy, wz    
   (28) B.SetAngularVelocity( N, wz*Bz> )
-> (29) w_B_N> = wz*Bz>

   (30) Bcm.SetVelocity( N, vx*Nx> + vy*Ny> )
-> (31) v_Bcm_N> = vx*Nx> + vy*Ny>

   (32) BKineticEnergy = B.GetKineticEnergy()
-> (33) BKineticEnergy = 0.5*Izz*wz^2 + 0.5*mB*(vx^2+vy^2)

   (34) %--------------------------------------------------------------------
   (35) % Example 3: GetKineticEnergy  (Kinetic energy of a system)
   (36) %--------------------------------------------------------------------
   (37) SKineticEnergy = System.GetKineticEnergy( N )
-> (38) SKineticEnergy = 0.5*Izz*wz^2 + 0.5*mB*(vx^2+vy^2) + 0.5*mQ*(v1+v2)^2

   (39) SKineticEnergy0 = System.GetKineticEnergy0()
-> (40) SKineticEnergy0 = 0.5*mQ*v1^2 + 0.5*Izz*wz^2 + 0.5*mB*(vx^2+vy^2)

   (41) SKineticEnergy1 = System.GetKineticEnergy1()
-> (42) SKineticEnergy1 = mQ*v1*v2

   (43) SKineticEnergy2 = System.GetKineticEnergy2()
-> (44) SKineticEnergy2 = 0.5*mQ*v2^2



GetMagnitude
GetMagnitude  and  GetMagnitudeSquared

 Purpose:  Calculates the magnitude of a vector or its magnitude squared.

Syntax 1:  GetMagnitude( vector> )
Syntax 2:  GetMagnitudeSquared( vector> )

   Input:  vector> -- a vector

Output 1:  Magnitude of vector>
Output 2:  Square of the magnitude of vector>

  Remark:  Use  abs  for the absolute value (magnitude)
           of a real, imaginary, or complex number.

 Related:  GetMagnitude           GetMagnitudeSquared
           GetDistance            GetDistanceSquared
           GetSpeed               GetSpeedSquared
           GetAngularSpeed        GetAngularSpeedSquared
           GetAngleBetweenVectors GetAngleBetweenUnitVectors
           GetPosition            SetPosition       Translate
           GetVelocity            SetVelocity       SetPositionVelocity
           GetAcceleration        SetAcceleration   SetVelocityAcceleration
           GetUnitVector          GetElongation     Vector   Dot

   (1) %--------------------------------------------------------------------
   (2) %Example: GetMagnitude and GetMagnitudeSquared
   (3) %--------------------------------------------------------------------
   (4) RigidFrame A
   (5) Constant x, y, z
   (6) v> = Vector( A, x, y, z )
-> (7) v> = x*Ax> + y*Ay> + z*Az>

   (8) magnitude = GetMagnitude( v> )
-> (9) magnitude = sqrt(x^2+y^2+z^2)

   (10) magnitudeSquared = GetMagnitudeSquared( v> )
-> (11) magnitudeSquared = x^2 + y^2 + z^2



GetMass
GetMass

 Purpose:  Gets an object's mass.

  Syntax:  Object.GetMass()

   Input:  Object -- The name of a Particle, RigidBody or System.

  Output:  Returns Object's mass.

 Related:  SetMass          GetMass         SetInertia
           GetCMPosition    GetCmVelocity   GetCmAcceleration
           GetInertiaDyadic  GetInertiaMatrix  GetMomentOfInertia
           GetProductOfInertia  GetRadiusOfGyration  GetInertiaVector

   (1) %--------------------------------------------------------------------
   (2) % Example 1: GetMass   (mass of particles)
   (3) %--------------------------------------------------------------------
   (4) Particle   P, Q, R, S            
   (5) Variable   mS'
   (6) P.SetMass( 17 )   
   (7) Q.SetMass( mQ )         % Declares mQ as a non-negative constant
   (8) R.SetMass( mR = 3 kg )  % Declares mR and sets its INPUT value to 3 kg
   (9) S.SetMass( mS )         % mS may be governed by an ODE 
   (10) massOfP = P.GetMass()
-> (11) massOfP = 17

   (12) massOfPAndQ = P.GetMass() + Q.GetMass()
-> (13) massOfPAndQ = 17 + mQ

   (14) massOfPQRS = System.GetMass()
-> (15) massOfPQRS = 17 + mQ + mR + mS

   (16) %--------------------------------------------------------------------
   (17) % Example 2: GetMass   (mass of rigid body)
   (18) %--------------------------------------------------------------------
   (19) RigidBody  B
   (20) B.SetMass( mB )    % Declares mB as a non-negative constant
   (21) massOfB = B.GetMass()
-> (22) massOfB = mB

   (23) %--------------------------------------------------------------------
   (24) % Example 3: GetMass   (mass of system of particles and rigid body)
   (25) %--------------------------------------------------------------------
   (26) massOfSystem = System.GetMass()    
-> (27) massOfSystem = 17 + mB + mQ + mR + mS



GetMassUnit
GetMassUnit  GetLengthUnit  GetTimeUnit  GetAngleUnit

 Purpose:  Displays the mass, length, time, or angle unit.
           Stands for the unit of mass, length, or time
           set by the SetUnitSystem command.

Syntax 1:  GetMassUnit()
Syntax 2:  GetLengthUnit()
Syntax 3:  GetTimeUnit()
Syntax 4:  GetAngleUnit()

Output 1:  Displays the current mass   unit to the screen.
Output 2:  Displays the current length unit to the screen.
Output 3:  Displays the current time   unit to the screen.
Output 4:  Displays "radian"  to the screen.

 Related:  ODE  Solve  Input  Output  OutputPlot  Plot  Animate
           ConvertUnits  GetUnitSystem  SetUnitSystem
           GetMassUnit   GetLengthUnit   GetTimeUnit  GetAngleUnit

--------------------------------------------------------------------
 Examples:
--------------------------------------------------------------------
   (1) GetMassUnit()
 kilogram
   (1) GetLengthUnit()
 meter
   (1) GetTimeUnit()
 second
   (1) GetAngleUnit()
 radian

   (1) %--------------------------------------------------------------------
   (2) %Example 1: GetMassUnit, GetLengthUnit, GetTimeUnit, GetAngleUnit 
   (3) %--------------------------------------------------------------------
   (4) SetUnitSystem( kg, m, sec )
   (5) KilogramsPerGram = ConvertUnits( GetMassUnit, gram )
-> (6) KilogramsPerGram = 1000

   (7) InchesPerMeter = ConvertUnits( inch, GetLengthUnit )
-> (8) InchesPerMeter = 0.0254

   (9) SecondSquaredPerMilliSecondSquared = ConvertUnits( GetTimeUnit^2, milliSecond^2 )
-> (10) SecondSquaredPerMilliSecondSquared = 1000000

   (11) RadianSecPerDegreeSecond = ConvertUnits( GetAngleUnit*sec, degrees*sec )
-> (12) RadianSecPerDegreeSecond = 57.29578

   (13) %--------------------------------------------------------------------
   (14) %Example 2: GetMassUnit, GetLengthUnit, GetTimeUnit, GetAngleUnit 
   (15) %--------------------------------------------------------------------
   (16) Variable  x' = sin(t)
-> (17) x' = sin(t)

   (18) Input  x = 2 GetLengthUnit,  tFinal = 10 seconds
   (19) Output t GetTimeUnit, x GetLengthUnit, x' GetLengthUnit/sec
   (20) ODE() GetUnitExample



GetMemory
GetMemory

 Purpose:  Reports amount of dynamically allocated program memory.

  Syntax:  GetMemory()

  Output:  Number of bytes of dynamically allocated memory.

 Example:

   (1) x = 5
-> (2) x = 5
   (3) GetMemory()

 25247 BYTES OF MEMORY USED.

   (3) y = 7
-> (4) y = 7
   (5) GetMemory()

 25260 BYTES OF MEMORY USED.



GetMomentOfEffectiveForce
GetMomentOfEffectiveForce

 Purpose:  Calculates an object's moment of effective force about a point.

Syntax 1:  Object.GetMomentOfEffectiveForce( aboutPoint )
Syntax 2:  Object.GetMomentOfEffectiveForce( aboutPoint, refFrame )

   Input:  Object     -- name of a Particle, RigidBody, or System.
           aboutPoint -- name of a Point.
           refFrame   -- name of a RigidFrame or RigidBody.

Output 1:  Object's moment of effective force abointPoint in the NewtonianFrame.
Output 2:  Object's moment of effective force abointPoint in refFrame.

  Remark:  Particle Q's moment of effective force aboutPoint in refFrame is:
           Cross( Q.GetPosition(aboutPoint), Q.GetEffectiveForce(refFrame) )

 Related:  GetLinearMomentum  GetAngularMomentum  GetEffectiveForce
           GetMomentOfForces  GetResultantForce  GetMomentOfEffectiveForce
           GetStatics   GetStaticsKane   GetStaticsLagrange
           GetDynamics  GetDynamicsKane  GetDynamicsLagrange

   (1) %--------------------------------------------------------------------
   (2) % Example 1: GetMomentOfEffectiveForce  (point moving in a plane)
   (3) %--------------------------------------------------------------------
   (4) NewtonianFrame N             
   (5) Particle       Q   
   (6) Q.SetMass( mQ )
   (7) Variable       x'', y''
   (8) Q.Translate( No, x*Nx> + y*Ny> )
-> (9) p_No_Q> = x*Nx> + y*Ny>
-> (10) v_Q_N> = x'*Nx> + y'*Ny>
-> (11) a_Q_N> = x''*Nx> + y''*Ny>

   (12) QMomentOfEffectiveForceAboutNo> = Q.GetMomentOfEffectiveForce( No )
-> (13) QMomentOfEffectiveForceAboutNo> = mQ*(x*y''-y*x'')*Nz>

   (14) %--------------------------------------------------------------------
   (15) % Example 2: GetMomentOfEffectiveForce  (rotating rigid body)
   (16) %--------------------------------------------------------------------
   (17) RigidBody  B  
   (18) B.SetMass( mB )
   (19) B.SetInertia( Bcm, Ixx, Iyy, Izz )
   (20) Variable   theta''
   (21) B.RotateZ( N, theta )
-> (22) B_N = [cos(theta), sin(theta), 0;  -sin(theta), cos(theta), 0;  0, 0, 1]
-> (23) w_B_N> = theta'*Bz>
-> (24) alf_B_N> = theta''*Bz>

   (25) BMomentOfEffectiveForceAboutBcm> = B.GetMomentOfEffectiveForce( Bcm )
-> (26) BMomentOfEffectiveForceAboutBcm> = Izz*theta''*Bz>

   (27) %--------------------------------------------------------------------
   (28) % Example 3: GetMomentOfEffectiveForce  (rotating/translating rigid body)
   (29) %--------------------------------------------------------------------
   (30) Bcm.Translate( No, x*Nx> + y*Ny> )
-> (31) p_No_Bcm> = x*Nx> + y*Ny>
-> (32) v_Bcm_N> = x'*Nx> + y'*Ny>
-> (33) a_Bcm_N> = x''*Nx> + y''*Ny>

   (34) BMomentOfEffectiveForceAboutNo> = B.GetMomentOfEffectiveForce( No )
-> (35) BMomentOfEffectiveForceAboutNo> = (Izz*theta''+mB*(x*y''-y*x''))*Bz>



GetMomentOfForces
GetMomentOfForces

 Purpose:  Sums the moments of all forces applied to an object.

  Syntax:  Object.GetMomentOfForces( aboutPoint )

   Input:  Object -- name of Point, Particle, RigidFrame, RigidBody, or System.
           aboutPoint -- the name of a point or Particle.

  Output:  Moment of all forces on Object about aboutPoint.

  Remark:  System depends on whether a NewtonianFrame was declared.
           Type HELP SYSTEM for more information.

  Remark:  If Q is a point of a RigidFrame or RigidBody B, declare it as
           Point Q(B).   This accounts for forces/moments on B.

 Related:  AddForce  AddForceDamper  AddForceElectrostatic  AddForceGravity
           AddForceInverseSquare  AddForceLinearActuator  AddForceSpring
           AddTorque  AddTorqueDamper
           GetMomentOfForces  GetResultantForce  GetResultantTorque
           GetForceGravityPotentialEnergy  GetForceSpringPotentialEnergy
           GetStatics   GetStaticsKane   GetStaticsLagrange
           GetDynamics  GetDynamicsKane  GetDynamicsLagrange

   (1) %--------------------------------------------------------------------
   (2) % Example 1: GetMomentOfForces  (moment of forces on Ao about No)
   (3) %--------------------------------------------------------------------
   (4) RigidFrame N                                
   (5) RigidBody  A    
   (6) Variable   x, y
   (7) Ao.SetPosition( No, x*Nx> )             
-> (8) p_No_Ao> = x*Nx>

   (9) Ao.AddForce( 2*Nx> + 3*Ny> )               
-> (10) Force_Ao> = 2*Nx> + 3*Ny>

   (11) MomentOfForcesOnAoAboutNo> = Ao.GetMomentOfForces( No )
-> (12) MomentOfForcesOnAoAboutNo> = 3*x*Nz>

   (13) %--------------------------------------------------------------------
   (14) % Example 2: GetMomentOfForces  (moment of forces on A about various points)
   (15) %--------------------------------------------------------------------
   (16) Acm.SetPosition( No, y*Ny> )             
-> (17) p_No_Acm> = y*Ny>

   (18) Acm.AddForce( 4*Nx> + 5*Ny> )  
-> (19) Force_Acm> = 4*Nx> + 5*Ny>

   (20) MomentOfForcesOnAAboutAcm> = A.GetMomentOfForces( Acm )
-> (21) MomentOfForcesOnAAboutAcm> = (2*y+3*x)*Nz>

   (22) MomentOfForcesOnAAboutAo> = A.GetMomentOfForces( Ao )
-> (23) MomentOfForcesOnAAboutAo> = (-5*x-4*y)*Nz>

   (24) MomentOfForcesOnAAboutNo> = A.GetMomentOfForces( No )
-> (25) MomentOfForcesOnAAboutNo> = (3*x-4*y)*Nz>

   (26) %--------------------------------------------------------------------
   (27) % Example 3: GetMomentOfForces (action/reaction)
   (28) %--------------------------------------------------------------------
   (29) RigidBody  B
   (30) Variable   Fx, Fy
   (31) Ao.SetPosition( Bo, 2*x*Nx> )                                   
-> (32) p_Bo_Ao> = 2*x*Nx>

   (33) Ao.AddForce( Bo, Fx*Nx> ) 
-> (34) Force_Ao_Bo> = Fx*Nx>

   (35) MomentOfForcesOnAAboutAo> := A.GetMomentOfForces( Ao )
-> (36) MomentOfForcesOnAAboutAo> = (-5*x-4*y)*Nz>

   (37) MomentOfForcesOnBAboutAo> := B.GetMomentOfForces( Ao )
-> (38) MomentOfForcesOnBAboutAo> = 0>

   (39) %--------------------------------------------------------------------
   (40) % Example 4: GetMomentOfForces (action/reaction with RigidFrame N)
   (41) %--------------------------------------------------------------------
   (42) No.AddForce( Acm, Fy*Ny> )
-> (43) Force_No_Acm> = Fy*Ny>

   (44) MomentOfForcesOnSystemAboutNo> := System.GetMomentOfForces( Ao )
-> (45) MomentOfForcesOnSystemAboutNo> = (-5*x-4*y)*Nz>

   (46) %--------------------------------------------------------------------
   (47) % Example 5: GetMomentOfForces (NewtonianFrame is external to system)
   (48) %--------------------------------------------------------------------
   (49) NewtonianFrame  N
   (50) MomentOfForcesOnSystemAboutNo> := System.GetMomentOfForces( Ao )
-> (51) MomentOfForcesOnSystemAboutNo> = (Fy*x-5*x-4*y)*Nz>



GetMomentOfInertia
GetMomentOfInertia

 Purpose:  Gets an object's moment of inertia about a line.

  Syntax:  Object.GetMomentOfInertia( aboutPoint, unitVector )

   Input:  Object -- The name of a Particle, RigidBody, or System.
           aboutPoint -- The name of a point or Particle.
           unitVector -- Unit vector or expression for a unit vector.

  Output:  Returns Object's moment of inertia for the line that passes
           through aboutPoint and that is parallel to unitVector.

 Related:  SetMass          GetMass         SetInertia
           GetCMPosition    GetCmVelocity   GetCmAcceleration
           GetInertiaDyadic  GetInertiaMatrix  GetMomentOfInertia
           GetProductOfInertia  GetRadiusOfGyration  GetInertiaVector

   (1) %--------------------------------------------------------------------
   (2) % Example 1: GetMomentOfInertia  (moment of inertia of a rigid body)
   (3) %--------------------------------------------------------------------
   (4) RigidBody  B
   (5) B.SetInertia( Bcm, Ixx, Iyy, Izz )
   (6) BMomentOfInertiaAboutBcmForBx = B.GetMomentOfInertia( Bcm, Bx> )
-> (7) BMomentOfInertiaAboutBcmForBx = Ixx

   (8) %--------------------------------------------------------------------
   (9) % Example 2: GetMomentOfInertia  (moment of inertia in another basis)
   (10) %--------------------------------------------------------------------
   (11) RigidFrame A
   (12) Variable  theta
   (13) B.SetRotationMatrixZ( A, theta )
-> (14) B_A = [cos(theta), sin(theta), 0;  -sin(theta), cos(theta), 0;  0, 0, 1]

   (15) BMomentOfInertiaAboutBcmForAx = B.GetMomentOfInertia( Bcm, Ax> )
-> (16) BMomentOfInertiaAboutBcmForAx = Ixx*cos(theta)^2 + Iyy*sin(theta)^2

   (17) %--------------------------------------------------------------------
   (18) % Example 3: GetMomentOfInertia  (moment of inertia of a particle)
   (19) %--------------------------------------------------------------------
   (20) Particle   Q
   (21) Q.SetMass( mQ )
   (22) Variable   x, y, z
   (23) Q.SetPosition( Bo, x*Bx> + y*By> + z*Bz> )
-> (24) p_Bo_Q> = x*Bx> + y*By> + z*Bz>

   (25) QMomentOfInertiaAboutBoForBx = Q.GetMomentOfInertia( Bo, Bx> )
-> (26) QMomentOfInertiaAboutBoForBx = mQ*(y^2+z^2)

   (27) %--------------------------------------------------------------------
   (28) % Example 4: GetMomentOfInertia  (moment of inertia of a system)
   (29) %--------------------------------------------------------------------
   (30) B.SetMass( mB )
   (31) Bcm.SetPosition( Bo, 2*Bx> + 3*By> + 4*Bz> )
-> (32) p_Bo_Bcm> = 2*Bx> + 3*By> + 4*Bz>

   (33) SMomentOfInertiaAboutBoForBx = System.GetMomentOfInertia( Bo, Bx> )
-> (34) SMomentOfInertiaAboutBoForBx = Ixx + 25*mB + mQ*(y^2+z^2)

   (35) SMomentOfInertiaAboutBoForAx = System.GetMomentOfInertia( Bo, Ax> )
-> (36) SMomentOfInertiaAboutBoForAx = Ixx + 25*mB + mQ*(y^2+z^2) + sin(theta)*
        (Iyy*sin(theta)+12*mB*cos(theta)+mQ*x^2*sin(theta)+2*mQ*x*y*cos(theta)-
        5*mB*sin(theta)-Ixx*sin(theta)-mQ*y^2*sin(theta))



GetPartialVelocity
GetPartialVelocity  GetPartialAngularVelocity

 Purpose:  Forms partial velocities and partial angular velocities.

Syntax 1:  Q.GetPartialVelocity( refFrame )
           Q.GetPartialVelocity( refFrame, generalizedSpeedi )
Syntax 2:  B.GetPartialAngularVelocity( refFrame )
           B.GetPartialAngularVelocity( refFrame, generalizedSpeedi )
Syntax 3:  GetPartialVelocity( scalarOrTensorExpression )
           GetPartialVelocity( scalarOrTensorExpression, generalizedSpeedi )

   Input:  Q -- name of a Point.
           B -- name of a RigidFrame or RigidBody.
           refFrame -- name of a RigidFrame or RigidBody.
           scalarOrTensorExpression -- scalar, vector, or dyadic expression.
           generalizedSpeedi -- name of a generalized speed.

Output 1:  Column matrix of Q's partial velocities in refFrame or
           Q's partial velocity in refFrame for generalizedSpeedi.

Output 2:  Column matrix of B's partial angular velocities in refFrame or
           B's partial angular velocity in refFrame for generalizedSpeedi.

Output 3:  Column matrix of partial velocities for scalarOrTensorExpression or
           the partial velocity associated with generalizedSpeedi.

  Remark:  The returned quantity may depend on whether the command is
           issued before or after the CONSTRAIN command.

 Related:  GetPartialVelocity    GetPartialAngularVelocity
           GetVelocityRemainder  GetAngularVelocityRemainder

   (1) %--------------------------------------------------------------------
   (2) % Example: GetPartialVelocity and GetPartialAngularVelocity
   (3) %--------------------------------------------------------------------
   (4) NewtonianFrame N
   (5) RigidBody      B       % Sphere
   (6) Point          BN(B)   % Point of B in contact with N
   (7) %----------------------------------------------
   (8) Constant  R
   (9) Variable  x',  y'
   (10) Variable  wx,  wy,  wz
   (11) SetGeneralizedSpeed( x', y', wx, wy, wz )
   (12) %----------------------------------------------
   (13) B.SetAngularVelocity( N,  wx*Nx> + wy*Ny> + wz*Nz> )
-> (14) w_B_N> = wx*Nx> + wy*Ny> + wz*Nz>

   (15) Bcm.SetPositionVelocity( No,  x*Nx> + y*Ny> + R*Nz> )
-> (16) p_No_Bcm> = x*Nx> + y*Ny> + R*Nz>
-> (17) v_Bcm_N> = x'*Nx> + y'*Ny>

   (18) %----------------------------------------------
   (19) %     Partial angular velocities and velocities
   (20) wBNPartials = B.GetPartialAngularVelocity( N ) 
-> (21) wBNPartials = [0>;  0>;  Nx>;  Ny>;  Nz>]

   (22) vBcmNPartials = Bcm.GetPartialVelocity( N )
-> (23) vBcmNPartials = [Nx>;  Ny>;  0>;  0>;  0>]



GetPolynomialRoots
GetPolynomialRoots  or  GetPolynomialFunction

 Purpose:  GetPolynomialRoots     gets the roots of a polynomial.
 Purpose:  GetPolynomialFunction  creates a polynomial function from a matrix
           of coefficients or determines the coefficients of the leading n
           terms of the Taylor-series expansion of a function about 0.

Syntax 1:  GetPolynomialRoots( M )
Syntax 2:  GetPolynomialRoots( function, xName, p )
Syntax 3:  GetPolynomialFunction( M, xName )
Syntax 4:  GetPolynomialFunction( function, xName, p )

   Input:  M -- row/column matrix with n elements.  For example,
                M = [1, 4, 7, 9] may represent x^3 + 4*x^2 + 7*x + 9.

           function -- a function of xName.
           xName    -- the name of a specified, variable, or constant.
           p        -- a positive integer.

Output 1:  Row/column matrix whose p elements are the roots of the
           polynomial represented by M.

Output 2:  Column matrix whose elements are the roots of the polynomial
           formed by the p+1 leading terms of the Taylor series expansion
           of function about xName = 0.  For example, the following:

             taylorExpansionRoots = GetPolynomialRoots( exp(x), x, 3 )

           returns the roots of the polynomial generated by doing a Taylor
           series expansion of exp(x) about x=0, i.e., it returns the roots
           of the polynomial 1 + x + x^2/2 + x^3/factorial(3).

Output 3:  Polynomial of degree p-1 in x equal to:
           M[1]*x^(p-1) + M[2]*x^(p-2) + ... M[p-1]*x + M[p].

Output 4:  Column matrix having p+1 elements whose ith element is
           the coefficient of the term of degree  p+1-i  in x
           in the Taylor series expansion of function about x = 0.

  Remark:  When p > 2, the elements of M must be real numbers (not symbols).

 Related:  GetLinearRoots  GetQuadraticRoots  GetQuadraticPositiveRoot  ...
           GetPolynomialRoots  GetPolynomialFunction  ...
           Solve  SolveDt  SolveSetInput
           SolveQuadraticPositiveRoot  SolveQuadraticPositiveRootDt  ...
           Spline (Line, Cubic, Bell, Pulse, Step, Transition, Polynomial, ...)

   (1) %--------------------------------------------------------------------
   (2) % Example 1: GetPolynomialFunction 
   (3) %--------------------------------------------------------------------
   (4) Variable x
   (5) functionX = GetPolynomialFunction( [t, 2, 3], x )
-> (6) functionX = 3 + 2*x + t*x^2

   (7) %--------------------------------------------------------------------
   (8) % Example 2: GetPolynomialFunction 
   (9) %--------------------------------------------------------------------
   (10) expansionX = GetPolynomialFunction( sin(x), x, 5 )
-> (11) expansionX = [0.008333333;  0;  -0.1666667;  0;  1;  0]

   (12) %--------------------------------------------------------------------
   (13) % Example 3: GetPolynomialRoots  (roots of 5th-order polynomial) 
   (14) %--------------------------------------------------------------------
   (15) SetImaginaryNumber( i )
   (16) Variable  p
   (17) rootsA = GetPolynomialRoots( p^5 + 2*p^4 + 3*p^3 + 5*p^2 + 9*p + 17,  p, 5 )  
-> (18) rootsA = [-1.857621;  -0.9475112 - 1.507048*i;  -0.9475112 + 1.507048*i;  
        0.8763218 - 1.455989*i;  0.8763218 + 1.455989*i]

   (19) %--------------------------------------------------------------------
   (20) % Example 4: GetPolynomialRoots  (roots of 5th-order polynomial) 
   (21) %--------------------------------------------------------------------
   (22) rootsB = GetPolynomialRoots( [1, 2, 3, 5, 9, 17] )
-> (23) rootsB = [-1.857621, -0.9475112 - 1.507048*i, -0.9475112 + 1.507048*i, 0.8763218 - 1.455989*i, 0.8763218 + 1.455989*i]



GetLinearRoots
GetLinearRoots

 Purpose:  Gets the roots of a polynomial of degree 1.

Syntax 1:  GetLinearRoots( function, x )
Syntax 2:  GetLinearRoots( M )

   Input:  function -- a mathematical expression that is a function of x.
           Note: A 1st-order (linear) polynomial of form  c1*x + c0
           is created from a Taylor series expansion of function about x=0.

           x -- the name of a specified, variable, or constant.

           M -- row/column matrix with two elements.  For example,
                M = [2, 5] may represent 2*x + 5.

  Output:  Root of the 1st-order polynomial represented by function or M.

 Related:  GetLinearRoots  GetQuadraticRoots  GetQuadraticPositiveRoot  ...
           GetPolynomialRoots  GetPolynomialFunction  ...
           Solve  SolveDt  SolveSetInput
           SolveQuadraticPositiveRoot  SolveQuadraticPositiveRootDt  ...
           FactorLinear  FactorQuadratic

   (1) %--------------------------------------------------------------------
   (2) % Example 1: GetLinearRoots  (roots of linear equation) 
   (3) %--------------------------------------------------------------------
   (4) Constant a, b
   (5) Variable x
   (6) rootsA = GetLinearRoots( a*x + b, x )  
-> (7) rootsA = -b/a

   (8) %--------------------------------------------------------------------
   (9) % Example 2: GetLinearRoots  (roots of linear equation) 
   (10) %--------------------------------------------------------------------
   (11) rootsB = GetLinearRoots( [a; b] )
-> (12) rootsB = -b/a



GetQuadraticRoots
GetQuadraticRoots,  GetQuadraticPositiveRoot,   GetQuadraticNegativeRoot

 Purpose:  Gets the roots of a polynomial of degree 2.

Syntax 1:  GetQuadraticRoots(        function, x )
           GetQuadraticPositiveRoot( function, x )
           GetQuadraticNegativeRoot( function, x )
Syntax 2:  GetQuadraticRoots(        M )
           GetQuadraticPositiveRoot( M )
           GetQuadraticNegativeRoot( M )

   Input:  function -- a mathematical expression that is a function of x.
           Note: A 2nd-order polynomial of the form  a*x^2 + b*x + c
           is created from a Taylor series expansion of function about x=0.

           x -- the name of a specified, variable, or constant.

           M -- row/column matrix with three elements.  For example,
                M = [1, 2, 5] may represent x^2 + 2*x + 5.

  Output:  GetQuadraticRoots  returns a 2x1 column matrix whose elements are
                              the roots of the polynomial in function or M.
           GetQuadraticPositiveRoot  returns the root associated with the
                          positive square root in the quadratic equation,
                          e.g., (-b + sqrt(b^2 - 4*a*c)) / 2*a
           GetQuadraticNegativeRoot  returns the root associated with the
                          negative square root in the quadratic equation.
                          e.g., (-b - sqrt(b^2 - 4*a*c)) / 2*a

  Remark:  Use  SolveQuadraticPositiveRoot  to calculate the positive root and
           assign the result to x.  Similarly for SolveQuadraticNegativeRoot.

 Related:  GetLinearRoots  GetQuadraticRoots  GetQuadraticPositiveRoot  ...
           GetPolynomialRoots  GetPolynomialFunction  ...
           Solve  SolveDt  SolveSetInput
           SolveQuadraticPositiveRoot  SolveQuadraticPositiveRootDt  ...
           FactorLinear  FactorQuadratic

   (1) %--------------------------------------------------------------------
   (2) % Example 1: GetQuadraticRoots  (roots of quadratic equation) 
   (3) %--------------------------------------------------------------------
   (4) Constant a, b, c
   (5) Variable x
   (6) rootsA = GetQuadraticRoots( a*x^2 + b*x + c, x )  
-> (7) rootsA[1] = -0.5*(b-sqrt(b^2-4*a*c))/a
-> (8) rootsA[2] = -0.5*(b+sqrt(b^2-4*a*c))/a

   (9) positiveRootA = GetQuadraticPositiveRoot( a*x^2 + b*x + c, x )  
-> (10) positiveRootA = -0.5*(b-sqrt(b^2-4*a*c))/a

   (11) negativeRootA = GetQuadraticNegativeRoot( a*x^2 + b*x + c, x )  
-> (12) negativeRootA = -0.5*(b+sqrt(b^2-4*a*c))/a

   (13) %--------------------------------------------------------------------
   (14) % Example 2: GetQuadraticRoots  (roots of quadratic equation) 
   (15) %--------------------------------------------------------------------
   (16) rootsB = GetQuadraticRoots( [a; b; c] )
-> (17) rootsB[1] = -0.5*(b-sqrt(b^2-4*a*c))/a
-> (18) rootsB[2] = -0.5*(b+sqrt(b^2-4*a*c))/a



GetEulerParameterMatrix44
GetEulerParameterMatrix44

 Purpose:  Gets the 4x4 Euler parameter matrix that multiplies a 4x1 Euler-
           parameter matrix to produce the 4 Euler parameters associated
           with concatenating two rotation matrices.

  Syntax:  GetEulerParameterMatrix44( e0, e1, e2, e3 )

   Input:  e0, e1, e2, e3 -- expressions for Euler parameters (quaternion)

  Output:  4x4 Euler parameter matrix, equal to:
           [ e0,  -e1,  -e2,  -e3;
             e1,   e0,  -e3,   e2;
             e2,   e3,   e0,  -e1;
             e3,  -e2,   e1,   e0   ]

  Remark:  Definitions of Euler parameters (quaternion) etc., are in
           Kane, T. R.,  Likins, P. W.,  and Levinson D. A.,
           Spacecraft Dynamics, McGraw-Hill, 1983, Ch. 1., and
           Mitiguy, Paul, Advanced Dynamics for Professional
           Mechanical, Aerospace, and BioMechanical Engineers.

 Related:  Rotate  RotateX  RotateY  RotateZ
           RotateNegativeX  RotateNegativeY  RotateNegativeZ
           SetRotationMatrixX  SetRotationMatrixY  SetRotationMatrixZ
           SetRotationMatrixNegativeX  SetRotationMatrixNegativeY  ...
           SetRotationMatrix  SetAngularVelocity  SetAngularAcceleration
           GetRotationMatrix  GetAngularVelocity  GetAngularAcceleration
           SetRotationMatrixODE   SetRotationMatrixAndPosition

   (1) %--------------------------------------------------------------------
   (2) % Example: GetEulerParameterMatrix44.al  
   (3) %--------------------------------------------------------------------
   (4) Variable  e0, e1, e2, e3
   (5) E = GetEulerParameterMatrix44( e0, e1, e2, e3 )
-> (6) E = [e0, -e1, -e2, -e3;  e1, e0, -e3, e2;  e2, e3, e0, -e1;  e3, -e2, e1, e0]



GetPosition
GetPosition

 Purpose:  Gets the position of a point from another point.

  Syntax:  Q.GetPosition( fromPoint )

   Input:  Q -- The name of a point.
           fromPoint -- The name of another point.

  Output:  Q's position vector from fromPoint.

 Related:  Translate        SetPositionVelocity   SetVelocityAcceleration
           SetPosition      GetPosition   GetDistance  GetDistanceSquared
           SetVelocity      GetVelocity   GetSpeed     GetElongation
           SetAcceleration  GetAcceleration

   (1) %--------------------------------------------------------------------
   (2) % Example: GetPosition 
   (3) %--------------------------------------------------------------------
   (4) RigidFrame N             
   (5) Point      P
   (6) Particle   Q            
   (7) Variable   xP, yP, zP
   (8) Variable   xQ, yQ, zQ
   (9) P.SetPosition( No, xP*Nx> + yP*Ny> + zP*Nz> )
-> (10) p_No_P> = xP*Nx> + yP*Ny> + zP*Nz>

   (11) Q.SetPosition( P,  xQ*Nx> + yQ*Ny> + zQ*Nz> )
-> (12) p_P_Q> = xQ*Nx> + yQ*Ny> + zQ*Nz>

   (13) QPositionVectorFromNo> = Q.GetPosition( No )
-> (14) QPositionVectorFromNo> = (xP+xQ)*Nx> + (yP+yQ)*Ny> + (zP+zQ)*Nz>



GetPotentialEnergy
GetPotentialEnergy

 Purpose:  Help with potential energy associated with various forces.

           For help with  gravity  potential energy, type
           Help  GetForceGravityPotentialEnergy

           For help with  spring  potential energy, type
           Help  GetForceSpringPotentialEnergy

           For help with  electrostatic  potential energy, type
           Help  GetForceElectrostaticPotentialEnergy

           For help with other inverse-square forces' potential energy, type
           Help  GetForceInverseSquarePotentialEnergy


GetPower
GetPower

 Purpose:  Gets the power of all forces and torques in the system.

  Syntax:  System.GetPower()

   Input:  None

  Output:  Power of all forces and torques in the system.

 Related:  AddForce  AddForceDamper  AddForceElectrostatic  AddForceGravity
           AddForceInverseSquare  AddForceLinearActuator  AddForceSpring
           AddTorque  AddTorqueDamper
           GetMomentOfForces  GetResultantForce  GetResultantTorque
           GetForceGravityPotentialEnergy  GetForceSpringPotentialEnergy
           GetStatics   GetStaticsKane   GetStaticsLagrange
           GetDynamics  GetDynamicsKane  GetDynamicsLagrange  GetKineticEnergy

   (1) %--------------------------------------------------------------------
   (2) % Example 1: GetPower   (Power of a force on point Bcm)
   (3) %--------------------------------------------------------------------
   (4) NewtonianFrame N             
   (5) RigidBody      B           
   (6) Variable       vx, vy
   (7) Specified      Fx, Fy
   (8) Bcm.SetVelocity( N, vx*Nx> + vy*Ny> )
-> (9) v_Bcm_N> = vx*Nx> + vy*Ny>

   (10) Bcm.AddForce( Fx*Nx> + Fy*Ny> )
-> (11) Force_Bcm> = Fx*Nx> + Fy*Ny>

   (12) PowerOfForce = System.GetPower()
-> (13) PowerOfForce = Fx*vx + Fy*vy

   (14) %--------------------------------------------------------------------
   (15) % Example 2: GetPower   (Power of a force and torque on rigid body)
   (16) %--------------------------------------------------------------------
   (17) Variable       wz        
   (18) Specified      Tz       
   (19) B.SetAngularVelocity( N, wz*Bz> )  
-> (20) w_B_N> = wz*Bz>

   (21) B.AddTorque( Tz*Bz> )  
-> (22) Torque_B> = Tz*Bz>

   (23) PowerOfForceAndTorqueOnB = System.GetPower()   
-> (24) PowerOfForceAndTorqueOnB = Fx*vx + Fy*vy + Tz*wz



GetProductOfInertia
GetProductOfInertia

 Purpose:  Gets an object's product of inertia about a point for
           two orthogonal unit vectors.

  Syntax:  Object.GetProductOfInertia( aboutPoint, unitVectorA, unitVectorB )

   Input:  Object -- The name of a Particle, RigidBody, or System.
           aboutPoint -- The name of a point or Particle.
           unitVectorA -- Unit vector or expression for a unit vector.
           unitVectorB -- Unit vector or expression for a unit vector.

  Output:  Object's product of inertia about aboutPoint for
           the unit vectors unitVectorA and unitVectorB.

  Remark:  Products of inertia adhere to the "negative sign convention".
           Example: For a 1 kg particle whose position from a point P is
           2*Nx> + 3*Ny>, the product of inertia Ixy = -m*x*y = -6 kg*m^2.

 Related:  SetMass          GetMass         SetInertia
           GetCMPosition    GetCmVelocity   GetCmAcceleration
           GetInertiaDyadic  GetInertiaMatrix  GetMomentOfInertia
           GetProductOfInertia  GetRadiusOfGyration  GetInertiaVector

   (1) %--------------------------------------------------------------------
   (2) % Example 1: GetProductOfInertia  (product of inertia of a rigid body)
   (3) %--------------------------------------------------------------------
   (4) RigidBody  B
   (5) B.SetInertia( Bcm, Ixx, Iyy, Izz )
   (6) BProductOfInertiaAboutBcmForBxBy = B.GetProductOfInertia( Bcm, Bx>, By> )
-> (7) BProductOfInertiaAboutBcmForBxBy = 0

   (8) %--------------------------------------------------------------------
   (9) % Example 2: GetProductOfInertia  (product of inertia in another basis)
   (10) %--------------------------------------------------------------------
   (11) RigidFrame A
   (12) Variable  theta
   (13) B.SetRotationMatrixZ( A, theta )
-> (14) B_A = [cos(theta), sin(theta), 0;  -sin(theta), cos(theta), 0;  0, 0, 1]

   (15) BProductOfInertiaAboutBcmForAxAy = B.GetProductOfInertia( Bcm, Ax>, Ay> )
-> (16) BProductOfInertiaAboutBcmForAxAy = (Ixx-Iyy)*sin(theta)*cos(theta)

   (17) %--------------------------------------------------------------------
   (18) % Example 3: GetProductOfInertia  (product of inertia of a particle)
   (19) %--------------------------------------------------------------------
   (20) Particle   Q
   (21) Q.SetMass( mQ )
   (22) Variable   x, y, z
   (23) Q.SetPosition( Bo, x*Bx> + y*By> + z*Bz> )
-> (24) p_Bo_Q> = x*Bx> + y*By> + z*Bz>

   (25) QProductOfInertiaAboutBoForBxBy = Q.GetProductOfInertia( Bo, Bx>, By> )
-> (26) QProductOfInertiaAboutBoForBxBy = -mQ*x*y

   (27) %--------------------------------------------------------------------
   (28) % Example 4: GetProductOfInertia  (product of inertia of a system)
   (29) %--------------------------------------------------------------------
   (30) B.SetMass( mB )
   (31) Bcm.SetPosition( Bo, 2*Bx> + 3*By> + 4*Bz> )
-> (32) p_Bo_Bcm> = 2*Bx> + 3*By> + 4*Bz>

   (33) SProductOfInertiaAboutBoForBxBy = System.GetProductOfInertia( Bo, Bx>, By> )
-> (34) SProductOfInertiaAboutBoForBxBy = -6*mB - mQ*x*y

   (35) SProductOfInertiaAboutBoForAxBy = System.GetProductOfInertia( Bo, Ax>, Ay> )
-> (36) SProductOfInertiaAboutBoForAxBy = -6*mB - mQ*x*y - sin(theta)*(Iyy*cos(
        theta)+mQ*x^2*cos(theta)-12*mB*sin(theta)-5*mB*cos(theta)-Ixx*cos(theta)
        -2*mQ*x*y*sin(theta)-mQ*y^2*cos(theta))



GetRadiusOfGyration
GetRadiusOfGyration

 Purpose:  Gets an object's radius of gyration about a line.

  Syntax:  Object.GetRadiusOfGyration( aboutPoint, unitVector )

   Input:  Object -- The name of a Particle, RigidBody, or System.
           aboutPoint -- The name of a point or Particle.
           unitVector -- Unit vector or expression for a unit vector.

  Output:  Object's radius of gyration for the line that passes
           through aboutPoint and that is parallel to unitVector.

 Related:  SetMass          GetMass         SetInertia
           GetCMPosition    GetCmVelocity   GetCmAcceleration
           GetInertiaDyadic  GetInertiaMatrix  GetMomentOfInertia
           GetProductOfInertia  GetRadiusOfGyration  GetInertiaVector

   (1) %--------------------------------------------------------------------
   (2) % Example 1: GetRadiusOfGyration  (radius of gyration of a rigid body)
   (3) %--------------------------------------------------------------------
   (4) RigidBody  B
   (5) B.SetMass( mB )
   (6) B.SetInertia( Bcm, Ixx, Iyy, Izz )
   (7) BRadiusOfGyrationAboutBcmForBx = B.GetRadiusOfGyration( Bcm, Bx> )
-> (8) BRadiusOfGyrationAboutBcmForBx = sqrt(Ixx)/sqrt(mB)

   (9) %--------------------------------------------------------------------
   (10) % Example 2: GetRadiusOfGyration  (radius of gyration in another basis)
   (11) %--------------------------------------------------------------------
   (12) RigidFrame A
   (13) Variable  theta
   (14) B.SetRotationMatrixZ( A, theta )
-> (15) B_A = [cos(theta), sin(theta), 0;  -sin(theta), cos(theta), 0;  0, 0, 1]

   (16) BRadiusOfGyrationAboutBcmForAx = B.GetRadiusOfGyration( Bcm, Ax> )
-> (17) BRadiusOfGyrationAboutBcmForAx = sqrt(Ixx*cos(theta)^2+Iyy*sin(theta)^2)
        /sqrt(mB)

   (18) %--------------------------------------------------------------------
   (19) % Example 3: GetRadiusOfGyration  (radius of gyration of a particle)
   (20) %--------------------------------------------------------------------
   (21) Particle   Q
   (22) Q.SetMass( mQ )
   (23) Variable   x, y, z
   (24) Q.SetPosition( Bo, x*Bx> + y*By> + z*Bz> )
-> (25) p_Bo_Q> = x*Bx> + y*By> + z*Bz>

   (26) QRadiusOfGyrationAboutBoForBx = Q.GetRadiusOfGyration( Bo, Bx> )
-> (27) QRadiusOfGyrationAboutBoForBx = sqrt(y^2+z^2)

   (28) %--------------------------------------------------------------------
   (29) % Example 4: GetRadiusOfGyration  (radius of gyration of a system)
   (30) %--------------------------------------------------------------------
   (31) Bcm.SetPosition( Bo, 2*Bx> + 3*By> + 4*Bz> )
-> (32) p_Bo_Bcm> = 2*Bx> + 3*By> + 4*Bz>

   (33) SRadiusOfGyrationAboutBoForBx = System.GetRadiusOfGyration( Bo, Bx> )
-> (34) SRadiusOfGyrationAboutBoForBx = sqrt((Ixx+25*mB+mQ*(y^2+z^2))/(mB+mQ))

   (35) SRadiusOfGyrationAboutBoForAx = System.GetRadiusOfGyration( Bo, Ax> )
-> (36) SRadiusOfGyrationAboutBoForAx = sqrt((Ixx+25*mB+mQ*(y^2+z^2)+sin(theta)
        *(Iyy*sin(theta)+12*mB*cos(theta)+mQ*x^2*sin(theta)+2*mQ*x*y*cos(theta)
        -5*mB*sin(theta)-Ixx*sin(theta)-mQ*y^2*sin(theta)))/(mB+mQ))



GetResultantForce
GetResultantForce

 Purpose:  Sums all forces applied to an object.

Syntax 1:  Object.GetResultantForce()
Syntax 2:  Q.GetResultantForce( P )

   Input:  Object -- a Point, Particle, RigidBody, RigidFrame, or System
           Q -- name of a point
           P -- name of a point

Output 1:  Resultant of all forces applied to Object.
Output 2:  Resultant of all forces applied to Q by P.

  Remark:  System depends on whether a NewtonianFrame was declared.
           Type HELP SYSTEM for more information.

  Remark:  If Q is a point of a RigidFrame or RigidBody B, declare it as
           Point Q(B).   This accounts for forces/moments on B.

 Related:  AddForce  AddForceDamper  AddForceElectrostatic  AddForceGravity
           AddForceInverseSquare  AddForceLinearActuator  AddForceSpring
           AddTorque  AddTorqueDamper
           GetMomentOfForces  GetResultantForce  GetResultantTorque
           GetForceGravityPotentialEnergy  GetForceSpringPotentialEnergy
           GetStatics   GetStaticsKane   GetStaticsLagrange
           GetDynamics  GetDynamicsKane  GetDynamicsLagrange

   (1) %--------------------------------------------------------------------
   (2) % Example 1: GetResultantForce 
   (3) %--------------------------------------------------------------------
   (4) RigidFrame N                                
   (5) RigidBody  B    
   (6) Bo.AddForce( No, 2*Nx> + 3*Ny> )   % Action/reaction  
-> (7) Force_Bo_No> = 2*Nx> + 3*Ny>

   (8) Bo.AddForce( 2*Nx> + 3*Ny> )               
-> (9) Force_Bo> = 2*Nx> + 3*Ny>

   (10) ResultantForceOnBoFromNo> = Bo.GetResultantForce( No )
-> (11) ResultantForceOnBoFromNo> = 2*Nx> + 3*Ny>

   (12) ResultantForceOnBo> = Bo.GetResultantForce()
-> (13) ResultantForceOnBo> = 4*Nx> + 6*Ny>

   (14) ResultantForceOnB> = B.GetResultantForce()
-> (15) ResultantForceOnB> = 4*Nx> + 6*Ny>

   (16) ResultantForceOnS> = System.GetResultantForce()
-> (17) ResultantForceOnS> = 2*Nx> + 3*Ny>

   (18) %--------------------------------------------------------------------
   (19) % Example 2: GetResultantForce 
   (20) %--------------------------------------------------------------------
   (21) Point      Bp(B)     % Bp is a point of B
   (22) Specified  Fz
   (23) Bp.AddForce( Bo, 8888*Nz> )        % Action/reaction
-> (24) Force_Bp_Bo> = 8888*Nz>

   (25) Bp.AddForce( Fz*Nz> )          
-> (26) Force_Bp> = Fz*Nz>

   (27) ResultantForceOnBpFromBo> = Bp.GetResultantForce( Bo )
-> (28) ResultantForceOnBpFromBo> = 8888*Nz>

   (29) ResultantForceOnBp> = Bp.GetResultantForce()
-> (30) ResultantForceOnBp> = (8888+Fz)*Nz>

   (31) ResultantForceOnB> := B.GetResultantForce()
-> (32) ResultantForceOnB> = 4*Nx> + 6*Ny> + Fz*Nz>

   (33) ResultantForceOnS> := System.GetResultantForce()
-> (34) ResultantForceOnS> = 2*Nx> + 3*Ny> + Fz*Nz>

   (35) %--------------------------------------------------------------------
   (36) % Example 3: GetResultantForce   (Newtonian is external to system)
   (37) %--------------------------------------------------------------------
   (38) NewtonianFrame N 
   (39) Specified      Rx, Ry
   (40) No.AddForce( Bcm, Rx*Nx> )         % Action/reaction
-> (41) Force_No_Bcm> = Rx*Nx>

   (42) No.AddForce( Ry*Ny> )              
-> (43) Force_No> = Ry*Ny>

   (44) ResultantForceOnNoFromBcm> = No.GetResultantForce( Bcm )
-> (45) ResultantForceOnNoFromBcm> = Rx*Nx>

   (46) ResultantForceOnNo> = No.GetResultantForce()
-> (47) ResultantForceOnNo> = (-2+Rx)*Nx> + (-3+Ry)*Ny>

   (48) ResultantForceOnN> = N.GetResultantForce()
-> (49) ResultantForceOnN> = (-2+Rx)*Nx> + (-3+Ry)*Ny>

   (50) ResultantForceOnB> := B.GetResultantForce()
-> (51) ResultantForceOnB> = (4-Rx)*Nx> + 6*Ny> + Fz*Nz>

   (52) ResultantForceOnS> := System.GetResultantForce()
-> (53) ResultantForceOnS> = (4-Rx)*Nx> + 6*Ny> + Fz*Nz>



GetResultantTorque
GetResultantTorque

 Purpose:  Sums all torques applied to a rigid object.

Syntax 1:  Object.GetResultantTorque()
Syntax 2:  B.GetResultantTorque( A )

   Input:  Object -- a RigidBody, RigidFrame, or System
           B -- the name of a RigidBody or RigidFrame.
           A -- the name of a RigidBody or RigidFrame.

Output 1:  Resultant of all torques applied to Object.
Output 2:  Resultant of all torques applied to B by A.

 Related:  AddForce  AddForceDamper  AddForceElectrostatic  AddForceGravity
           AddForceInverseSquare  AddForceLinearActuator  AddForceSpring
           AddTorque  AddTorqueDamper
           GetMomentOfForces  GetResultantForce  GetResultantTorque
           GetForceGravityPotentialEnergy  GetForceSpringPotentialEnergy
           GetStatics   GetStaticsKane   GetStaticsLagrange
           GetDynamics  GetDynamicsKane  GetDynamicsLagrange

   (1) %--------------------------------------------------------------------
   (2) % Example 1: GetResultantTorque 
   (3) %--------------------------------------------------------------------
   (4) RigidFrame N                                
   (5) RigidBody  B    
   (6) B.AddTorque( N, 2*Nx> + 3*Ny> )   % Action/reaction  
-> (7) Torque_B_N> = 2*Nx> + 3*Ny>

   (8) B.AddTorque( 2*Nx> + 3*Ny> )               
-> (9) Torque_B> = 2*Nx> + 3*Ny>

   (10) ResultantTorqueOnBFromN> = B.GetResultantTorque( N )
-> (11) ResultantTorqueOnBFromN> = 2*Nx> + 3*Ny>

   (12) ResultantTorqueOnB> = B.GetResultantTorque()
-> (13) ResultantTorqueOnB> = 4*Nx> + 6*Ny>

   (14) %--------------------------------------------------------------------
   (15) % Example 2: GetResultantTorque 
   (16) %--------------------------------------------------------------------
   (17) RigidFrame  A
   (18) Specified   Tz
   (19) A.AddTorque( B, 8888*Nz> )        % Action/reaction
-> (20) Torque_A_B> = 8888*Nz>

   (21) A.AddTorque( Tz*Nz> )          
-> (22) Torque_A> = Tz*Nz>

   (23) ResultantTorqueOnAFromB> = A.GetResultantTorque( B )
-> (24) ResultantTorqueOnAFromB> = 8888*Nz>

   (25) ResultantTorqueOnA> = A.GetResultantTorque()
-> (26) ResultantTorqueOnA> = (8888+Tz)*Nz>

   (27) ResultantTorqueOnB> := B.GetResultantTorque()
-> (28) ResultantTorqueOnB> = 4*Nx> + 6*Ny> - 8888*Nz>

   (29) %--------------------------------------------------------------------
   (30) % Example 3: GetResultantTorque 
   (31) %--------------------------------------------------------------------
   (32) NewtonianFrame N 
   (33) RigidFrame     C
   (34) Specified      Tx, Ty
   (35) N.AddTorque( C, Tx*Nx> )          % Action/reaction
-> (36) Torque_N_C> = Tx*Nx>

   (37) N.AddTorque( Ty*Ny> )              
-> (38) Torque_N> = Ty*Ny>

   (39) ResultantTorqueOnNFromC> = N.GetResultantTorque( C )
-> (40) ResultantTorqueOnNFromC> = Tx*Nx>

   (41) ResultantTorqueOnN> = N.GetResultantTorque()
-> (42) ResultantTorqueOnN> = (-2+Tx)*Nx> + (-3+Ty)*Ny>

   (43) ResultantTorqueOnC> := C.GetResultantTorque()
-> (44) ResultantTorqueOnC> = -Tx*Nx>



GetRhs
GetRhs

 Purpose:  Returns the assigned right-hand side of a name.

  Syntax:  GetRhs( name )

   Input:  name -- the name of a scalar expression

  Output:  The expression assigned to name.

  Remark:  The GetRhs command is usually unnecessary for names of
           matrices, vectors, or dyadics.  Usually, these names are
           automatically replaced with their right-hand-sides.

 Related:  Evaluate  Explicit  GetRhs  ReplaceString  SetAutoRhs

   (1) %--------------------------------------------------------------------
   (2) % Example:  GetRhs( ... )
   (3) %--------------------------------------------------------------------
   (4) Constant a, b
   (5) c = a + b^2
-> (6) c = a + b^2

   (7) d = c + sin(c)              
-> (8) d = c + sin(c)

   (9) e = GetRhs(c) + sin(c)
-> (10) e = a + b^2 + sin(c)



GetRotationMatrix
GetRotationMatrix

 Purpose:  Gets the rotation matrix relating two sets of bases vectors.

  Syntax:  B.GetRotationMatrix( N )

   Input:  B -- name of a RigidFrame or RigidBody.
           N -- name of another RigidFrame or RigidBody.

  Output:  Rotation matrix that relates Bx>, By>, Bz>  to  Nx>, Ny>, Nz>

 Related:  GetAngularAcceleration  GetAngularVelocity  GetRotationMatrix
           SetAngularAcceleration  SetAngularVelocity  SetRotationMatrix

   (1) %--------------------------------------------------------------------
   (2) % Example: GetRotationMatrix 
   (3) %--------------------------------------------------------------------
   (4) RigidFrame N             
   (5) RigidBody  A, B
   (6) Variable   qA, qB
   (7) A.SetRotationMatrixX( N, qA )
-> (8) A_N = [1, 0, 0;  0, cos(qA), sin(qA);  0, -sin(qA), cos(qA)]

   (9) B.SetRotationMatrixY( A, qB )
-> (10) B_A = [cos(qB), 0, -sin(qB);  0, 1, 0;  sin(qB), 0, cos(qB)]

   (11) BRotationMatrixToN = B.GetRotationMatrix( N )
-> (12) BRotationMatrixToN[1,1] = cos(qB)
-> (13) BRotationMatrixToN[1,2] = sin(qA)*sin(qB)
-> (14) BRotationMatrixToN[1,3] = -sin(qB)*cos(qA)
-> (15) BRotationMatrixToN[2,1] = 0
-> (16) BRotationMatrixToN[2,2] = cos(qA)
-> (17) BRotationMatrixToN[2,3] = sin(qA)
-> (18) BRotationMatrixToN[3,1] = sin(qB)
-> (19) BRotationMatrixToN[3,2] = -sin(qA)*cos(qB)
-> (20) BRotationMatrixToN[3,3] = cos(qA)*cos(qB)



GetSpeed
GetSpeed  and  GetSpeedSquared

 Purpose:  Gets a point's speed in a reference frame.

Syntax 1:  Q.GetSpeed( refFrame )
Syntax 2:  Q.GetSpeedSquared( refFrame )

   Input:  Q -- name of a point.
           refFrame -- name of a RigidFrame or RigidBody.

Output 1:  Magnitude of Q's velocity in refFrame.
Output 2:  Square of the magnitude of Q's velocity in refFrame.

 Related:  GetMagnitude           GetMagnitudeSquared
           GetDistance            GetDistanceSquared
           GetSpeed               GetSpeedSquared
           GetAngularSpeed        GetAngularSpeedSquared
           GetAngleBetweenVectors GetAngleBetweenUnitVectors
           GetPosition            SetPosition       Translate
           GetVelocity            SetVelocity       SetPositionVelocity
           GetAcceleration        SetAcceleration   SetVelocityAcceleration
           GetUnitVector          GetElongation     Vector   Dot

   (1) %--------------------------------------------------------------------
   (2) % Example: GetSpeed  and  GetSpeedSquared
   (3) %--------------------------------------------------------------------
   (4) RigidFrame N
   (5) Point      Q            
   (6) Variable   vx, vy
   (7) Q.SetVelocity( N, vx*Nx> + vy*Ny> )
-> (8) v_Q_N> = vx*Nx> + vy*Ny>

   (9) speed = Q.GetSpeed( N )   
-> (10) speed = sqrt(vx^2+vy^2)

   (11) speedSquared = Q.GetSpeedSquared( N )   
-> (12) speedSquared = vx^2 + vy^2



GetStatics
GetStatics    GetStaticsKane    GetStaticsLagrange

 Purpose:  Gets equations governing static equilibrium.

Syntax 1:  Object.GetStatics()
Syntax 2:  Object.GetStatics( aboutPoint )
Syntax 3:  System.GetStaticsKane()
Syntax 4:  System.GetStaticsLagrange()  IN DEVELOPMENT.  SEE SYNTAX.

   Input:  Object -- Point, Particle, RigidFrame, RigidBody, or System.
           aboutPoint -- The name of a point.

Output 1:  Resultant of all forces on Object.
Output 2:  Resultant of all moments on Object about aboutPoint.
Output 3:  Kane's     equation for statics for the entire System.
Output 4:  Lagrange's equation for statics for the entire System.

  Remark:  If Q is a point of a RigidFrame or RigidBody B, declare it as
           Point Q(B).   This accounts for forces/moments on B.

  Remark:  For Newton/Euler equations, type  Help Statics  or  Help Dynamics
           For Kane's       equations, type  Help Kane
           For Lagrange's   equations, type  Help Lagrange

 Related:  AddForce  AddForceDamper  AddForceElectrostatic  AddForceGravity
           AddForceInverseSquare  AddForceLinearActuator  AddForceSpring
           AddTorque  AddTorqueDamper
           GetMomentOfForces  GetResultantForce  GetResultantTorque
           GetForceGravityPotentialEnergy  GetForceSpringPotentialEnergy
           SetMass  SetPosition  SetRotationMatrix  Rotate
           NewtonianFrame  Point  Particle  RigidFrame  RigidBody
           GetStatics   GetStaticsKane   GetStaticsLagrange
           GetDynamics  GetDynamicsKane  GetDynamicsLagrange
           SetGeneralizedCoordinate  SetGeneralizedSpeed

   (1) %--------------------------------------------------------------------
   (2) % Example: GetStatics 
   (3) %--------------------------------------------------------------------
   (4) NewtonianFrame N             
   (5) RigidBody      B           % Rigid pendulum
   (6) Constant       g           % Local gravitational constant
   (7) Constant       L           % Length of pendulum
   (8) Variable       theta       % Pendulum angle
   (9) Variable       Tz          % Torque applied to B from N
   (10) Variable       Fx, Fy      % Support force on Bo from No
   (11) B.SetMass( m )
   (12) B.SetRotationMatrixZ( N, theta )  
-> (13) B_N = [cos(theta), sin(theta), 0;  -sin(theta), cos(theta), 0;  0, 0, 1]

   (14) Bcm.SetPosition( Bo, -L*By> )
-> (15) p_Bo_Bcm> = -L*By>

   (16) Bo.AddForce( No, Fx*Nx> + Fy*Ny> ) 
-> (17) Force_Bo_No> = Fx*Nx> + Fy*Ny>

   (18) Bcm.AddForce( -m*g*Ny> )
-> (19) Force_Bcm> = -m*g*Ny>

   (20) B.AddTorque( Tz*Bz> )  
-> (21) Torque_B> = Tz*Bz>

   (22) % Resultant of all forces on B    
   (23) BStaticForces> = B.GetStatics()
-> (24) BStaticForces> = Fx*Nx> + (Fy-m*g)*Ny>

   (25) % Resultant of the moments of all forces on B about Bo    
   (26) BStaticMoments> = B.GetStatics( Bo )
-> (27) BStaticMoments> = Tz*Bz> - m*g*L*sin(theta)*Nz>

   (28) % Solve scalar equations for Fx, Fy, and Tz
   (29) BStatics[1] = Dot( BStaticForces>,  Nx> )
-> (30) BStatics[1] = Fx

   (31) BStatics[2] = Dot( BStaticForces>,  Ny> )
-> (32) BStatics[2] = Fy - m*g

   (33) BStatics[3] = Dot( BStaticMoments>, Nz> )
-> (34) BStatics[3] = Tz - m*g*L*sin(theta)

   (35) Solve( BStatics, Fx, Fy, Tz )
-> (36) Fx = 0
-> (37) Fy = m*g
-> (38) Tz = m*g*L*sin(theta)



SVD
SVD        Experimental command, not recommended for use!

 Purpose:  Calculates the singular values (and possibly singular vectors)
           of a real matrix.

Syntax 1:  SVD( M )
Syntax 2:  SVD( M, nameU, nameV )

   Input:  M -- a matrix whose elements are real numbers.

           nameU -- the name to be assigned to the matrix whose columns
           are the singular vectors of M * Transpose(M).

           nameV -- the name to be assigned to the matrix whose columns
           are the singular vectors of Transpose(M) * M.

Output 1:  Returns a column matrix Scol with M's singular values ordered
           from lowest to highest (subject to change).
Output 2:  Returns the column matrix Scol and assigns M's singular vectors
           to the columns of nameU and the columns of nameV.

  Remark:  M = U * S * Transpose(V), where U and V are orthonormal matrices
           and S is a diagonal matrix with M's singular values on the diagonal.

 Related:  GetColumns  GetDeterminant  GetDiagonalMatrix  GetEigen
           GetElement  GetIdentityMatrix  GetInverse  GetRows  GetTrace
           GetTranspose  GetZeroMatrix  Solve  SVD

   (1) %--------------------------------------------------------------------
   (2) % Example 1: SVD   (singularValues of a full-rank matrix)
   (3) %--------------------------------------------------------------------
   (4) A = [1, 2, 3;  4, 5, 6;  5, 3, 7]
-> (5) A = [1, 2, 3;  4, 5, 6;  5, 3, 7]

   (6) SingularValuesOfA = SVD( A )
-> (7) SingularValuesOfA = [0.7659489;  1.801498;  13.04484]

   (8) %--------------------------------------------------------------------
   (9) % Example 2: SVD   (singularValues of a singular matrix)
   (10) %--------------------------------------------------------------------
   (11) B = [1, 2, 3;  4, 5, 6;  2, 4, 6]
-> (12) B = [1, 2, 3;  4, 5, 6;  2, 4, 6]

   (13) SingularValuesOfB = SVD( B )
-> (14) SingularValuesOfB = [5.27944E-08;  1.363919;  12.04739]

   (15) %--------------------------------------------------------------------
   (16) % Example 3: SVD   (singularValues of a non-square matrix)
   (17) %--------------------------------------------------------------------
   (18) C = [1, 2, 3;  4, 5, 6]
-> (19) C = [1, 2, 3;  4, 5, 6]

   (20) SingularValuesOfC = SVD( C )
-> (21) SingularValuesOfC = [0.7728696;  9.508032]

   (22) %--------------------------------------------------------------------
   (23) % Example 4: SVD   (singularValues and singularVectors of a matrix)
   (24) %--------------------------------------------------------------------
   (25) D = [1, 2;  3, 4]
-> (26) D = [1, 2;  3, 4]

   (27) SingularValuesOfD := SVD( D, SingularVectorU, SingularVectorV )
-> (28) SingularVectorU = [-0.9145143, -0.4045536;  0.4045536, -0.9145143]
-> (29) SingularVectorV = [-0.8174156, -0.5760484;  0.5760484, -0.8174156]
-> (30) SingularValuesOfD = [0.3659662;  5.464986]



GetTaylorSeries
GetTaylorSeries

 Purpose:  Expands functions in Taylor series.

  Syntax:  GetTaylorSeries( F, Range, arg1, arg2, ... )

   Input:  F -- a  scalar, vector, dyadic, or matrix expression.

           Range -- n  or  n:m,  where n and m are positive
                    integers such that n < m.

           argi -- the scalar name Ci (e.g., a constant or variable) or
                   the equation Ci = D (D is a scalar expression); or
                   the equation Ci = D:P, where P is a scalar name.

  Output:  The following table describes output associated with F.

           Range|    argi    |              Output
           -----|------------|-----------------------------------
             n  |  Ci        |  nth term of the Taylor series
                |            |  expansion of F about Ci = 0.
                |            |
             n  |  Ci = D    |  nth term of the Taylor series
                |            |  expansion of F about Ci = D.
                |            |
             n  |  Ci = D:P  |  nth term of the Taylor series
                |            |  expansion of F about Ci = D,
                |            |  with P in place of Ci - D.
                |            |
            n:m |  Ci        |  nth  through  mth  terms of Taylor
                |            |  expansion of F about Ci = 0.
                |            |
            n:m |  Ci = D    |  nth  through  mth  terms of Taylor
                |            |  expansion of F about Ci = D.
                |            |
            n:m |  Ci = D:P  |  nth  through  mth  terms of Taylor
                |            |  expansion of F about Ei = D,
                |            |  with P in place of Ci - D.

  Remark:  Certain numerical inaccuracies in Taylor series expan-
           sions may make it advantageous to issue a command such
           as SetAutoEpsilon( 1.0E-13 ).

 Related:  GetDefaults  SetAutoZee
           GetTaylorSeries  Linearize  SetAutoLinearize  SetAutoTaylorSeries

   (1) %--------------------------------------------------------------------
   (2) % Example 1:  GetTaylorSeries   (one function with one variable)
   (3) %--------------------------------------------------------------------
   (4) Variable x, dx
   (5) TaylorCosAbout0 = GetTaylorSeries( cos(x), 0:4, x )
-> (6) TaylorCosAbout0 = 1 + 0.04166667*x^4 - 0.5*x^2

   (7) TaylorCosAbout1 = GetTaylorSeries( cos(x), 0:3, x=1 )
-> (8) TaylorCosAbout1 = 1.381773 + 0.1402452*(-1+x)^3 - 0.841471*x - 0.2701512
       *(-1+x)^2

   (9) TaylorCosAbout1Dx = GetTaylorSeries( cos(x), 0:3, x=1:dx )
-> (10) TaylorCosAbout1Dx = 0.5403023 + 0.1402452*dx^3 - 0.841471*dx - 0.2701512
        *dx^2

   (11) %--------------------------------------------------------------------
   (12) % Example 2:  GetTaylorSeries   (one function with two variables)
   (13) %--------------------------------------------------------------------
   (14) Variable y, dy
   (15) TaylorExpXYAbout0 = GetTaylorSeries( exp(x+y), 0:1, x, y )
-> (16) TaylorExpXYAbout0 = 1 + x + y

   (17) TaylorExpXYAbout2 = GetTaylorSeries( exp(x+y), 0:1, x=2, y=2 )
-> (18) TaylorExpXYAbout2 = -163.7945 + 54.59815*x + 54.59815*y

   (19) TaylorExpXYAbout2Dxy = GetTaylorSeries( exp(x+y), 0:1, x=2:dx, y=2:dy )
-> (20) TaylorExpXYAbout2Dxy = 54.59815 + 54.59815*dx + 54.59815*dy

   (21) %--------------------------------------------------------------------
   (22) % Example 3:  GetTaylorSeries   (matrix of functions with one variable)
   (23) %--------------------------------------------------------------------
   (24) matrix = [sin(x); cos(x); exp(x)]
-> (25) matrix = [sin(x);  cos(x);  exp(x)]

   (26) matrixExpanded = GetTaylorSeries( matrix, 0:4, x=0 )
-> (27) matrixExpanded[1] = -0.1666667*x*(-6+x^2)
-> (28) matrixExpanded[2] = 1 + 0.04166667*x^4 - 0.5*x^2
-> (29) matrixExpanded[3] = 1 + x + 0.04166667*x^4 + 0.1666667*x^3 + 0.5*x^2

   (30) %--------------------------------------------------------------------
   (31) % Example 4:  GetTaylorSeries   (vector function of two variable)
   (32) %--------------------------------------------------------------------
   (33) z = sin(x) + cos(y)
-> (34) z = sin(x) + cos(y)

   (35) RigidFrame  N
   (36) vector> = sin(x)*Nx> + cos(y)*Ny> + z*Nz>
-> (37) vector> = sin(x)*Nx> + cos(y)*Ny> + z*Nz>

   (38) vectorExpanded> = GetTaylorSeries( vector>, 0:1, x=1:dx, y=2:dy )
-> (39) vectorExpanded> = (0.841471+0.5403023*dx)*Nx> + (-0.4161468-0.9092974*
        dy)*Ny> + (0.4253241+0.5403023*dx-0.9092974*dy)*Nz>



Linearize
Linearize  Linearize0   Linearize1

 Purpose:  Returns the sum of the 0th and 1st term of a Taylor series
           or returns just the 0th or 1st terms of that Taylor series.

  Syntax:  Linearize(  F, arg1, arg2, ... )
           Linearize0( F, arg1, arg2, ... )  --  same as Evaluate.
           Linearize1( F, arg1, arg2, ... )

   Input:  F -- a  scalar, vector, dyadic, or matrix expression.

           argi -- the scalar name Ci (e.g., a constant or variable) or
                   the equation Ci = D (D is a scalar expression); or
                   the equation Ci = D:P, where P is a scalar name.

  Output:  The following table describes output associated with F.

               argi    |  Output is Taylor series expansion of F
           ------------|-----------------------------------
             Ci        |  0th  and/or  1st  terms about Ci = 0.
             Ci = D    |  0th  and/or  1st  terms about Ci = D.
             Ci = D:P  |  0th  and/or  1st  terms about Ei = D,
                       |  with P in place of Ci - D.

  Remark:  Certain numerical inaccuracies in Taylor series expan-
           sions may make it advantageous to issue a command such
           as SetAutoEpsilon( 1.0E-13 ).

 Related:  GetDefaults  SetAutoZee
           GetTaylorSeries  Linearize  SetAutoLinearize  SetAutoTaylorSeries
           FactorLinear  FactorQuadratic

   (1) %--------------------------------------------------------------------
   (2) % Example 1:  Linearize   (one function with one variable)
   (3) %--------------------------------------------------------------------
   (4) Variable x, dx
   (5) linearizeCosAbout0 = Linearize( cos(x), x )
-> (6) linearizeCosAbout0 = 1

   (7) linearizeCosAbout1 = Linearize( cos(x), x=1 )
-> (8) linearizeCosAbout1 = 1.381773 - 0.841471*x

   (9) linearizeCosAbout1Dx = Linearize( cos(x), x=1:dx )
-> (10) linearizeCosAbout1Dx = 0.5403023 - 0.841471*dx

   (11) %--------------------------------------------------------------------
   (12) % Example 2:  Linearize   (one function with two variables)
   (13) %--------------------------------------------------------------------
   (14) Variable y, dy
   (15) linearizeExpXYAbout0 = Linearize( exp(x+y), x, y )
-> (16) linearizeExpXYAbout0 = 1 + x + y

   (17) linearizeExpXYAbout2 = Linearize( exp(x+y), x=2, y=2 )
-> (18) linearizeExpXYAbout2 = -163.7945 + 54.59815*x + 54.59815*y

   (19) linearizeExpXYAbout2Dxy = Linearize( exp(x+y), x=2:dx, y=2:dy )
-> (20) linearizeExpXYAbout2Dxy = 54.59815 + 54.59815*dx + 54.59815*dy

   (21) %--------------------------------------------------------------------
   (22) % Example 3:  Linearize   (matrix of functions with one variable)
   (23) %--------------------------------------------------------------------
   (24) matrix = [sin(x); cos(x); exp(x)]
-> (25) matrix = [sin(x);  cos(x);  exp(x)]

   (26) linearizeMatrix  = Linearize(  matrix, x=0 )
-> (27) linearizeMatrix = [x;  1;  1 + x]

   (28) linearizeMatrix0 = Linearize0( matrix, x=0 )
-> (29) linearizeMatrix0 = [0;  1;  1]

   (30) linearizeMatrix1 = Linearize1( matrix, x=0 )
-> (31) linearizeMatrix1 = [x;  0;  x]

   (32) %--------------------------------------------------------------------
   (33) % Example 4:  Linearize   (vector function of two variable)
   (34) %--------------------------------------------------------------------
   (35) z = sin(x) + cos(y)
-> (36) z = sin(x) + cos(y)

   (37) RigidFrame  N
   (38) vector> = sin(x)*Nx> + cos(y)*Ny> + z*Nz>
-> (39) vector> = sin(x)*Nx> + cos(y)*Ny> + z*Nz>

   (40) vectorExpanded> = Linearize( vector>, x=1:dx, y=2:dy )
-> (41) vectorExpanded> = (0.841471+0.5403023*dx)*Nx> + (-0.4161468-0.9092974*
        dy)*Ny> + (0.4253241+0.5403023*dx-0.9092974*dy)*Nz>



GetTrace
GetTrace

 Purpose:  Forms the trace of a matrix or dyadic.

  Syntax:  GetTrace( A )

   Input:  A -- a matrix or a dyadic.

  Output:  Trace of A.

 Related:  GetColumns  GetDeterminant  GetDiagonalMatrix  GetEigen
           GetElement  GetIdentityMatrix  GetInverse  GetRows  GetTrace
           GetTranspose  GetZeroMatrix  Solve

   (1) %--------------------------------------------------------------------
   (2) % Example 1: GetTrace   ( trace of a matrix )
   (3) %--------------------------------------------------------------------
   (4) Constant a{1:3,1:3}
   (5) M = [a11, a12, a13; a21, a22, a23]
-> (6) M = [a11, a12, a13;  a21, a22, a23]

   (7) traceOfMatrixM = GetTrace( M )
-> (8) traceOfMatrixM = a11 + a22

   (9) %--------------------------------------------------------------------
   (10) % Example 2: GetTrace   ( trace of a dyadic )
   (11) %--------------------------------------------------------------------
   (12) RigidBody B
   (13) D>> = Dyadic( B,  a11, a12, 0,  0, 0, 0,  0, a23, a33  )
-> (14) D>> = a11*Bx>*Bx> + a12*Bx>*By> + a23*Bz>*By> + a33*Bz>*Bz>

   (15) traceOfDyadicD = GetTrace( D>> )
-> (16) traceOfDyadicD = a11 + a33



GetTranspose
GetTranspose

 Purpose:  Forms the transpose of a matrix or dyadic.

  Syntax:  GetTranspose( A )

   Input:  A -- a matrix or a dyadic.

  Output:  Trace of A.

 Related:  GetColumns  GetDeterminant  GetDiagonalMatrix  GetEigen
           GetElement  GetIdentityMatrix  GetInverse  GetRows  GetTrace
           GetTranspose  GetZeroMatrix  Solve

   (1) %--------------------------------------------------------------------
   (2) % Example 1: GetTranspose  ( transpose of a matrix )
   (3) %--------------------------------------------------------------------
   (4) Constant a, b
   (5) M = [a, b;  3, 4;  5, 6]
-> (6) M = [a, b;  3, 4;  5, 6]

   (7) transposeM = GetTranspose( M )
-> (8) transposeM = [a, 3, 5;  b, 4, 6]

   (9) %--------------------------------------------------------------------
   (10) % Example 2: GetTranspose  ( transpose of a dyadic )
   (11) %--------------------------------------------------------------------
   (12) RigidBody B
   (13) D>> = Dyadic( B,  a, a*b, 3,  4, b^2, 5,  6, 7, 8 )
-> (14) D>> = a*Bx>*Bx> + a*b*Bx>*By> + 3*Bx>*Bz> + 4*By>*Bx> + b^2*By>*By>
        + 5*By>*Bz> + 6*Bz>*Bx> + 7*Bz>*By> + 8*Bz>*Bz>

   (15) tranposeD>> = GetTranspose( D>> )
-> (16) tranposeD>> = a*Bx>*Bx> + 4*Bx>*By> + 6*Bx>*Bz> + a*b*By>*Bx> + b^2*By>*By>
        + 7*By>*Bz> + 3*Bz>*Bx> + 5*Bz>*By> + 8*Bz>*Bz>



GetUnitVector
GetUnitVector

 Purpose:  Forms a unit vector in the same direction as a given vector.

Syntax 1:  GetUnitVector( v> )
Syntax 2:  GetUnitVector( v>, denominator )
Syntax 3:  Q.GetUnitVector( fromPoint )
Syntax 4:  Q.GetUnitVector( fromPoint, denominator )

   Input:  v> -- a vector
           Q -- The name of a point.
           fromPoint -- The name of another point.
           denominator -- A non-negative scalar expression equal to the
                          magnitude of v> -- or equal to the magnitude
                          of v> plus a small "epsilon", where epsilon's
                          purpose is to avoid divide-by-zero errors.

Output 1:  v> divided by the magnitude of v>
Output 2:  v> divided by denominator
Output 3:  Unit vector directed to Q from fromPoint
Output 4:  Q's position vector fromPoint divided by denominator

 Remark:   denominator is useful when a symbol already exists for the
           magnitude of v> - or when an "epsilon" is useful for avoiding
           divide-by-zero errors that otherwise may result when the
           magnitude of v> is zero.

 Related:  GetMagnitude           GetMagnitudeSquared
           GetDistance            GetDistanceSquared
           GetSpeed               GetSpeedSquared
           GetAngularSpeed        GetAngularSpeedSquared
           GetAngleBetweenVectors GetAngleBetweenUnitVectors   ConvertUnits
           GetUnitVector          Vector   Cross  Dot   Rotate

   (1) %--------------------------------------------------------------------
   (2) %Example 1: GetUnitVector   (Unit vector from vector)
   (3) %--------------------------------------------------------------------
   (4) RigidFrame N
   (5) v> = 3*Nx> + 4*Ny>
-> (6) v> = 3*Nx> + 4*Ny>

   (7) unitVector> = GetUnitVector( v> )
-> (8) unitVector> = 0.6*Nx> + 0.8*Ny>

   (9) %--------------------------------------------------------------------
   (10) %Example 2: GetUnitVector   (Unit vector from vector with denominator)
   (11) %--------------------------------------------------------------------
   (12) Constant  epsilon
   (13) unitVectorWithEpsilon> = GetUnitVector( t*Nx>, epsilon+t )
-> (14) unitVectorWithEpsilon> = t/(epsilon+t)*Nx>

   (15) %--------------------------------------------------------------------
   (16) %Example 3: GetUnitVector   (Unit vector between points)
   (17) %--------------------------------------------------------------------
   (18) Point     P, Q
   (19) Variable  zQ
   (20) Q.SetPosition( P,  zQ*Nz> )
-> (21) p_P_Q> = zQ*Nz>

   (22) UnitPositionVectorFromPToQ> = Q.GetUnitVector( P )
-> (23) UnitPositionVectorFromPToQ> = zQ/abs(zQ)*Nz>

   (24) %--------------------------------------------------------------------
   (25) %Example 4: GetUnitVector   (Unit vector between points with denominator)
   (26) %--------------------------------------------------------------------
   (27) Variable  xP, yP
   (28) P.SetPosition( No, xP*Nx> + yP*Ny> )
-> (29) p_No_P> = xP*Nx> + yP*Ny>

   (30) L = Q.GetDistance( No )
-> (31) L = sqrt(xP^2+yP^2+zQ^2)

   (32) UnitPositionVectorFromNoToQ> = Q.GetUnitVector( No, L )
-> (33) UnitPositionVectorFromNoToQ> = xP/L*Nx> + yP/L*Ny> + zQ/L*Nz>



GetUnitSystem
GetUnitSystem

 Purpose:  Displays the dimensions of a quantity.
           Displays the names of all units recognized by the program.

Syntax 1:  GetUnitSystem( unitExpression )
Syntax 2:  GetUnitSystem()

   Input:  unitExpression -- an expression involving names of units and their
                             products (*), quotients (/), and powers (^).

Output 1:  The dimension of unitExpression.  For example, if unitExpression
           is  Newton*meter,  the response is  mass*length^2/time^2.

Output 2:  Names of all units recognized by the program.

 Related:  ODE  Solve  Input  Output  OutputPlot  Plot  Animate
           ConvertUnits  GetUnitSystem  SetUnitSystem
           GetMassUnit   GetLengthUnit   GetTimeUnit   GetAngleUnit

--------------------------------------------------------------------
 Example:  GetUnitSystem
--------------------------------------------------------------------
   (1) GetUnitSystem( Newton * meter^2 )
mass*length^3/time^2



GetVelocity
GetVelocity

 Purpose:  Gets a point's velocity in a reference frame.

  Syntax:  Q.GetVelocity( refFrame )

   Input:  Q -- name of a point.
           refFrame -- name of a RigidFrame or RigidBody.

  Output:  Returns Q's velocity in refFrame.

 Related:  Translate        SetPositionVelocity   SetVelocityAcceleration
           SetPosition      GetPosition   GetDistance  GetDistanceSquared
           SetVelocity      GetVelocity   GetSpeed     GetElongation
           SetAcceleration  GetAcceleration            GetVelocityRelative

   (1) %--------------------------------------------------------------------
   (2) % Example: GetVelocity 
   (3) %--------------------------------------------------------------------
   (4) RigidFrame N
   (5) Point      Q            
   (6) Variable   vx, vy
   (7) Q.SetVelocity( N, vx*Nx> + vy*Ny> )
-> (8) v_Q_N> = vx*Nx> + vy*Ny>

   (9) QVelocityInN> = Q.GetVelocity( N )   
-> (10) QVelocityInN> = vx*Nx> + vy*Ny>



GetVelocityRelative
GetVelocityRelative  or  GetAccelerationRelative

 Purpose:  Gets a point's velocity or acceleration relative to another point.

Syntax 1:  Q.GetVelocityRelative( P, refFrame )
Syntax 2:  Q.GetAccelerationRelative( P, refFrame )

   Input:  Q, P     -- names of points.
           refFrame -- name of a RigidFrame or RigidBody.

Output 1:  Returns Q's velocity     relative to P in refFrame.
Output 1:  Returns Q's acceleration relative to P in refFrame.

 Related:  Translate        SetPositionVelocity   SetVelocityAcceleration
           SetPosition      GetPosition   GetDistance  GetDistanceSquared
           SetVelocity      GetVelocity   GetSpeed     GetElongation
           SetAcceleration  GetAcceleration

   (1) %--------------------------------------------------------------------
   (2) % Example: GetVelocityRelative   GetAccelerationRelative
   (3) %--------------------------------------------------------------------
   (4) NewtonianFrame  N
   (5) Point           P, Q            
   (6) Variable        xP'', yP'',  xQ'', yQ''
   (7) P.Translate( No,  xP*Nx> + yP*Ny> )
-> (8) p_No_P> = xP*Nx> + yP*Ny>
-> (9) v_P_N> = xP'*Nx> + yP'*Ny>
-> (10) a_P_N> = xP''*Nx> + yP''*Ny>

   (11) Q.Translate( No,  xQ*Nx> + yQ*Ny> )
-> (12) p_No_Q> = xQ*Nx> + yQ*Ny>
-> (13) v_Q_N> = xQ'*Nx> + yQ'*Ny>
-> (14) a_Q_N> = xQ''*Nx> + yQ''*Ny>

   (15) vQRelativeToP> = Q.GetVelocityRelative( P, N )
-> (16) vQRelativeToP> = (xQ'-xP')*Nx> + (yQ'-yP')*Ny>

   (17) aQRelativeToP> = Q.GetAccelerationRelative( P, N )
-> (18) aQRelativeToP> = (xQ''-xP'')*Nx> + (yQ''-yP'')*Ny>



GetVelocityRemainder
GetVelocityRemainder  GetAngularVelocityRemainder

 Purpose:  Forms velocity and angular velocity remainder.

Syntax 1:  Q.GetVelocityRemainder( refFrame )
Syntax 2:  B.GetAngularVelocityRemainder( refFrame )
Syntax 3:  GetVelocityRemainder( mathExpression )

   Input:  Q -- name of a Point or Particle.
           B -- name of a RigidFrame or RigidBody.
           refFrame -- name of a RigidFrame or  RigidBody.
           mathExpression -- A scalar, vector, matrix, ... expression.

Output 1:  Portion of Q's velocity in refFrame that does NOT
           multiply an independent generalized speed.

Output 2:  Portion of B's angular velocity in in refFrame that does NOT
           multiply an independent generalized speed.

Output 3:  Portion of mathExpression that does NOT
           multiply an independent generalized speed.

  Remark:  The returned quantity may depend on whether the command is
           issued before or after the CONSTRAIN command.

 Related:  GetPartialVelocity    GetPartialAngularVelocity
           GetVelocityRemainder  GetAngularVelocityRemainder

   (1) %--------------------------------------------------------------------
   (2) % Example: GetVelocityRemainder and GetAngularVelocityRemainder
   (3) %--------------------------------------------------------------------
   (4) NewtonianFrame N
   (5) RigidBody      B       % Sphere
   (6) Point          BN(B)   % Point of B in contact with N
   (7) %----------------------------------------------
   (8) Constant    R
   (9) Variable    x', y'
   (10) Variable    wz
   (11) Specified   wx,  wy
   (12) SetGeneralizedSpeed( x', y', wz )
   (13) %----------------------------------------------
   (14) %     Kinematics
   (15) B.SetAngularVelocity( N,  wx*Nx> + wy*Ny> + wz*Nz> )
-> (16) w_B_N> = wx*Nx> + wy*Ny> + wz*Nz>

   (17) Bcm.SetPositionVelocity( No, x*Nx> + y*Ny> + R*Nz> )
-> (18) p_No_Bcm> = x*Nx> + y*Ny> + R*Nz>
-> (19) v_Bcm_N> = x'*Nx> + y'*Ny>

   (20) %----------------------------------------------
   (21) %     Angular velocity and velocity remainders
   (22) wBNRemainder> = B.GetAngularVelocityRemainder( N ) 
-> (23) wBNRemainder> = wx*Nx> + wy*Ny>

   (24) vBcmNRemainder> = Bcm.GetVelocityRemainder( N )
-> (25) vBcmNRemainder> = 0>



ImaginaryNumber
ImaginaryNumber

 Purpose:  Declares the name assigned to the square root of -1.
           Returns  the name assigned to the square root of -1.

Syntax 1:  SetImaginaryNumber( i )
Syntax 2:  GetImaginaryNumber()

   Input:  i -- the name to be assigned to sqrt(-1).

Output 2:  Name assigned to sqrt(-1).

  Remark:  The default name of the square root of -1 is imaginary.

 Related:  Constant  ImaginaryNumber  Specified  Variable
           MathFunctions  SetComplex

   (1) %--------------------------------------------------------------------
   (2) % Example: ImaginaryNumber  
   (3) %--------------------------------------------------------------------
   (4) B = 3 + sqrt(-1)         % Default name of sqrt(-1) is imaginary
-> (5) B = 3 + imaginary

   (6) SetImaginaryNumber( i )
   (7) C = 3 + sqrt(-1)
-> (8) C = 3 + i

   (9) D = 4*sqrt(-1) + 3*GetImaginaryNumber()
-> (10) D = 7*i

   (11) E = abs(3+i) + sin(i) + cosh(i)
-> (12) E = 3.70258 + 1.175201*i



IndependentVariable
IndependentVariable

 Purpose:  Declares the name assigned to the independent variable.
           Returns  the name assigned to the independent variable.

Syntax 1:  SetIndependentVariable( t )
Syntax 2:  GetIndependentVariable()

   Input:  t --  the name to be assigned as the independent variable.

Output 2:  Name assigned to the independent variable.

  Remark:  The default name of the independent variable is t.

  Remark:  The prime symbol ' denotes implicit ordinary differentiation
           with respect to the independent variable.  For example, when
           the independent variable t denotes time, x' denotes dx/dt,
           the ordinary time-derivative of x.

 Related:  Constant  ImaginaryNumber  Specified  Variable
           SetGeneralizedCoordinate  SetGeneralizedSpeed

   (1) %--------------------------------------------------------------------
   (2) % Example 1:  IndependentVariable  
   (3) %--------------------------------------------------------------------
   (4) Variable  y''  
   (5) a = GetIndependentVariable() + y + dt(y)
-> (6) a = t + y + y'

   (7) SetIndependentVariable( s )
   (8) b = GetIndependentVariable()^2
-> (9) b = s^2



Input
Input

 Purpose:  Assigns/reports numerical values (with optional units) to constants,
           initial values, and numerical integration parameters for use by the
           ODE, Solve, EvaluateAtInput, and EvaluateToNumber commands.

Syntax 1:  Input a = v1 unitsA,  b = v2 unitsB,  c = v3,  d = v4,  ...
Syntax 2:  Input
Syntax 3:  Input( a )                 or  Input( a + 2*b + 3*c )
Syntax 4:  Input( a,  NoUnitSystem )  or  Input( a + 2*b + 3*c,  NoUnitSystem )
Syntax 5:  Input( a, GetUnitSystem )  or  Input( a + 2*b + 3*c, GetUnitSystem )
Syntax 6:  ClearInput( a )   or   ClearInput( a, b, c )

           a, b, c, d     -- names of scalars or matrix of names of scalars
           v1, v2, v3, v4 -- expressions that resolve to a real number
           unitsA, unitsB -- units associated with a and b

Output 1:  Assigns input values (possibly with units) to  a, b, c, d.
Output 2:  Lists quantities (values and units) assigned in Input statements.
Output 3:  Returns  a's  input value (no units conversion).
Output 4:  Returns  a's  input value (no units conversion).
Output 5:  Returns  a's  input value multiplied by conversion factor from
           units assigned to a to the units named by SetUnitSystem.
Output 6:  Clears input values and units assigned to  a  or  a, b, c.

  Remark:  Input values and units can also be assigned by declarations in:
           Constant, SetMass, and SetInertia.

  Remark:  Input values can also be assigned to:  absError,  relError,
           tInitial,  tFinal,  tStep,  printIntScreen,  printIntFile.

  Remark:  Type GetUnitSystem for a list of units

 Related:  ODE  Solve  Input  Output  OutputPlot  Plot  Animate
           ConvertUnits  GetUnitSystem  SetUnitSystem  SetDigits
           absError  tInitial  tFinal  tStep  printIntScreen  printIntFile
           Solve  SolveDt  SolveSetInput  SolveSetInputDt  ...

   (1) %--------------------------------------------------------------------
   (2) % Example 1: Assigning Input   
   (3) %--------------------------------------------------------------------
   (4) SetUnitSystem( kg, m, s )
   (5) Constant  a = 2 m,   b = 3 cm/s,  c
   (6) Variable  y'' = a*y + b*y' + c*sin(y)
-> (7) y'' = a*y + c*sin(y) + b*y'

   (8) Input     y = 4 m,   y' = 0,   c = 5 + Input(a) meters
   (9) %
   (10) %--------------------------------------------------------------------
   (11) % Example 2: Returning Input   
   (12) %--------------------------------------------------------------------
   (13) ac = Input( a + c )
-> (14) ac = 9

   (15) b1 = Input( b,  NoUnitSystem ) 
-> (16) b1 = 3

   (17) b2 = Input( b, GetUnitSystem ) 
-> (18) b2 = 0.03

   (19) %
   (20) %--------------------------------------------------------------------
   (21) % Example 3: Inspecting Input  (Typing INPUT causes the following to be displayed)
   (22) %--------------------------------------------------------------------
   (23) %  INPUT has been assigned as follows:
   (24) %   a                         2                       m
   (25) %   b                         3                       cm/s
   (26) %   c                         7                       meters
   (27) %   y                         4                       m
   (28) %   y'                        0
   (29) %--------------------------------------------------------------------
   (30) % Example 4: ClearInput  
   (31) %--------------------------------------------------------------------
   (32) ClearInput( a, b, y' )


int
int

 Purpose:  Returns the integer portion of a real scalar expression.

  Syntax:  int( realScalarExpression )

   Input:  realScalarExpression -- a real scalar expression.

  Output:  Integer portion of realScalarExpression.

 Related:  ceil  floor  int  max  min  round  sign  MathFunctions

   (1) %--------------------------------------------------------------------
   (2) % Example: int 
   (3) %--------------------------------------------------------------------
   (4) A = int( 2.991 ) 
-> (5) A = 2

   (6) B = int( 3.001 ) 
-> (7) B = 3

   (8) C = int( -2.991 ) 
-> (9) C = -2

   (10) D = int( -3.001 ) 
-> (11) D = -3

   (12) E = int( 2.9 + t ) 
-> (13) E = int(2.9+t)



Integrate
Integrate

 Purpose:  Integrates a scalar function or matrix of scalar functions.

  Syntax:  Integrate( scalarOrMatrixExpression,  x = xi : xf )

   Input:  scalarOrMatrixExpression -- a scalar or matrix of scalar
                                       expressions that depend on x.
           x  -- a scalar symbol
           xi -- the integral's lower limit for x
           xf -- the integral's upper limit for x

  Output:  Integral of (scalarOfMatrixExpression * dx) from x=xi to x=xf,
           where dx is the differential of x.

  Remark:  Integrate returns a number or matrix of numbers.
           Integrate may be nested to create double and triple integrals.

  Remark:  Do not use Integrate with time-integrals (x=t) which involve
           implicit-derivatives of time (e.g., the integrand or limits
           involve y and y' exists (or vice-versa).
           Good:     Integrate( t^2,  t=0:3 )
           Bad:      Variable x' = 3;  Input x = 0;  Integrate( x, t=0:3)

  Remark:  Integrate returns a numerical approximation to the integral.
           The accuracy of the solution tends to improve as the input
           value assigned to absError and/or relError gets smaller.
           The default value of absError (e.g., absError = 1.0E-7)
           can be changed via the Input command, e.g.,
           Input  absError = 1.0E-7

 Related:  D  Dt  DtDt  Integrate  MathFunctions  absError  relError

   (1) %--------------------------------------------------------------------
   (2) % Example 1:  Integrate( scalarExpression, x=xi:xf )
   (3) %--------------------------------------------------------------------
   (4) Input absError = 1.0E-07
   (5) Variable  x
   (6) integral1 = Integrate( 2*x, x=0:3 )
-> (7) integral1 = 9

   (8) %--------------------------------------------------------------------
   (9) % Example 2:  Integrate( matrixExpression, x=xi:xf )
   (10) %--------------------------------------------------------------------
   (11) matrix = [x^2; 3*sqrt(cos(x))*exp(2*x)]
-> (12) matrix = [x^2;  3*sqrt(cos(x))*exp(2*x)]

   (13) integral2 = Integrate( matrix, x = -pi/2 : pi/2 )
-> (14) integral2 = [2.583856;  20.08743]

   (15) %--------------------------------------------------------------------
   (16) % Example 3:  Integrate( Integrate( ... ) )
   (17) %--------------------------------------------------------------------
   (18) Variable  y
   (19) integral3 = Integrate( exp(2*y) * Integrate( 3*cos(x), x=1:3), y=0:2 )
-> (20) integral3 = -56.30628

   (21) %--------------------------------------------------------------------
   (22) % Example 4:  Integrate( Integrate( ... ) )
   (23) %--------------------------------------------------------------------
   (24) integral4 = Integrate( Integrate( 3*cos(x*y)*exp(y), x=0:y), y=0:2 )
-> (25) integral4 = 6.873792



Kane
GetStaticsKane  GetDynamicsKane

 Purpose:  Gets Kane's equations for statics or dynamics .

Syntax 1:  System.GetStaticsKane()
Syntax 2:  System.GetDynamicsKane()

Output 1:  Kane's statics  equations for the System.
Output 2:  Kane's dynamics equations for the System.

  Remark:  For Newton/Euler equations, type  Help Statics or Help Dynamics
           For Kane's       equations, type  Help Kane
           For Lagrange's   equations, type  Help Lagrange

 Related:  AddForce  AddTorque  SetMass  SetInertia  Rotate  Translate
           NewtonianFrame  Point  Particle  RigidFrame  RigidBody
           GetStatics   GetStaticsKane   GetStaticsLagrange
           GetDynamics  GetDynamicsKane  GetDynamicsLagrange
           Constrain  SetGeneralizedCoordinate  SetGeneralizedSpeed


Lagrange
GetStaticsLagrange  GetDynamicsLagrange

 Purpose:  Gets Lagrange's equations for statics or dynamics.

Syntax 1:  System.GetStaticsLagrange(  SystemPotential = sysPotential )
           System.GetDynamicsLagrange( SystemPotential = sysPotential )
---------------------------------------------------------------------------
Syntax 2*: System.GetStaticsLagrange(     AddPotential = addPotential ) **
           System.GetDynamicsLagrange(    AddPotential = addPotential ) **
Syntax 3*: System.GetStaticsLagrange()  ** RESERVED SYNTAX, IN DEVELOPMENT.
           System.GetDynamicsLagrange() ** RESERVED SYNTAX, IN DEVELOPMENT.
---------------------------------------------------------------------------

   Input:  sysPotential -- system potential energy (all generalized forces).
           addPotential -- potential energy for forces not in the workspace.

Output 1:  Lagrange's statics or dynamics equations for the entire System.
           All generalized forces have a corresponding potential function.
Output 3:  Lagrange's statics or dynamics equations for the entire System.
           Generalized forces are formed via partial derivatives.

  Remark:  For Newton/Euler equations, type  Help Statics or Help Dynamics
           For Kane's       equations, type  Help Kane
           For Lagrange's   equations, type  Help Lagrange

 Related:  AddForce  AddTorque  SetMass  SetInertia  Rotate  Translate
           NewtonianFrame  Point  Particle  RigidFrame  RigidBody
           GetStatics   GetStaticsKane   GetStaticsLagrange
           GetDynamics  GetDynamicsKane  GetDynamicsLagrange
           SetGeneralizedCoordinate  SetGeneralizedSpeed


Newton
GetStatics  GetDynamics

 Purpose:  Gets Newton/Euler statics or dynamics equations of motion.

Syntax 1:  Object.GetStatics()
Syntax 2:  Object.GetDynamics()

   Input:  Object -- Point, Particle, RigidBody, RigidFrame, or System.

Output 1:  Newton/Euler statics  equations for Object.
Output 2:  Newton/Euler dynamics equations for Object.

  Remark:  For Newton/Euler equations, type  Help Statics or Help Dynamics
           For Kane's       equations, type  Help Kane
           For Lagrange's   equations, type  Help Lagrange

 Related:  AddForce  AddTorque  SetMass  SetInertia  Rotate  Translate
           NewtonianFrame  Point  Particle  RigidFrame  RigidBody
           GetStatics   GetStaticsKane   GetStaticsLagrange
           GetDynamics  GetDynamicsKane  GetDynamicsLagrange
           SetGeneralizedCoordinate  SetGeneralizedSpeed


List
List

 Purpose:  Displays workspace contents on the screen.

Syntax 1:  List
Syntax 2:  List( startLineNumber )
Syntax 3:  List( startLineNumber:stopLineNumber )

   Input:  startLineNumber -- the first line number to be displayed.
           stopLineNumber  -- the  last line number to be displayed.

Output 1:  Displays all lines in the workspace.
Output 2:  Displays startLineNumber and all subsequent lines in the workspace.
Output 2:  Displays startLineNumber to stopLineNumber.

 Related:  !  %  &  Clear  List  Pause  Quit  Run  Save  GetDefaults

--------------------------------------------------------------------
 Example:  List
--------------------------------------------------------------------
   (1) a = 2
-> (2) a = 2

   (3) b = 3
-> (4) b = 3

   (5) list 1:2

   (1) a = 2
-> (2) a = 2



log
log or log10

 Purpose:  Returns the natural (base e) logarithm of a scalar expression.
           Returns the base 10 logarithm of a scalar expression.

 Syntax 1: log( scalarExpression )
 Syntax 2: log10( scalarExpression )

   Input:  scalarExpression -- a real or complex scalar expression.

Output 1:  Base e (2.71828...) logarithm of scalarExpression.
Output 2:  Base 10 logarithm of scalarExpression.

  Remark:  Use  log(r)/log(b)  to calculate the logarithm of the real
           positive number r to the real positive base b.

 Related:  ImaginaryNumber  MathFunctions

   (1) %--------------------------------------------------------------------
   (2) % Example 1: log and log10   (real scalar expressions)
   (3) %--------------------------------------------------------------------
   (4) Ae = log( 2 ) 
-> (5) Ae = 0.6931472

   (6) Be = log(2*t)
-> (7) Be = 0.6931472 + log(t)

   (8) A10 = log10( 2 ) 
-> (9) A10 = 0.30103

   (10) B10 = log10(2*t)
-> (11) B10 = 0.30103 + log10(t)

   (12) C = log(1+2*t) + log10(1+2*t)
-> (13) C = log(1+2*t) + log10(1+2*t)

   (14) %--------------------------------------------------------------------
   (15) % Example 2: log and log10   (complex scalar expressions)
   (16) %--------------------------------------------------------------------
   (17) Ye = log( 2 + 3*GetImaginaryNumber() )
-> (18) Ye = 1.282475 + 0.9827937*imaginary

   (19) Y10 = log10( 2 + 3*GetImaginaryNumber() )
-> (20) Y10 = 0.5569717 + 0.4268219*imaginary

   (21) Z = log( 3*GetImaginaryNumber() + t ) + log10( 3*GetImaginaryNumber() + t )
-> (22) Z = log(3*imaginary+t) + log10(3*imaginary+t)



MathFunctions
MathFunctions

 Absolute value:              abs
 Exponential and logarithmic: exp, log, log10
 factorial:                   factorial
 Hyperbolic:                  cosh, sinh, tanh
 Integer functions:           ceil, floor, int, round, sign, randomInteger
 Inverse trigonometric:       acos, asin, atan, atan2, acosDegrees, ...
 Maximum and minimum:         max, min
 Square and square-root:      squared, sqrt
 Trigonometric:               cos, sin, tan, cosDegrees, sinDegrees, ...
 Related:                     imaginaryNumber

Type HELP NAME for help with NAME; e.g., HELP abs



Matrix
Matrix

 Purpose:  Constructs a matrix from a vector, dyadic, ...

Syntax 1:  Matrix( A, vector>    )
Syntax 2:  Matrix( A, dyadic>>   )
Syntax 3:  Matrix( A, triadic>>> )

   Input:  A -- the name of a RigidFrame or RigidBody
           vector>    -- a vector  expression
           dyadic>>   -- a dyadic  expression
           triadic>>> -- a triadic expression

Output 1:  3 x 1  matrix whose elements are the Ax>, Ay>, Az>
           measures of vector>

Output 2:  3 x 3  matrix whose elements are the Ai>*Aj>
           (i,j = x,y,z) measures of dyadic>>

Output 3:  27 x 1 matrix whose elements are the Ai>*Aj>*Ak>
           (i,j,k = x,y,z) measures of triadic>>>

  Remark:  Vector( A, vector>  ) is equivalent to Syntax 1.
           Dyadic( A, dyadic>> ) is equivalent to Syntax 2.

 Related:  Dyadic  Matrix  Vector  Express
           GetColumns  GetDeterminant  GetDiagonalMatrix  GetEigen
           GetElement  GetIdentityMatrix  GetInverse  GetRows  GetTrace
           GetTranspose  GetZeroMatrix  Solve

   (1) %--------------------------------------------------------------------
   (2) % Example: Matrix  (constructor with vector)
   (3) %--------------------------------------------------------------------
   (4) RigidFrame A, B
   (5) B.SetRotationMatrixZ( A, t ) 
-> (6) B_A = [cos(t), sin(t), 0;  -sin(t), cos(t), 0;  0, 0, 1]

   (7) M1 = Matrix( A,  2*Ax> + 3*Ay> + 4*Az> )
-> (8) M1 = [2;  3;  4]

   (9) M2 = Matrix( B,  2*Ax> + 3*Ay> + 4*Az> )
-> (10) M2 = [2*cos(t) + 3*sin(t);  3*cos(t) - 2*sin(t);  4]

   (11) %--------------------------------------------------------------------
   (12) % Example: Matrix  (constructor with dyadic)
   (13) %--------------------------------------------------------------------
   (14) M3 = Matrix( A,  2*Ax>*Ax> + 3*Ay>*Ay> + 4*Ax>*Ay> + 5*Ay>*Ax> )
-> (15) M3 = [2, 4, 0;  5, 3, 0;  0, 0, 0]

   (16) %--------------------------------------------------------------------
   (17) % Example: Matrix  (constructor with dyadic in mixed bases)
   (18) %--------------------------------------------------------------------
   (19) M4 = Matrix( B,  Ax>*Bz> + 2*Ay>*Bz> + 3*Az>*Bx> + 4*Bz>*Bz> )
-> (20) M4 = [0, 0, cos(t) + 2*sin(t);  0, 0, 2*cos(t) - sin(t);  3, 0, 4]



min
min  or  max

 Purpose:  Returns the smaller or larger of two real numbers.

Syntax 1:  min( x, y )
Syntax 2:  max( x, y )

   Input:  x -- an expression that resolves to a real number.
           y -- an expression that resolves to a real number.

Output 1:  Minimum of x and y.
Output 2:  Maximum of x and y.

 Related:  ceil  floor  int  max  min  round  sign  MathFunctions

   (1) %--------------------------------------------------------------------
   (2) % Example: min 
   (3) %--------------------------------------------------------------------
   (4) A = min(  3,  5 ) 
-> (5) A = 3

   (6) B = min( -3, -5 ) 
-> (7) B = -5

   (8) C = 50
-> (9) C = 50

   (10) D = min( 3, C ) 
-> (11) D = 3

   (12) %--------------------------------------------------------------------
   (13) % Example: max 
   (14) %--------------------------------------------------------------------
   (15) E = max(  3,  5 ) 
-> (16) E = 5

   (17) F = max( -3, -5 ) 
-> (18) F = -3



MOTIONGENESISPATH
MOTIONGENESISPATH   (Unnecessary for regular program use)

 Purpose:  Specifies the operating system path to the program folder.
           This is the top-level directory for the program.
           Its sub-directories contains files used by the program.

  Windows 95/98/Millenium:

           Add the following line to the file Autoexec.bat, which
           resides on the C:\ drive:

               SET MOTIONGENESISPATH=pathToProgram

           For example, if the program was installed in the directory
           C:\Fred, the line that belongs in the file Autoexec.bat is

               SET MOTIONGENESISPATH=C:\Fred

  Windows NT:

           To  set  the  environment  variable,  click  on Start,
           Settings,  Control Panel, System.  Click on the Envir-
           onment  tab.   Enter  the  Variable  MOTIONGENESISPATH
           and enter the Value  pathToProgram.  For example, if
           the  program was installed in the  C:\Fred  directory,
           enter  C:\Fred  as the Value.  Click OK to exit.

  Windows 2000 and XP:

           To  set  the  environment  variable,  click  on Start,
           Settings,  Control  Panel,  System,  Advanced,  Envir-
           onment   Variables.   Under   System Variables,  click
           New....  Enter the Variable Name MOTIONGENESISPATH and
           enter the Variable Value pathToProgram.  For example,
           if the program was installed in the C:\Fred directory,
           enter  C:\Fred  as the Variable Value.  Click OK
           to exit each open dialogue box.

  Unix and Macintosh OSX:

           To  set the environment variable, edit the file .cshrc
           and add the following line:

                setenv MOTIONGENESISPATH pathToProgram

           For example, if the program was installed in the directory
           /Fred,  then the following line must appear in the file .cshrc:

                setenv MOTIONGENESISPATH /Fred

           After  editing  the  .cshrc  file, type  source .cshrc
           at the Unix prompt (or logout and login again)

  Remark:  Even if this environment variable is not set or is set
           improperly,  the  program searches various directories
           (folders) for its associated files.

 Related:  GetDefaults  GetWorkingDirectory  SetWorkingDirectory
           GetEnvironmentValue   SetScratchDirectory



NewtonianFrame
NewtonianFrame

 Purpose:  Declares a Newtonian (inertial) reference frame, which is
           a special RigidFrame in which  F = m*a  is valid.

Syntax 1:  NewtonianFrame N      (creates a Newtonian reference frame N)
Syntax 2:  NewtonianFrame        (displays the name of the NewtonianFrame)

   Input:  N -- name that starts with a letter, followed by a reasonable
                number of alphanumeric characters.

Output 1:  NewtonianFrame N   creates a special  RigidFrame N  and creates
           right-handed orthogonal unit vectors Nx>, Ny>, Nz> fixed in N and
           creates a point No (called N's origin) fixed in N (welded to N).

  Remark:  The NewtonianFrame may be changed anytime or reassigned
           to the name of an existing RigidFrame or RigidBody.
           It cannot be welded to another frame.

 Related:  NewtonianFrame  Particle  Point  RigidBody  RigidFrame  System

   (1) %--------------------------------------------------------------------
   (2) % Example: NewtonianFrame
   (3) %--------------------------------------------------------------------
   (4) NewtonianFrame N
   (5) Particle  Q
   (6) Q.SetMass( m )
   (7) Q.SetVelocity( N, 2*Nx> + 4*Ny> )
-> (8) v_Q_N> = 2*Nx> + 4*Ny>

   (9) KE = Q.GetKineticEnergy()
-> (10) KE = 10*m



ODE
ODE

 Purpose:  Executes or writes a MATLAB, C, or Fortran program to solve
           ordinary differential or coupled differential/algebraic equations.

Syntax 1:  ODE()                             Filename.Ext
Syntax 2:  ODE( EqnsToSolve, x1, x2, ... )   Filename.Ext
Syntax 3:  ODE()                             Filename.Ext( Tx, Ty, Tz )
Syntax 4:  ODE() [A = Astart, Astop, Astep]  Filename.Ext
Note:      The various options in Syntax 1-4 can be used together.

   Input:  Filename -- a valid file name.  If no Filename is specified,
           the program solves the ODEs and puts results in the file ODE.i

           Ext -- nothing (immediate solution)
               -- .m    (produces MATLAB  code)
               -- .c    (produces C       code and input file Filename.in)
               -- .f    (produces FORTRAN code and input file Filename.in)
               -- .for  (same as .f except 72 character line length)

   Input:  EqnsToSolve -- matrix of (or single) scalar expressions that are
           LINEAR functions of x1, x2, ..., and regarded as equal to zero.
           Treated as:  EqnsToSolve[1] = 0,   EqnsToSolve[2] = 0, ...
           EqnsToSolve may have form EqnsToSolve = 0 or EqnsToSolve = Rhs.

           x1, x2 -- the names of scalars or a matrix of scalar names.

           Tx, Ty, Tz -- scalar names (maybe with units) that allow for
           passing command-line arguments to MATLAB or C programs.
           Example 1:  Filename.m( Tx N*m,  Ty N*cm,  Tz lbf*ft )
           Example 2:  Filename( Tx=2 N*m,  Ty=3 N*cm,  Tz = 5 )

           A = Astart, Astop, Astep -- A is the name (maybe with units) of a
           scalar quantity used as a loop index.  Astart, Astop, Astep are
           numerical values.  Example:  [A cm = 0, 100, 2]

Output 1:  Produces a program that solves the ordinary differential
           equations in the workspace, output their numerical results, and
           output numerical values of quantities named in OUTPUT statements.

Output 2:  Solves the set of simultaneous algebraic equations in EqnsToSolve
           for x1, x2, ...  at each time step while also solving the ODEs
           in the workspace and outputting relevant numerical results.

Output 3:  To run Filename.m, type  Filename( 12, 56, 87 )  at MATLAB prompt.
           To run Filename.c, type  Filename 12 56 87       from OS shell.

Output 4:  Incorporates Fortran DO-loops or C/MATLAB FOR-loops.
           To have multiple loops inside the program, use, e.g.,
           [ A = Astart, Astop, Astep;   B = Bstart, Bstop, Bstep; ... ]

  Remark:  Input values and units are named in INPUT statements.
           Output quantities and units are named in OUTPUT statements.

  Remark:  SetDigits sets the format of numbers output by programs created by
           the ODE command.  It does not affect calculation accuracy.

  Remark:  The solution is approximate and its accuracy tends to improve
           as the input value assigned to absError gets smaller.
           The default value of absError can be changed via the Input command:
           Input  absError = 1.0E-5 cm,  relError = 1.0E-7

  Remark:  Use the  .for  extension for FORTRAN whose line lengths cannot
           exceed 72 characters and which supports all line breaks.
           Use the  .f   extension for FORTRAN with lines less than 120
           characters and which cannot break lines in the middle of names.

 Related:  ODE  Solve  Input  Output  OutputPlot  Plot  Animate
           ConvertUnits  GetUnitSystem  SetUnitSystem  SetDigits  SetLineWidth
           absError  tInitial  tFinal  tStep  printIntScreen  printIntFile
           Solve  SolveDt  SolveSetInput  SolveSetInputDt  ...

   (1) %--------------------------------------------------------------------
   (2) % Example 1: ODE()      (1st-order ODE)
   (3) %--------------------------------------------------------------------
   (4) Variable x' = sin(t)
-> (5) x' = sin(t)

   (6) Input  x = 1 m,  tFinal=10 sec,  tStep=0.02 sec,  absError=1.0E-07
   (7) Output  t seconds,  x m,  x' m/sec
   (8) ODE()  FirstOrderODE

   (9) %--------------------------------------------------------------------
   (10) % Example 2: ODE()      (2nd-order ODE)
   (11) %--------------------------------------------------------------------
   (12) Variable  q'' = cos(t) - sin(q) 
-> (13) q'' = cos(t) - sin(q)

   (14) Input  q = 0 deg,  q' = 2 rad/sec
   (15) Output  t seconds,  q  degrees,  q' deg/sec,  q'' rad/sec^2
   (16) ODE()  SecondOrderODE

   (17) %--------------------------------------------------------------------
   (18) % Example 3: ODE()      (Pass arguments b and k to .m function) 
   (19) %--------------------------------------------------------------------
   (20) Constant m = 1 kg,  b,  k
   (21) Variable y'' = (-b*y' - k*y) / m
-> (22) y'' = -(k*y+b*y')/m

   (23) Input  y = 1 m,  y' = 0 m/sec
   (24) ODE()  HarmonicOscillator.m(  b N*s/m,  k N/cm ) 

   (25) %--------------------------------------------------------------------
   (26) % Example 4: ODE(...)   (Coupled 2rd-order ODEs - with plotting) 
   (27) %--------------------------------------------------------------------
   (28) Variable qA'', qB''
   (29) Eqn[1] = 10*sin(qA) + (21-sin(qB)^2)*qA'' - 2*sin(qB)*cos(qB)*qA'*qB' 
-> (30) Eqn[1] = 10*sin(qA) + (21-sin(qB)^2)*qA'' - 2*sin(qB)*cos(qB)*qA'*qB'

   (31) Eqn[2] = sin(qB)*cos(qB)*qA'^2 + qB''
-> (32) Eqn[2] = sin(qB)*cos(qB)*qA'^2 + qB''

   (33) Input  qA = 90 deg,  qB = 1.0 deg,  qA' = 0 rad/sec,  qB' = 0 rad/sec
   (34) OutputPlot  t sec,  qA degrees,  qB degrees
   (35) ODE( Eqn,  qA'',  qB'' )  CoupledSecondOrderODE.m 



Optimize
Optimize

 Purpose:  Optimizes a function (e.g., finding a local minimum or maximum)
           possibly with equality constraints, e.g., a combination of
           statics, dynamics, and/or geometry and motion constraints.

Syntax 1:  Optimize( CostFunction,  Constraints,  x1, x2, ...)
           Optimize( CostFunction,                x1, x2, ... )
Syntax 2:  Optimize( CostFunction,  Constraints,  x1=Guess1,  x2=Guess2,  ... )
           Optimize( CostFunction,                x1=Guess1,  x2=Guess2,  ... )
Syntax 3:  answer = Optimize( CostFunction, Constraints, x1=Guess1, x2=Guess2 )
           answer = Optimize( CostFunction,              x1=Guess1, x2=Guess2 )

   Input   CostFunction -- scalar expression that is a function of x1, x2, ...

           Constraints -- matrix of (or single) scalar expressions that
           are functions of x1, x2, ..., and regarded as equal to zero.
           Treated as:  Constraint[1] = 0,   Constraint[2] = 0,  ...

           x1, x2 -- the names of scalars or a matrix of scalar names.

           Guess1, Guess2 -- expressions that resolve to real numbers.

Output 1:  A matrix of scalar expression that are functions of
           x1, x2, ...,  and regarded as equal to zero.
Output 2:  Solutions (real numbers) are assigned to x1, x2, ...
Output 3:  Solutions (real numbers) are returned in a matrix.
           Solutions are NOT assigned to x1, x2, ...

 Remark:   Depending on the CostFunction and Constraints, the matrix of
           returned equations may be linear or nonlinear in the unknowns.

 Remark:   CostFunction is a single (one) scalar expression.
           For least-square optimization of form  CostFunction = x1^2 + x2^2,
           if Constraints are linear in the x1, x2,  the returned
           matrix of equation(s) are linear in x1, x2, ...
           For convex optimization, e.g.,  CostFunction = x1^2 + x2^2  or
           CostFunction = x1^4 + x2^4,  there is one optimal solution.
           For non-convex optimization, the returned equations(s)
           may be nonlinear and there may be multiple solutions.

 Remark:   Providing Guess1, Guess2, ..., instructs Optimize to subsequently
           call  Solve  to produce a NUMERICAL solution for x1, x2, ...
           Type  Help Solve  for more information.

 Related:  ODE  Solve  SolveDt  SolveSetInput  SolveSetInputDt  Optimize ...
           GetPolynomialRoots  GetQuadraticRoots  GetQuadraticPositiveRoot  ...
           SolveQuadraticPositiveRoot  SolveQuadraticPositiveRootDt  ...
           SetAutoDifferentiate  SetAutoOverwrite
           SetDt  SetNoDt   =   :=   +=   *=   /=   ^=


Output
Output  OutputPlot  OutputEncode

 Purpose:  Causes programs created by the ODE and Solve command to create
           output files containing designated quantities and units.
           Displays quantities listed in Output statements.

Syntax 1:  Output       x1 optionalUnits1, x2 optionalUnits2, ...
           OutputPlot   x1 optionalUnits1, x2 optionalUnits2, ...
           OutputEncode x1 optionalUnits1, x2 optionalUnits2, ...

   Input:  x1, x2, ... -- the names of scalars or matrices
           optionalUnits1, optionalUnits2 -- units associated with x1, x2, ...

 Purpose:  The values of x1 and x2 are calculated when a program produced
           by the ODE or Solve command is executed.

           OutputPlot will include statements in .m files to generate plots
           when a .m file is run - or immediately generate plots when
           an ODE() command is run with a Windows/PC computer.

           OutputEncode instructs MATLAB(R), C, Fortran programs to calculate
           output without writing to data files or displaying them on-screen.

Syntax 2:  ClearOutput()       or ClearOutput(     startInteger : stopInteger)
           ClearOutputPlot()   or ClearOutputPlot( startInteger : stopInteger)
           ClearOutputEncode() or ClearOutputEncode(startInteger: stopInteger)

   Input:  startInteger -- the first output statement to be cleared.
           stopInteger  -- the last  output statement to be cleared.

 Purpose:  Clears the designated range (or all if no range is designated) of
           previously issued Output, OutputPlot, or OutputEncode statements.

Syntax 3:  Output  or  OutputPlot  or  OutputEncode

Purpose:   Displays Output, OutputPlot, OutputEncode statements.

  Remark:  Type GetUnitSystem for a list of units

           In the event that x1, x2, ... is a matrix, the associated
           Fortran, C, MATLAB, etc. code contains provisions for evaluating
           the elements of the matrix, but not for reporting their values.

           If no units are assigned to x1, x2, ... in an Output statement,
           the units assigned to x1, x2, ... in an Input command will
           automatically be assigned to x1, x2, ...

           If no units are assigned in Input or Output statements to:
           t, tInitial, tFinal, tStep,  then the time unit designated
           by SetUnitSystem is assigned to these quantities automatically.

 Related:  ODE  Solve  Input  Output  OutputPlot  Plot  Animate
           ConvertUnits  GetUnitSystem  SetUnitSystem  SetDigits

   (1) %--------------------------------------------------------------------
   (2) % Example 1:  Output
   (3) %--------------------------------------------------------------------
   (4) Variable  y'' = 4*y + 3*y'
-> (5) y'' = 4*y + 3*y'

   (6) Input  y = 25.4 cm,  y' = 0 m/s
   (7) Input  tFinal = 2 sec,  tStep = 0.1 sec,  absError = 0.00001
   (8) Output      t sec,  y cm,  y inch,  y^2 m 
   (9) OutputPlot  t sec,  y cm,  y inch,  y^2 m^2 
   (10) ODE() Test

   (11) %-----------------
   (12) % The ODE command produces Test.1, which appears as follows:
   (13) %
   (14) % FILE: Test.1
   (15) %
   (16) %       t              y              y             y^2
   (17) %     (sec)          (cm)          (inch)           (m)
   (18) %
   (19) % 0.000000E+000  2.540000E+001  1.000000E+001  6.451600E-002
   (20) % 1.000000E-001  2.596466E+001  1.022231E+001  6.741637E-002
   (21) %      ...            ...           ...
   (22) %
   (23) %--------------------------------------------------------------------
   (24) % Example 2: Typing OUTPUT causes the following to be displayed
   (25) %--------------------------------------------------------------------
   (26) % Output 1:  t sec,y cm,y inch,y^2 m 


Particle
Particle

 Purpose:  Declares particles.

Syntax 1:  Particle Q1, Q2, ...          (creates particles Q1, Q2, ...)
Syntax 2:  Particle                      (displays names of all Particles)

   Input:  Q1 -- name that starts with a letter, followed by a reasonable
                 number of alphanumeric characters (similarly for Q2).

  Remark:  Particle Q{1:4}       is same as:  Particle Q1, Q2, Q3, Q4
           Particle Q{1:3}Ed     is same as:  Particle Q1Ed, Q2Ed, Q3Ed
           Particle Q{1:2}{2:3}  is same as:  Particle QB12, Q13, Q22, Q23

 Related:  NewtonianFrame  Particle  Point  RigidBody  RigidFrame  System

   (1) %--------------------------------------------------------------------
   (2) % Example 1: Particle
   (3) %--------------------------------------------------------------------
   (4) RigidBody B
   (5) Particle  Q
   (6) Particle  Q{1:4}
   (7) %--------------------------------------------------------------------
   (8) % Example 2: Particle  (typing PARTICLE displays the following)
   (9) %--------------------------------------------------------------------
   (10) % The following Particle have been declared:
   (11) %
   (12) % Q  Q1  Q2  Q3  Q4


Pause
Pause  or  Stop

 Purpose:  Suspends execution when running an input file.

Syntax 1:  Pause( )
Syntax 2:  Pause( numberOfSeconds )
Syntax 3:  Pause( WAIT )
Syntax 4:  Pause( STOP )   or   STOP

   Input:  numberOfSeconds -- an integer between 0 and 60, equal to the
           desired duration, in seconds, to pause program execution.
           Note: No pause occurs when numberOfSeconds is 0.

Output 1:  On-screen appearance of the following message:
           Press ENTER to resume execution.
           Press any other key to proceed interactively.

Output 2:  Suspends program execution for numberOfSeconds.
Output 3:  Suspends program execution until the user presses the ENTER key.
Output 4:  Stops reading from input file and proceeds interactively.

  Remark:  If reading from an input file stops, you may type RUN
           to resume execution from the input file.

 Related:  !  %  &  Clear  List  Pause  Quit  Run  Save  SetPauseOnWarning



Pi
Pi

 Purpose:  Name assigned to the following ratio associated with a circle:
           Pi = CircumferenceOfCircle / DiameterOfCircle.

  Syntax:  Pi

  Output:  3.14159265358979323846264338327950288419716939937510582 ...

 Related:  Constant  ImaginaryNumber  Specified  Variable
           SetGeneralizedCoordinate  SetGeneralizedSpeed  t


Plot
Plot       (For PC/Windows, and with proper install on most Macintosh OS/X)

 Purpose:  Invokes plotting program

Syntax 1:  Plot
Syntax 2:  Plot dataFile1
Syntax 3:  Plot dataFile1, dataFile2, dataFile3
Syntax 4:  Plot dataFile1 [1,2,3,4]  dataFile2 [1,4,3]

   Input:  dataFilei -- the name of a data file having columns of numbers.
           [1,2,3,4] -- designates the columns to be plotted, i.e.,
                        plots columns 2, 3, and 4 versus column 1.

  Output:  Invokes the plotting program and displays plots.

  Remark:  More HELP is available after invoking the Plot tool, e.g.,
           drag and drop data files onto the MotionGenesis executable.

 Related:  ODE  Solve  Input  Output  OutputPlot  Plot  Animate

   (1) %--------------------------------------------------------------------
   (2) % Example: Plot  
   (3) % Plot A:  x, x^2, x' versus t.  Uses data from file OdeData.1
   (4) % Plot B:  x, y       versus t.  Uses files OdeData.1, OdeData.2
   (5) %--------------------------------------------------------------------
   (6) Variable x' = sin(t)
-> (7) x' = sin(t)

   (8) Variable y' = cos(t)
-> (9) y' = cos(t)

   (10) Input   x = 0,  y = 0,  tFinal = 10
   (11) Output  t, x, x^2, x'
   (12) Output  t, y, y'
   (13) ODE()  OdeData

   (14) Plot   OdeData.1 [1, 2,3,4]  
   (15) Pause( 5 )
   (16) Plot   OdeData.1 [1,2]       OdeData.2 [1,2]


Point
Point

 Purpose:  Declares points.  Welds a point to a RigidFrame or RigidBody.

Syntax 1:  Point P1, P2, ...         (creates points P1, P2, ...)
Syntax 2:  Point P()                 (creates point P, not welded to an object)
Syntax 3:  Point Q( B )              (creates point Q welded to B)
Syntax 4:  Point                     (displays names of all Points)

   Input:  P1 -- name that starts with a letter, followed by a reasonable
                 number of alphanumeric characters (similarly for P2, etc).

           B -- the name of a RigidFrame or RigidBody.

Output 2:  Point P()  creates a point Q that is purposely not attached to a
           RigidBody or RigidFrame (suppressing related notes/warnings).

Output 3:  Creates point Q of RigidFrame or RigidBody B  (welds Q to B).
           Sets Q's velocity and acceleration in B  to 0>.
           Propagates forces on Q to resultant forces and moments on B.

  Remark:  Point P{1:4}        is same as:   Point P1, P2, P3, P4
           Point P{1:3}Ed      is same as:   Point P1Ed, P2Ed, P3Ed
           Point P{1:2}{2:3}   is same as:   Point P12, P13, P22, P23

  Remark:  The declaration  RigidFrame A  or  RigidBody A  automatically
           creates a point Ao (called A's origin) that is fixed on A.

           The declaration  RigidBody B  automatically creates a
           point Bcm (B's center of mass) that is fixed on B.

 Related:  NewtonianFrame  Particle  Point  RigidBody  RigidFrame  System

   (1) %--------------------------------------------------------------------
   (2) % Example 1: Point
   (3) %--------------------------------------------------------------------
   (4) RigidBody  B
   (5) Point P
   (6) Point P{1:4}
   (7) Point Q(B)
   (8) %--------------------------------------------------------------------
   (9) % Example 2: Point  (typing POINT displays the following)
   (10) %--------------------------------------------------------------------
   (11) % The following Point have been declared:
   (12) %
   (13) % Bo  P  P1  P2  P3  P4  Q(B), Bcm


Quit
Quit  or  QuitExit

 Purpose:  Quits (exits) the program.

Syntax 1:  Quit
Syntax 2:  QuitExit

  Remark:  Quit will prompt the user if information has not been saved.
           QuitExit will quit (exit) without prompting the user to save.

 Related:  !  %  &  Clear  List  Pause  Quit  Run  Save  GetDefaults



RandomInteger
RandomInteger

 Purpose:  Returns a random positive integer.

  Syntax:  RandomInteger()

  Output:  Random integer that is greater than or equal to 0 and less
           than or equal to machine specific number (e.g., 32767).

 Related:  ceil  floor  int  max  min  round  sign  MathFunctions

   (1) %--------------------------------------------------------------------
   (2) % Example: RandomInteger   
   (3) %--------------------------------------------------------------------
   (4) randomIntegerA = RandomInteger() 
-> (5) randomIntegerA = 9396

   (6) randomIntegerB = RandomInteger() 
-> (7) randomIntegerB = 9930

   (8) randomIntegerC = RandomInteger() 
-> (9) randomIntegerC = 20325



ReplaceString
ReplaceString

 Purpose:  Replaces strings in an expression with new strings.
           Truncates numbers in an expression (possibly simplifying it).

Syntax 1:  ReplaceString( mathExpression )
Syntax 2:  ReplaceString( mathExpression, string1=rhs1, string2=rhs2, ... )

   Input:  mathExpression -- A scalar, vector, matrix, ... expression.
           stringi - A string of characters appearing in mathExpression.
           rhsi -- An expression to substitute for stringi. (i=1,2,...)

Output 1:  Returns mathExpression with numbers rounded to the number
           of digits used for display (numbers are frequently
           displayed with less precision than they are stored).

Output 2:  Returns mathExpression with stringi replaced by rhsi
           wherever stringi appears in mathExpression.
           Numbers are also truncated as described above.

  Remark:  The  ReplaceString  command  uses a string replacement
           which ignores mathematical rules as shown in Example 1:

 Related:  Epsilon  Evaluate  Expand  Explicit
           Factor  FactorLinear  FactorQuadratic  ReplaceString
           GetRhs  SetAutoRhs  SetDigits

   (1) %--------------------------------------------------------------------
   (2) % Example 1: ReplaceString   (scalar expression)
   (3) %--------------------------------------------------------------------
   (4) Constant  a, x, y, z
   (5) s = x^2*cos(y) - sin(t)
-> (6) s = x^2*cos(y) - sin(t)

   (7) s1 = ReplaceString( s, 2*cos(y) = z )
-> (8) s1 = x^z - sin(t)

   (9) s2 = ReplaceString( s, x^2*cos(y) = z )
-> (10) s2 = z - sin(t)

   (11) se = ReplaceString( s, x^2*cos(y) - sin(t) = 3*z )
-> (12) se = 3*z

   (13) %--------------------------------------------------------------------
   (14) % Example 2: ReplaceString  (vector expression)
   (15) %--------------------------------------------------------------------
   (16) RigidBody   B
   (17) v> = Vector( B, (1+1E-11)*x, (1+1E-7)*x*y, (1+1E-4)*x*y*z )
-> (18) v> = 1*x*Bx> + 1*x*y*By> + 1.0001*x*y*z*Bz>

   (19) v1> = ReplaceString( v> )
-> (20) v1> = x*Bx> + x*y*By> + 1.0001*x*y*z*Bz>

   (21) v2> = ReplaceString( v>, x*y = z )
-> (22) v2> = x*Bx> + z*By> + 1.0001*z^2*Bz>

   (23) %--------------------------------------------------------------------
   (24) % Example 3: ReplaceString   (matrix expression)
   (25) %--------------------------------------------------------------------
   (26) matrix[1] = v>
-> (27) matrix[1] = 1*x*Bx> + 1*x*y*By> + 1.0001*x*y*z*Bz>

   (28) matrix[2] = x*y - z
-> (29) matrix[2] = x*y - z

   (30) matrixB = ReplaceString( matrix,  x*y - z = 5 )
-> (31) matrixB = [x*Bx> + x*y*By> + 1.0001*x*y*z*Bz>;  5]



RigidBody
RigidBody

 Purpose:  Declares rigid bodies.

Syntax 1:  RigidBody  A, B, ...     (creates rigid bodies A, B, ...)
Syntax 2:  RigidBody                (displays all names declared as RigidBody)

   Input:  A -- name that starts with a letter, followed by a reasonable
                number of alphanumeric characters (similarly for B).

Output 1:  The declaration  RigidBody B  automatically creates right-handed
           orthogonal unit vectors Bx>, By>, Bz>  fixed in B and creates a
           point Bcm (B's center of mass) that is fixed in B and creates a
           point Bo  (called B's origin)  that is fixed in B (welded to B).

  Remark:  RigidBody B{1:4}       is same as  RigidBody B1, B2, B3, B4
           RigidBody B{1:3}Ed     is same as  RigidBody B1Ed, B2Ed, B3Ed
           RigidBody B{1:2}{2:3}  is same as  RigidBody B12, B13, B22, B23

  Remark:  The declaration  Point P(B)       welds point P to rigid body B.
           The declaration  RigidFrame F(B)  welds F to rigid body B.

 Related:  NewtonianFrame  Particle  Point  RigidBody  RigidFrame  System

   (1) %--------------------------------------------------------------------
   (2) % Example: RigidBody
   (3) %--------------------------------------------------------------------
   (4) RigidBody A
   (5) RigidBody B, C
   (6) RigidBody G{2:5}Ed
   (7) %--------------------------------------------------------------------
   (8) % Example 2: RigidBody  (typing RigidBody displays the following)
   (9) %--------------------------------------------------------------------
   (10) % The following have been declared RigidBody:
   (11) %
   (12) % A  B  C  G2Ed  G3Ed  G4Ed  G5Ed


RigidFrame
RigidFrame

 Purpose:  Declares a rigid frame (reference frame).
           Welds a rigid frame to a RigidBody or another RigidFrame.

Syntax 1:  RigidFrame  A, B, ...    (creates rigid frames A, B, ...)
Syntax 2:  RigidFrame  B( D )       (creates rigid frame B welded to D)
Syntax 3:  RigidFrame               (displays names of all RigidFrames)

   Input:  A -- name that starts with a letter, followed by a reasonable
                number of alphanumeric characters (similarly for B).

           D -- name of a RigidFrame or RigidBody.

Output 1:  The declaration  RigidFrame A  automatically creates right-handed
           orthogonal unit vectors Ax>, Ay>, Az>  fixed in A and creates a
           point Ao  (called A's origin)  that is fixed in A (welded to A).

Output 2:  Creates RigidFrame B and welds it to RigidBody or RigidFrame D.
           Sets  B's  angular velocity/acceleration in D to 0>.
           Sets  point Bo's  velocity/acceleration  in D to 0>.
           Propagates force/torques on B to resultant forces/moments on D.

           RigidFrame B{1:4}       is same as  RigidFrame B1, B2, B3, B4
           RigidFrame B{1:3}Ed     is same as  RigidFrame B1Ed, B2Ed, B3Ed
           RigidFrame B{1:2}{2:3}  is same as  RigidFrame B12, B13, B22, B23

  Remark:  The NewtonianFrame is a special RigidFrame.

  Remark:  The declaration  Point P(B)  welds point P to RigidFrame B.

 Related:  NewtonianFrame  Particle  Point  RigidBody  RigidFrame  System

   (1) %--------------------------------------------------------------------
   (2) % Example: RigidFrame
   (3) %--------------------------------------------------------------------
   (4) RigidFrame A, D
   (5) RigidFrame B( D )
   (6) RigidFrame G{3:5}Ed
   (7) %--------------------------------------------------------------------
   (8) % Example 2: RigidFrame  (typing RigidFrame displays the following)
   (9) %--------------------------------------------------------------------
   (10) % The following have been declared RigidFrame:
   (11) %
   (12) % A  B(D)  D  G3Ed  G4Ed  G5Ed


round
round

 Purpose:  Returns the integer nearest to a real number.

  Syntax:  round( realScalarExpression )

   Input:  realScalarExpression -- a real scalar expression.

  Output:  Integer nearest to realScalarExpression.

 Related:  ceil  floor  int  max  min  round  sign  MathFunctions

   (1) %--------------------------------------------------------------------
   (2) % Example: round 
   (3) %--------------------------------------------------------------------
   (4) A = round( 2.991 ) 
-> (5) A = 3

   (6) B = round( 3.001 ) 
-> (7) B = 3

   (8) C = round( -2.991 ) 
-> (9) C = -3

   (10) D = round( -3.001 ) 
-> (11) D = -3

   (12) E = round( 2.9 + t ) 
-> (13) E = round(2.9+t)

   (14) F = round(  2.499999999 )
-> (15) F = 2

   (16) G = round( -2.499999999 )
-> (17) G = -2



Rotate
Rotate

 Purpose:  Forms the rotation matrix (direction cosine matrix) associated
           with the right-handed rotation of a rigid basis (e.g., B) in
           another rigid basis (e.g., A).  Tries to form B's angular
           velocity/acceleration in A and in the NewtonianFrame.

Syntax 1:  B.Rotate( A, [3x3RotationMatrix] )
Syntax 2:  B.Rotate( A, unitVector, theta )
Syntax 3:  B.Rotate( A, SequenceIJK, q1, q2, q3 )
Syntax 4:  B.RotateX( A, theta )     B.RotateNegativeX( A, theta )
           B.RotateY( A, theta )     B.RotateNegativeY( A, theta )
           B.RotateZ( A, theta )     B.RotateNegativeZ( A, theta )
           Type  HELP RotateX  for examples.

   Input:  B -- name of a RigidFrame or RigidBody.
           A -- name of another RigidFrame or RigidBody.

           theta, q1, q2, q3 -- angles (scalar expressions).

           unitVector -- unit vector that can be expressed in terms of
                         either  Ax>, Ay>, Az>  or  Bx>, By>, Bz>

           SequenceIJK -- BodyIJK or SpaceIJK, e.g., of the form:
                   BodyXYZ,  BodyYZX,  BodyZXY,  BodyXZY,  BodyYXZ,  BodyZYX
                   BodyXYX,  BodyXZX,  BodyYXY,  BodyYZY,  BodyZXZ,  BodyZYZ
                  SpaceXYZ, SpaceYZX, SpaceZXY, SpaceXZY, SpaceYXZ, SpaceZYX
                  SpaceXYX, SpaceXZX, SpaceYXY, SpaceYZY, SpaceZXZ, SpaceZYZ

  Output:  Sets and returns the rotation matrix that is associated with
           right-handed rotations of B relative to A and that relates
           Bx>, By>, Bz>  to  Ax>, Ay>, Az>.

           The angular velocity and angular acceleration of B in A are
           also formed if rotation matrix can be time-differentiated.

           The angular velocity and angular acceleration of B in the
           NewtonianFrame are also formed if a NewtonianFrame was
           declared and the angular velocity and angular acceleration
           of A in the NewtonianFrame is in the workspace.

Output 1:  Output for B's rotation in A associated with 3x3 rotation matrix.
Output 2:  Output for B's rotation in A about unitVector by angle theta.
Output 3:  Output for B's successive rotations in A by angles q1, q2, q3.
Output 4:  Output for B's rotation in A about unit vector by angle theta.
           Type, e.g.,  HELP RotateX  for examples.

 Related:  Rotate  RotateX  RotateY  RotateZ
           RotateNegativeX  RotateNegativeY  RotateNegativeZ
           SetRotationMatrixX  SetRotationMatrixY  SetRotationMatrixZ
           SetRotationMatrixNegativeX  SetRotationMatrixNegativeY  ...
           SetRotationMatrix  SetAngularVelocity  SetAngularAcceleration
           GetRotationMatrix  GetAngularVelocity  GetAngularAcceleration
           SetRotationMatrixODE

   (1) %--------------------------------------------------------------------
   (2) % Example 1: Rotate (simple rotation with one angle) 
   (3) %--------------------------------------------------------------------
   (4) RigidFrame A, B
   (5) Variable   theta''
   (6) B.Rotate( A, GetUnitVector( Ax> + Ay> ),  theta )
-> (7) B_A[1,1] = 0.5 + 0.5*cos(theta)
-> (8) B_A[1,2] = 0.5 - 0.5*cos(theta)
-> (9) B_A[1,3] = -0.7071068*sin(theta)
-> (10) B_A[2,1] = 0.5 - 0.5*cos(theta)
-> (11) B_A[2,2] = 0.5 + 0.5*cos(theta)
-> (12) B_A[2,3] = 0.7071068*sin(theta)
-> (13) B_A[3,1] = 0.7071068*sin(theta)
-> (14) B_A[3,2] = -0.7071068*sin(theta)
-> (15) B_A[3,3] = cos(theta)
-> (16) w_B_A> = 0.7071068*theta'*Ax> + 0.7071068*theta'*Ay>
-> (17) alf_B_A> = 0.7071068*theta''*Ax> + 0.7071068*theta''*Ay>

   (18) %--------------------------------------------------------------------
   (19) % Example 2: Rotate (successive Body-fixed rotations with 3 angles)
   (20) %--------------------------------------------------------------------
   (21) RigidFrame  C, D
   (22) Variable   q1'', q2'', q3''
   (23) D.Rotate( C, BodyXYZ,   q1, q2, q3 )                 
-> (24) D_C[1,1] = cos(q2)*cos(q3)
-> (25) D_C[1,2] = sin(q3)*cos(q1) + sin(q1)*sin(q2)*cos(q3)
-> (26) D_C[1,3] = sin(q1)*sin(q3) - sin(q2)*cos(q1)*cos(q3)
-> (27) D_C[2,1] = -sin(q3)*cos(q2)
-> (28) D_C[2,2] = cos(q1)*cos(q3) - sin(q1)*sin(q2)*sin(q3)
-> (29) D_C[2,3] = sin(q1)*cos(q3) + sin(q2)*sin(q3)*cos(q1)
-> (30) D_C[3,1] = sin(q2)
-> (31) D_C[3,2] = -sin(q1)*cos(q2)
-> (32) D_C[3,3] = cos(q1)*cos(q2)
-> (33) w_D_C> = (sin(q3)*q2'+cos(q2)*cos(q3)*q1')*Dx> + (cos(q3)*q2'-sin(q3)*
        cos(q2)*q1')*Dy> + (q3'+sin(q2)*q1')*Dz>

-> (34) alf_D_C> = (cos(q3)*q2'*q3'+sin(q3)*q2''+cos(q2)*cos(q3)*q1''-sin(q2)*
        cos(q3)*q1'*q2'-sin(q3)*cos(q2)*q1'*q3')*Dx> + (sin(q2)*sin(q3)*q1'*q2'
        +cos(q3)*q2''-sin(q3)*q2'*q3'-cos(q2)*cos(q3)*q1'*q3'-sin(q3)*cos(q2)*
        q1'')*Dy> + (cos(q2)*q1'*q2'+q3''+sin(q2)*q1'')*Dz>

   (35) %--------------------------------------------------------------------
   (36) % Example 3: Rotate (from rotation matrix)
   (37) %--------------------------------------------------------------------
   (38) RigidFrame  E, F
   (39) Variable    q''
   (40) F.Rotate( E, [cos(q), sin(q), 0; -sin(q), cos(q), 0; 0, 0, 1] )                 
-> (41) F_E = [cos(q), sin(q), 0;  -sin(q), cos(q), 0;  0, 0, 1]
-> (42) w_F_E> = q'*Fz>
-> (43) alf_F_E> = q''*Fz>

   (44) %--------------------------------------------------------------------
   (45) % Note: For more HELP, try:   Rotate   RotateX   RotateY   RotateZ


RotateX
RotateX    RotateNegativeX      (RotatePositiveX is identical to RotateX)

 Purpose:  Forms the rotation matrix (direction cosine matrix) associated
           with the right-handed rotation of a rigid basis (e.g., B) in
           another rigid basis (e.g., A).  Tries to form B's angular
           velocity/acceleration in A and in the NewtonianFrame.

Syntax 1:  B.RotateX( A, q )
Syntax 2:  B.RotateX( A, q, u )
Syntax 3:  B.RotateNegativeX( A, q )
Syntax 4:  B.RotateNegativeX( A, q, u )

   Input:  B -- name of a RigidFrame or RigidBody.
           A -- name of another RigidFrame or RigidBody.
           q -- expression for an angle.
           u -- name of an angular velocity variable.

Output 1:  Sets and returns the B_A rotation matrix formed by a right-handed
           rotation of B relative to A about  Ax> = Bx>  by the angle q.

           B's angular velocity and angular acceleration in A
           are also formed if q can be time differentiated.

           B's angular velocity and angular acceleration in the NewtonianFrame
           are also formed if a NewtonianFrame was declared and A's angular
           velocity/acceleration in the NewtonianFrame are in the workspace.

Output 2:  Same as Output 1, except tries to form an ODE relating q' to u that
           allows for more efficient angular velocity/acceleration expressions.

Output 3:  Same as Output 1, except B rotates about  -Ax> = -Bx>.

 Related:  Rotate  RotateX  RotateY  RotateZ
           RotateNegativeX  RotateNegativeY  RotateNegativeZ
           SetRotationMatrixX  SetRotationMatrixY  SetRotationMatrixZ
           SetRotationMatrixNegativeX  SetRotationMatrixNegativeY  ...
           SetRotationMatrix  SetAngularVelocity  SetAngularAcceleration
           GetRotationMatrix  GetAngularVelocity  GetAngularAcceleration
           SetRotationMatrixODE

   (1) %--------------------------------------------------------------------
   (2) % Example 1:  RotateX   (with angle)
   (3) %--------------------------------------------------------------------
   (4) NewtonianFrame N
   (5) RigidFrame     A
   (6) Variable       qA''
   (7) A.RotateX( N, qA )
-> (8) A_N = [1, 0, 0;  0, cos(qA), sin(qA);  0, -sin(qA), cos(qA)]
-> (9) w_A_N> = qA'*Ax>
-> (10) alf_A_N> = qA''*Ax>

   (11) %--------------------------------------------------------------------
   (12) % Example 2:  RotateNegativeX   (with angle and rate)
   (13) %--------------------------------------------------------------------
   (14) RigidFrame    B
   (15) Variable      qB'', wB'
   (16) B.RotateNegativeX( A, qB, wB )
-> (17) B_A = [1, 0, 0;  0, cos(qB), -sin(qB);  0, sin(qB), cos(qB)]
-> (18) qB' = wB + qA'
-> (19) w_B_A> = -qB'*Bx>
-> (20) w_B_N> = -wB*Ax>
-> (21) qB'' = wB' + qA''
-> (22) alf_B_A> = -qB''*Bx>
-> (23) alf_B_N> = -wB'*Bx>

   (24) %--------------------------------------------------------------------
   (25) % Note: For more HELP, try:   Rotate   RotateX   RotateY   RotateZ


RotateY
RotateY    RotateNegativeY      (RotatePositiveY is identical to RotateY)

 Purpose:  Forms the rotation matrix (direction cosine matrix) associated
           with the right-handed rotation of a rigid basis (e.g., B) in
           another rigid basis (e.g., A).  Tries to form B's angular
           velocity/acceleration in A and in the NewtonianFrame.

Syntax 1:  B.RotateY( A, q )
Syntax 2:  B.RotateY( A, q, u )
Syntax 3:  B.RotateNegativeY( A, q )
Syntax 4:  B.RotateNegativeY( A, q, u )

   Input:  B -- name of a RigidFrame or RigidBody.
           A -- name of another RigidFrame or RigidBody.
           q -- expression for an angle.
           u -- name of an angular velocity variable.

Output 1:  Sets and returns the B_A rotation matrix formed by a right-handed
           rotation of B relative to A about  Ay> = By>  by the angle q.

           B's angular velocity and angular acceleration in A
           are also formed if q can be time differentiated.

           B's angular velocity and angular acceleration in the NewtonianFrame
           are also formed if a NewtonianFrame was declared and A's angular
           velocity/acceleration in the NewtonianFrame are in the workspace.

Output 2:  Same as Output 1, except tries to form an ODE relating q' to u that
           allows for more efficient angular velocity/acceleration expressions.

Output 3:  Same as Output 1, except B rotates about  -Ay> = -By>.

 Related:  Rotate  RotateX  RotateY  RotateZ
           RotateNegativeX  RotateNegativeY  RotateNegativeZ
           SetRotationMatrixX  SetRotationMatrixY  SetRotationMatrixZ
           SetRotationMatrixNegativeX  SetRotationMatrixNegativeY  ...
           SetRotationMatrix  SetAngularVelocity  SetAngularAcceleration
           GetRotationMatrix  GetAngularVelocity  GetAngularAcceleration
           SetRotationMatrixODE

   (1) %--------------------------------------------------------------------
   (2) % Example 1:  RotateY   (with angle)
   (3) %--------------------------------------------------------------------
   (4) NewtonianFrame N
   (5) RigidFrame     A
   (6) Variable       qA''
   (7) A.RotateY( N, qA )
-> (8) A_N = [cos(qA), 0, -sin(qA);  0, 1, 0;  sin(qA), 0, cos(qA)]
-> (9) w_A_N> = qA'*Ay>
-> (10) alf_A_N> = qA''*Ay>

   (11) %--------------------------------------------------------------------
   (12) % Example 2:  RotateNegativeY   (with angle and rate)
   (13) %--------------------------------------------------------------------
   (14) RigidFrame    B
   (15) Variable      qB'', wB'
   (16) B.RotateNegativeY( A, qB, wB )
-> (17) B_A = [cos(qB), 0, sin(qB);  0, 1, 0;  -sin(qB), 0, cos(qB)]
-> (18) qB' = wB + qA'
-> (19) w_B_A> = -qB'*By>
-> (20) w_B_N> = -wB*Ay>
-> (21) qB'' = wB' + qA''
-> (22) alf_B_A> = -qB''*By>
-> (23) alf_B_N> = -wB'*By>

   (24) %--------------------------------------------------------------------
   (25) % Note: For more HELP, try:   Rotate   RotateX   RotateY   RotateZ


RotateZ
RotateZ    RotateNegativeZ      (RotatePositiveZ is identical to RotateZ)

 Purpose:  Forms the rotation matrix (direction cosine matrix) associated
           with the right-handed rotation of a rigid basis (e.g., B) in
           another rigid basis (e.g., A).  Tries to form B's angular
           velocity/acceleration in A and in the NewtonianFrame.

Syntax 1:  B.RotateZ( A, q )
Syntax 2:  B.RotateZ( A, q, u )
Syntax 3:  B.RotateNegativeZ( A, q )
Syntax 4:  B.RotateNegativeZ( A, q, u )

   Input:  B -- name of a RigidFrame or RigidBody.
           A -- name of another RigidFrame or RigidBody.
           q -- expression for an angle.
           u -- name of an angular velocity variable.

Output 1:  Sets and returns the B_A rotation matrix formed by a right-handed
           rotation of B relative to A about  Az> = Bz>  by the angle q.

           B's angular velocity and angular acceleration in A
           are also formed if q can be time differentiated.

           B's angular velocity and angular acceleration in the NewtonianFrame
           are also formed if a NewtonianFrame was declared and A's angular
           velocity/acceleration in the NewtonianFrame are in the workspace.

Output 2:  Same as Output 1, except tries to form an ODE relating q' to u that
           allows for more efficient angular velocity/acceleration expressions.

Output 3:  Same as Output 1, except B rotates about  -Az> = -Bz>.

 Related:  Rotate  RotateX  RotateY  RotateZ
           RotateNegativeX  RotateNegativeY  RotateNegativeZ
           SetRotationMatrixX  SetRotationMatrixY  SetRotationMatrixZ
           SetRotationMatrixNegativeX  SetRotationMatrixNegativeY  ...
           SetRotationMatrix  SetAngularVelocity  SetAngularAcceleration
           GetRotationMatrix  GetAngularVelocity  GetAngularAcceleration
           SetRotationMatrixODE

   (1) %--------------------------------------------------------------------
   (2) % Example 1:  RotateZ   (with angle)
   (3) %--------------------------------------------------------------------
   (4) NewtonianFrame N
   (5) RigidFrame     A
   (6) Variable       qA''
   (7) A.RotateZ( N, qA )
-> (8) A_N = [cos(qA), sin(qA), 0;  -sin(qA), cos(qA), 0;  0, 0, 1]
-> (9) w_A_N> = qA'*Az>
-> (10) alf_A_N> = qA''*Az>

   (11) %--------------------------------------------------------------------
   (12) % Example 2:  RotateNegativeZ   (with angle and rate)
   (13) %--------------------------------------------------------------------
   (14) RigidFrame    B
   (15) Variable      qB'', wB'
   (16) B.RotateNegativeZ( A, qB, wB )
-> (17) B_A = [cos(qB), -sin(qB), 0;  sin(qB), cos(qB), 0;  0, 0, 1]
-> (18) qB' = wB + qA'
-> (19) w_B_A> = -qB'*Bz>
-> (20) w_B_N> = -wB*Az>
-> (21) qB'' = wB' + qA''
-> (22) alf_B_A> = -qB''*Bz>
-> (23) alf_B_N> = -wB'*Bz>

   (24) %--------------------------------------------------------------------
   (25) % Note: For more HELP, try:   Rotate   RotateX   RotateY   RotateZ


Run
Run

 Purpose:  Reads (loads) a file containing a sequence of program commands.

Syntax 1:  Run FileName.txt
Syntax 2:  Run

Output 1:  Execution of commands in the file named FileName.txt
           The file name extension should be  .txt  or  .al

Output 2:  Continued execution of lines in a command file that follow
           a line or error that previously caused execution to halt.

  Remark:  FileName.txt is the name of a command file located in the:
           (a) Current working directory
           (b) Directory specified via a relative path
           (c) Directory specified via an absolute path

           For example, valid commands include:
           Run Pendulum.txt
           Run ..\PendulumDirectory\Pendulum.txt   (PC/Windows)
           Run ../PendulumDirectory/Pendulum.txt   (Unix/Macintosh)
           Run \PendulumDirectory\Pendulum.txt     (PC/Windows)
           Run /PendulumDirectory/Pendulum.txt     (Unix/Macintosh)

  Remark:  Command files should be named with the extension  .txt  or  .al
           Just typing  FileName.txt   is identical to   Run FileName.txt

  Remark:  The Run command can be used within one command file to start
           execution of other command files.

  Remark:  Command files are ASCII text files with line breaks.
           Use a text editor or do a proper Save-As in a word processor.

 Related:  !  %  &  Clear  Save  Run  Quit  if  else  elseif

--------------------------------------------------------------------
 Example:  Prepare the file "Test.txt" in ASCII text format as follows.
--------------------------------------------------------------------
          % Test.txt
          a = 1 + 2 + pi + 3*t + 4*t

--------------------------------------------------------------------
 At the MotionGenesis command prompt, type:  Run Test.txt
--------------------------------------------------------------------

   (1) % Run.al
   (2) a = 1 + 2 + pi + 3*t + 4*t 
-> (3) a = 6.141593 + 7*t



Save
Save  SaveOverwrite  (or Print)

 Purpose:  Creates a text file containing input or input and output.
           To print the file, open it with a text editor and print.

Syntax 1:  Save FileName.txt
           Save FileName.txt,  m
           Save FileName.txt,  m:n
Syntax 2:  Save FileName.all
Syntax 3:  Save FileName.html
           Save FileName.html,  m
           Save FileName.html,  m:n

   Input:  FileName.txt  -- a file whose extension is .txt or .al
           FileName.all  -- a file whose extension is .all
           FileName.html -- a file whose extension is .html or .htm

           m -- the line number of the first line to be saved
           n -- the line number of the last  line to be saved
                the default value for n is the last line.

Output 1:  Creates a text file containing input lines only.
Output 2:  Creates a text file containing input and program responses.
Output 3:  Creates a html file containing input and program responses.

  Remark:  SaveOverwrite abc.html  overwrites abc.html (no prompt to user).

   Print:  To print a text file, open the file in a text editor
           (e.g., NotePad, TextWrangler, TextEdit, SimpleText, Emacs)
           or word-processor with Courier font (e.g., Microsoft Word)
           and print the file from within that program.

  Remark:  It is usually more efficient to use a text editor to
           create a command file and then use the Run command.

           If you instead choose to enter commands at the program prompt,
           save your commands with Save FileName.txt (not FileName.all).

  Remark:  FileName.txt is the name of a file to be located in the:
           (a) Current working directory
           (b) Directory specified via a relative path
           (c) Directory specified via an absolute path

           For example, valid commands include:
           Save Pendulum.txt
           Save ..\PendulumDirectory\Pendulum.txt   (PC/Windows)
           Save C:\PendulumDirectory\Pendulum.txt   (PC/Windows)
           Save ../PendulumDirectory/Pendulum.txt   (Unix/Macintosh)
           Save /PendulumDirectory/Pendulum.txt     (Unix/Macintosh)

 Related:  !  %  &  Clear  Save  Print  Run  Quit

--------------------------------------------------------------------
 Example:  Type the following commands at the program prompt.
--------------------------------------------------------------------
 a = 2 + 2
 b = 3 + 3
 Save SaveExample.txt
 Save SaveExample.all
 Save SaveExample.html
 Quit
--------------------------------------------------------------------
 SaveExample.txt contains the following:
--------------------------------------------------------------------
 a = 2 + 2
 b = 3 + 3
--------------------------------------------------------------------
 SaveExample.all and SaveExample.html contain the following:
--------------------------------------------------------------------
    (1) a = 2 + 2
 -> (2) a = 4

    (3) b = 3 + 3
 -> (4) b = 6



SetScratchDirectory
SetScratchDirectory

 Purpose:  Specifies the operating system path to the directory
           used by the program for scratch files.

           PC/Windows:
           SetScratchDirectory C:\TempFolder

           MAC/Unix:
           SetScratchDirectory /TempFolder

  Remark:  To set the scratch directory, edit the MGDefaultPreferences.txt
           file that resides in the MotionGenesis MGToolbox folder.
           The previous examples show how to specify an existing folder
           on the computer's (hard) drive as the scratch directory.

  Remark:  If the scratch directory is not set (or is set improperly),
           scratch files are written to the current working directory.

  Remark:  The comment symbol % should not appear after SetScratchDirectory.

 Related:  GetDefaults  GetWorkingDirectory  SetWorkingDirectory
           GetEnvironmentValue   SetScratchDirectory



SetWorkingDirectory
SetWorkingDirectory   GetWorkingDirectory

 Purpose:  Specifies the operating system path to write files.

Syntax 1:  SetWorkingDirectory( pathToFolder )
Syntax 2:  GetWorkingDirectory()

           PC/Windows:
           SetWorkingDirectory( C:\MotionGenesis )
           SetWorkingDirectory( "C:\Documents and Settings\Paul" )

           MAC/Unix:
           SetWorkingDirectory( /MotionGenesis )
           SetWorkingDirectory( /Paul/Mechanics/Simulations )

  Remark:  The syntax for pathToFolder depends on the operating system.
           The previous examples show how to specify an existing folder
           on the computer's (hard) drive as the working directory.

  Remark:  Alternately, edit the file  MGDefaultPreferences.txt
           that resides in the MotionGenesis MGToolbox folder.

 Related:  GetDefaults  GetWorkingDirectory  SetWorkingDirectory
           GetEnvironmentValue   SetScratchDirectory



SetAcceleration
SetAcceleration

 Purpose:  Sets a point's acceleration in a reference frame.

Syntax 1:  Q.SetAcceleration( N, fromPoint )
Syntax 2:  Q.SetAcceleration( N, fromPoint, BFixed )
Syntax 3:  Q.SetAcceleration( N, fromPoint, BFrame, BQ )
Syntax 4:  Q.SetAcceleration( N, accelerationVector )

   Input:  Q -- name of a Point.
           N -- name of a RigidFrame or RigidBody.

           fromPoint -- Point whose velocity in N is already known.

           BFixed -- Rigid frame/body on which fromPoint and Q  are fixed.
           BFrame -- Rigid frame/body on which fromPoint and BQ are fixed.
                     Q is moving on BFrame.

           BQ -- Point of BFrame that is coincident with Q.

           accelerationVector -- an acceleration vector.

  Output:  Sets and returns Q's acceleration in N.

  Remark:  Syntax 2 may also set the following (if not in workspace):
             fromPoint's velocity and acceleration in BFixed to 0>
             Q's         velocity and acceleration in BFixed to 0>

           Syntax 3 may also set the following (if not in workspace):
             fromPoint's velocity and acceleration in BFrame to 0>
             BQ          may be defined as a physical point of BFrame
             BQ's        velocity and acceleration in BFrame to 0>
             BQ's        position from fromPoint
             Q's         velocity in BFrame (via Q' position vector fromPoint)
             Q's         acceleration in BFrame (via differentiation)

  Remark:  Q's position vector fromPoint is used by this command.

  Remark:  If Q is welded to rigid frame/body B, declare it:  Point Q(B).
           Alternately, use  Q.SetVelocityAcceleration( B, 0> )  if Q does not
           move on B, but is not a physical point of B (Q is not welded to B).

 Related:  Translate        SetPositionVelocity   SetVelocityAcceleration
           SetPosition      GetPosition   GetDistance  GetDistanceSquared
           SetVelocity      GetVelocity   GetSpeed     GetElongation
           SetAcceleration  GetAcceleration

   (1) %--------------------------------------------------------------------
   (2) % Example 1: SetAcceleration 
   (3) % Set Q1's acceleration in N by differentiation.  Uses No fixed on N 
   (4) %--------------------------------------------------------------------
   (5) RigidFrame N             
   (6) Point      Q1            
   (7) Variable   x1'', y1''           
   (8) Q1.SetPosition( No, x1*Nx> + y1*Ny> )
-> (9) p_No_Q1> = x1*Nx> + y1*Ny>

   (10) Q1.SetAcceleration( N, No )   
-> (11) a_Q1_N> = x1''*Nx> + y1''*Ny>

   (12) %--------------------------------------------------------------------
   (13) % Example 2: SetAcceleration 
   (14) % Set Q2's acceleration in N by differentiation and Q1's acceleration
   (15) %--------------------------------------------------------------------
   (16) Point     Q2            
   (17) Variable  x2'', y2''  
   (18) Q2.SetPosition( Q1, x2*Nx> + y2*Ny> )
-> (19) p_Q1_Q2> = x2*Nx> + y2*Ny>

   (20) Q2.SetAcceleration( N, Q1 )     
-> (21) a_Q2_N> = (x1''+x2'')*Nx> + (y1''+y2'')*Ny>

   (22) %--------------------------------------------------------------------
   (23) % Example 3: SetAcceleration
   (24) % Set Q3's acceleration in N via two points (Q3 and Bo) fixed on B
   (25) %--------------------------------------------------------------------
   (26) Point     Q3            
   (27) RigidBody B                  % Translating/rotating rigid body 
   (28) Variable  qB''               % Angle and time-derivatives
   (29) Constant  L                  % Distance between Bo and Q3
   (30) B.SetAngularVelocityAcceleration( N, qB'*Bz> )
-> (31) w_B_N> = qB'*Bz>
-> (32) alf_B_N> = qB''*Bz>

   (33) Bo.SetAcceleration( N, t*Nx> )
-> (34) a_Bo_N> = t*Nx>

   (35) Q3.SetPosition( Bo, L*Bx> )
-> (36) p_Bo_Q3> = L*Bx>

   (37) Q3.SetAcceleration( N, Bo, B )  
-> (38) a_Q3_N> = -L*qB'^2*Bx> + L*qB''*By> + t*Nx>

   (39) %--------------------------------------------------------------------
   (40) % Example 4: SetAcceleration
   (41) % Set Q4's acceleration in N via one point (Q4) moving on rigid-body B
   (42) %--------------------------------------------------------------------
   (43) Point      Q4, BQ4           % Point of B coincident with Q4
   (44) Variable   x4''  
   (45) Q4.SetPosition( Bo, x4*Bx> )
-> (46) p_Bo_Q4> = x4*Bx>

   (47) Q4.SetAcceleration( N, Bo, B, BQ4 )    
-> (48) p_Bo_BQ4> = x4*Bx>
-> (49) a_BQ4_N> = -x4*qB'^2*Bx> + x4*qB''*By> + t*Nx>
-> (50) v_Q4_B> = x4'*Bx>
-> (51) a_Q4_B> = x4''*Bx>
-> (52) a_Q4_N> = (x4''-x4*qB'^2)*Bx> + (2*qB'*x4'+x4*qB'')*By> + t*Nx>



SetAngularAcceleration
SetAngularAcceleration

 Purpose:  Sets a reference frame's angular acceleration.

Syntax 1:  B.SetAngularAcceleration( N, angularAccelerationVector )
Syntax 2:  B.SetAngularAcceleration( N )

   Input:  B -- name of a RigidFrame or RigidBody.
           N -- name of another RigidFrame or RigidBody.
           angularAccelerationVector -- an angular acceleration vector

Output 1:  Sets and returns B's angular acceleration in N.
Output 2:  Calculates, sets and returns B's angular acceleration in N.

 Related:  GetAngularAcceleration  Rotate  SetAngularVelocity  SetRotationMatrix

   (1) %--------------------------------------------------------------------
   (2) % Example: SetAngularAcceleration.al 
   (3) %--------------------------------------------------------------------
   (4) RigidFrame N             
   (5) RigidBody  A, B
   (6) Variable   wx', wy', wz',  w1', w2', w3'
   (7) A.SetAngularVelocityAcceleration( N, wx*Ax> + wy*Ay> + wz*Az> )
-> (8) w_A_N> = wx*Ax> + wy*Ay> + wz*Az>
-> (9) alf_A_N> = wx'*Ax> + wy'*Ay> + wz'*Az>

   (10) B.SetAngularVelocityAcceleration( A, w1*Ax> + w2*Ay> + w3*Az> )
-> (11) w_B_A> = w1*Ax> + w2*Ay> + w3*Az>
-> (12) alf_B_A> = w1'*Ax> + w2'*Ay> + w3'*Az>

   (13) B.SetAngularAcceleration( N )
-> (14) alf_B_N> = (w3*wy+w1'+wx'-w2*wz)*Ax> + (w1*wz+w2'+wy'-w3*wx)*Ay> + (w2*
        wx+w3'+wz'-w1*wy)*Az>



SetAngularVelocity
SetAngularVelocity

 Purpose:  Sets a reference frame's angular velocity.

Syntax 1:  B.SetAngularVelocity( N, angularVelocityVector )
Syntax 2:  B.SetAngularVelocity( A, SequenceI,   q1 )
Syntax 3:  B.SetAngularVelocity( A, SequenceIJ,  q1, q2 )
Syntax 4:  B.SetAngularVelocity( A, SequenceIJK, q1, q2, q3 )
Syntax 5:  B.SetAngularVelocity( A, EulerParameters, e0, e1, e2, e3 )
           B.SetAngularVelocity( A, Quaternion,      e0, e1, e2, e3 )
Syntax 6:  B.SetAngularVelocity( A, RodriguesParameters, rho1, rho2, rho3 )
Syntax 7:  B.SetAngularVelocity( A, matrix33 )
Syntax 8:  B.SetAngularVelocityFromRotationMatrix( N )
Syntax 9:  B.SetAngularVelocity( N )

   Input:  B -- name of a RigidFrame or RigidBody.
           N -- name of another RigidFrame or RigidBody.

           angularVelocityVector -- an angular velocity vector.

           q1, q2, q3 -- angles (scalar expressions).

           SequenceI -- BodyI or SpaceI where I is X, -X, Y, -Y, Z, -Z, e.g.,
                          BodyX,  BodyY,  BodyZ,  -BodyX,  Body-Y, etc.
                         SpaceX, SpaceY, SpaceZ, -SpaceX, Space-Y, etc.

           SequenceIJ -- BodyIJ or Space IJ where I and J are appropriate
                         combinations of X, -X, Y, -Y, Z, -Z, e.g.,
                         BodyXY,  BodyXZ,  BodyYX,  BodyYZ,  BodyZX,  BodyZY
                        SpaceXY, SpaceXZ, SpaceYX, SpaceYZ, SpaceZX, SpaceZY
                        Body-XY,  BodyX-Z,  Body-Y-X, Space-XY, etc.

           SequenceIJK -- BodyIJK or SpaceIJK where I, J, K are appropriate
                          combinations of X, -X, Y, -Y, Z, -Z, e.g.,
                   BodyXYZ,  BodyYZX,  BodyZXY,  BodyXZY,  BodyYXZ,  BodyZYX
                   BodyXYX,  BodyXZX,  BodyYXY,  BodyYZY,  BodyZXZ,  BodyZYZ
                  SpaceXYZ, SpaceYZX, SpaceZXY, SpaceXZY, SpaceYXZ, SpaceZYX
                  SpaceXYX, SpaceXZX, SpaceYXY, SpaceYZY, SpaceZXZ, SpaceZYZ
                  Body-XYZ, BodyX-YZ, BodyXY-Z, Body-X-YZ,  Space-X-Y-Z, etc.

           e0, e1, e2, e3 -- expressions for Euler parameters (quaternion).

           rho1, rho2, rho3 -- expressions for Rodrigues parameters.

           Rxx,Rxy,Rxz, Ryx,Ryy,Ryz, Rzx,Rzy,Rzz - expressions for elements.

           matrix33 -- 3x3 rotation matrix (direction cosine matrix).

 Output:   Calculates, sets, and returns B's angular velocity in N.
 Output 8: Calculates the B_N rotation matrix and calls Syntax 7.
 Output 9: Calculates B's angular velocity in N by the angular velocity addition
           theorem and/or time-derivatives of rotation matrices.

  Remark:  Definitions of orientation angles, Euler parameters (quaternion),
           Rodrigues parameters, and direction cosines are in
           Kane, T. R.,  Likins, P. W.,  and Levinson D. A.,
           Spacecraft Dynamics, McGraw-Hill, 1983, Ch. 1., and
           Mitiguy, Paul, Advanced Dynamics for Professional
           Mechanical, Aerospace, and BioMechanical Engineers.

 Related:  Rotate  RotateX  RotateY  RotateZ
           RotateNegativeX  RotateNegativeY  RotateNegativeZ
           SetRotationMatrixX  SetRotationMatrixY  SetRotationMatrixZ
           SetRotationMatrixNegativeX  SetRotationMatrixNegativeY  ...
           SetRotationMatrix  SetAngularVelocity  SetAngularAcceleration
           GetRotationMatrix  GetAngularVelocity  GetAngularAcceleration
           SetRotationMatrixODE   SetRotationMatrixAndPosition
           SetAngularVelocityAcceleration

   (1) %--------------------------------------------------------------------
   (2) % Example: SetAngularVelocity 
   (3) %--------------------------------------------------------------------
   (4) RigidFrame N             
   (5) RigidBody  A, B
   (6) Variable   wx, wy, wz,  w1, w2, w3
   (7) A.SetAngularVelocity( N, wx*Ax> + wy*Ay> + wz*Az> )
-> (8) w_A_N> = wx*Ax> + wy*Ay> + wz*Az>

   (9) B.SetAngularVelocity( A, w1*Bx> + w2*By> + w3*Bz> )
-> (10) w_B_A> = w1*Bx> + w2*By> + w3*Bz>

   (11) B.SetAngularVelocity( N )
-> (12) w_B_N> = wx*Ax> + wy*Ay> + wz*Az> + w1*Bx> + w2*By> + w3*Bz>



SetAngularVelocityAcceleration
SetAngularVelocityAcceleration

 Purpose:  Sets a reference frame's angular velocity and angular acceleration.

  Syntax:  B.SetAngularVelocityAcceleration( A, angularVelocityVector )

   Input:  B -- name of a RigidFrame or RigidBody.
           A -- name of another RigidFrame or RigidBody.
           angularVelocityVector -- an angular velocity vector

  Output:  Sets B's angular velocity in A and B's angular acceleration in A.
           If possible, sets B's angular velocity in the NewtonianFrame.
           If possible, sets B's angular acceleration in NewtonianFrame.

 Related:  GetAngularVelocity  Rotate  SetAngularAcceleration  SetRotationMatrix

   (1) %--------------------------------------------------------------------
   (2) % Example 1: SetAngularVelocityAcceleration 
   (3) % Set A's angular velocity and acceleration in N. 
   (4) %--------------------------------------------------------------------
   (5) NewtonianFrame N             
   (6) RigidFrame     A
   (7) Variable       wx', wy', wz'
   (8) A.SetAngularVelocityAcceleration( N, wx*Ax> + wy*Ay> + wz*Az> )
-> (9) w_A_N> = wx*Ax> + wy*Ay> + wz*Az>
-> (10) alf_A_N> = wx'*Ax> + wy'*Ay> + wz'*Az>

   (11) %--------------------------------------------------------------------
   (12) % Example 2: SetAngularVelocityAcceleration 
   (13) % Set B's angular velocity and acceleration in both A and N. 
   (14) %--------------------------------------------------------------------
   (15) RigidFrame    B
   (16) Variable      wBA'
   (17) B.SetAngularVelocityAcceleration( A, wBA*Az> )
-> (18) w_B_A> = wBA*Az>
-> (19) w_B_N> = wx*Ax> + wy*Ay> + (wBA+wz)*Az>
-> (20) alf_B_A> = wBA'*Az>
-> (21) alf_B_N> = (wBA*wy+wx')*Ax> + (wy'-wBA*wx)*Ay> + (wBA'+wz')*Az>



SetAutoDifferentiate
SetAutoDifferentiate

 Purpose:  Controls whether or not ordinary derivatives of quantities
           declared as a Variable or Specified are automatically calculated.
           In other words, controls whether or not y', y'', y''', etc.,
           are automatically calculated and assigned when y is assigned.

  Syntax:  SetAutoDifferentiate( SETTING )

   Input:  SETTING -- ON or OFF

  Output:  When SETTING is ON, the ordinary derivatives of y are
           automatically assigned when y is assigned, e.g.,
           y', y'', and y''' are assigned when y is assigned.

  Remark:  Program default is SetAutoDifferentiate( OFF ).

 Related:  GetDefaults   SetAutoDifferentiate  SetAutoOverwrite
           Solve  SolveDt  SolveSetInput  SolveSetInputDt  ...
           SolveQuadraticPositiveRoot  SolveQuadraticPositiveRootDt  ...
           SetDt  SetNoDt   =   :=   +=   *=   /=   ^=

   (1) %--------------------------------------------------------------------
   (2) % Example 1:  No automatic differentiation 
   (3) %--------------------------------------------------------------------
   (4) Variable  x'
   (5) SetAutoDifferentiate( OFF )
   (6) x = sin(t)
-> (7) x = sin(t)

   (8) SetDt( x = cos(t) )  
-> (9) x = cos(t)
-> (10) x' = -sin(t)

   (11) %--------------------------------------------------------------------
   (12) % Example 2:  Auto-differentiates y to assign  y'  and  y''
   (13) %--------------------------------------------------------------------
   (14) Variable  y''
   (15) SetAutoDifferentiate( ON )
   (16) y = t^3
-> (17) y = t^3
-> (18) y' = 3*t^2
-> (19) y'' = 6*t



SetAutoEpsilon
SetAutoEpsilon  GetAutoEpsilon

 Purpose:  In every expression, rounds numbers suitably close to an integer.

Syntax 1:  SetAutoEpsilon( n )
Syntax 2:  GetAutoEpsilon

   Input:  n -- a number greater than or equal to zero, and less
                than or equal to 0.5, i.e.,  0 <= n <= 0.5

Output 1:  In every expression, rounds any number that is within n of an
           integer to this integer.  Replaces number of the form x.y with:
           (a) x,   if 0.y is less than or equal to n
           (b) x+1, if 0.y is greater than n and greater than or equal to 1-n
           No rounding occurs when 0.y is greater than n and less than 1-n.

Output 2:  The number previously set by SetAutoEpsilon.

  Remark:  Program default is SetAutoEpsilon( 0.0 ), i.e., no rounding occurs.

 Related:  Epsilon  SetAutoEpsilon  SetDigits  GetDefaults

   (1) %--------------------------------------------------------------------
   (2) % Example 1:  SetAutoEpsilon 
   (3) %--------------------------------------------------------------------
   (4) SetAutoEpsilon( 1.0E-14 )
   (5) w = 2E-08 + 0.002*t + 0.2*sin(t)
-> (6) w = 2E-08 + 0.002*t + 0.2*sin(t)

   (7) %--------------------------------------------------------------------
   (8) % Example 2:  SetAutoEpsilon 
   (9) %--------------------------------------------------------------------
   (10) SetAutoEpsilon( 1.0E-7 )
   (11) x = 2E-08 + 0.002*t + 0.2*sin(t)
-> (12) x = 0.002*t + 0.2*sin(t)

   (13) %--------------------------------------------------------------------
   (14) % Example 3:  SetAutoEpsilon 
   (15) %--------------------------------------------------------------------
   (16) SetAutoEpsilon( 0.03 )
   (17) y = 2E-08 + 0.002*t + 0.2*sin(t)
-> (18) y = 0.2*sin(t)

   (19) %--------------------------------------------------------------------
   (20) % Example 4:  SetAutoEpsilon 
   (21) %--------------------------------------------------------------------
   (22) SetAutoEpsilon( 0.3 )
   (23) z = 2E-08 + 0.002*t + 0.2*sin(t)
-> (24) z = 0



SetAutoExpress
SetAutoExpress

 Purpose:  Determines whether or not angular velocities and
           angular accelerations of rigid bodies in the
           NewtonianFrame are to be automatically expressed
           e.g., in terms of basis vectors fixed in the bodies.

  Syntax:  SetAutoExpress( SETTING )

   Input:  SETTING -- ON or OFF

  Remark:  SetAutoExpress(ON) affects the angular velocity and/or
           angular acceleration of a RigidBody B in the NewtonianFrame
           only if B's central inertia dyadic has been set.

  Remark:  Program default is SetAutoExpress( ON ).

 Related:  Express  GetDefaults

   (1) %--------------------------------------------------------------------
   (2) % Example 1:  SetAutoExpress( OFF )
   (3) %--------------------------------------------------------------------
   (4) SetAutoExpress( OFF )
   (5) NewtonianFrame N
   (6) RigidBody B
   (7) Variable  qB''
   (8) B.SetRotationMatrixX( N, qB )
-> (9) B_N = [1, 0, 0;  0, cos(qB), sin(qB);  0, -sin(qB), cos(qB)]

   (10) B.SetAngularVelocityAcceleration( N, qB'*Nx> )
-> (11) w_B_N> = qB'*Nx>
-> (12) alf_B_N> = qB''*Nx>

   (13) %--------------------------------------------------------------------
   (14) % Example 2:  SetAutoExpress( ON )
   (15) %--------------------------------------------------------------------
   (16) SetAutoExpress( ON )
   (17) RigidBody C
   (18) Variable  qC''
   (19) C.SetInertia( Ccm, 3, 2, 1 )
   (20) C.SetRotationMatrixX( N, qC )
-> (21) C_N = [1, 0, 0;  0, cos(qC), sin(qC);  0, -sin(qC), cos(qC)]

   (22) C.SetAngularVelocityAcceleration( N, qC'*Nx> )
-> (23) w_C_N> = qC'*Cx>
-> (24) alf_C_N> = qC''*Cx>



SetAutoFactor
SetAutoFactor

 Purpose:  Determines whether or not to automatically factor expressions.

  Syntax:  SetAutoFactor( SETTING )

   Input:  SETTING -- ON or OFF

  Remark:  Program default is SetAutoFactor( ON ).

 Related:  Factor  GetDefaults

   (1) %--------------------------------------------------------------------
   (2) % Example 1:  SetAutoFactor( OFF )
   (3) %--------------------------------------------------------------------
   (4) Constant  A,B,C
   (5) SetAutoFactor( OFF )
   (6) x = A*B + A*C + A*(B+C)^2
-> (7) x = A*B + A*C + A*(B+C)^2

   (8) %--------------------------------------------------------------------
   (9) % Example 2:  SetAutoFactor( ON )
   (10) %--------------------------------------------------------------------
   (11) SetAutoFactor( ON )
   (12) y = A*B + A*C + A*(B+C)^2
-> (13) y = A*(B+C+(B+C)^2)



SetAutoOverWrite
SetAutoOverWrite

 Purpose:  Determines whether to overwrite automatically or only
           when the user has responded affirmatively to a prompt.

  Syntax:  SetAutoOverWrite( SETTING )

   Input:  SETTING -- ON, OFF, or ALL

  Output:  SETTING  |  When prompt is issued:
           ---------------------------------------------------
           OFF      |  Before symbols or files are overwritten
                    |
           ON       |  Before files are overwritten
                    |
           ALL      |  Never (use with caution!)
           ---------------------------------------------------

  Remark:  Use  :=  to assign and overwrite without query.
           Use  +=  to accumulate sums.
           Similarly for  -=  *=  /=

  Remark:  Program default is SetAutoOverwrite( OFF ).

 Related:  GetDefaults   SetAutoDifferentiate  SetAutoOverwrite
           Solve  SolveDt  SolveSetInput  SolveSetInputDt  ...
           SolveQuadraticPositiveRoot  SolveQuadraticPositiveRootDt  ...
           SetDt  SetNoDt   =   :=   +=   *=   /=   ^=

   (1) %--------------------------------------------------------------------
   (2) % Example 1:  SetAutoOverwrite( OFF )
   (3) %--------------------------------------------------------------------
   (4) Variable y = sin(t)
-> (5) y = sin(t)

   (6) y := t^2     % Use  :=  to  overwrite without query. 
-> (7) y = t^2

   (8) %--------------------------------------------------------------------
   (9) % Example 2:  SetAutoOverwrite( ON )
   (10) %--------------------------------------------------------------------
   (11) SetAutoOverWrite( ON )
   (12) y = 351
-> (13) y = 351

   (14) Solve( y - exp(t), y )
-> (15) y = exp(t)



SetAutoRhs
SetAutoRhs

 Purpose:  Determines whether or not to replace symbols appearing
           on  the  left-hand  sides of equations with the right-
           hand  sides  of  the  equations when these symbols are
           used in expressions.

  Syntax:  SetAutoRhs( SETTING )

   Input:  SETTING -- ON, OFF, or ALL

  Output:  SETTING  |  When a symbol is replaced by its right-hand-side:
           -------------------------------------------------------------
           OFF      |  The name of a user-defined matrix.
                    |  The name of a user-defined vector or dyadic.
                    |
           ON       |  Symbols  replaced when SETTING is OFF
                    |  are also replaced when SETTING is ON.
                    |  In addition, certain other symbols that
                    |  have "small" right-hand-sides are replaced.
                    |
           ALL      |  Any symbol that has a right-hand-side.
           -------------------------------------------------------------

  Remark:  Program default is SetAutoRhs( ON ).

 Related:  Evaluate  Explicit  GetDefaults  GetRhs  ReplaceString  SetAutoRhs

   (1) %--------------------------------------------------------------------
   (2) % Example 1:  SetAutoRhs( OFF )
   (3) %--------------------------------------------------------------------
   (4) SetAutoRhs( OFF )
   (5) a = 3
-> (6) a = 3

   (7) b = 2 + a
-> (8) b = 2 + a

   (9) %--------------------------------------------------------------------
   (10) % Example 2:  SetAutoRhs( ON )
   (11) %--------------------------------------------------------------------
   (12) SetAutoRhs( ON )
   (13) c = 2 + a
-> (14) c = 5

   (15) d = cos(t) + c*sin(t) 
-> (16) d = cos(t) + 5*sin(t)

   (17) e = abs(t) + d
-> (18) e = abs(t) + d

   (19) %--------------------------------------------------------------------
   (20) % Example 3:  SetAutoRhs( ALL )
   (21) %--------------------------------------------------------------------
   (22) SetAutoRhs( ALL )
   (23) f = abs(t) + d
-> (24) f = abs(t) + cos(t) + 5*sin(t)



SetAutoSimplify
SetAutoSimplify

 Purpose:  Determines whether or not to automatically simplify
           certain mathematical expressions.

  Syntax:  SetAutoSimplify( ACOS=SETTING, ASIN=SETTING, ATAN=SETTING )

   Input:  SETTING -- ON or OFF

  Output:  When SETTING is ON, replaces

           Acos( cos(X) )  with  X
           Asin( sin(X) )  with  X
           Atan( tan(X) )  with  X

           where  X  is any symbolic (non-numeric) expression.

  Remark:  The proper range for x for each simplification is:
           Acos( cos(X) ) =  X        when      0 <= X <= pi
           Asin( sin(X) ) =  X        when  -pi/2 <= X <= pi/2
           Atan( tan(X) ) =  X        when  -pi/2 <= X <= pi/2
           Acos( sin(X) ) = -X+pi/2   when  -pi/2 <= X <= pi/2
           Asin( cos(X) ) = -X+pi/2   when      0 <= X <= pi

  Remark:  Program default is SetAutoSimplify( ACOS=OFF, ASIN=OFF, ATAN=OFF ).

 Related:  GetDefaults

   (1) %--------------------------------------------------------------------
   (2) % Example:  SetAutoSimplify
   (3) %--------------------------------------------------------------------
   (4) SetAutoSimplify( ACOS=ON, ASIN=ON, ATAN=OFF )
   (5) a = Acos( cos(t^3) )
-> (6) a = t^3

   (7) b = Asin( sin(t^3) )
-> (8) b = t^3

   (9) c = Atan( tan(t^3) )
-> (10) c = atan(tan(t^3))

   (11) d = Atan( tan(3) )
-> (12) d = -0.1415927



SetAutoTaylorSeries
SetAutoLinearize   SetAutoTaylorSeries

 Purpose:  Automatically expands all expressions in Taylor series.

Syntax 1:  SetAutoLinearize(           arg1, arg2, ... )
Syntax 2:  SetAutoTaylorSeries( Range, arg1, arg2, ... )
Syntax 3:  SetAutoLinearize(    SETTING )
Syntax 4:  SetAutoTaylorSeries( SETTING )

   Input:  Range -- n or n:m, where n and m are positive integers with n < m.
           Range -- 0:1  for SetAutoLinearize.

           argi -- the scalar name Ci (e.g., a constant or variable) or
                   the equation Ci = D (D is a scalar expression); or
                   the equation Ci = D:P, where P is a scalar name.

           SETTING -- ON or OFF

  Output:  The following table applies to the output expression F
           (F may be a scalar, vector, dyadic, or matrix expression).

           Range|    argi    |              Output
           -----|------------|-----------------------------------
             n  |  Ci        |  nth term of the Taylor series
                |            |  expansion of F about Ci = 0.
                |            |
             n  |  Ci = D    |  nth term of the Taylor series
                |            |  expansion of F about Ci = D.
                |            |
             n  |  Ci = D:P  |  nth term of the Taylor series
                |            |  expansion of F about Ci = D,
                |            |  with P in place of Ci - D.
                |            |
            n:m |  Ci        |  nth  through  mth  terms of Taylor
                |            |  expansion of F about Ci = 0.
                |            |
            n:m |  Ci = D    |  nth  through  mth  terms of Taylor
                |            |  expansion of F about Ci = D.
                |            |
            n:m |  Ci = D:P  |  nth  through  mth  terms of Taylor
                |            |  expansion of F about Ei = D,
                |            |  with P in place of Ci - D.

  Remark:  Syntax 1 and 2 automatically turns SETTING ON.
           Syntax 3 and 4 are useful only after using Syntax 1 or 2 and
           for subsequently turning SETTING OFF (and perhaps ON later).

  Remark:  Due to numerical round-off in Taylor series expansions, consider
           also issuing an "epsilon" command  SetAutoEpsilon( 1.0E-13 ).

 Related:  GetDefaults  SetAutoZee
           GetTaylorSeries  Linearize  SetAutoLinearize  SetAutoTaylorSeries


SetAutoZee
SetAutoZee

 Purpose:  Determines whether or not Zs are to automatically created.

  Syntax:  SetAutoZee( SETTING )

   Input:  SETTING -- OFF, ON, or AUTO

  Output:  When SETTING is ON, introduces, in selected expressions,
           Z1, Z2, ... as names for sub-expressions, and makes
           corresponding replacements.

           When SETTING is OFF, no Zs are automatically created.

           When SETTING is AUTO, no Zs are automatically created
           until a long expression is encountered, at which time,
           SETTING is turned ON.

  Remark:  Specific names can be excluded from Zs, provided the
           names occur only linearly in expressions.
           To this end, enter   SetNoZeeSymbol( M ),  where M is
           a name to be excluded or a matrix of names to be excluded.

  Remark:  The command SetAutoZee is not available with demonstration and
           certain educational and other licenses.

  Remark:  This command helps produce efficient equations and codes.

  Remark:  Program default is SetAutoZee( AUTO ).

 Related:  GetDefaults  SetAutoLinearize  SetAutoTaylorSeries  SetAutoZee
           Zee  SetNoZeeSymbol  ResetNoZeeSymbol  GetNoZeeSymbol

   (1) %--------------------------------------------------------------------
   (2) % Example 1:  SetAutoZee( OFF )
   (3) %--------------------------------------------------------------------
   (4) SetAutoZee( OFF )
   (5) NewtonianFrame  N
   (6) RigidBody A
   (7) Variable qA''
   (8) A.RotateX( N, qA )
-> (9) A_N = [1, 0, 0;  0, cos(qA), sin(qA);  0, -sin(qA), cos(qA)]
-> (10) w_A_N> = qA'*Ax>
-> (11) alf_A_N> = qA''*Ax>

   (12) %--------------------------------------------------------------------
   (13) % Example 2:  SetAutoZee( ON )
   (14) %--------------------------------------------------------------------
   (15) SetAutoZee( ON )
   (16) RigidBody B
   (17) Variable qB''
   (18) B.RotateX( N, qB )
-> (19) z1 = cos(qB)
-> (20) z2 = sin(qB)
-> (21) B_N = [1, 0, 0;  0, z1, z2;  0, -z2, z1]
-> (22) w_B_N> = qB'*Bx>
-> (23) alf_B_N> = qB''*Bx>



SetBasisSubscripts
SetBasisSubscripts

 Purpose:  Designates the last alphanumeric character in the name of
           right-handed orthogonal, unit vectors created when a
           RigidBody, RigidFrame, or NewtonianFrame is declared.

  Syntax:  SetBasisSubscripts( x,y,z )

   Input:  x,y,z -- three distinct, comma delimited, alphabetic
           characters (letters) or the numbers 1,2,3

  Output:  SetBasisSubscripts( x,y,z )  creates right-handed orthogonal
           unit vectors Bx>, By>, Bz>  fixed in B when:  RigidBody B,
           RigidFrame B,  or  NewtonianFrame B  is issued.

  Remark:  Program default is SetBasisSubscripts( x, y, z ).
           Basis subscripts may be changed at anytime.

 Related:  GetBasisVector  GetDefaults  SetBasisSubscripts

   (1) %--------------------------------------------------------------------
   (2) % Example 1:  SetBasisSubscripts (default basis subscripts)
   (3) %--------------------------------------------------------------------
   (4) RigidBody A
   (5) v> = Vector( A, 10, 20, 30 )
-> (6) v> = 10*Ax> + 20*Ay> + 30*Az>

   (7) %--------------------------------------------------------------------
   (8) % Example 2:  SetBasisSubscripts (vary basis subscripts)
   (9) %--------------------------------------------------------------------
   (10) SetBasisSubscripts( 1,2,3 )
   (11) w> = Vector( A, 10, 20, 30 )
-> (12) w> = 10*A1> + 20*A2> + 30*A3>

   (13) vChangesToo> = v>
-> (14) vChangesToo> = 10*A1> + 20*A2> + 30*A3>

   (15) %--------------------------------------------------------------------
   (16) % Example 3:  SetBasisSubscripts (vary basis subscripts again)
   (17) %--------------------------------------------------------------------
   (18) SetBasisSubscripts( i,j,k )
   (19) x> = Vector( A, 10, 20, 30 )
-> (20) x> = 10*Ai> + 20*Aj> + 30*Ak>

   (21) sum> = v> + w>
-> (22) sum> = 20*Ai> + 40*Aj> + 60*Ak>



SetBeepSoundOnError
SetBeepSoundOnError

 Purpose:  Determines whether or not to issue an audible beep
           sound when a warning or error message is issued.

  Syntax:  SetBeepSoundOnError( SETTING )

   Input:  SETTING -- ON or OFF

  Remark:  Program default is SetBeepSoundOnError( OFF ).

 Related:  GetDefaults



SetCharge
SetCharge

 Purpose:  Sets and returns the charge on a point or Particle.

Syntax 1:  Q.SetCharge( qCharge )
Syntax 2:  Q.SetCharge( expression )
Syntax 3:  Q.SetCharge( qCharge = expression )

   Input:  Q -- The name of a point or Particle.
           qCharge -- The name of a scalar
           expression - A scalar expression, e.g., sin(t).

Output 1:  Sets Q's charge to qCharge and returns qCharge.
           If not yet declared, qCharge is declared as a constant.

Output 2:  Sets Q's charge to expression and returns expression.

Output 3:  Sets Q's charge to qCharge.  Assigns qCharge to expression.
           Returns qCharge or expression.

 Related:  GetCharge  GetMass  SetCharge  SetMass
           AddForceElectrostatic

   (1) %--------------------------------------------------------------------
   (2) % Example: SetCharge 
   (3) %--------------------------------------------------------------------
   (4) Point      P, Q
   (5) Particle   R, S            
   (6) Variable   cS'
   (7) P.SetCharge( 17 )   
   (8) Q.SetCharge( cQ )               % Declares cQ as a constant.
   (9) R.SetCharge( cR = 3 Coulombs )  % Declares cR and sets it INPUT to 3 Coulombs
   (10) S.SetCharge( cS )               % cS may be governed by an ODE or equation


SetCMSymbol
SetCMSymbol

 Purpose:  Designates the symbol for the center of mass of bodies.

  Syntax:  SetCMSymbol( cm )

   Input:  cm -- alphanumeric  string with 10 or fewer characters
           used to identify the center of mass of bodies.

  Remark:  The SetCMSymbol command must be issued before any body is declared.

  Remark:  Program default is SetCMSymbol( cm ).

 Related:  GetDefaults

   (1) %--------------------------------------------------------------------
   (2) % Example:  SetCMSymbol 
   (3) %--------------------------------------------------------------------
   (4) SetCMSymbol( cm )
   (5) NewtonianFrame N
   (6) RigidBody B
   (7) B.SetMass( m )
   (8) Bcm.Translate( No, t^3*Nx> + sin(t)*Ny> )
-> (9) p_No_Bcm> = t^3*Nx> + sin(t)*Ny>
-> (10) v_Bcm_N> = 3*t^2*Nx> + cos(t)*Ny>
-> (11) a_Bcm_N> = 6*t*Nx> - sin(t)*Ny>

   (12) LinearMomentum> = B.GetLinearMomentum()
-> (13) LinearMomentum> = 3*m*t^2*Nx> + m*cos(t)*Ny>

   (14) B.SetAngularVelocity( N, 0> )
-> (15) w_B_N> = 0>

   (16) AngularMomentumAboutNo> = B.GetAngularMomentum( No )
-> (17) AngularMomentumAboutNo> = -m*t^2*(3*sin(t)-t*cos(t))*Nz>

   (18) KinetEnergy = B.GetKineticEnergy()
-> (19) KinetEnergy = 0.5*m*(9*t^4+cos(t)^2)



SetDefaults
SetDefaults

 Purpose:  Sets defaults to be compatible with older versions of the program.

  Syntax:  SetDefaults( AUTOLEV )

 Purpose:  Sets program defaults to be compatible with Autolev, e.g.,
           SetBasisSubscripts( 1, 2, 3 )
           SetCMSymbol( o )

  Remark:  To be AUTOLEV compatible when the program starts, edit the file
           MGDefaultPreferences.txt file  (in the MGToolbox folder).
           Un-comment the line (remove the percent sign) in front of:
           % SetDefaults  AUTOLEV

  Remark:  The following commands are available, albeit superseded.

       1.  CODE      superseded by   ODE and Solve
       2.  SIMPROT   superseded by   Rotate and SetRotationMatrix
       3.  V1PT      superseded by   SetVelocity
       4.  V2PTS     superseded by   SetVelocity
       5.  A1PT      superseded by   SetAcceleration
       6.  A2PTS     superseded by   SetAcceleration
       7.  KE        superseded by   GetKineticEnergy
       8.  FR        superseded by   GetGeneralizedForce
       9.  FRSTAR    superseded by  -GetGeneralizedEffectiveForce
      10.  TSTAR     superseded by  -GetMomentOfEffectiveForce
      11.  GYROSTAT  may be superseded in future versions

  Remark:  The following commands are only available when
           SetDefaults( AUTOLEV ) has been issued.

       1.  ARRANGE         replaced by   FactorLinear and FactorQuadratic
       2.  CM              replaced by   GetCMPosition
       3.  CODE DYNAMICS   replaced by   ODE
       4.  COEF( s, [x,y]  replaced by   GetCoefficientShallow( s, [x,y] )
                           superseded by GetCoefficient( s, [x,y] )
       5.  DEGREES         replaced by   ConvertUnits, Input, and Output
       6.  DIRCOS          replaced by   Rotate and SetRotationMatrix
       7.  EIG(M,A,B)      replaced by   GetEigen
       8.  INERTIA         replaced by   SetInertia and GetInertia
       9.  KANE            replaced by   GetDynamicsKane, GetStaticsKane, Solve
      10.  MASS            replaced by   SetMass and GetMass
      11.  MOMENTUM        replaced by   GetLinearMomentum, GetAngularMomentum, ...
      12.  MotionVariable  replaced by   Variable and SetGeneralizedSpeed
      13.  MotionVariable' replaced by   Variable and SetGeneralizedSpeed
      14.  NiCheck         replaced by   GetEnergyCheckKane
      15.  REPRESENT       replaced by   Matrix, Vector, and Dyadic
      16.  UNITS           replaced by   ConvertUnits, Input, and Output

  Remark:  The following old AUTOLEV commands are incompatible
           with this program -- regardless of SetDefaults( AUTOLEV ).

       1.  Force( Q,   Vec> )   replaced by  Q.AddForce( Vec> )
           Force( P/Q, Vec> )   replaced by  Q.AddForce( P, Vec> )

       2.  Torque( B,   Vec> )  replaced by  B.AddTorque( Vec> )
           Torque( A/B, Vec> )  replaced by  B.AddTorque( A, Vec> )

       3.  NiCheck( SIGMA )     replaced by  GetEnergyCheckSigmaR
       4.  Fr( listOfObject )   removed because theoretically unsound

 Related:  AUTOLEV  GetDefaults



SetComplex
SetComplex

 Purpose:  Determines whether to treat scalars as real or complex.

  Syntax:  SetComplex( SETTING )

   Input:  SETTING -- ON, OFF, or AUTO

  Remark:  SetComplex( Setting ) affects simplification.
           When Setting is OFF or AUTO, simplifications may assume that
           names declared by Constant, Specified, Variable, etc., are
           real (not imaginary or complex).

  Remark:  Expressions involving only real quantities are simplified
           maximally when SETTING is OFF, whereas expressions involving
           complex quantities are simplified maximally when SETTING is ON.
           When SETTING is AUTO, simplifications are made as if SETTING
           were OFF until the first imaginary number is encountered,
           at which time, SETTING is automatically changed to ON.

  Remark:  Program default is SetComplex( AUTO ).

 Related:  GetDefaults  ImaginaryNumber
           Constant  Specified  Variable

   (1) %--------------------------------------------------------------------
   (2) % Example 1:  SetComplex( OFF )
   (3) %--------------------------------------------------------------------
   (4) Variable x
   (5) SetComplex( OFF )
   (6) a = sqrt(x^2)
-> (7) a = abs(x)

   (8) b = Evaluate( a, x = 2 + GetImaginaryNumber() )  
-> (9) b = abs(2+imaginary)

   (10) c = Exp( GetImaginaryNumber() * x )
-> (11) c = exp(imaginary*x)

   (12) %--------------------------------------------------------------------
   (13) % Example 2:  SetComplex( ON )
   (14) %--------------------------------------------------------------------
   (15) SetComplex( ON )
   (16) d = sqrt(x^2)  
-> (17) d = sqrt(x^2)

   (18) e = Evaluate( a, x = 2 + GetImaginaryNumber() )  
-> (19) e = 2.236068

   (20) f = Evaluate( d, x = 2 + GetImaginaryNumber() )  
-> (21) f = 2 + imaginary

   (22) g = Exp( GetImaginaryNumber() * x )
-> (23) g = cos(x) + imaginary*sin(x)

   (24) %--------------------------------------------------------------------
   (25) % Example 3:  SetComplex( AUTO )
   (26) %--------------------------------------------------------------------
   (27) SetComplex( AUTO )
   (28) k = sqrt(x^2)                                 % Complex if OFF
-> (29) k = abs(x)

   (30) L = Evaluate( a, x = 2+GetImaginaryNumber() ) % Complex turns ON
-> (31) L = 2.236068

   (32) m = Exp( GetImaginaryNumber() * x )           % Complex is ON
-> (33) m = cos(x) + imaginary*sin(x)



SetDigits
SetDigits   GetDigits

 Purpose:  Sets an upper limit on the number of digits displayed on
           the screen when numerical values are reported.
           Governs the format and number of digits displayed in output
           files created in response to the ODE and Solve commands.

Syntax 1:  SetDigits( n )

Syntax 2:  GetDigits( )

 Input 1:  n -- a positive integer less than or equal to 16.

Output 2:  Returns the number  n  previously set in a SetDigits command.

  Remark:  Regardless of the value of n, all computations are performed
           in double precision and to machine accuracy.

  Remark:  Program default is SetDigits( 7 ).

 Related:  ODE  Solve  Input  Output  OutputPlot  Plot  Animate
           SetDigits  SetAutoEpsilon  Epsilon  GetDefaults

   (1) %--------------------------------------------------------------------
   (2) % Example 1:  SetDigits (default number of displayed digits)
   (3) %--------------------------------------------------------------------
   (4) x = exp(2)
-> (5) x = 7.389056

   (6) %--------------------------------------------------------------------
   (7) % Example 2:  SetDigits (vary the number of displayed digits)
   (8) %--------------------------------------------------------------------
   (9) SetDigits( 12 )
   (10) y = x
-> (11) y = 7.38905609893

   (12) SetDigits( 3 )
   (13) z = x
-> (14) z = 7.39

   (15) numberOfDigits = GetDigits()
-> (16) numberOfDigits = 3



SetDt
SetDt  or   SetNoDt

 Purpose:  Assigns a scalar quantity and its ordinary derivatives.

Syntax 1:  SetDt(   x = scalarExpression )
Syntax 2:  SetNoDt( x = scalarExpression )

   Input:  x -- a scalar name (e.g., a Variable or Specified).
           scalarExpression -- a differentiable scalar expression.

Output 1:  Assigns x   to       scalarExpression.
           Assigns x'  to   Dt( scalarExpression )
           Assigns x'' to DtDt( scalarExpression ) if x'' exists, etc.
           Returns x.

Output 2:  Assigns x to scalarExpression and returns x.
           x', x'', etc., are not assigned.

  Remark:  SetDt will assign x and as many ordinary derivatives
           of x as exist, e.g., x', x'', x''', etc.

  Remark:  SetNoDt will not set x' and will skip warning
           messages about the possible use of SetDt.

 Related:  D  Dt  DtDt  Integrate  MathFunctions
           SetDt  Solve  SolveDt  SolveSetInput  SolveSetInputDt  ...
           SolveQuadraticPositiveRoot  SolveQuadraticPositiveRootDt  ...

   (1) %--------------------------------------------------------------------
   (2) % Example 1:  SetDt( ... )
   (3) %--------------------------------------------------------------------
   (4) Variable  x'
   (5) SetDt( x = sin(t) )
-> (6) x = sin(t)
-> (7) x' = cos(t)

   (8) %--------------------------------------------------------------------
   (9) % Example 2:  SetDt( ... )
   (10) %--------------------------------------------------------------------
   (11) Specified y''
   (12) SetDt( y = t^3 )
-> (13) y = t^3
-> (14) y' = 3*t^2
-> (15) y'' = 6*t

   (16) %--------------------------------------------------------------------
   (17) % Example 3:  SetNoDt( ... )
   (18) %--------------------------------------------------------------------
   (19) SetNoDt( y = cos(t) )
-> (20) y = cos(t)



SetGeneralizedCoordinate
SetGeneralizedCoordinate   GetGeneralizedCoordinate

 Purpose:  Names generalized coordinates for Lagrange's method and for
           calculating generalized forces associated with potential energy.
           Returns a column matrix whose elements are generalized coordinates.

Syntax 1:  SetGeneralizedCoordinate( x, y, theta, qA, qB )
Syntax 2:  GetGeneralizedCoordinate()

   Input:  x, y, theta, qA, qB, -- names that start with a letter
           followed by a reasonable number of alphanumeric characters.

Output 1:  Appends x, y, ... qB to matrix of generalized coordinates.
Output 2:  Column matrix of names declared in SetGeneralizedCoordinate.

 Related:  Constant  ImaginaryNumber  Specified  Variable
           SetGeneralizedCoordinate  SetGeneralizedSpeed
           GetStatics   GetStaticsKane   GetStaticsLagrange
           GetDynamics  GetDynamicsKane  GetDynamicsLagrange


SetGeneralizedSpeed
SetGeneralizedSpeed   GetGeneralizedSpeed

 Purpose:  Names generalized speeds for Kane's method.
           Returns a column matrix whose elements are generalized speeds.

Syntax 1:  SetGeneralizedSpeed( qA', qB', wx, wy, u1, u2 )
Syntax 2:  GetGeneralizedSpeed()

 Input 1:  qA', qB', wx, wy, u1, u2, -- names that start with a letter
           followed by a reasonable number of alphanumeric characters,
           and that may end with one or more prime symbols '.

Output 1:  Appends qA', ... u2 to matrix of generalized speeds.
Output 2:  Column matrix of names declared in SetGeneralizedSpeed commands.

 Related:  Constant  ImaginaryNumber  Specified  Variable
           SetGeneralizedCoordinate  SetGeneralizedSpeed
           GetStatics   GetStaticsKane   GetStaticsLagrange
           GetDynamics  GetDynamicsKane  GetDynamicsLagrange

   (1) %--------------------------------------------------------------------
   (2) % Example: SetGeneralizedSpeed  (Projectile motion)
   (3) %--------------------------------------------------------------------
   (4) NewtonianFrame N
   (5) Particle P
   (6) P.SetMass( m = 1 kg )
   (7) Constant  g = 9.8 m/s^2
   (8) Variable  x'', y''
   (9) SetGeneralizedSpeed( x', y' )
   (10) P.Translate( No, x*Nx> + y*Ny> )
-> (11) p_No_P> = x*Nx> + y*Ny>
-> (12) v_P_N> = x'*Nx> + y'*Ny>
-> (13) a_P_N> = x''*Nx> + y''*Ny>

   (14) P.AddForce( -m*g*Ny> )
-> (15) Force_P> = -m*g*Ny>

   (16) KanesEquations = System.GetDynamicsKane()
-> (17) KanesEquations = [m*x'';  m*(g+y'')]

   (18) Solve( KanesEquations, x'', y'' )
-> (19) x'' = 0
-> (20) y'' = -g



SetNoZeeSymbol
SetNoZeeSymbol  ResetNoZeeSymbol   GetNoZeeSymbol

 Purpose:  Identifies scalar quantities that are to be excluded from Zs.

Syntax 1:  SetNoZeeSymbol( x, y, z )
Syntax 2:  ResetNoZeeSymbol( )
Syntax 3:  ResetNoZeeSymbol( x, y )
Syntax 4:  GetNoZeeSymbol( )

   Input:  x, y, z -- Names of a scalar symbol (e.g., a constant or variable)
                      or a matrix of scalar names.

Output 1:  Appends x, y, z to the matrix of names to be excluded from Zs.
           Returns the matrix of all names to be excluded from Zs.

Output 2:  Removes all names to be excluded from Zs.
           Returns 1x1 zero matrix.

Output 3:  Removes all names to be excluded from Zs.
           Appends x, y to the matrix of names to be excluded from Zs.
           Returns the 2x1 matrix [x; y] -- names to be excluded from Zs.

Output 4:  Returns the matrix of all names to be excluded from Zs.

  Remark:  Names can be excluded from Zs provided that occur only linearly.

 Related:  Explicit  Zee  GetRhs  SetAutoRhs
           SetNoZeeSymbol  ResetNoZeeSymbol  GetNoZeeSymbol

   (1) %--------------------------------------------------------------------
   (2) % Example 1: SetNoZeeSymbol  (with scalar expressions)
   (3) %--------------------------------------------------------------------
   (4) Constant   a, b, c
   (5) ScalarExpression = (a-b)*cos(t) + (b-c)*sin(t)
-> (6) ScalarExpression = (a-b)*cos(t) + (b-c)*sin(t)

   (7) SetNoZeeSymbol( a )
   (8) testA = Zee( ScalarExpression )
-> (9) z1 = cos(t)
-> (10) z2 = sin(t)
-> (11) z3 = b - c
-> (12) z4 = z3*z2 - b*z1
-> (13) testA = z4 + a*z1

   (14) SetNoZeeSymbol( b )
   (15) testB = Zee( ScalarExpression )
-> (16) z5 = z2 - z1
-> (17) z6 = c*z2
-> (18) testB = a*z1 + b*z5 - z6

   (19) ResetNoZeeSymbol()
   (20) testC = Zee( ScalarExpression )
-> (21) z7 = a - b
-> (22) z8 = z3*z2 + z7*z1
-> (23) testC = z8

   (24) %--------------------------------------------------------------------
   (25) % Example 2: SetNoZeeSymbol  (with matrix expressions)
   (26) %--------------------------------------------------------------------
   (27) Variable x, y
   (28) matrix[1] = 10 + a + b + c + abs(t)*x + sin(t)*exp(t)*cos(t^2)*y
-> (29) matrix[1] = 10 + a + b + c + abs(t)*x + sin(t)*exp(t)*cos(t^2)*y

   (30) matrix[2] = 10 + a^2 + cos(b+c)*tan(t)*x
-> (31) matrix[2] = 10 + a^2 + cos(b+c)*tan(t)*x

   (32) SetNoZeeSymbol( x, y )
   (33) testD = Zee( matrix )
-> (34) z9 = abs(t)
-> (35) z10 = exp(t)
-> (36) z11 = cos(t^2)
-> (37) z12 = z2*z10*z11
-> (38) z13 = 10 + a + b + c
-> (39) z14 = cos(b+c)
-> (40) z15 = tan(t)
-> (41) z16 = z14*z15
-> (42) z17 = 10 + a^2
-> (43) testD = [z13 + z9*x + z12*y;  z17 + z16*x]

   (44) noZeeSymbols = GetNoZeeSymbol()
-> (45) noZeeSymbols = [x;  y]



SetLineSpacing
SetLineSpacing

 Purpose:  Sets output line spacing.

  Syntax:  SetLineSpacing( n )

   Input:  n -- 0 or 1 or 2 or a positive integer (e.g., less than 10).

  Remark:  When n = 0, input lines follow each other without
           intervening blank lines, and an input line that
           follows a response line is preceded by a blank line.
           When n > 0, n-1 blank lines follow each input line
           and each response line.

  Remark:  Program default is SetLineSpacing( 0 ).

 Related:  GetDefaults  SetLineStepping

   (1) %--------------------------------------------------------------------
   (2) % Example 1: SetLineSpacing (uses the default value 0)
   (3) %--------------------------------------------------------------------
   (4) SetLineSpacing( 0 )
   (5) A = t^2
-> (6) A = t^2

   (7) B = t^2
-> (8) B = t^2

   (9) %--------------------------------------------------------------------
   (10) % Example 2: SetLineSpacing (single spacing)
   (11) %--------------------------------------------------------------------
   (12) SetLineSpacing( 1 )
   (13) A := t^2
-> (14) A = t^2
   (15) B := t^2
-> (16) B = t^2
   (17) %--------------------------------------------------------------------
   (18) % Example 3: SetLineSpacing (double spacing)
   (19) %--------------------------------------------------------------------
   (20) SetLineSpacing( 2 )

   (21) A := t^2

-> (22) A = t^2

   (23) B := t^2

-> (24) B = t^2



SetLineStepping
SetLineStepping

 Purpose:  Runs an input file one line at a time.

  Syntax:  SetLineStepping( SETTING )

   Input:  SETTING -- ON or OFF

  Remark:  When running an input file with SETTING is ON, the cursor
           appears near a question mark to prompt the user.
           Pressing  Enter  causes the next input line to appear on
           the screen or causes all response lines corresponding to
           an input line to be displayed.

           When SETTING is ON, pressing the  Esc  key and pressing
           Enter causes any input lines that were read to be processed,
           causes the question mark to disappear, suspends running
           the input file, and enables normal operation.
           Subsequently, typing  RUN  at a line prompt runs the
           input file with the question mark and line stepping ON.

  Remark:  Program default is SetLineStepping( OFF ).

 Related:  GetDefaults  Run  SetLineStepping

--------------------------------------------------------------------
 Example:  SetLineStepping
--------------------------------------------------------------------

   (1) SetLineStepping( ON )
   (2) Run( TESTFILE )
   (2) ?



SetLineWidth
SetLineWidth

 Purpose:  Sets the line width for writing output to .all or .html files
           (in conjunction with the SAVE command) or in writing C, Fortran,
           MATLAB(R) codes (in conjunction with the CODE or ODE commands).

  Syntax:  SetLineWidth( lineWidth )

   Input:  lineWidth -- 0 or a positive integer less than 65536.

  Remark:  If lineWidth = 0, the following program defaults are used:
           -------------------------------------------------------
            File type |  Line width |  Strict limit |  Use
           -------------------------------------------------------
           .all       |  80         |  No           |  Text file
           .html      |  80         |  No           |  Browser
           .m         |  128        |  No           |  MATLAB(R)
           .c         |  128        |  No           |  C
           .f         |  120        |  No           |  FORTRAN
           .for       |  72         |  Yes          |  FORTRAN 77

 Related:  Save  Code  ODE

--------------------------------------------------------------------
 Example:  SetLineWidth  (tests SetLineWidth function)
--------------------------------------------------------------------
 x = expand( (t+cos(t))^24,  0:24 )
 SetLineWidth( 150 )
 y = expand( (t+cos(t))^24,  0:24 )
 Save  SetLineWidth.html

 Input  t = 0.25
 OutputEncode  x, y
 CODE Algebraic() SetLineWidth.m



SetMass
SetMass

 Purpose:  Sets and returns the mass of a Particle or RigidBody.

Syntax 1:  B.SetMass( mB )
Syntax 2:  B.SetMass( expression )
Syntax 3:  B.SetMass( mB = expression )
Syntax 4:  B.SetMass( mB = 10 kg )

   Input:   B -- The name of a Particle or RigidBody.
           mB -- The name of a scalar.
           expression -- Scalar expression, e.g., sin(t).

Output 1:  Sets B's mass to mB and returns mB.
           Declares mB as a non-negative constant (if not yet declared).

Output 2:  Sets B's mass to expression and returns expression.

Output 3:  Sets B's mass to mB.  Assigns mB to expression.
           Returns mB or expression.

Output 4:  Sets B's mass to mB.  Assigns the input value of mB to 10 kg.
           Returns mB.

 Related:  SetMass          GetMass         SetInertia
           GetCMPosition    GetCmVelocity   GetCmAcceleration
           GetInertiaDyadic  GetInertiaMatrix  GetMomentOfInertia
           GetProductOfInertia  GetRadiusOfGyration  GetInertiaVector

   (1) %--------------------------------------------------------------------
   (2) % Example: SetMass 
   (3) %--------------------------------------------------------------------
   (4) Particle   P, Q, R, S            
   (5) RigidBody  B
   (6) Variable   mS'
   (7) P.SetMass( 17 )   
   (8) Q.SetMass( mQ )         % Declares mQ as a non-negative constant
   (9) R.SetMass( mR = 3 kg )  % Declares mR and sets its INPUT value to 3 kg
   (10) S.SetMass( mS )         % mS may be governed by an ODE or equation
   (11) B.SetMass( mB )         % Declares mB as a non-negative constant
   (12) mSystem= System.GetMass()    
-> (13) mSystem = 17 + mB + mQ + mR + mS



SetMassInertia
SetMassInertia   (also see SetMass and SetInertia)

 Purpose:  Sets a RigidBody's mass and inertia about its center of mass.
           Returns the associated inertia dyadic.

Syntax 1:  B.SetMassInertia( mB, IBxx, IByy, IBzz )
Syntax 2:  B.SetMassInertia( mB, IBxx, IByy, IBzz, IBxy, IByz, IBzx )
Syntax 3:  B.SetMassInertia( mB, aboutPoint, A, I11, I22, I33 )
Syntax 4:  B.SetMassInertia( mB, aboutPoint, A, I11, I22, I33, I12, I23, I31 )
Syntax 5:  B.SetMassInertia( mB, aboutPoint, symmetricInertiaDyadic )
Syntax 6:  B.SetMassInertia( mB, aboutPoint, threeElementMatrix )
Syntax 7:  B.SetMassInertia( mB, aboutPoint, 3x3symmetricMatrix  )

   Input:  B -- The name of a RigidBody.

           mB -- The mass of B.  This argument can be an expression such as
                 mB = sin(t) or set an input value with mB = 10 kg.

           aboutPoint -- The name of a point (typically fixed on B).

           IBxx, IByy, IBzz -- B's moments  of inertia about aboutPoint
                               for Bx>, By>, and Bz>, respectively.

           IBxy, IByz, IBzx -- B's products of inertia about aboutPoint
                               for  Bx>*By>,  By>*Bz>,  and  Bz>*Bx>.

           A -- The name of a RigidBody or RigidFrame.

           I11, I22, I33 -- B's moments  of inertia about aboutPoint
                            for Ax>, Ay>, and Az>, respectively.

           I12, I23, I31 -- B's products of inertia about aboutPoint
                            for  Ax>*Ay>,  Ay>*Az>,  and  Az>*Ax>.
                            Note the cyclical permutation ordering.

           symmetricInertiaDyadic -- A symmetric inertia dyadic.

           threeElementMatrix -- 3 x 1  or  1 x 3  matrix of real scalars.

           3x3symmetricMatrix -- 3 x 3  symmetric matrix of real scalars.

 Outputs:  In each case, sets and returns B's inertia dyadic about aboutPoint.

Output:    Calls:  B.SetMass( mB )   then subsequently returns the following
Output 1:  B.SetInertia( Bcm, IBxx, IByy, IBzz )
Output 2:  B.SetInertia( Bcm, IBxx, IByy, IBzz, IBxy, IByz, IBzx )
Output 3:  B.SetMassInertia( aboutPoint, I11, I22, I33 )
Output i:  Corresponding  B.SetInertia( .... )  commands  (i = 4, 5, 6).

  Remark:  Declares  mB, IBxx, IByy, IBzz  as non-negative constants or
           IBxy, IByz, IBzx as constants (if not yet declared).  Alternately,
           the inertia scalars IBxx, IByy, ... can be an expression such as
           Ixy = -m*x*y or a number with units, e.g.,  Ixy = -6 kg*m^2.

  Remark:  Products of inertia adhere to the "negative sign convention".
           Example: For a 1 kg particle whose position from a point P is
           2*Nx> + 3*Ny>, the product of inertia Ixy = -m*x*y = -6 kg*m^2.

 Related:  SetMass              GetMass              SetInertia
           GetCMPosition        GetCmVelocity        GetCmAcceleration
           GetInertiaDyadic     GetInertiaMatrix     GetMomentOfInertia
           GetProductOfInertia  GetRadiusOfGyration  GetInertiaVector

   (1) %--------------------------------------------------------------------
   (2) % Example: SetMassInertia 
   (3) %--------------------------------------------------------------------
   (4) RigidFrame N   
   (5) RigidBody  A, B, C, D, E, F
   (6) A.SetMassInertia( m, IAxx, IAyy, IAzz )  
   (7) B.SetMassInertia( m, IBxx, IByy, IBzz, IBxy, IByz, IBzx ) 
   (8) C.SetMassInertia( m, Ccm, N, I11, I22, I33 )
   (9) D.SetMassInertia( m, Dcm, 5*1>> )
   (10) E.SetMassInertia( m, Eo, [2, 3, 4] )
   (11) F.SetMassInertia( m, Fo, [2, -0.1, 0;  -0.1, 3, 0;  0, 0, 4] )
   (12) %--------------------------------------------------------------------
   (13) AInertiaAboutAcm>> = A.GetInertia( Acm )
-> (14) AInertiaAboutAcm>> = IAxx*Ax>*Ax> + IAyy*Ay>*Ay> + IAzz*Az>*Az>

   (15) DInertiaAboutDcm>> = D.GetInertia( Dcm )
-> (16) DInertiaAboutDcm>> = 5*1>>

   (17) EInertiaAboutEo>> = E.GetInertia( Eo )
-> (18) EInertiaAboutEo>> = 2*Ex>*Ex> + 3*Ey>*Ey> + 4*Ez>*Ez>



SetInertia
SetInertia

 Purpose:  Sets and returns a RigidBody's inertia dyadic about a point.

Syntax 1:  B.SetInertia( aboutPoint, IBxx, IByy, IBzz )
Syntax 2:  B.SetInertia( aboutPoint, IBxx, IByy, IBzz, IBxy, IByz, IBzx )
Syntax 3:  B.SetInertia( aboutPoint, A, I11, I22, I33 )
Syntax 4:  B.SetInertia( aboutPoint, A, I11, I22, I33, I12, I23, I31 )
Syntax 5:  B.SetInertia( aboutPoint, symmetricInertiaDyadic )
Syntax 6:  B.SetInertia( aboutPoint, threeElementMatrix )
Syntax 7:  B.SetInertia( aboutPoint, 3x3symmetricMatrix  )

   Input:  B -- The name of a RigidBody.

           aboutPoint -- The name of a point (typically fixed on B).

           IBxx, IByy, IBzz -- B's moments  of inertia about aboutPoint
                               for Bx>, By>, and Bz>, respectively.

           IBxy, IByz, IBzx -- B's products of inertia about aboutPoint
                               for  Bx>*By>,  By>*Bz>,  and  Bz>*Bx>.
                               Note the cyclical permutation ordering.

           A -- The name of a RigidBody or RigidFrame.

           I11, I22, I33 -- B's moments  of inertia about aboutPoint
                            for Ax>, Ay>, and Az>, respectively.

           I12, I23, I31 -- B's products of inertia about aboutPoint
                            for  Ax>*Ay>,  Ay>*Az>,  and  Az>*Ax>.
                            Note the cyclical permutation ordering.

           symmetricInertiaDyadic -- A symmetric inertia dyadic.

           threeElementMatrix -- 3 x 1  or  1 x 3  matrix of real scalars.

           3x3symmetricMatrix -- 3 x 3  symmetric matrix of real scalars.

 Outputs:  In each case, sets and returns B's inertia dyadic about aboutPoint.

Output 1:  Sets and returns IBxx*Bx>*Bx> + IByy*By>*By> + IBzz*Bz>*Bz>

Output 2:  Sets and returns IBxx*Bx>*Bx> + IBxy*Bx>*By> + IBzx*Bx>*Bz> +
                            IBxy*By>*Bx> + IByy*By>*By> + IByz*By>*Bz> +
                            IBzx*Bz>*Bx> + IByz*Bz>*Bx> + IBzz*Bz>*Bz>

Output 3:  Sets and returns I11*Ax>*Ax> + I22*Ay>*Ay> + I33*Az>*Az>

Output 4:  Sets and returns I11*Ax>*Ax> + I12*Ax>*Ay> + I31*Ax>*Az> +
                            I12*Ay>*Ax> + I22*Ay>*Ay> + I23*Ay>*Az> +
                            I31*Az>*Ax> + I23*Az>*Ax> + I33*Az>*Az>

Output 5:  Sets and returns symmetricInertiaDyadic.

Output 6:  When threeElementMatrix is the 3x1 matrix m,
           sets and returns m[1]*Bx>*Bx> + m[2]*By>*By> + m[3]*Bz>*Bz>

Output 7:  When 3x3symmetricMatrix is the matrix I,
           Sets and returns I[1,1]*Bx>*Bx> + I[1,2]*Bx>*By> + I[1,3]*Bx>*Bz> +
                            I[2,1]*By>*Bx> + I[2,2]*By>*By> + I[2,3]*By>*Bz> +
                            I[3,1]*Bz>*Bx> + I[3,2]*Bz>*Bx> + I[3,3]*Bz>*Bz>

  Remark:  If moments of inertia such as IBxx are not already declared,
           they are declared as non-negative constants.

           If products of inertia such as IBxy are not already declared,
           they are declared as constants.

           IBij (i,j=x,y,z) can be an expression such as IBxx = m*r^2/2

  Remark:  Products of inertia adhere to the "negative sign convention".
           Example: For a 1 kg particle whose position from a point P is
           2*Nx> + 3*Ny>, the product of inertia Ixy = -m*x*y = -6 kg*m^2.

 Related:  SetMass          GetMass         SetInertia
           GetCMPosition    GetCmVelocity   GetCmAcceleration
           GetInertiaDyadic  GetInertiaMatrix  GetMomentOfInertia
           GetProductOfInertia  GetRadiusOfGyration  GetInertiaVector

   (1) %--------------------------------------------------------------------
   (2) % Example: SetInertia 
   (3) %--------------------------------------------------------------------
   (4) RigidFrame N   
   (5) RigidBody  A, B, C, D, E, F
   (6) A.SetInertia( Acm, IAxx, IAyy, IAzz )  
   (7) B.SetInertia( Bcm, IBxx, IByy, IBzz, IBxy, IByz, IBzx ) 
   (8) C.SetInertia( Ccm, N, I11, I22, I33 )
   (9) D.SetInertia( Dcm, 5*1>> )
   (10) E.SetInertia( Eo, [2, 3, 4] )
   (11) F.SetInertia( Fo, [2, -0.1, 0;  -0.1, 3, 0;  0, 0, 4] )
   (12) %--------------------------------------------------------------------
   (13) AInertiaAboutAcm>> = A.GetInertia( Acm )
-> (14) AInertiaAboutAcm>> = IAxx*Ax>*Ax> + IAyy*Ay>*Ay> + IAzz*Az>*Az>

   (15) DInertiaAboutDcm>> = D.GetInertia( Dcm )
-> (16) DInertiaAboutDcm>> = 5*1>>

   (17) EInertiaAboutEo>> = E.GetInertia( Eo )
-> (18) EInertiaAboutEo>> = 2*Ex>*Ex> + 3*Ey>*Ey> + 4*Ez>*Ez>



SetPauseOnWarning
SetPauseOnWarning

 Purpose:  Sets the duration of the pause that occurs when a warning is
           issued during execution of an input file.

Syntax 1:  SetPauseOnWarning( numberOfSeconds )
Syntax 2:  SetPauseOnWarning( WAIT )

   Input:  numberOfSeconds -- an integer between 0 and 60, equal to the
           desired duration, in seconds, of the pause following a warning.
           Note: No pause occurs when numberOfSeconds is 0.

           WAIT -- WAIT

Output 1:  Suspends program execution for numberOfSeconds.
Output 2:  Suspends program execution until the user presses the ENTER key.

  Remark:  Program default is SetPauseOnWarning( WAIT ).
           This default can be set in the MGDefaultPreferences.txt
           file that resides in the program's MGToolbox folder.

  Remark:  If reading from an input file stops, you may type RUN
           to resume execution from the input file.

 Related:  Pause  SetPauseOnWarning  GetDefaults



SetRotationMatrix
SetRotationMatrix

 Purpose:  Sets the rotation matrix relating two sets of bases vectors
           associated with right-handed rotations of B relative to A.

Syntax 1:  B.SetRotationMatrix( A, aboutUnitVector, q1 )
Syntax 2:  B.SetRotationMatrix( A, SequenceI,   q1 )
Syntax 3:  B.SetRotationMatrix( A, SequenceIJ,  q1, q2 )
Syntax 4:  B.SetRotationMatrix( A, SequenceIJK, q1, q2, q3 )
Syntax 5:  B.SetRotationMatrix( A, EulerParameters, e0, e1, e2, e3 )
           B.SetRotationMatrix( A, Quaternion,      e0, e1, e2, e3 )
Syntax 6:  B.SetRotationMatrix( A, RodriguesParameters, rho1, rho2, rho3 )
Syntax 7:  B.SetRotationMatrix( A, PoissonParameters, Rxx,Rxy, ..., Rzz )
Syntax 8:  B.SetRotationMatrix( A, matrix33 )
Syntax 9:  B.SetRotationMatrixX( A, q )  B.SetRotationMatrixNegativeX( A, q )
           B.SetRotationMatrixY( A, q )  B.SetRotationMatrixNegativeY( A, q )
           B.SetRotationMatrixZ( A, q )  B.SetRotationMatrixNegativeZ( A, q )
           Type  HELP SetRotationMatrixX  for examples.

   Input:  B -- name of a RigidFrame or RigidBody.
           A -- name of another RigidFrame or RigidBody.

           q1, q2, q3 -- angles (scalar expressions).

           aboutUnitVector -- a unit vector that can be expressed in
                   terms of either Ax>, Ay>, Az>  or  Bx>, By>, Bz>.

           SequenceI -- BodyI or SpaceI where I is X, -X, Y, -Y, Z, -Z, e.g.,
                          BodyX,  BodyY,  BodyZ,  -BodyX,  Body-Y, etc.
                         SpaceX, SpaceY, SpaceZ, -SpaceX, Space-Y, etc.

           SequenceIJ -- BodyIJ or Space IJ where I and J are appropriate
                         combinations of X, -X, Y, -Y, Z, -Z, e.g.,
                         BodyXY,  BodyXZ,  BodyYX,  BodyYZ,  BodyZX,  BodyZY
                        SpaceXY, SpaceXZ, SpaceYX, SpaceYZ, SpaceZX, SpaceZY
                        Body-XY,  BodyX-Z,  Body-Y-X, Space-XY, etc.

           SequenceIJK -- BodyIJK or SpaceIJK where I, J, K are appropriate
                          combinations of X, -X, Y, -Y, Z, -Z, e.g.,
                   BodyXYZ,  BodyYZX,  BodyZXY,  BodyXZY,  BodyYXZ,  BodyZYX
                   BodyXYX,  BodyXZX,  BodyYXY,  BodyYZY,  BodyZXZ,  BodyZYZ
                  SpaceXYZ, SpaceYZX, SpaceZXY, SpaceXZY, SpaceYXZ, SpaceZYX
                  SpaceXYX, SpaceXZX, SpaceYXY, SpaceYZY, SpaceZXZ, SpaceZYZ
                  Body-XYZ, BodyX-YZ, BodyXY-Z, Body-X-YZ,  Space-X-Y-Z, etc.

           e0, e1, e2, e3 -- expressions for Euler parameters (quaternion).

           rho1, rho2, rho3 -- expressions for Rodrigues parameters.

           Rxx,Rxy,Rxz, Ryx,Ryy,Ryz, Rzx,Rzy,Rzz - expressions for elements.

           matrix33 -- 3x3 rotation matrix (direction cosine matrix).

  Output:  Sets and returns the rotation matrix that relates
           Bx>, By>, Bz>  to  Ax>, Ay>, Az>

  Remark:  Definitions of orientation angles, Euler parameters (quaternion),
           Rodrigues parameters, and direction cosines are in
           Kane, T. R.,  Likins, P. W.,  and Levinson D. A.,
           Spacecraft Dynamics, McGraw-Hill, 1983, Ch. 1., and
           Mitiguy, Paul, Advanced Dynamics for Professional
           Mechanical, Aerospace, and BioMechanical Engineers.

 Related:  Rotate  RotateX  RotateY  RotateZ
           RotateNegativeX  RotateNegativeY  RotateNegativeZ
           SetRotationMatrixX  SetRotationMatrixY  SetRotationMatrixZ
           SetRotationMatrixNegativeX  SetRotationMatrixNegativeY  ...
           SetRotationMatrix  SetAngularVelocity  SetAngularAcceleration
           GetRotationMatrix  GetAngularVelocity  GetAngularAcceleration
           SetRotationMatrixODE   SetRotationMatrixAndPosition

   (1) %--------------------------------------------------------------------
   (2) % Examples 1 & 2: SetRotationMatrix (simple rotations with one angle) 
   (3) %--------------------------------------------------------------------
   (4) AutoOverwrite ON
   (5) RigidFrame A, B
   (6) Variable   q1, q2, q3
   (7) %--------------------------------------------------------------------
   (8) B.SetRotationMatrix( A, -BodyZ,  q1 )
-> (9) B_A = [cos(q1), -sin(q1), 0;  sin(q1), cos(q1), 0;  0, 0, 1]

   (10) B.SetRotationMatrix( A, UnitVector(3*By>+4*Bz>), q1 )
-> (11) B_A[1,1] = cos(q1)
-> (12) B_A[1,2] = 0.8*sin(q1)
-> (13) B_A[1,3] = -0.6*sin(q1)
-> (14) B_A[2,1] = -0.8*sin(q1)
-> (15) B_A[2,2] = 0.36 + 0.64*cos(q1)
-> (16) B_A[2,3] = 0.48 - 0.48*cos(q1)
-> (17) B_A[3,1] = 0.6*sin(q1)
-> (18) B_A[3,2] = 0.48 - 0.48*cos(q1)
-> (19) B_A[3,3] = 0.64 + 0.36*cos(q1)

   (20) %--------------------------------------------------------------------
   (21) % Example 3: SetRotationMatrix (successive rotations with two angles)
   (22) %--------------------------------------------------------------------
   (23) B.SetRotationMatrix( A,  Space-Y-X,  q1, q2 )
-> (24) B_A[1,1] = cos(q1)
-> (25) B_A[1,2] = sin(q1)*sin(q2)
-> (26) B_A[1,3] = sin(q1)*cos(q2)
-> (27) B_A[2,1] = 0
-> (28) B_A[2,2] = cos(q2)
-> (29) B_A[2,3] = -sin(q2)
-> (30) B_A[3,1] = -sin(q1)
-> (31) B_A[3,2] = sin(q2)*cos(q1)
-> (32) B_A[3,3] = cos(q1)*cos(q2)

   (33) %--------------------------------------------------------------------
   (34) % Example 4: SetRotationMatrix (successive rotations with three angles)
   (35) %--------------------------------------------------------------------
   (36) B.SetRotationMatrix( A, BodyXYZ,   q1, q2, q3 )                 
-> (37) B_A[1,1] = cos(q2)*cos(q3)
-> (38) B_A[1,2] = sin(q3)*cos(q1) + sin(q1)*sin(q2)*cos(q3)
-> (39) B_A[1,3] = sin(q1)*sin(q3) - sin(q2)*cos(q1)*cos(q3)
-> (40) B_A[2,1] = -sin(q3)*cos(q2)
-> (41) B_A[2,2] = cos(q1)*cos(q3) - sin(q1)*sin(q2)*sin(q3)
-> (42) B_A[2,3] = sin(q1)*cos(q3) + sin(q2)*sin(q3)*cos(q1)
-> (43) B_A[3,1] = sin(q2)
-> (44) B_A[3,2] = -sin(q1)*cos(q2)
-> (45) B_A[3,3] = cos(q1)*cos(q2)

   (46) %--------------------------------------------------------------------
   (47) % Example 5: SetRotationMatrix (Euler parameters / quaternion )
   (48) %--------------------------------------------------------------------
   (49) Variable  e0, e1, e2, e3
   (50) B.SetRotationMatrix( A,  EulerParameters, e0, e1, e2, e3 )
-> (51) B_A[1,1] = -1 + 2*e0^2 + 2*e1^2
-> (52) B_A[1,2] = 2*e0*e3 + 2*e1*e2
-> (53) B_A[1,3] = 2*e1*e3 - 2*e0*e2
-> (54) B_A[2,1] = 2*e1*e2 - 2*e0*e3
-> (55) B_A[2,2] = -1 + 2*e0^2 + 2*e2^2
-> (56) B_A[2,3] = 2*e0*e1 + 2*e2*e3
-> (57) B_A[3,1] = 2*e0*e2 + 2*e1*e3
-> (58) B_A[3,2] = 2*e2*e3 - 2*e0*e1
-> (59) B_A[3,3] = -1 + 2*e0^2 + 2*e3^2

   (60) %--------------------------------------------------------------------
   (61) % Example 6: SetRotationMatrix (Rodrigues parameters / Gibbs vector)
   (62) %--------------------------------------------------------------------
   (63) Variable  rho0, rho1, rho2
   (64) B.SetRotationMatrix( A,  RodriguesParameters, rho0, rho1, rho2 )
-> (65) B_A[1,1] = (1+rho0^2-rho1^2-rho2^2)/(1+rho0^2+rho1^2+rho2^2)
-> (66) B_A[1,2] = 2*(rho2+rho0*rho1)/(1+rho0^2+rho1^2+rho2^2)
-> (67) B_A[1,3] = -2*(rho1-rho0*rho2)/(1+rho0^2+rho1^2+rho2^2)
-> (68) B_A[2,1] = -2*(rho2-rho0*rho1)/(1+rho0^2+rho1^2+rho2^2)
-> (69) B_A[2,2] = (1+rho1^2-rho0^2-rho2^2)/(1+rho0^2+rho1^2+rho2^2)
-> (70) B_A[2,3] = 2*(rho0+rho1*rho2)/(1+rho0^2+rho1^2+rho2^2)
-> (71) B_A[3,1] = 2*(rho1+rho0*rho2)/(1+rho0^2+rho1^2+rho2^2)
-> (72) B_A[3,2] = -2*(rho0-rho1*rho2)/(1+rho0^2+rho1^2+rho2^2)
-> (73) B_A[3,3] = -(-1+rho0^2+rho1^2-rho2^2)/(1+rho0^2+rho1^2+rho2^2)

   (74) %--------------------------------------------------------------------
   (75) % Example 7: SetRotationMatrix (Poisson parameters)
   (76) %--------------------------------------------------------------------
   (77) Variable  R{1:3}{1:3}
   (78) B.SetRotationMatrix( A, PoissonParameters, R11,R12,R13, R21,R22,R23, R31,R32,R33 )
-> (79) B_A = [R11, R12, R13;  R21, R22, R23;  R31, R32, R33]

   (80) %--------------------------------------------------------------------
   (81) % Example 8: SetRotationMatrix (Directly from 3x3 matrix)
   (82) %--------------------------------------------------------------------
   (83) B.SetRotationMatrix( A, [R11,R12,R13; R21,R22,R23; R31,R32,R33] )
-> (84) B_A = [R11, R12, R13;  R21, R22, R23;  R31, R32, R33]

   (85) %--------------------------------------------------------------------
   (86) % Note: For more examples, type HELP for one of the following:
   (87) %       SetRotationMatrix
   (88) %       SetRotationMatrixX      SetRotationMatrixNegativeX
   (89) %       SetRotationMatrixY      SetRotationMatrixNegativeY
   (90) %       SetRotationMatrixZ      SetRotationMatrixNegativeZ


SetRotationMatrixAndPosition
SetRotationMatrixAndPosition

 Purpose:  Sets the rotation matrix and position vector associated with
           two rigid frames (or rigid bodies).

  Syntax:  B.SetRotationMatrixAndPosition( A, matrix33, p )

   Input:  B -- name of a RigidFrame or RigidBody.
           A -- name of another RigidFrame or RigidBody.

           matrix33 -- 3x3 rotation matrix (direction cosine matrix).
           p        -- position matrix with 3 elements.

  Output:  Calls the following two methods:
           B.SetRotationMatrix( A,  matrix33 )
           Bo.SetPosition( Ao,  p[1]*Ax> + p[2]*Ay> + p[3]*Az> )

           Returns 3x4 matrix:  [ matrix33 | p ]

 Related:  SetRotationMatrix   SetPosition
           SetRotationMatrixAndPosition   TranslateAcrossJoint
           SetVelocityAccelerationForGetGeometry

   (1) %--------------------------------------------------------------------
   (2) % Examples: SetRotationMatrixAndPosition 
   (3) %--------------------------------------------------------------------
   (4) RigidFrame A, B
   (5) B.SetRotationMatrixAndPosition( A,  [cos(t), sin(t), 0;  sin(t), cos(t), 0;  0, 0, 1],  [1; 2; 3] )
-> (6) B_A = [cos(t), sin(t), 0;  sin(t), cos(t), 0;  0, 0, 1]
-> (7) p_Ao_Bo> = Ax> + 2*Ay> + 3*Az>



SetRotationMatrixOde
SetRotationMatrixOde

 Purpose:  Sets the rotation matrix relating two sets of bases vectors.
           Forms differential equations that relate the time-derivatives
           of orientation angles, Euler parameters, Rodrigues parameters,
           or rotation matrix elements (direction cosines) to
           angular velocity measures.

Syntax 1:  B.SetRotationMatrixODE( A, SequenceIJK,      q1, q2, q3 )
Syntax 2:  B.SetRotationMatrixODE( A, EulerParameters,  e0, e1, e2, e3 )
           B.SetRotationMatrixODE( A, Quaternion,       e0, e1, e2, e3 )
Syntax 3:  B.SetRotationMatrixODE( A, RodriguesParameters, rho1, rho2, rho3 )
Syntax 4:  B.SetRotationMatrixODE( A, PoissonParameters, Rxx,Rxy, ..., Rzz )

   Input:  B -- name of a RigidFrame or RigidBody.
           A -- name of another RigidFrame or RigidBody.

           SequenceIJK -- one of the following:
                   BodyXYZ,  BodyYZX,  BodyZXY,  BodyXZY,  BodyYXZ,  BodyZYX
                   BodyXYX,  BodyXZX,  BodyYXY,  BodyYZY,  BodyZXZ,  BodyZYZ
                  SpaceXYZ, SpaceYZX, SpaceZXY, SpaceXZY, SpaceYXZ, SpaceZYX
                  SpaceXYX, SpaceXZX, SpaceYXY, SpaceYZY, SpaceZXZ, SpaceZYZ

           q1, q2, q3 -- names of radian measures of orientation angles
           associated with right-handed rotations of B relative to A,
           that relate Bi> to Aj>  (i,j = x,y,z).

           e0, e1, e2, e3 -- names of Euler parameters (quaternion)
           that relate Bi> to Aj>  (i,j = x,y,z).

           rho1, rho2, rho3 -- names of Rodrigues parameters
           that relate Bi> to Aj>  (i,j = x,y,z).

           Rxx,Rxy,Rxz, Ryx,Ryy,Ryz, Rzx,Rzy,Rzz - names of rotation matrix
           elements that relate Bi> to Aj>  (i,j = x,y,z).

  Output:  Sets and returns the rotation matrix that relates
           Bx>, By>, Bz>  to  Ax>, Ay>, Az>

Output 1:  Expresses q1', q2', and q3' in terms of q1, q2, q3,
           and B's angular velocity in A.

Output 2:  Expresses e0', e1', e2', e3' in terms of e0, e1, e2, e3,
           and B's angular velocity in A.

Output 3:  Expresses rho1', rho2', and rho3' in terms of rho1, rho2, rho3,
           and B's angular velocity in A.

Output 4:  Expresses Rxx', ... Rzz' in terms of Rxx, ... Rzz,
           and B's angular velocity in A.

  Remark:  B's angular velocity in A or its equivalent must be in the
           workspace before this command can be issued.

  Remark:  Definitions of orientation angles, Euler parameters (quaternion),
           Rodrigues parameters, and direction cosines are in
           Kane, T. R.,  Likins, P. W.,  and Levinson D. A.,
           Spacecraft Dynamics, McGraw-Hill, 1983, Ch. 1., and
           Mitiguy, Paul, Advanced Dynamics for Professional
           Mechanical, Aerospace, and BioMechanical Engineers.

 Related:  Rotate  RotateX  RotateY  RotateZ
           RotateNegativeX  RotateNegativeY  RotateNegativeZ
           SetRotationMatrixX  SetRotationMatrixY  SetRotationMatrixZ
           SetRotationMatrixNegativeX  SetRotationMatrixNegativeY  ...
           SetRotationMatrix  SetAngularVelocity  SetAngularAcceleration
           GetRotationMatrix  GetAngularVelocity  GetAngularAcceleration
           SetRotationMatrixODE  SetEulerParameterODE  SetRodriguesParameterODE
           SetPoissonParameterODE

   (1) %--------------------------------------------------------------------
   (2) % Example 1: SetRotationMatrixODE  (Orientation angles)
   (3) %--------------------------------------------------------------------
   (4) RigidFrame  A, B
   (5) Variable    q1',  q2', q3'
   (6) Variable    wx',  wy', wz'
   (7) B.SetAngularVelocity( A, wx*Bx> + wy*By> + wz*Bz> )
-> (8) w_B_A> = wx*Bx> + wy*By> + wz*Bz>

   (9) B.SetRotationMatrixODE( A, BodyXYZ, q1, q2, q3 )
-> (10) B_A[1,1] = cos(q2)*cos(q3)
-> (11) B_A[1,2] = sin(q3)*cos(q1) + sin(q1)*sin(q2)*cos(q3)
-> (12) B_A[1,3] = sin(q1)*sin(q3) - sin(q2)*cos(q1)*cos(q3)
-> (13) B_A[2,1] = -sin(q3)*cos(q2)
-> (14) B_A[2,2] = cos(q1)*cos(q3) - sin(q1)*sin(q2)*sin(q3)
-> (15) B_A[2,3] = sin(q1)*cos(q3) + sin(q2)*sin(q3)*cos(q1)
-> (16) B_A[3,1] = sin(q2)
-> (17) B_A[3,2] = -sin(q1)*cos(q2)
-> (18) B_A[3,3] = cos(q1)*cos(q2)
-> (19) q1' = (wx*cos(q3)-wy*sin(q3))/cos(q2)
-> (20) q2' = wx*sin(q3) + wy*cos(q3)
-> (21) q3' = wz - tan(q2)*(wx*cos(q3)-wy*sin(q3))

   (22) %--------------------------------------------------------------------
   (23) % Example 2: SetRotationMatrixODE (Euler parameters / quaternion )
   (24) %--------------------------------------------------------------------
   (25) RigidFrame  C
   (26) Variable    e0', e1', e2', e3' 
   (27) C.SetAngularVelocity( A, wx*Cx> + wy*Cy> + wz*Cz> )
-> (28) w_C_A> = wx*Cx> + wy*Cy> + wz*Cz>

   (29) C.SetRotationMatrixODE( A, Euler, e0, e1, e2, e3 )
-> (30) C_A[1,1] = -1 + 2*e0^2 + 2*e1^2
-> (31) C_A[1,2] = 2*e0*e3 + 2*e1*e2
-> (32) C_A[1,3] = 2*e1*e3 - 2*e0*e2
-> (33) C_A[2,1] = 2*e1*e2 - 2*e0*e3
-> (34) C_A[2,2] = -1 + 2*e0^2 + 2*e2^2
-> (35) C_A[2,3] = 2*e0*e1 + 2*e2*e3
-> (36) C_A[3,1] = 2*e0*e2 + 2*e1*e3
-> (37) C_A[3,2] = 2*e2*e3 - 2*e0*e1
-> (38) C_A[3,3] = -1 + 2*e0^2 + 2*e3^2
-> (39) e0' = -0.5*e1*wx - 0.5*e2*wy - 0.5*e3*wz
-> (40) e1' = 0.5*e0*wx + 0.5*e2*wz - 0.5*e3*wy
-> (41) e2' = 0.5*e0*wy + 0.5*e3*wx - 0.5*e1*wz
-> (42) e3' = 0.5*e0*wz + 0.5*e1*wy - 0.5*e2*wx

   (43) %--------------------------------------------------------------------
   (44) % Example 3: SetRotationMatrixODE  (Rodrigues parameters)
   (45) %--------------------------------------------------------------------
   (46) RigidFrame  D
   (47) Variable    r1', r2', r3' 
   (48) D.SetAngularVelocity( A, wx*Dx> + wy*Dy> + wz*Dz> )
-> (49) w_D_A> = wx*Dx> + wy*Dy> + wz*Dz>

   (50) D.SetRotationMatrixODE( A, Rodrigues, r1, r2, r3 )
-> (51) D_A[1,1] = (1+r1^2-r2^2-r3^2)/(1+r1^2+r2^2+r3^2)
-> (52) D_A[1,2] = 2*(r3+r1*r2)/(1+r1^2+r2^2+r3^2)
-> (53) D_A[1,3] = -2*(r2-r1*r3)/(1+r1^2+r2^2+r3^2)
-> (54) D_A[2,1] = -2*(r3-r1*r2)/(1+r1^2+r2^2+r3^2)
-> (55) D_A[2,2] = (1+r2^2-r1^2-r3^2)/(1+r1^2+r2^2+r3^2)
-> (56) D_A[2,3] = 2*(r1+r2*r3)/(1+r1^2+r2^2+r3^2)
-> (57) D_A[3,1] = 2*(r2+r1*r3)/(1+r1^2+r2^2+r3^2)
-> (58) D_A[3,2] = -2*(r1-r2*r3)/(1+r1^2+r2^2+r3^2)
-> (59) D_A[3,3] = -(-1+r1^2+r2^2-r3^2)/(1+r1^2+r2^2+r3^2)
-> (60) r1' = 0.5*wx*(1+r1^2) + 0.5*wz*(r2+r1*r3) - 0.5*wy*(r3-r1*r2)
-> (61) r2' = 0.5*wx*(r3+r1*r2) + 0.5*wy*(1+r2^2) - 0.5*wz*(r1-r2*r3)
-> (62) r3' = 0.5*wy*(r1+r2*r3) + 0.5*wz*(1+r3^2) - 0.5*wx*(r2-r1*r3)

   (63) %--------------------------------------------------------------------
   (64) % Example 4: SetRotationMatrixODE  (Direction cosines)
   (65) %--------------------------------------------------------------------
   (66) RigidFrame  F
   (67) Variable    C{1:3,1:3}' 
   (68) F.SetAngularVelocity( A, wx*Fx> + wy*Fy> + wz*Fz> )
-> (69) w_F_A> = wx*Fx> + wy*Fy> + wz*Fz>

   (70) F.SetRotationMatrixODE( A, Poisson, C11,C12,C13, C21,C22,C23, C31,C32,C33 )
-> (71) F_A = [C11, C12, C13;  C21, C22, C23;  C31, C32, C33]
-> (72) C11' = C21*wz - C31*wy
-> (73) C12' = C22*wz - C32*wy
-> (74) C13' = C23*wz - C33*wy
-> (75) C21' = C31*wx - C11*wz
-> (76) C22' = C32*wx - C12*wz
-> (77) C23' = C33*wx - C13*wz
-> (78) C31' = C11*wy - C21*wx
-> (79) C32' = C12*wy - C22*wx
-> (80) C33' = C13*wy - C23*wx



SetEulerParameterODE
SetEulerParameterODE  or  SetQuaternionODE

 Purpose:  Forms differential equations by relating the time-derivatives
           of Euler parameters (quaternion) to angular velocity measures.

  Syntax:  B.SetEulerParameterODE( A, e0, e1, e2, e3 )
           B.SetQuaternionODE(     A, e0, e1, e2, e3 )

   Input:  B -- name of a RigidFrame or RigidBody.
           A -- name of another RigidFrame or RigidBody.

           e0, e1, e2, e3 -- names of Euler parameters (quaternion)
           that relate Bi> to Aj>  (i,j = x,y,z).

  Output:  Expresses e0', e1', e2', e3' in terms of e0, e1, e2, e3,
           and B's angular velocity in A.
           Returns the column matrix [e0; e1; e2; e3]

  Remark:  B's angular velocity in A or its equivalent must be in the
           workspace before this command can be issued.

  Remark:  Definitions of Euler parameters (quaternions) are in
           Kane, T. R.,  Likins, P. W.,  and Levinson D. A.,
           Spacecraft Dynamics, McGraw-Hill, 1983, Ch. 1., and
           Mitiguy, Paul, Advanced Dynamics for Professional
           Mechanical, Aerospace, and BioMechanical Engineers.

 Related:  Rotate  RotateX  RotateY  RotateZ
           RotateNegativeX  RotateNegativeY  RotateNegativeZ
           SetRotationMatrixX  SetRotationMatrixY  SetRotationMatrixZ
           SetRotationMatrixNegativeX  SetRotationMatrixNegativeY  ...
           SetRotationMatrix  SetAngularVelocity  SetAngularAcceleration
           GetRotationMatrix  GetAngularVelocity  GetAngularAcceleration
           SetRotationMatrixODE  SetEulerParameterODE  SetRodriguesParameterODE
           SetPoissonParameterODE

   (1) %--------------------------------------------------------------------
   (2) % Example: SetEulerParameterODE
   (3) %--------------------------------------------------------------------
   (4) RigidFrame  A, B
   (5) Variable    wx,  wy,  wz
   (6) Variable    e0', e1', e2', e3' 
   (7) B.SetAngularVelocity( A, wx*Bx> + wy*By> + wz*Bz> )
-> (8) w_B_A> = wx*Bx> + wy*By> + wz*Bz>

   (9) B.SetEulerParameterODE( A, e0, e1, e2, e3 )
-> (10) e0' = -0.5*e1*wx - 0.5*e2*wy - 0.5*e3*wz
-> (11) e1' = 0.5*e0*wx + 0.5*e2*wz - 0.5*e3*wy
-> (12) e2' = 0.5*e0*wy + 0.5*e3*wx - 0.5*e1*wz
-> (13) e3' = 0.5*e0*wz + 0.5*e1*wy - 0.5*e2*wx



SetRodriguesParameterODE
SetRodriguesParameterODE

 Purpose:  Forms differential equations by relating the time-derivatives
           of Rodrigues parameters to angular velocity measures.

  Syntax:  B.SetRodriguesParameterODE( A, r1, r2, r3 )

   Input:  B -- name of a RigidFrame or RigidBody.
           A -- name of another RigidFrame or RigidBody.

           r1, r2, r3 -- names of Rodrigues parameters
           that relate Bi> to Aj>  (i,j = x,y,z).

  Output:  Expresses r1', r2', and r3' in terms of r1, r2, r3,
           and B's angular velocity in A.
           Returns the column matrix [r1; r2; r3]

  Remark:  B's angular velocity in A or its equivalent must be in the
           workspace before this command can be issued.

  Remark:  Euler-Rodrigues parameters (or Gibbs vector) were invented
           by Euler 1770 and rediscovered by Rodrigues in 1840.
           Definitions of Rodrigues parameters (Gibbs vectors) are in
           Kane, T. R.,  Likins, P. W.,  and Levinson D. A.,
           Spacecraft Dynamics, McGraw-Hill, 1983, Ch. 1., and
           Mitiguy, Paul, Advanced Dynamics for Professional
           Mechanical, Aerospace, and BioMechanical Engineers.

 Related:  Rotate  RotateX  RotateY  RotateZ
           RotateNegativeX  RotateNegativeY  RotateNegativeZ
           SetRotationMatrixX  SetRotationMatrixY  SetRotationMatrixZ
           SetRotationMatrixNegativeX  SetRotationMatrixNegativeY  ...
           SetRotationMatrix  SetAngularVelocity  SetAngularAcceleration
           GetRotationMatrix  GetAngularVelocity  GetAngularAcceleration
           SetRotationMatrixODE  SetEulerParameterODE  SetRodriguesParameterODE
           SetPoissonParameterODE

   (1) %--------------------------------------------------------------------
   (2) % Example: SetRodriguesParameterODE
   (3) %--------------------------------------------------------------------
   (4) RigidFrame  A, B
   (5) Variable    wx,  wy,  wz
   (6) Variable    r1', r2', r3' 
   (7) B.SetAngularVelocity( A, wx*Bx> + wy*By> + wz*Bz> )
-> (8) w_B_A> = wx*Bx> + wy*By> + wz*Bz>

   (9) B.SetRodriguesParameterODE( A, r1, r2, r3 )
-> (10) r1' = 0.5*wx*(1+r1^2) + 0.5*wz*(r2+r1*r3) - 0.5*wy*(r3-r1*r2)
-> (11) r2' = 0.5*wx*(r3+r1*r2) + 0.5*wy*(1+r2^2) - 0.5*wz*(r1-r2*r3)
-> (12) r3' = 0.5*wy*(r1+r2*r3) + 0.5*wz*(1+r3^2) - 0.5*wx*(r2-r1*r3)



SetPoissonParameterODE
SetPoissonParameterODE

 Purpose:  Forms differential equations by relating the time-derivatives
           of Rodrigues parameters to angular velocity measures.

  Syntax:  B.SetPoissonParameterODE( A, Rxx,Rxy,Rxz, Ryx,Ryy,Ryz, Rzx,Rzy,Rzz )

   Input:  B -- name of a RigidFrame or RigidBody.
           A -- name of another RigidFrame or RigidBody.

           Rxx,Rxy,Rxz, Ryx,Ryy,Ryz, Rzx,Rzy,Rzz - names of rotation matrix
           elements that relate Bi> to Aj>  (i,j = x,y,z).

  Output:  Expresses Rxx', ... Rzz', in terms of Rxx, ... Rzz,
           and B's angular velocity in A.
           Returns 3x3 matrix [Rxx,Rxy,Rxz; Ryx,Ryy,Ryz; Rzx,Rzy,Rzz]

  Remark:  B's angular velocity in A or its equivalent must be in the
           workspace before this command can be issued.

  Remark:  Definitions of Poisson parameters are in
           Kane, T. R.,  Likins, P. W.,  and Levinson D. A.,
           Spacecraft Dynamics, McGraw-Hill, 1983, Ch. 1., and
           Mitiguy, Paul, Advanced Dynamics for Professional
           Mechanical, Aerospace, and BioMechanical Engineers.

 Related:  Rotate  RotateX  RotateY  RotateZ
           RotateNegativeX  RotateNegativeY  RotateNegativeZ
           SetRotationMatrixX  SetRotationMatrixY  SetRotationMatrixZ
           SetRotationMatrixNegativeX  SetRotationMatrixNegativeY  ...
           SetRotationMatrix  SetAngularVelocity  SetAngularAcceleration
           GetRotationMatrix  GetAngularVelocity  GetAngularAcceleration
           SetRotationMatrixODE  SetEulerParameterODE  SetRodriguesParameterODE
           SetPoissonParameterODE

   (1) %--------------------------------------------------------------------
   (2) % Example: SetPoissonParameterODE
   (3) %--------------------------------------------------------------------
   (4) RigidFrame  A, B
   (5) Variable    wx,  wy,  wz
   (6) Variable    Rxx', Rxy', Rxz'
   (7) Variable    Ryx', Ryy', Ryz'
   (8) Variable    Rzx', Rzy', Rzz'
   (9) B.SetAngularVelocity( A, wx*Bx> + wy*By> + wz*Bz> )
-> (10) w_B_A> = wx*Bx> + wy*By> + wz*Bz>

   (11) B.SetPoissonParameterODE( A, Rxx,Rxy,Rxz, Ryx,Ryy,Ryz, Rzx,Rzy,Rzz )
-> (12) Rxx' = Ryx*wz - Rzx*wy
-> (13) Rxy' = Ryy*wz - Rzy*wy
-> (14) Rxz' = Ryz*wz - Rzz*wy
-> (15) Ryx' = Rzx*wx - Rxx*wz
-> (16) Ryy' = Rzy*wx - Rxy*wz
-> (17) Ryz' = Rzz*wx - Rxz*wz
-> (18) Rzx' = Rxx*wy - Ryx*wx
-> (19) Rzy' = Rxy*wy - Ryy*wx
-> (20) Rzz' = Rxz*wy - Ryz*wx



SetRotationMatrixX
SetRotationMatrixX     SetRotationMatrixNegativeX

 Purpose:  Forms the rotation matrix (direction cosine matrix) associated
           with the right-handed rotation of a rigid basis (e.g., B)
           relative to another rigid basis (e.g., A).

Syntax 1:  B.SetRotationMatrixX( A, q )
Syntax 2:  B.SetRotationMatrixNegativeX( A, q )

   Input:  B -- name of a RigidFrame or RigidBody.
           A -- name of another RigidFrame or RigidBody.
           q -- expressions for an angle.

Output 1:  Sets and returns the B_A rotation matrix formed by a right-handed
           rotation of B relative to A about  Ax> = Bx>  by the angle q.

Output 2:  Same as Output 1, except B rotates about  -Ax> = -Bx>.

  Remark:  SetRotationMatrixPositiveX is identical to SetRotationMatrixX

 Related:  Rotate  RotateX  RotateY  RotateZ
           RotateNegativeX  RotateNegativeY  RotateNegativeZ
           SetRotationMatrixX  SetRotationMatrixY  SetRotationMatrixZ
           SetRotationMatrixNegativeX  SetRotationMatrixNegativeY  ...
           SetRotationMatrix  SetAngularVelocity  SetAngularAcceleration
           GetRotationMatrix  GetAngularVelocity  GetAngularAcceleration
           SetRotationMatrixODE

   (1) %--------------------------------------------------------------------
   (2) % Example 1:  SetRotationMatrixX
   (3) %--------------------------------------------------------------------
   (4) RigidFrame     A, B, C
   (5) Variable       q
   (6) B.SetRotationMatrixX( A, q )
-> (7) B_A = [1, 0, 0;  0, cos(q), sin(q);  0, -sin(q), cos(q)]

   (8) %--------------------------------------------------------------------
   (9) % Example 2:  SetRotationMatrixNegativeX
   (10) %--------------------------------------------------------------------
   (11) C.SetRotationMatrixNegativeX( B, t )
-> (12) C_B = [1, 0, 0;  0, cos(t), -sin(t);  0, sin(t), cos(t)]

   (13) %--------------------------------------------------------------------
   (14) % Note: For more HELP, try:  Rotate     SetRotationMatrix  
   (15) %                            RotateX    SetRotationMatrixX  
   (16) %                            RotateY    SetRotationMatrixY  
   (17) %                            RotateZ    SetRotationMatrixZ


SetRotationMatrixY
SetRotationMatrixY     SetRotationMatrixNegativeY

 Purpose:  Forms the rotation matrix (direction cosine matrix) associated
           with the right-handed rotation of a rigid basis (e.g., B)
           relative to another rigid basis (e.g., A).

Syntax 1:  B.SetRotationMatrixY( A, q )
Syntax 2:  B.SetRotationMatrixNegativeY( A, q )

   Input:  B -- name of a RigidFrame or RigidBody.
           A -- name of another RigidFrame or RigidBody.
           q -- expressions for an angle

Output 1:  Sets and returns the B_A rotation matrix formed by a right-handed
           rotation of B relative to A about  Ay> = By>  by the angle q.

Output 2:  Same as Output 1, except B rotates about  -Ay> = -By>.

  Remark:  SetRotationMatrixPositiveY is identical to SetRotationMatrixY.

 Related:  Rotate  RotateX  RotateY  RotateZ
           RotateNegativeX  RotateNegativeY  RotateNegativeZ
           SetRotationMatrixX  SetRotationMatrixY  SetRotationMatrixZ
           SetRotationMatrixNegativeX  SetRotationMatrixNegativeY  ...
           SetRotationMatrix  SetAngularVelocity  SetAngularAcceleration
           GetRotationMatrix  GetAngularVelocity  GetAngularAcceleration
           SetRotationMatrixODE

   (1) %--------------------------------------------------------------------
   (2) % Example 1:  SetRotationMatrixY
   (3) %--------------------------------------------------------------------
   (4) RigidFrame     A, B, C
   (5) Variable       q
   (6) B.SetRotationMatrixY( A, q )
-> (7) B_A = [cos(q), 0, -sin(q);  0, 1, 0;  sin(q), 0, cos(q)]

   (8) %--------------------------------------------------------------------
   (9) % Example 2:  SetRotationMatrixNegativeY
   (10) %--------------------------------------------------------------------
   (11) C.SetRotationMatrixNegativeY( B, t )
-> (12) C_B = [cos(t), 0, sin(t);  0, 1, 0;  -sin(t), 0, cos(t)]

   (13) %--------------------------------------------------------------------
   (14) % Note: For more HELP, try:  Rotate     SetRotationMatrix  
   (15) %                            RotateX    SetRotationMatrixX  
   (16) %                            RotateY    SetRotationMatrixY  
   (17) %                            RotateZ    SetRotationMatrixZ


SetRotationMatrixZ
SetRotationMatrixZ     SetRotationMatrixNegativeZ

 Purpose:  Forms the rotation matrix (direction cosine matrix) associated
           with the right-handed rotation of a rigid basis (e.g., B)
           relative to another rigid basis (e.g., A).

Syntax 1:  B.SetRotationMatrixZ( A, q )
Syntax 2:  B.SetRotationMatrixNegativeZ( A, q )

   Input:  B -- name of a RigidFrame or RigidBody.
           A -- name of another RigidFrame or RigidBody.
           q -- expressions for an angle

Output 1:  Sets and returns the B_A rotation matrix formed by a right-handed
           rotation of B relative to A about  Az> = Bz>  by the angle q.

Output 2:  Same as Output 1, except B rotates about  -Az> = -Bz>.

  Remark:  SetRotationMatrixPositiveZ is identical to SetRotationMatrixY.

 Related:  Rotate  RotateX  RotateY  RotateZ
           RotateNegativeX  RotateNegativeY  RotateNegativeZ
           SetRotationMatrixX  SetRotationMatrixY  SetRotationMatrixZ
           SetRotationMatrixNegativeX  SetRotationMatrixNegativeY  ...
           SetRotationMatrix  SetAngularVelocity  SetAngularAcceleration
           GetRotationMatrix  GetAngularVelocity  GetAngularAcceleration
           SetRotationMatrixODE

   (1) %--------------------------------------------------------------------
   (2) % Example:  SetRotationMatrixZ
   (3) %--------------------------------------------------------------------
   (4) RigidFrame     A, B, C
   (5) Variable       q
   (6) B.SetRotationMatrixZ( A, q )
-> (7) B_A = [cos(q), sin(q), 0;  -sin(q), cos(q), 0;  0, 0, 1]

   (8) %--------------------------------------------------------------------
   (9) % Example:  SetRotationMatrixNegativeZ
   (10) %--------------------------------------------------------------------
   (11) C.SetRotationMatrixNegativeZ( B, t )
-> (12) C_B = [cos(t), -sin(t), 0;  sin(t), cos(t), 0;  0, 0, 1]

   (13) %--------------------------------------------------------------------
   (14) % Note: For more HELP, try:  Rotate     SetRotationMatrix  
   (15) %                            RotateX    SetRotationMatrixX  
   (16) %                            RotateY    SetRotationMatrixY  
   (17) %                            RotateZ    SetRotationMatrixZ


SetTransformationMatrix
SetTransformationMatrix   GetTransformationMatrix   GetTransformationMatrix44

Reserved:  Keywords, syntax, commands are arguments are reserved for future release.
           IN DEVELOPMENT.

 Purpose:  Sets the transformation matrix relating two rigid frames or bodies.

Syntax 1:  B.SetTransformationMatrix( A, matrix33, positionVector )
Syntax 2:  B.SetTransformationMatrix( A, matrix34 )
Syntax 3:  B.SetTransformationMatrix( A, matrix44 )
Syntax 4:  B.GetTransformationMatrix(   A )
Syntax 5:  B.GetTransformationMatrix44( A )

   Input:  B -- name of a RigidFrame or RigidBody.
           A -- name of another RigidFrame or RigidBody.

           matrix33 -- 3x3 rotation matrix (direction cosine matrix).
           matrix34 -- 3x4 transformation matrix [ 3x3 ; 3x1 ].
           matrix44 -- 4x4 transformation matrix with 4th row [ 0, 0, 0, 1].
           positionVector -- Position vector between Bo and Ao.

  Output:  Sets and returns the transformation matrix that relates
           Bx>, By>, Bz>  to  Ax>, Ay>, Az> and the
           position vector between Bo and Ao.

 Related:  Rotate  RotateX  RotateY  RotateZ
           RotateNegativeX  RotateNegativeY  RotateNegativeZ
           SetRotationMatrixX  SetRotationMatrixY  SetRotationMatrixZ
           SetRotationMatrixNegativeX  SetRotationMatrixNegativeY  ...
           SetRotationMatrix  SetAngularVelocity  SetAngularAcceleration
           GetRotationMatrix  GetAngularVelocity  GetAngularAcceleration
           SetRotationMatrixODE


SetPosition
SetPosition

 Purpose:  Sets a point's position from another point.

  Syntax:  Q.SetPosition( fromPoint, positionVector )

   Input:  Q -- The name of a point.
           fromPoint -- The name of another point.
           positionVector -- a position vector.

  Output:  Sets and returns Q's position vector from fromPoint.

 Related:  Translate        SetPositionVelocity   SetVelocityAcceleration
           SetPosition      GetPosition   GetDistance  GetDistanceSquared
           SetVelocity      GetVelocity   GetSpeed     GetElongation
           SetAcceleration  GetAcceleration

   (1) %--------------------------------------------------------------------
   (2) % Example: SetPosition 
   (3) %--------------------------------------------------------------------
   (4) RigidFrame N             
   (5) Point      P
   (6) Particle   Q            
   (7) Variable   xP, yP, zP
   (8) Variable   xQ, yQ, zQ
   (9) P.SetPosition( No, xP*Nx> + yP*Ny> + zP*Nz> )
-> (10) p_No_P> = xP*Nx> + yP*Ny> + zP*Nz>

   (11) Q.SetPosition( P,  xQ*Nx> + yQ*Ny> + zQ*Nz> )
-> (12) p_P_Q> = xQ*Nx> + yQ*Ny> + zQ*Nz>

   (13) QPositionVectorFromNo> = Q.GetPosition( No )
-> (14) QPositionVectorFromNo> = (xP+xQ)*Nx> + (yP+yQ)*Ny> + (zP+zQ)*Nz>



SetPositionVelocity
SetPositionVelocity

 Purpose:  Sets a point's position from another point.
           Sets a point's velocity in a reference frame.

Syntax 1:  Q.SetPositionVelocity( fromPoint, positionVector )
           (Note: positionVector may be differentiated).

Syntax 2:  Q.SetPositionVelocity( fromPoint, positionVector, BFixed )
           (Note: positionVector will NOT be differentiated).

Syntax 3:  Q.SetPositionVelocity( fromPoint, positionVector, BFrame, BQ )
           (Note: positionVector may be differentiated).

   Input:  Q -- name of a point.

           fromPoint -- Point whose velocity in the NewtonianFrame
                        (or designated frame) is known (in the workspace).

           BFixed -- Rigid frame/body on which fromPoint and Q  are fixed.
           BFrame -- Rigid frame/body on which fromPoint and BQ are fixed.
                     Q is moving on BFrame.

           BQ -- Point of BFrame that is coincident with Q.

  Output:  Sets Q's position vector from fromPoint to positionVector.
           Sets Q's velocity in the NewtonianFrame (or designated refFrame).

  Remark:  To set Q's velocity in a non-NewtonianFrame, insert refFrame (name
           of a RigidFrame or RigidBody) as the optional first argument, e.g.,
Syntax 1:  Q.SetPositionVelocity( refFrame, fromPoint, positionVector )
Syntax 2:  Q.SetPositionVelocity( refFrame, fromPoint, positionVector, BFixed )
Syntax 3:  Q.SetPositionVelocity( refFrame, fromPoint, positionVector,BFrame,BQ)

  Remark:  Use of Syntax 2 may also set the following (if not in workspace):
             fromPoint's velocity and acceleration in BFixed to 0>
             Q's         velocity and acceleration in BFixed to 0>

           Use of Syntax 3 may also set the following (if not in workspace):
             fromPoint's velocity and acceleration in BFrame to 0>
             BQ          may be defined as a physical point of BFrame
             BQ's        velocity and acceleration in BFrame to 0>
             BQ's        position from fromPoint
             Q's         velocity in BFrame (via Q' position vector fromPoint)

  Remark:  If Q is welded to rigid frame/body B, declare it:  Point Q(B).
           Alternately, use  Q.SetVelocityAcceleration( B, 0> )  if Q does not
           move on B, but is not a physical point of B (Q is not welded to B).

 Related:  Translate        SetPositionVelocity   SetVelocityAcceleration
           SetPosition      GetPosition   GetDistance  GetDistanceSquared
           SetVelocity      GetVelocity   GetSpeed     GetElongation
           SetAcceleration  GetAcceleration

   (1) %--------------------------------------------------------------------
   (2) % Example 1: SetPositionVelocity 
   (3) % Set Q1's velocity in N by differentiation. 
   (4) %--------------------------------------------------------------------
   (5) NewtonianFrame N             
   (6) Point     Q1            
   (7) Variable  x1', y1'           
   (8) Q1.SetPositionVelocity( No, x1*Nx> + y1*Ny> )
-> (9) p_No_Q1> = x1*Nx> + y1*Ny>
-> (10) v_Q1_N> = x1'*Nx> + y1'*Ny>

   (11) %--------------------------------------------------------------------
   (12) % Example 2: SetPositionVelocity 
   (13) % Set Q2's velocity in N by differentiation.
   (14) %--------------------------------------------------------------------
   (15) Point     Q2            
   (16) Variable  x2', y2'  
   (17) Q2.SetPositionVelocity( Q1, x2*Nx> + y2*Ny> )
-> (18) p_Q1_Q2> = x2*Nx> + y2*Ny>
-> (19) v_Q2_N> = (x1'+x2')*Nx> + (y1'+y2')*Ny>

   (20) %--------------------------------------------------------------------
   (21) % Example 3: SetPositionVelocity
   (22) % Set Q3's velocity in N via two points fixed on B
   (23) %--------------------------------------------------------------------
   (24) Point     Q3            
   (25) RigidBody B                  % Translating/rotating rigid body 
   (26) Variable  qB'                % Angle and time-derivative
   (27) Constant  L                  % Distance between Bo and Q3
   (28) B.SetAngularVelocity( N, qB'*Bz> )
-> (29) w_B_N> = qB'*Bz>

   (30) Bo.SetPositionVelocity( No, t^2/2*Nx> )
-> (31) p_No_Bo> = 0.5*t^2*Nx>
-> (32) v_Bo_N> = t*Nx>

   (33) Q3.SetPositionVelocity( Bo, L*Bx>, B )
-> (34) p_Bo_Q3> = L*Bx>
-> (35) v_Q3_N> = L*qB'*By> + t*Nx>

   (36) %--------------------------------------------------------------------
   (37) % Example 4: SetPositionVelocity
   (38) % Set Q4's velocity in N via one point moving on B
   (39) %--------------------------------------------------------------------
   (40) Point      Q4, BQ4           % Point of B coincident with Q4
   (41) Variable   x4'  
   (42) Q4.SetPositionVelocity( Bo, x4*Bx>, B, BQ4 )
-> (43) p_Bo_Q4> = x4*Bx>
-> (44) p_Bo_BQ4> = x4*Bx>
-> (45) v_BQ4_N> = x4*qB'*By> + t*Nx>
-> (46) v_Q4_B> = x4'*Bx>
-> (47) v_Q4_N> = x4'*Bx> + x4*qB'*By> + t*Nx>



SetScreenDisplay
SetScreenDisplay  (Experimental - not recommended for use)

 Purpose:  Determines whether or not to print input lines or
           response lines to the screen.

  Syntax:  SetScreenDisplay( SETTING )

   Input:  SETTING -- ON, OFF, or NONE

 Outputs:  With SetScreenDisplay(ON), all input and output information
           is displayed on screen (default behavior).

           With SetScreenDisplay(OFF), only input lines and prompts are
           displayed on screen and output response are suppressed.

           With SetScreenDisplay(NONE), neither input or output is displayed.

 Related:  GetDefaults



SetSFunctionInput
SetSFunctionInput  ResetSFunctionInput   GetSFunctionInput

 Purpose:  Identifies scalar quantities that are to be used by the ODE and
           Solve commands while generating .mSFunction and .cSFunction codes.
           These quantities are inputs to SFunction blocks.

Syntax 1:  SetSFunctionInput( x, y, z)
Syntax 2:  ResetSFunctionInput( )
Syntax 3:  ResetSFunctionInput( x, y )
Syntax 4:  GetSFunctionInput()

   Input:  x, y, z ... -- names appearing in Specified declarations.

Output 1:  Appends x, y, z  to the matrix of names for SFunction input.
           Returns the matrix of all names for SFunction input.

Output 2:  Removes all names from SFunction input.
           Returns 1x1 zero matrix.

Output 3:  Removes all names from SFunction input.
           Appends x, y to the matrix of names for SFunction input.
           Returns the matrix of all names for SFunction input.

Output 4:  Returns the matrix of all names for SFunction input.

 Related:  ODE  Solve  Input  Output  OutputPlot  Plot  Animate
           ConvertUnits  GetUnitSystem  SetUnitSystem  SetDigits
           Solve  SolveDt  SolveSetInput  SolveSetInputDt  ...
           SetSFunctionInput   ResetSFunctionInput  GetSFunctionInput

   (1) %---------------------------------------------------------------------
   (2) % Example: SetSFunctionInput
   (3) %---------------------------------------------------------------------
   (4) Specified  Fx = 0
-> (5) Fx = 0

   (6) Constant   m = 1000 kg
   (7) Variable   x'' = Fx / m
-> (8) x'' = Fx/m

   (9) SetSFunctionInput( Fx )
   (10) Input  x=2 m, x'=0 km/sec
   (11) Output t sec,  x meter,  x' km/sec
   (12) ODE() CarCruiseControl.mSFunction



SetPlotting
SetPlotting   (Experimental -- subject to change).

 Purpose:  Controls whether or not plots are displayed.

  Syntax:  SetPlotting( ON )   or    SetPlotting( OFF )

  Remark:  Program default is SetPlotting( ON ).
           When OFF, plots are not displayed (disabled).

 Related:  GetDefaults   LineStepping  SetAutoDifferentiate  SetAutoOverwrite
           SetPlotting  Plot  OutputPlot


SetUnitSystem
SetUnitSystem

 Purpose:  Sets a unit system for unit conversions, e.g., for units set
           in Input and Output statements and Evaluate and Solve commands.

Syntax 1:  SetUnitSystem( massUnit, lengthUnit, timeUnit )
Syntax 2:  SetUnitSystem()

   Input:  massUnit   -- the name of a unit of mass,   e.g., kg
           lengthUnit -- the name of a unit of length, e.g., cm
           timeUnit   -- the name of a unit of time,   e.g., seconds

Output 1:  Conversions are employed when the program uses Input and Output
           statements and for arguments of the Evaluate and Solve commands.

Output 2:  On-screen display of massUnit, lengthUnit, and timeUnit.

  Remark:  Program default is SetUnitSystem( kilogram, meter, second ).

 Related:  ODE  Solve  Input  Output  OutputPlot  Plot  Animate
           Evaluate  Solve  SolveDt  SolveSetInput  SolveSetInputDt  ...
           ConvertUnits  GetUnitSystem  SetUnitSystem
           GetMassUnit   GetLengthUnit   GetTimeUnit   GetAngleUnit

--------------------------------------------------------------------
Example 1: SetUnitSystem
--------------------------------------------------------------------
   (1) SetUnitSystem( kilogram, meter, second )
   (2) SetUnitSystem()
       kilogram, meter, second

--------------------------------------------------------------------
Example 2: SetUnitSystem
--------------------------------------------------------------------
   (1) SetDigits( 3 )
   (2) Constant  F, m, g
   (3) Variable  v'
   (3) v' = g + F/m
-> (4) v' = g + F/m
   (5) SetUnitSystem( kg, meter, sec )
   (6) Input  F=100 milliNewtons,  m=2 grams,  g=9.8 m/sec^2
   (7) Input  tFinal = 1 min,  tStep = 0.5 sec
   (8) Output  t, v, v km/hour, 1/2*m*v^2 milliJoules
   (9) ODE() Test.c

   The ODE command creates the C program Test.c, which on input,
   converts F from milliNewtons to kg*meter/sec^2 (Newtons) and
   converts m from grams to kg, e.g., with C statements such as

      F = 0.001 * F;
      m = 0.001 * m;

   On output, t is output in seconds (because no output units were
   specified and sec was designated as the time unit in SetUnitSystem);
   v is output with the label UNITS (which means no unit conversions
   were applied);  v is output in km/hour (a conversion from meter/sec
   to km/hour is applied); and  1/2*m*v^2 is output in milliJoules
   [a conversion from kg*meter^2/sec^2 to milliJoules is applied as
   the derived energy units designated by SetUnitSystem( kg, meter, sec)
   is kg*meter^2/sec^2 (Joules).]

   Execution of Test.c produces output file Test.1, e.g., as follows:
   Note: To produce output file Test.1 without first creating C code,
   remove the .c extension by changing line (9) to   ODE() Test

 FILE: Test.1

      t          v          v      1/2*m*v^2
    (sec)     (UNITS)   (km/hour) (milliJoules)

  0.00E-001  0.00E-001  0.00E-001  0.00E-001
  5.00E-001  2.99E+001  1.08E+002  8.94E+002
  1.00E+000  5.98E+001  2.15E+002  3.58E+003

   (1) %--------------------------------------------------------------------
   (2) % Example 3: SetUnitSystem  (affects unit conversions)  
   (3) %--------------------------------------------------------------------
   (4) SetUnitSystem( gram, cm, sec )
   (5) MetersPerCm = ConvertUnits( meter, GetUnitSystem )
-> (6) MetersPerCm = 100

   (7) InchesPerCm = ConvertUnits( inch,  GetUnitSystem )
-> (8) InchesPerCm = 2.54

   (9) a1 = Evaluate( t^2, t = 2 inches )  
-> (10) a1 = 25.8064

   (11) a2 = Evaluate( t^2, t = 2 meters )
-> (12) a2 = 40000

   (13) s1 = Solve( t^5 - 1, t=1 inch )
->   %  Note: t = 1  was converted from  t = 0.3937008 inch.
-> (14) s1 = [1]

   (15) s2 = Solve( t^5 - 1, t=1 meter )
->   %  Note: t = 1  was converted from  t = 0.01 meter.
-> (16) s2 = [1]



SetVelocity
SetVelocity

 Purpose:  Sets a point's velocity in a reference frame.

Syntax 1:  Q.SetVelocity( N, fromPoint )
Syntax 2:  Q.SetVelocity( N, fromPoint, BFixed )
Syntax 3:  Q.SetVelocity( N, fromPoint, BFrame, BQ )
Syntax 4:  Q.SetVelocity( N, velocityVector )

   Input:  Q -- name of a point.
           N -- name of a RigidFrame or RigidBody.

           fromPoint -- Point whose velocity in N is already known.

           BFixed -- Rigid frame/body on which fromPoint and Q  are fixed.
           BFrame -- Rigid frame/body on which fromPoint and BQ are fixed.
                     Q is moving on BFrame.

           BQ -- Point of BFrame that is coincident with Q.

           velocityVector -- a velocity vector.

  Output:  Sets and returns Q's velocity in N.

  Remark:  Use of Syntax 2 may also set the following (if not in workspace):
             fromPoint's velocity and acceleration in BFixed to 0>
             Q's         velocity and acceleration in BFixed to 0>

           Use of Syntax 3 may also set the following (if not in workspace):
             fromPoint's velocity and acceleration in BFrame to 0>
             BQ          may be defined as a physical point of BFrame
             BQ's        velocity and acceleration in BFrame to 0>
             BQ's        position from fromPoint
             Q's         velocity in BFrame (via Q' position vector fromPoint)

  Remark:  Q's position vector fromPoint is used by this command.

  Remark:  If Q is welded to rigid frame/body B, declare it:  Point Q(B).
           Alternately, use  Q.SetVelocityAcceleration( B, 0> )  if Q does not
           move on B, but is not a physical point of B (Q is not welded to B).

 Related:  Translate        SetPositionVelocity   SetVelocityAcceleration
           SetPosition      GetPosition   GetDistance  GetDistanceSquared
           SetVelocity      GetVelocity   GetSpeed     GetElongation
           SetAcceleration  GetAcceleration

   (1) %--------------------------------------------------------------------
   (2) % Example 1: SetVelocity 
   (3) % Set Q1's velocity in N by differentiation.  Uses No fixed on N 
   (4) %--------------------------------------------------------------------
   (5) RigidFrame N             
   (6) Point      Q1            
   (7) Variable   x1', y1'           
   (8) Q1.SetPosition( No, x1*Nx> + y1*Ny> )
-> (9) p_No_Q1> = x1*Nx> + y1*Ny>

   (10) Q1.SetVelocity( N, No )   
-> (11) v_Q1_N> = x1'*Nx> + y1'*Ny>

   (12) %--------------------------------------------------------------------
   (13) % Example 2: SetVelocity 
   (14) % Set Q2's velocity in N by differentiation and Q1's velocity in N
   (15) %--------------------------------------------------------------------
   (16) Point     Q2            
   (17) Variable  x2', y2'  
   (18) Q2.SetPosition( Q1, x2*Nx> + y2*Ny> )
-> (19) p_Q1_Q2> = x2*Nx> + y2*Ny>

   (20) Q2.SetVelocity( N, Q1 )     
-> (21) v_Q2_N> = (x1'+x2')*Nx> + (y1'+y2')*Ny>

   (22) %--------------------------------------------------------------------
   (23) % Example 3: SetVelocity
   (24) % Set Q3's velocity in N via two points (Q3 and Bo) fixed on B
   (25) %--------------------------------------------------------------------
   (26) Point     Q3            
   (27) RigidBody B                  % Translating/rotating rigid body 
   (28) Variable  qB'                % Angle and time-derivative
   (29) Constant  L                  % Distance between Bo and Q3
   (30) B.SetAngularVelocity( N, qB'*Bz> )
-> (31) w_B_N> = qB'*Bz>

   (32) Bo.SetVelocity( N, t*Nx> )
-> (33) v_Bo_N> = t*Nx>

   (34) Q3.SetPosition( Bo, L*Bx> )
-> (35) p_Bo_Q3> = L*Bx>

   (36) Q3.SetVelocity( N, Bo, B )  
-> (37) v_Q3_N> = L*qB'*By> + t*Nx>

   (38) %--------------------------------------------------------------------
   (39) % Example 4: SetVelocity
   (40) % Set Q4's velocity in N via one point (Q4) moving on rigid-body B
   (41) %--------------------------------------------------------------------
   (42) Point      Q4, BQ4           % Point of B coincident with Q4
   (43) Variable   x4'  
   (44) Q4.SetPosition( Bo, x4*Bx> )
-> (45) p_Bo_Q4> = x4*Bx>

   (46) Q4.SetVelocity( N, Bo, B, BQ4 )    
-> (47) p_Bo_BQ4> = x4*Bx>
-> (48) v_BQ4_N> = x4*qB'*By> + t*Nx>
-> (49) v_Q4_B> = x4'*Bx>
-> (50) v_Q4_N> = x4'*Bx> + x4*qB'*By> + t*Nx>



SetVelocityAcceleration
SetVelocityAcceleration

 Purpose:  Sets a point's velocity and acceleration in a reference frame.

Syntax 1:  Q.SetVelocityAcceleration( N, fromPoint )
Syntax 2:  Q.SetVelocityAcceleration( N, fromPoint, BFixed )
Syntax 3:  Q.SetVelocityAcceleration( N, fromPoint, BFrame, BQ )
Syntax 4:  Q.SetVelocityAcceleration( N, velocityVector )

   Input:  Q -- name of a point.
           N -- name of a RigidFrame or RigidBody.

           fromPoint -- Point whose velocity and acceleration in N is known.

           BFixed -- Rigid frame/body on which fromPoint and Q  are fixed.
           BFrame -- Rigid frame/body on which fromPoint and BQ are fixed.
                     Q is moving on BFrame.

           BQ -- Point of BFrame that is coincident with Q.

           velocityVector -- a velocity vector.

  Output:  Sets Q's velocity and acceleration in N.

  Remark:  Use of Syntax 2 may also set the following (if not in workspace):
             fromPoint's velocity and acceleration in BFixed to 0>
             Q's         velocity and acceleration in BFixed to 0>

           Use of Syntax 3 may also set the following (if not in workspace):
             fromPoint's velocity and acceleration in BFrame to 0>
             BQ          may be defined as a physical point of BFrame
             BQ's        velocity and acceleration in BFrame to 0>
             BQ's        position from fromPoint
             Q's         velocity in BFrame (via Q' position vector fromPoint)
             Q's         acceleration in BFrame (via differentiation)

  Remark:  Q's position vector fromPoint is used by this command.

  Remark:  If Q is welded to rigid frame/body B, declare it:  Point Q(B).
           Alternately, use  Q.SetVelocityAcceleration( B, 0> )  if Q does not
           move on B, but is not a physical point of B (Q is not welded to B).

 Related:  Translate        SetPositionVelocity   SetVelocityAcceleration
           SetPosition      GetPosition   GetDistance  GetDistanceSquared
           SetVelocity      GetVelocity   GetSpeed     GetElongation
           SetAcceleration  GetAcceleration

   (1) %--------------------------------------------------------------------
   (2) % Example 1: SetVelocityAcceleration 
   (3) % Set Q1's velocity and acceleration in N by differentiation. 
   (4) %--------------------------------------------------------------------
   (5) RigidFrame N             
   (6) Point      Q1            
   (7) Variable   x1'', y1''           
   (8) Q1.SetPosition( No, x1*Nx> + y1*Ny> )
-> (9) p_No_Q1> = x1*Nx> + y1*Ny>

   (10) Q1.SetVelocityAcceleration( N, No )   
-> (11) v_Q1_N> = x1'*Nx> + y1'*Ny>
-> (12) a_Q1_N> = x1''*Nx> + y1''*Ny>

   (13) %--------------------------------------------------------------------
   (14) % Example 2: SetVelocityAcceleration 
   (15) % Set Q2's velocity and acceleration in N by differentiation.
   (16) %--------------------------------------------------------------------
   (17) Point     Q2            
   (18) Variable  x2'', y2''  
   (19) Q2.SetPosition( Q1, x2*Nx> + y2*Ny> )
-> (20) p_Q1_Q2> = x2*Nx> + y2*Ny>

   (21) Q2.SetVelocityAcceleration( N, Q1 )     
-> (22) v_Q2_N> = (x1'+x2')*Nx> + (y1'+y2')*Ny>
-> (23) a_Q2_N> = (x1''+x2'')*Nx> + (y1''+y2'')*Ny>

   (24) %--------------------------------------------------------------------
   (25) % Example 3: SetVelocityAcceleration
   (26) % Set Q3's velocity and acceleration in N via two points fixed on B
   (27) %--------------------------------------------------------------------
   (28) Point     Q3            
   (29) RigidBody B                  % Translating/rotating rigid body 
   (30) Variable  qB''               % Angle and time-derivatives
   (31) Constant  L                  % Distance between Bo and Q3
   (32) B.SetAngularVelocityAcceleration( N, qB'*Bz> )
-> (33) w_B_N> = qB'*Bz>
-> (34) alf_B_N> = qB''*Bz>

   (35) Bo.SetVelocityAcceleration( N, t*Nx> )
-> (36) v_Bo_N> = t*Nx>
-> (37) a_Bo_N> = Nx>

   (38) Q3.SetPosition( Bo, L*Bx> )
-> (39) p_Bo_Q3> = L*Bx>

   (40) Q3.SetVelocityAcceleration( N, Bo, B )  
-> (41) v_Q3_N> = L*qB'*By> + t*Nx>
-> (42) a_Q3_N> = -L*qB'^2*Bx> + L*qB''*By> + Nx>

   (43) %--------------------------------------------------------------------
   (44) % Example 4: SetVelocityAcceleration
   (45) % Set Q4's velocity and acceleration in N via one point moving on B
   (46) %--------------------------------------------------------------------
   (47) Point      Q4, BQ4           % Point of B coincident with Q4
   (48) Variable   x4''  
   (49) Q4.SetPosition( Bo, x4*Bx> )
-> (50) p_Bo_Q4> = x4*Bx>

   (51) Q4.SetVelocityAcceleration( N, Bo, B, BQ4 )    
-> (52) p_Bo_BQ4> = x4*Bx>
-> (53) v_BQ4_N> = x4*qB'*By> + t*Nx>
-> (54) v_Q4_B> = x4'*Bx>
-> (55) v_Q4_N> = x4'*Bx> + x4*qB'*By> + t*Nx>
-> (56) a_BQ4_N> = -x4*qB'^2*Bx> + x4*qB''*By> + Nx>
-> (57) a_Q4_B> = x4''*Bx>
-> (58) a_Q4_N> = (x4''-x4*qB'^2)*Bx> + (2*qB'*x4'+x4*qB'')*By> + Nx>



sign
sign   sign0IsPositive1   sign0IsNegative1   signDerivative

 Purpose:  Returns the sign of a real scalar expression.

Syntax 1:  sign( realScalar )
Syntax 2:  sign0IsPositive1( realScalar )
Syntax 3:  sign0IsNegative1( realScalar )
Syntax 4:  signDerivative( realScalar )

   Input:  realScalar -- a real scalar expression.

Output 1:  Returns the sign of realScalar, i.e., returns
           1  if  realScalar > 0
           0  if  realScalar = 0
          -1  if  realScalar < 0
Output 2:  Returns  1  if realScalar >= 0,  otherwise returns -1.
Output 3:  Returns -1  if realScalar <= 0,  otherwise returns  1.
Output 4:  Undefined   if realScalar  = 0,  otherwise returns  0.

  Remark:  Combine sign with ceil or floor for if statements:
           isPositive      = ceil(  sign(t)/2 )          % Returns 0 or 1.
           isNonNegative   = ceil(  sign(t)/2 + 1E-14 )  % Returns 0 or 1.
           isNegative      = floor( sign(t)/2 )          % Returns 0 or 1.
           isTLessThan9    = ceil( sign(9-t) / 2 )       % Returns 0 or 1.
           isTGreaterThan9 = ceil( sign(t-9) / 2 )       % Returns 0 or 1.

 Related:  ceil  floor  int  max  min  round  sign  MathFunctions

   (1) %--------------------------------------------------------------------
   (2) % Example 1: Sign 
   (3) %--------------------------------------------------------------------
   (4) A1 = sign( 2.3 ) 
-> (5) A1 = 1

   (6) B1 = sign( 0 ) 
-> (7) B1 = 0

   (8) C1 = sign( -2.3 ) + sign(5+t) 
-> (9) C1 = -1 + sign(5+t)

   (10) %--------------------------------------------------------------------
   (11) % Example 2: Sign0IsPositive1 
   (12) %--------------------------------------------------------------------
   (13) A2 = Sign0IsPositive1( 2.3 ) + Sign0IsPositive1( 0 ) 
-> (14) A2 = 2

   (15) B2 = Sign0IsPositive1( -2.3 ) 
-> (16) B2 = -1

   (17) %--------------------------------------------------------------------
   (18) % Example 3: Sign0IsNegative1 
   (19) %--------------------------------------------------------------------
   (20) A3 = Sign0IsNegative1( 2.3 ) 
-> (21) A3 = 1

   (22) B3 = Sign0IsNegative1( 0 ) + Sign0IsNegative1( -2.3 ) 
-> (23) B3 = -2

   (24) %--------------------------------------------------------------------
   (25) % Example 4: SignDerivative 
   (26) %--------------------------------------------------------------------
   (27) signDt = Dt( sign(t) + Sign0IsPositive1(1+t^3) )
-> (28) signDt = signDerivative(t) + 3*t^2*signDerivative(1+t^3)



sin
sin

 Purpose:  Returns the sine of a scalar expression.

Syntax 1:  sin( scalarExpressionRad )
Syntax 2:  sinDegrees( realNumberDeg )

   Input:  scalarExpressionRad -- the radian measure of a real or
                                  complex scalar expression.
           realNumberDeg -- expression that resolves to a real number.

Output 1:  Sine of scalarExpressionRad.
Output 2:  Sine of realNumberDeg.

 Related:  ConvertUnits  ImaginaryNumber  MathFunctions
           cos  sin  tan  acos  asin  atan  atan2  cosDegrees  ...

   (1) %--------------------------------------------------------------------
   (2) % Example 1: sin   (real scalar expressions)
   (3) %--------------------------------------------------------------------
   (4) A = sin( pi/6 ) 
-> (5) A = 0.5

   (6) B = sinDegrees( 30 ) 
-> (7) B = 0.5

   (8) C = sin(t) + sin( t * ConvertUnits(deg,rad) )
-> (9) C = sin(t) + sin(0.01745329*t)

   (10) D = sin(0.5+2*t)
-> (11) D = sin(0.5+2*t)

   (12) %--------------------------------------------------------------------
   (13) % Example 2: sin   (complex scalar expressions)
   (14) %--------------------------------------------------------------------
   (15) E = sin( 2 + 3*GetImaginaryNumber() )
-> (16) E = 9.154499 - 4.168907*imaginary

   (17) F = sin( 3*GetImaginaryNumber() + t )
-> (18) F = sin(3*imaginary+t)



Solve
Solve  --  also see SolveDt, SolveSetInput, SolveSetInputDt.

 Purpose:  Solves linear and nonlinear algebraic equations.

Syntax 1:  Solve(         EqnsToSolve, x1, x2, ... )
           Solve( METHOD, EqnsToSolve, x1, x2, ... )
Syntax 2:  Solve(         EqnsToSolve x1=Guess1,  x2=Guess2,  ... )
Syntax 3:  answer = Solve( METHOD, EqnsToSolve,  x1,  x2,  ... )
Syntax 4:  answer = Solve(         EqnsToSolve,  x1=Guess1,  x2=Guess2,  ... )

   Input:  EqnsToSolve -- matrix of (or single) scalar expressions that
           are functions of x1, x2, ..., and regarded as equal to zero.
           Treated as:  EqnsToSolve[1] = 0,   EqnsToSolve[2] = 0, ...
           EqnsToSolve may have form EqnsToSolve = 0 or EqnsToSolve = Rhs.

           x1, x2 -- the names of scalars or a matrix of scalar names.

           METHOD -- Minors, MinorsImplicit, MinorsExplicit,
                     Gauss,  GaussExplicit,  GaussExplicit,  Implicit.
           When METHOD is provided, EqnsToSolve must be linear in x1, x2, ...

           Guess1, Guess2 -- expressions that resolve to real numbers.

Output 1:  Solutions (symbolic expressions) are assigned to x1, x2, ...
Output 2:  Solutions (real numbers) are assigned to x1, x2, ...
Output 3:  Solutions (symbolic expressions) are returned in a matrix.
           Solutions are NOT assigned to x1, x2, ...
Output 4:  Solutions (real numbers) are returned in a matrix.
           Solutions are NOT assigned to x1, x2, ...

  Remark:  MINORS is advantageous for a small number of equations and
           for avoiding divide-by-zero problems other than when the
           set of equations are truly singular (the determinant of
           its coefficient matrix is zero).

           GAUSS may be better than MINORS for solving larger number
           of equations when divide-by-zero problem associated with
           pivots in Gaussian elimination can be avoided.

           IMPLICIT may be more efficient when some of the unknowns x1, x2,
           ..., are allowed to be expressed in terms of other unknowns.

           If no method is specified, a method is chosen based on
           the number of equations and number of non-zero and
           non-numerical elements in the coefficient matrix.

 Remark:   A set of n linear algebraic equations in n unknowns may
           have one unique solution or is singular (no solution or
           an infinite number of solutions).

 Remark:   Nonlinear algebraic equations may have 0, 1, 2, 3, ..., solutions.
           Their solution is approximate and its accuracy tends to improve
           as the input value assigned to absError gets smaller.
           To change the default value of absError to 1.234E-5, enter
           Input  absError = 1.234E-5

 Remark:   Providing Guess1, Guess2, ..., instructs the Solve command
           to produce a NUMERICAL solution for x1, x2, ...
           A numerical solution (and hence Guess1, Guess2) is
           required when EqnsToSolve is nonlinear in x1, x2, ...
           If necessary, symbols resolve to numbers using INPUT values.
           When EqnsToSolve are nonlinear, the numerical algorithm attempts
           to converge to a solution closest to Guess1, Guess2, ...
           When arguments have the form  x1 = 30 deg,  x2 = 45 cm/hour,
           solutions for x1 and x2 are returned in units determined by
           SetUnitSystem, e.g., x1 in units of radians and x2 in m/sec.

 Remark:   A solution may be reported even though one does not exist.
           For example,  Solve( exp(-t) = 0, t=4 )  may report a solution
           for t greater than 16.2 because the absolute value of
           exp(-16.2) is less than the default value of absError.

 Related:  ODE  Solve  SolveDt  SolveSetInput  SolveSetInputDt  ...
           GetPolynomialRoots  GetQuadraticRoots  GetQuadraticPositiveRoot  ...
           SolveQuadraticPositiveRoot  SolveQuadraticPositiveRootDt  ...
           SetAutoDifferentiate  SetAutoOverwrite
           SetDt  SetNoDt   =   :=   +=   *=   /=   ^=

   (1) %--------------------------------------------------------------------
   (2) % Example 1: Solve  (one linear equation in one unknown) 
   (3) %--------------------------------------------------------------------
   (4) Variable  unknown
   (5) Solve(  2*unknown - 8*t,  unknown )
-> (6) unknown = 4*t

   (7) %--------------------------------------------------------------------
   (8) % Example 2: Solve  (two linear equations in two unknowns) 
   (9) %--------------------------------------------------------------------
   (10) Variable  s1, s2
   (11) Eqn[1] = 2*s1 + 6*s2 - 2*sin(t)      
-> (12) Eqn[1] = 2*s1 + 6*s2 - 2*sin(t)

   (13) Eqn[2] = 2*s1 + 4*s2 - 2*cos(t)            
-> (14) Eqn[2] = 2*s1 + 4*s2 - 2*cos(t)

   (15) Solve(  Eqn,  s1, s2 )
-> (16) s1 = 3*cos(t) - 2*sin(t)
-> (17) s2 = sin(t) - cos(t)

   (18) %--------------------------------------------------------------------
   (19) % Example 3: Solve (two linear equations in two unknowns, MINORS) 
   (20) %--------------------------------------------------------------------
   (21) Constant  a{1:2,1:2}, x{1:2}, b{1:2}
   (22) LhsEqnX[1] = a11*x1 + a12*x2 
-> (23) LhsEqnX[1] = a11*x1 + a12*x2

   (24) LhsEqnX[2] = a21*x1 + a22*x2 
-> (25) LhsEqnX[2] = a21*x1 + a22*x2

   (26) UnknownsMatrix = [x1;  x2]
-> (27) UnknownsMatrix = [x1;  x2]

   (28) Solve( MinorsExplicit,  LhsEqnX - [b1; b2],  UnknownsMatrix )
-> (29) x1 = -(a12*b2-a22*b1)/(a11*a22-a12*a21)
-> (30) x2 = (a11*b2-a21*b1)/(a11*a22-a12*a21)

   (31) %--------------------------------------------------------------------
   (32) % Example 4: Solve (two linear equations in 2 unknowns, GaussImplicit) 
   (33) %--------------------------------------------------------------------
   (34) Variable  y1, y2
   (35) ZeroEqnY[1] = a11*y1 + a12*y2 - b1
-> (36) ZeroEqnY[1] = a11*y1 + a12*y2 - b1

   (37) ZeroEqnY[2] = a21*y1 + a22*y2 - b2
-> (38) ZeroEqnY[2] = a21*y1 + a22*y2 - b2

   (39) Solve( GaussImplicit,  ZeroEqnY,  y1, y2 )
-> (40) y1 = (b1-a12*y2)/a11
-> (41) y2 = (b2-a21*b1/a11)/(a22-a12*a21/a11)

   (42) %--------------------------------------------------------------------
   (43) % Example 5: Solve (two linear equations in 2 unknowns, GaussExplicit) 
   (44) %--------------------------------------------------------------------
   (45) Variable  z1, z2
   (46) LhsEqnZ = [a11, a12;  a21, a22] * [z1; z2] 
-> (47) LhsEqnZ = [a11*z1 + a12*z2;  a21*z1 + a22*z2]

   (48) Solve( GaussExplicit,  LhsEqnZ - [b1; b2],  z1, z2 )
-> (49) z1 = (b1-a12*(b2-a21*b1/a11)/(a22-a12*a21/a11))/a11
-> (50) z2 = (b2-a21*b1/a11)/(a22-a12*a21/a11)

   (51) %--------------------------------------------------------------------
   (52) % Example 6: Solve (return the solutions without assignment) 
   (53) %--------------------------------------------------------------------
   (54) Variable z
   (55) solutionMatrixA = Solve(  2*z - 5*t,  z )
-> (56) solutionMatrixA = [2.5*t]

   (57) solutionMatrixB = Solve(  z^2 + sin(z)^2.2 - 1,  z=2 )
-> (58) solutionMatrixB = [0.7528387]

   (59) %--------------------------------------------------------------------
   (60) % Example 7: Solve  (one nonlinear equation in one unknown with units) 
   (61) %--------------------------------------------------------------------
   (62) Solve(  sin(z),  z=91 deg )
-> (63) z = 3.141593       %  or  z = 180 deg.

   (64) %--------------------------------------------------------------------
   (65) % Example 8: Solve  (two nonlinear equations in two unknowns) 
   (66) %--------------------------------------------------------------------
   (67) Variable  x, y
   (68) ZeroNonlinearEqn[1] = -1 + x^2 + y^2      % Equation for  circle
-> (69) ZeroNonlinearEqn[1] = -1 + x^2 + y^2

   (70) ZeroNonlinearEqn[2] = y - sin(x)          % Sine function
-> (71) ZeroNonlinearEqn[2] = y - sin(x)

   (72) Solve(  ZeroNonlinearEqn,  x=2, y=3 )
-> (73) x = 0.7390851
-> (74) y = 0.673612

   (75) %--------------------------------------------------------------------
   (76) % Example 9: Solve  (two nonlinear equations in two unknowns w/ input) 
   (77) %--------------------------------------------------------------------
   (78) Variable  q1, q2
   (79) Constant  a = 2 noUnits,  b = 1 noUnits   
   (80) ZeroEqnQ[1] = -1 + q1^2/a^2 + q2^2/b^2    % Equation for an ellipse
-> (81) ZeroEqnQ[1] = -1 + q1^2/a^2 + q2^2/b^2

   (82) ZeroEqnQ[2] = q2 - sin(q1)                % Sine function
-> (83) ZeroEqnQ[2] = q2 - sin(q1)

   (84) Solve(  ZeroEqnQ,  q1 = 1,  q2 = 25 )
-> (85) q1 = 1.029867
-> (86) q2 = 0.8572303



SolveDt
SolveDt  --  also see Solve, SolveSetInput, SolveSetInputDt.

 Purpose:  Solves _linear_ algebraic equations.
           Differentiates the equations and solves for derivatives.

  Syntax:  SolveDt(         EqnsToSolve, x1, x2, ... )
           SolveDt( METHOD, EqnsToSolve, x1, x2, ... )

   Input:  EqnsToSolve -- matrix of (or single) scalar expressions that are
           LINEAR functions of x1, x2, ..., and regarded as equal to zero.
           Treated as:  EqnsToSolve[1] = 0,   EqnsToSolve[2] = 0, ...

           x1, x2 -- the names of scalars or a matrix of scalar names.

           METHOD -- Minors, MinorsImplicit, MinorsExplicit,
                     Gauss,  GaussExplicit,  GaussExplicit,  Implicit.

  Output:  Solutions are assigned to x1, x2, ... and x1', x2', ...

  Remark:  SolveDt recursively differentiates to form the
           1st, 2nd, 3rd, ... derivatives of x1, x2, ..., and
           stops differentiating when an nth derivative of x1, x2, ...,
           has not been declared (e.g., x1'' does not exit).

  Remark:  See additional remarks and examples by typing Help Solve.

 Related:  ODE  Solve  SolveDt  SolveSetInput  SolveSetInputDt  ...
           GetPolynomialRoots  GetQuadraticRoots  GetQuadraticPositiveRoot  ...
           SolveQuadraticPositiveRoot  SolveQuadraticPositiveRootDt  ...
           SetAutoDifferentiate  SetAutoOverwrite
           SetDt  SetNoDt   =   :=   +=   *=   /=   ^=

   (1) %--------------------------------------------------------------------
   (2) % Example 1: SolveDt  (one linear equation in one unknown) 
   (3) %--------------------------------------------------------------------
   (4) Variable  x'
   (5) SolveDt(  x - 5*t,  x )
-> (6) x = 5*t
-> (7) x' = 5

   (8) %--------------------------------------------------------------------
   (9) % Example 2: SolveDt  (two linear equations in two unknowns) 
   (10) %--------------------------------------------------------------------
   (11) Variable  s1', s2'
   (12) Zero[1] = s1 + 3*s2 - sin(t)      
-> (13) Zero[1] = s1 + 3*s2 - sin(t)

   (14) Zero[2] = s1 + 2*s2 - cos(t)            
-> (15) Zero[2] = s1 + 2*s2 - cos(t)

   (16) SolveDt(  Zero,  s1, s2 )
-> (17) s1 = 3*cos(t) - 2*sin(t)
-> (18) s2 = sin(t) - cos(t)
-> (19) s1' = -3*sin(t) - 2*cos(t)
-> (20) s2' = sin(t) + cos(t)

   (21) %--------------------------------------------------------------------
   (22) % Example 3: SolveDt (two linear equations in two unknowns, MINORS) 
   (23) %--------------------------------------------------------------------
   (24) Variable  x1'', x2''
   (25) ZeroEqnX[1] = 2 + x1 + sin(t)*x2      
-> (26) ZeroEqnX[1] = 2 + x1 + sin(t)*x2

   (27) ZeroEqnX[2] = 3 + x1 + cos(t)*x2         
-> (28) ZeroEqnX[2] = 3 + x1 + cos(t)*x2

   (29) SolveDt( MINORS,  ZeroEqnX,  x1, x2 )
-> (30) x1 = -2*(1.5*sin(t)-cos(t))/(sin(t)-cos(t))
-> (31) x2 = 1/(sin(t)-cos(t))
-> (32) x1' = x2/(sin(t)-cos(t))
-> (33) x2' = -(sin(t)+cos(t))*x2/(sin(t)-cos(t))
-> (34) x1'' = 2*x2'/(sin(t)-cos(t))
-> (35) x2'' = (sin(t)*x2-cos(t)*x2-2*sin(t)*x2'-2*cos(t)*x2')/(sin(t)-cos(t))

   (36) %--------------------------------------------------------------------
   (37) % Example 4: SolveDt (two linear equations in two unknowns, GAUSS) 
   (38) %--------------------------------------------------------------------
   (39) Constant  a{1:2}{1:2}
   (40) Variable  y{1:2}'
   (41) ZeroEqnY[1] = a11*y1 + a12*y2 - t
-> (42) ZeroEqnY[1] = a11*y1 + a12*y2 - t

   (43) ZeroEqnY[2] = a21*y1 + a22*y2 - t^2
-> (44) ZeroEqnY[2] = a21*y1 + a22*y2 - t^2

   (45) SolveDt( GAUSS,  ZeroEqnY,  y{1:2} )
-> (46) y1 = (t-a12*y2)/a11
-> (47) y2 = -t*(a21/a11-t)/(a22-a12*a21/a11)
-> (48) y1' = (1-a12*y2')/a11
-> (49) y2' = -(a21/a11-2*t)/(a22-a12*a21/a11)

   (50) %--------------------------------------------------------------------
   (51) % Example 5: SolveDt (numeric solution for q2, symbolic solution for q2') 
   (52) %--------------------------------------------------------------------
   (53) Variable  q1'', q2''
   (54) Input q1 = 0 deg
   (55) SolveDt(  q2 + cos(q2) + sin(q1),  q2 = 20 deg )
-> (56) q2 = -0.7390851       %  or  q2 = -42.34646 deg.
-> (57) q2' = -cos(q1)*q1'/(1-sin(q2))
-> (58) q2'' = (sin(q1)*q1'^2+cos(q2)*q2'^2-cos(q1)*q1'')/(1-sin(q2))



SolveSetInput
SolveSetInput  --  also see Solve, SolveDt, SolveSetInputDt.

 Purpose:  Solves NUMERICAL linear and nonlinear algebraic equations
           and sets Input values for the unknowns.

  Syntax:  SolveSetInput( EqnsToSolve,  x1=Guess1,  x2=Guess2,  ... )

   Input:  EqnsToSolve -- matrix of (or single) scalar expressions that
           are functions of x1, x2, ..., and regarded as equal to zero.
           Treated as:  EqnsToSolve[1] = 0,   EqnsToSolve[2] = 0, ...

           x1, x2 -- the names of scalars.

           Guess1, Guess2, -- expressions that resolve to real numbers.
           Note: When arguments have the form  x1 = 30 deg, x2 = 45 cm/hr,
           solutions for x1 and x2 are returned in units determined by
           SetUnitSystem, e.g., x1 in units of radians and x2 in m/sec.

  Output:  Solutions (real numbers) and associated units (if designated in
           Guess1, Guess2, ...) are assigned to Input values for x1, x2, ...
           Solutions (real numbers) that have been converted to the units
           designated in SetUnitSystem are returned in a matrix.

  Remark:  See additional remarks by typing Help Solve.

 Related:  ODE  Solve  SolveDt  SolveSetInput  SolveSetInputDt  ...
           GetPolynomialRoots  GetQuadraticRoots  GetQuadraticPositiveRoot  ...
           SolveQuadraticPositiveRoot  SolveQuadraticPositiveRootDt  ...
           SetAutoDifferentiate  SetAutoOverwrite
           SetDt  SetNoDt   =   :=   +=   *=   /=   ^=

   (1) %--------------------------------------------------------------------
   (2) % Example 1: SolveSetInput  (one equation in one unknown) 
   (3) %--------------------------------------------------------------------
   (4) Variable z
   (5) ExpressionEqualToZero = -1 + z^2 + sin(z)^2.2
-> (6) ExpressionEqualToZero = -1 + z^2 + sin(z)^2.2

   (7) SolveSetInput( ExpressionEqualToZero,   z = 2 )

->  %  INPUT has been assigned as follows:
->  %   z                         0.7528386616717591

   (8) %--------------------------------------------------------------------
   (9) % Example 2: SolveSetInput  (two equations in two unknowns) 
   (10) %--------------------------------------------------------------------
   (11) Variable  x, y
   (12) ZeroMatrix[1] = -1 + x^2 + y^2         % Equation for  circle
-> (13) ZeroMatrix[1] = -1 + x^2 + y^2

   (14) ZeroMatrix[2] = y - sin(x)             % Sine function
-> (15) ZeroMatrix[2] = y - sin(x)

   (16) SolveSetInput( ZeroMatrix,  x=2, y=3 )

->   %  INPUT has been assigned as follows:
->   %   x                         0.7390851332151607
->   %   y                         0.6736120291832148

   (17) %--------------------------------------------------------------------
   (18) % Example 3: SolveSetInput  (two equations in two unknowns w/ input) 
   (19) %--------------------------------------------------------------------
   (20) Variable  x1, x2
   (21) Constant  a = 2 noUnits,  b = 1 noUnits
   (22) Zero[1] = -1 + x1^2/a^2 + x2^2/b^2     % Equation for an ellipse
-> (23) Zero[1] = -1 + x1^2/a^2 + x2^2/b^2

   (24) Zero[2] = x2 - sin(x1)                 % Sine function
-> (25) Zero[2] = x2 - sin(x1)

   (26) SolveSetInput( Zero,  x1 = 1,  x2 = 25 )

->   %  INPUT has been assigned as follows:
->   %   x1                        1.029866529322259
->   %   x2                        0.8572302683325125

   (27) %--------------------------------------------------------------------
   (28) % Example 4: SolveSetInput  (guess and solution have units) 
   (29) %--------------------------------------------------------------------
   (30) Variable  s1, s2
   (31) SolveSetInput( [sin(s1); sin(s2)],  s1 = 91 deg,  s2 = 271 deg )

->   %  INPUT has been assigned as follows:
->   %   s1                        180                     deg
->   %   s2                        360                     deg

   (32) %--------------------------------------------------------------------
   (33) % Example 5: SolveSetInput (SolveSetInput for w, return solution) 
   (34) %--------------------------------------------------------------------
   (35) Variable w
   (36) answer = SolveSetInput( cos(w),  w = 1 deg )

->   %  INPUT has been assigned as follows:
->   %   w                         90                      deg

->   %  Note: w = 1.570796  was converted from  w = 90 deg.
-> (37) answer = [1.570796]



SolveSetInputDt
SolveSetInputDt  --  also see Solve, SolveDt, SolveSetInput.

 Purpose:  Solves linear and nonlinear algebraic equations to set NUMERICAL
           Input values for the unknowns, differentiates to find  SYMBOLIC
           expressions for the derivatives of the unknowns.

  Syntax:  SolveSetInputDt( EqnsToSolve, x1=Guess1, x2=Guess2,  ... )

   Input:  EqnsToSolve -- matrix of (or single) scalar expressions that
           are functions of x1, x2, ..., and regarded as equal to zero.
           Treated as:  EqnsToSolve[1] = 0,   EqnsToSolve[2] = 0, ...

           x1, x2 -- the names of scalars.

           Guess1, Guess2, -- expressions that resolve to real numbers.
           Note: When arguments have the form  x1 = 30 deg, x2 = 45 cm/hr,
           solutions for x1 and x2 are returned in units determined by
           SetUnitSystem, e.g., x1 in units of radians and x2 in m/sec.

  Output:  Solutions (real numbers) and associated units (if designated in
           Guess1, Guess2, ...) are assigned to Input values for x1, x2, ...
           Solutions (real numbers) that have been converted to the units
           designated in SetUnitSystem are returned in a matrix.
           Solutions (expressions)  are assigned to x1', x2', ...

  Remark:  SolveSetInputDt recursively differentiates to form the
           1st, 2nd, 3rd, ... derivatives of x1, x2, ..., and
           stops differentiating when an nth derivative of x1, x2, ...,
           has not been declared (e.g., x1''' does not exist).

  Remark:  See additional remarks by typing Help Solve.

 Related:  ODE  Solve  SolveDt  SolveSetInput  SolveSetInputDt  ...
           GetPolynomialRoots  GetQuadraticRoots  GetQuadraticPositiveRoot  ...
           SolveQuadraticPositiveRoot  SolveQuadraticPositiveRootDt  ...
           SetAutoDifferentiate  SetAutoOverwrite
           SetDt  SetNoDt   =   :=   +=   *=   /=   ^=

   (1) %--------------------------------------------------------------------
   (2) % Example 1: SolveSetInputDt   (one equation in one unknown) 
   (3) %--------------------------------------------------------------------
   (4) Variable z'
   (5) ExpressionEqualToZero = -1 + z^2 + sin(z)^2.2
-> (6) ExpressionEqualToZero = -1 + z^2 + sin(z)^2.2

   (7) SolveSetInputDtSymbolic( ExpressionEqualToZero,  z = 2 )

->  %  INPUT has been assigned as follows:
->  %   z                         0.7528386616717591

-> (8) z' = 0

   (9) %--------------------------------------------------------------------
   (10) % Example 2: SolveSetInputDt   (two equations in two unknowns) 
   (11) %--------------------------------------------------------------------
   (12) Variable  x', y'
   (13) Constant  a = 1 noUnits,  b = 1 noUnits
   (14) Input     t = 0 sec
   (15) ZeroMatrix[1] = x^2 + y^2 - cos(t)        % Equation for  circle
-> (16) ZeroMatrix[1] = x^2 + y^2 - cos(t)

   (17) ZeroMatrix[2] = a*y - b*sin(x)            % Sine function
-> (18) ZeroMatrix[2] = a*y - b*sin(x)

   (19) SolveSetInputDtSymbolic( ZeroMatrix,  x=2, y=3 )

->   %  INPUT has been assigned as follows:
->   %   x                         0.7390851332151607
->   %   y                         0.6736120291832148

-> (20) x' = -0.5*a*sin(t)/(a*x+b*y*cos(x))
-> (21) y' = -0.5*b*sin(t)*cos(x)/(a*x+b*y*cos(x))

   (22) %--------------------------------------------------------------------
   (23) % Example 3: SolveSetInputDt  (differentiates for w' and w'') 
   (24) %--------------------------------------------------------------------
   (25) Variable w''
   (26) answer = SolveSetInputDt( cos(w) - t*cos(t),  w = 1 deg )

->   %  INPUT has been assigned as follows:
->   %   w                         90                      deg

->   %  Note: w = 1.570796  was converted from  w = 90 deg.
-> (27) w' = -(cos(t)-t*sin(t))/sin(w)
-> (28) w'' = (2*sin(t)+t*cos(t)-cos(w)*w'^2)/sin(w)
-> (29) answer = [1.570796]



SolveQuadraticPositiveRoot
SolveQuadraticPositiveRoot,    SolveQuadraticNegativeRoot
SolveQuadraticPositiveRootDt,  SolveQuadraticNegativeRootDt

 Purpose:  Solve for the positive or negative roots of a polynomial
           of degree 2 (and possibly its ordinary derivatives).

Syntax 1:  SolveQuadraticPositiveRoot( function, x )
           SolveQuadraticNegativeRoot( function, x )
           SolveQuadraticPositiveRoot( M, x )
           SolveQuadraticNegativeRoot( M, x )
Syntax 2:  SolveQuadraticPositiveRootDt( function, x )
           SolveQuadraticNegativeRootDt( function, x )
           SolveQuadraticPositiveRootDt( M, x )
           SolveQuadraticNegativeRootDt( M, x )

   Input:  function -- a mathematical expression that is a function of x.
           Note: A 2nd-order polynomial of the form  a*x^2 + b*x + c
           is created from a Taylor series expansion of function about x=0.

           x -- the name of a specified, variable, or constant.

           M -- an 3-element row/column matrix.
           Note: A 2nd-order polynomial of the form  a*x^2 + b*x + c
           is created from M, e.g.,  M[0]*x^2 + M[1]*x + M[2].

Output 1:  SolveQuadraticPositiveRoot  assigns x to the root associated
                with the positive square root in the quadratic equation,
                e.g.,  x = (-b + sqrt(b^2 - 4*a*c)) / 2*a
           SolveQuadraticNegativeRoot  assigns x to the root associated
                with the negative square root in the quadratic equation.
                e.g.,  x = (-b - sqrt(b^2 - 4*a*c)) / 2*a

Output 2:  Differentiates and solves to form x', x'', ...  and stops
           differentiating when the nth derivative of x has not been
           declared (e.g., x''' does not exist).

  Remark:  Use  GetQuadraticRoots  to return the positive and negative roots
           in a 2x1 matrix (without assigning the result to x).
           Use  GetQuadraticPositiveRoot  to return the positive root without
           assigning the result to x.  Similarly for GetQuadraticNegativeRoot.

 Related:  GetPolynomialRoots  GetQuadraticRoots  GetQuadraticPositiveRoot  ...
           SetDt  Solve  SolveDt  SolveSetInput  SolveSetInputDt  ...
           SolveQuadraticPositiveRoot  SolveQuadraticPositiveRootDt  ...
           FactorLinear  FactorQuadratic

   (1) %--------------------------------------------------------------------
   (2) % Example 1: SolveQuadraticPositiveRoot  (root of quadratic equation) 
   (3) %--------------------------------------------------------------------
   (4) Constant a, b, c
   (5) Variable x, y
   (6) SolveQuadraticPositiveRoot( a*x^2 + b*x + c, x )  
-> (7) x = -0.5*(b-sqrt(b^2-4*a*c))/a

   (8) SolveQuadraticNegativeRoot( a*y^2 + b*y + c, y )
-> (9) y = -0.5*(b+sqrt(b^2-4*a*c))/a

   (10) %--------------------------------------------------------------------
   (11) % Example 2: SolveQuadraticPositiveRootDt  (roots with differentiation)
   (12) %--------------------------------------------------------------------
   (13) Variable z''
   (14) SolveQuadraticPositiveRootDt( a*z^2 - sin(t), z )  
-> (15) z = sqrt(sin(t)/a)
-> (16) z' = 0.5*cos(t)/(a*z)
-> (17) z'' = -0.5*(sin(t)+2*a*z'^2)/(a*z)



Specified
Specified  or  SpecifiedEncode

 Purpose:  Declares the names of specified quantities.

Syntax 1:  Specified        a,  b,  x+,  y-,  ...
Syntax 2:  Specified        u',  q'',  ...
Syntax 3:  SpecifiedEncode  u',  q'',  ...
Syntax 4:  Specified        (displays all names declared as Specified)

   Input:  a -- name that starts with a letter, followed by a reasonable
                number of alphanumeric characters (similarly for b).
           a, b, ... are regarded as REAL until SetComplex is ON.

           x+ -- declares x as real and non-negative.
           y- -- declares y as real and non-positive.
           Helps simplification such as  abs(x) = x  or  abs(y) = -y.

           u'  -- declares u' and u as Specified.
           q'' -- declares q'', q', and q as Specified.

Output 3:  SpecifiedEncode forces MATLAB(R), C, and Fortran programs to include
           quantities that may not otherwise appear due to code-optimization.

  Remark:  The 1st and 2nd ordinary derivatives of s are denoted s' and s''.
           If s is Specified, Dt(s) is permitted only if s' was also declared.

  Remark:  Variable  vs.  Specified ??
           Variable:  Regarded as unknown (to be solved).
                      Partial velocities account for assignment of Variable.
           Specified: Regarded as known   (prescribed).
                      Assigned in program  OR  leave "to be specified" in
                      special functions in MATLAB(R), C, and Fortran codes.
                      Partial velocities ignore assignment of Specified.

  Remark:  The name  a{i}bb    declares a1bb ... aibb  (i is positive integer).
           The name  a{i:j}bb  declares aibb ... ajbb  (i >= 0  and  i <= j).
           The name  a{m,n}bb  declares amnbb     (m, n are integers 0 to 9).
           The name  a{m:x,n:y}  declares amn ... axy    (m <= x and n <= y).

  Remark:  The default name of the independent variable is t.

  Remark:  To both declare and assign a Specified, type e.g.,
           Specified x'' = 2*sin(t)

 Related:  Constant  ImaginaryNumber  Specified  Variable
           SetGeneralizedCoordinate  SetGeneralizedSpeed
           SetDt  SolveDt  SetAutoDifferentiate

   (1) %--------------------------------------------------------------------
   (2) % Example: Specified
   (3) %--------------------------------------------------------------------
   (4) Specified  x'+,  y-,  e{0:3}'
   (5) Specified  q'',  u'
   (6) b = sin(t) + abs(x) + x' - abs(x') + y + abs(y)
-> (7) b = sin(t) + x

   (8) derivExample = dt(b) + dt(e0) + dt(q) + dt(q') + dt(u)
-> (9) derivExample = cos(t) + e0' + q' + u' + x' + q''

   (10) u = sin(t)
-> (11) u = sin(t)

   (12) SetDt( q = t^3 )
-> (13) q = t^3
-> (14) q' = 3*t^2
-> (15) q'' = 6*t



Squared
Squared

 Purpose:  Forms the square of a scalar, a matrix, or a vector.

Syntax 1:  Squared( scalarExpression )
Syntax 2:  Squared( matrixExpression )
Syntax 3:  Squared( vectorExpression )

   Input:  scalarExpression -- a real or complex scalar expression.
           matrixExpression -- a matrix expression.
           vectorExpression -- a vector expression.

Output 1:  Returns scalarExpression^2.
Output 2:  Returns matrixExpression * matrixExpression.
Output 3:  Returns Dot( vectorExpression, vectorExpression ).

 Related:  ImaginaryNumber  MathFunctions
           GetMagnitude  GetMagnitudeSquared  Squared  sqrt

   (1) %--------------------------------------------------------------------
   (2) % Example 1: Squared  (scalar expressions)
   (3) %--------------------------------------------------------------------
   (4) A = Squared( -3 ) 
-> (5) A = 9

   (6) B = Squared( 3.2 * GetImaginaryNumber() ) 
-> (7) B = -10.24

   (8) C = Squared( -3 + GetImaginaryNumber() ) 
-> (9) C = 8 - 6*imaginary

   (10) %--------------------------------------------------------------------
   (11) % Example 2: Squared  (matrix expressions)
   (12) %--------------------------------------------------------------------
   (13) D = Squared( [1, 2;  3, 4] )
-> (14) D = [7, 10;  15, 22]

   (15) E = Squared( [1, 2;  3, 4 + GetImaginaryNumber()] )
-> (16) E = [7, 10 + 2*imaginary;  15 + 3*imaginary, 21 + 8*imaginary]

   (17) %--------------------------------------------------------------------
   (18) % Example 3: Squared  (vector expressions)
   (19) %--------------------------------------------------------------------
   (20) RigidFrame N 
   (21) F = Squared( sin(t)*Nx> - 2*Ny> + 3*Nz> )
-> (22) F = 13 + sin(t)^2



sqrt
sqrt

 Purpose:  Returns the square-root of a scalar expression.

  Syntax:  sqrt( scalarExpression )

   Input:  scalarExpression -- a real or complex scalar expression.

  Output:  sqrt( scalarExpression ).

 Related:  ImaginaryNumber  MathFunctions
           GetMagnitude  GetMagnitudeSquared  Squared  sqrt

   (1) %--------------------------------------------------------------------
   (2) % Example 1: sqrt   (real scalar expressions)
   (3) %--------------------------------------------------------------------
   (4) A = sqrt( 9 ) 
-> (5) A = 3

   (6) B = sqrt( 9.5 ) 
-> (7) B = 3.082207

   (8) C = sqrt(2*t)
-> (9) C = 1.414214*sqrt(t)

   (10) %--------------------------------------------------------------------
   (11) % Example 2: sqrt   (complex scalar expressions)
   (12) %--------------------------------------------------------------------
   (13) D = sqrt( -9 )
-> (14) D = 3*imaginary

   (15) E = sqrt( 9 + 4*GetImaginaryNumber() )
-> (16) E = 3.069923 + 0.6514821*imaginary

   (17) F = sqrt( 3*GetImaginaryNumber() + t )
-> (18) F = sqrt(3*imaginary+t)



System
System

 Purpose:  Defines a collection of the following physical objects:
           Point,  Particle,  RigidFrame,  RigidBody.

Syntax 1:  System
Syntax 1:  System  Fred( A, B, C )
Syntax 2:  K = System.GetKineticEnergy()
Syntax 3:  L = System(B,C).GetLinearMomentum()

   Input:  Fred -- name that starts with a letter, followed by a reasonable
                   number of alphanumeric characters.

   Input:  A, B, C -- names that were previously declared as a Point,
                      Particle, RigidFrame, RigidBody, or System.

Output 1:  Creates a system containing all objects named in a Point, Particle,
           RigidFrame, or RigidBody declaration -- except the NewtonianFrame.

Output 2:  Creates a system named Fred containing A, B, C.

Output 3:  By itself, the  "System"  keyword refers to the collection of all
           objects declared as  Point,  Particle,  RigidFrame, and RigidBody
           that are not part of (welded to) the NewtonianFrame.

Output 4:  Constructs an unnamed system consisting of B and C and calculates
           the sum of the linear momentum of B and C.

  Remark:  The NewtonianFrame is not part of the System.

  Remark:  Systems are used in connection with the commands:
           AddForceGravity     GetForceGravityPotentialEnergy
           GetMass             GetInertia ...       (several variants)
           GetCMPosition       GetCMVelocity        GetCMAcceleration
           GetLinearMomentum   GetAngularMomentum   GetGeneralizedMomentum
           GetResultantForce   GetResultantMoment   GetResultantTorque
           GetKineticEnergy    GetPower             GetEnergyCheckKane
           GetStatics          GetDynamics
           GetStaticsKane      GetDynamicsKane

 Related:  NewtonianFrame  Particle  Point  RigidBody  RigidFrame  System

   (1) %--------------------------------------------------------------------
   (2) % Example: System
   (3) %--------------------------------------------------------------------
   (4) RigidBody  A, B
   (5) A.SetMass( mA )            
   (6) B.SetMass( mB )            
   (7) massSystemAB = System.GetMass()
-> (8) massSystemAB = mA + mB

   (9) Particle   P, Q
   (10) P.SetMass( mP )            
   (11) Q.SetMass( mQ )            
   (12) massSystemABPQ = System.GetMass()
-> (13) massSystemABPQ = mA + mB + mP + mQ



SyntaxForms
Syntactical Forms

 #x>, #y>, #z>  right-handed set of mutually perpendicular unit
                vectors fixed in RigidFrame or RigidBody #,
                e.g., Bx>, By>, Bz> are fixed in B.

 #o             name of the point ("origin") fixed on RigidFrame
                or RigidBody #, e.g., Bo is the origin of B.

 #cm            name of the center of mass (point) fixed on RigidBody #,
                e.g., Bcm is the center of mass of B.

 #_$            rotation matrix (direction cosine matrix) relating
                unit vectors #i>  (i = x,y,z)  fixed in # to
                unit vectors $j>  (j = x,y,z)  fixed in $ where each of
                # and $ have been declared as a RigidFrame or RigidBody;
                the element in row i, column j of #_$ is equal
                to the dot-product of #i> and $j>,
                e.g., B_A is the rotation matrix relating
                Bx>, By>, Bz> to Ax>, Ay>, Az>.

 w_#_$>         angular velocity of # in $ where each of # and $
                have been declared as a RigidFrame or RigidBody,
                e.g., w_B_A> is the angular velocity of B in A.

 alf_#_$>       angular acceleration of # in $ where each of # and $
                have been declared as a RigidFrame or RigidBody,
                e.g., alf_B_A> is the angular acceleration of B in A.

 Torque_#>      resultant torque of relevant external couples on RigidFrame or
                RigidBody #.  For example, Torque_B> is the torque on B.

 Torque_#_$>    resultant torque of relevant couples acting on # from $, where
                each of # and $ have been declared as a RigidFrame or RigidBody,
                e.g., Torque_B_A> is the torque on B from A.

 Force_#>       resultant of relevant external contact and distance forces on
                Point or Particle #.  For example, Force_Q> is the force on Q.

 Force_#_$>     resultant of relevant contact and distance forces acting on
                # from $, where each of # and $ have been declared as a
                Point or Particle, e.g., Force_Q_P> is the force on Q from P.

 p_#_$>         position vector from # to $, where each of # and $
                have been declared as a Point or Particle,
                e.g., p_Q_R> is the position vector from Q to R.

 v_#_$>         velocity of # in $, where # is a Point or Particle
                and # is a RigidFrame or RigidBody, e.g.,
                v_Q_N> is the velocity of Q in N.

 a_#_$>         acceleration of # in $, where # is a Point or Particle
                and # is a RigidFrame or RigidBody, e.g.,
                a_Q_N> is the acceleration of Q in N.

 Zr             rth expression name assigned by a Zee or AutoZee command

 {}             encloses indices, e.g., in declarations

 AUXILIARY[i]   ith constraint function used by the CONSTRAIN command.
 DEPENDENT[j]   jth constraint function used by the CONSTRAIN command.

 []             symbols surrounding elements in a matrix, e.g., [1, 2; 3, 4]

 =   or  :=     assignment                  or   overwrite assignment
 +   or  +=     addition                    or   cumulative addition
 -   or  -=     subtraction or unary minus  or   cumulative subtraction
 *   or  *=     multiplication              or   cumulative multiplication
 /   or  /=     division                    or   cumulative division
 ^   or  ^=     exponentiation              or   cumulative exponentiation

 ,              comma separates arguments of a function and
                separates elements of a row in a matrix

 ;              semicolon separates rows of a matrix; separates commands

 '              prime denotes implicit, ordinary, scalar differentiation
                with respect to the independent variable t, (e.g., y').

 !              invokes operating system e.g.,  !someOperatingSystemCommand

 &              line continuation symbol (for really long lines)

 %              beginning of a comment.
 %%             beginning of a comment for a MATLAB, C, or Fortran program.

 >              symbol used to denote a vector quantity
 >>             symbol used to denote a dyadic quantity
 >>>            symbol used to denote a triadic quantity
 0>             zero vector
 0>>            zero dyadic
 1>>            unit dyadic
 t              time
 Pi             3.1415926...
 imaginary      default name for the square root of -1


t
t

 Purpose:  Default name assigned to the independent variable.
           The program initiates with a declaration of the form:
           IndependentVariable  t

  Syntax:  t

  Remark:  The default name of the independent variable is t.
           t is usually regarded as time.

  Remark:  The prime symbol ' denotes implicit ordinary differentiation
           with respect to the independent variable.  For example, when
           the independent variable t denotes time, x' denotes dx/dt,
           the ordinary time-derivative of x.

 Related:  Constant  ImaginaryNumber  IndependentVariable
           Pi  Specified  t  Variable


tan
tan

 Purpose:  Returns the tangent of a scalar expression.

Syntax 1:  tan( scalarExpressionRad )
Syntax 2:  tanDegrees( realNumberDeg )

   Input:  scalarExpressionRad -- the radian measure of a real or
                                  complex scalar expression.
           realNumberDeg -- expression that resolves to a real number.

Output 1:  Tangent of scalarExpressionRad.
Output 2:  Tangent of realNumberDeg.

 Related:  ConvertUnits  ImaginaryNumber  MathFunctions
           cos  sin  tan  acos  asin  atan  atan2  cosDegrees  ...

   (1) %--------------------------------------------------------------------
   (2) % Example 1: tan   (real scalar expressions)
   (3) %--------------------------------------------------------------------
   (4) A = tan( pi/4 ) 
-> (5) A = 1

   (6) B = tanDegrees( 45 ) 
-> (7) B = 1

   (8) C = tan(t) + tan( t * ConvertUnits(deg,rad) )
-> (9) C = tan(t) + tan(0.01745329*t)

   (10) D = tan(0.5+2*t)
-> (11) D = tan(0.5+2*t)

   (12) %--------------------------------------------------------------------
   (13) % Example 2: tan   (complex scalar expressions)
   (14) %--------------------------------------------------------------------
   (15) E = tan( 2 + 3*GetImaginaryNumber() )
-> (16) E = -0.003764026 + 1.003239*imaginary

   (17) F = tan( 3*GetImaginaryNumber() + t )
-> (18) F = tan(3*imaginary+t)



Translate
Translate

 Purpose:  Sets a point's position from another point.
           Sets a point's velocity in a reference frame.
           Sets a point's acceleration in a reference frame.

Syntax 1:  Q.Translate( fromPoint, positionVector )
           (Note: positionVector may be differentiated).

Syntax 2:  Q.Translate( fromPoint, positionVector, BFixed )
           (Note: positionVector will NOT be differentiated).

Syntax 3:  Q.Translate( fromPoint, positionVector, BFrame, BQ )
           (Note: positionVector may be differentiated).

   Input:  Q -- name of a point.

           fromPoint -- Point whose velocity and acceleration in the
                        NewtonianFrame (or designated frame) is known.

           BFixed -- Rigid frame/body on which fromPoint and Q  are fixed.
           BFrame -- Rigid frame/body on which fromPoint and BQ are fixed.
                     Q is moving on BFrame.

           BQ -- Point of BFrame that is coincident with Q.

  Output:  Sets Q's position vector from fromPoint to positionVector.
           Sets Q's velocity in the NewtonianFrame (or designated frame).
           Sets Q's acceleration in the NewtonianFrame (or designated frame).

Output 2:  Syntax 2 may also set the following (if not in workspace):
           fromPoint's velocity and acceleration in BFixed to 0>
           Q's         velocity and acceleration in BFixed to 0>

Output 3:  Syntax 3 may also set the following (if not in workspace):
           fromPoint's velocity and acceleration in BFrame to 0>.
           BQ          may be defined as a physical point of BFrame, with
                       its velocity and acceleration in BFrame set to 0>.
           BQ's        position from fromPoint.
           Q's         velocity in BFrame (derivative of p_fromPoint_Q>).
           Q's         acceleration in BFrame (via differentiation).

  Remark:  To set Q's velocity in a non-NewtonianFrame, insert refFrame (name
           of a RigidFrame or RigidBody) as the optional first argument, e.g.,
Syntax 1:  Q.Translate( refFrame, fromPoint, positionVector )
Syntax 2:  Q.Translate( refFrame, fromPoint, positionVector, BFixed )
Syntax 3:  Q.Translate( refFrame, fromPoint, positionVector, BFrame, BQ )

  Remark:  If Q is welded to rigid frame/body B, declare it:  Point Q(B).
           Alternately, use  Q.SetVelocityAcceleration( B, 0> )  if Q does not
           move on B, but is not a physical point of B (Q is not welded to B).

 Related:  Translate        SetPositionVelocity   SetVelocityAcceleration
           SetPosition      GetPosition   GetDistance  GetDistanceSquared
           SetVelocity      GetVelocity   GetSpeed     GetElongation
           SetAcceleration  GetAcceleration

   (1) %--------------------------------------------------------------------
   (2) % Example 1: Translate 
   (3) % Set Q1's velocity and acceleration in N by differentiation. 
   (4) %--------------------------------------------------------------------
   (5) NewtonianFrame N             
   (6) Point     Q1            
   (7) Variable  x1'', y1''           
   (8) Q1.Translate( No, x1*Nx> + y1*Ny> )
-> (9) p_No_Q1> = x1*Nx> + y1*Ny>
-> (10) v_Q1_N> = x1'*Nx> + y1'*Ny>
-> (11) a_Q1_N> = x1''*Nx> + y1''*Ny>

   (12) %--------------------------------------------------------------------
   (13) % Example 2: Translate 
   (14) % Set Q2's velocity and acceleration in N by differentiation.
   (15) %--------------------------------------------------------------------
   (16) Point     Q2            
   (17) Variable  x2'', y2''  
   (18) Q2.Translate( Q1, x2*Nx> + y2*Ny> )
-> (19) p_Q1_Q2> = x2*Nx> + y2*Ny>
-> (20) v_Q2_N> = (x1'+x2')*Nx> + (y1'+y2')*Ny>
-> (21) a_Q2_N> = (x1''+x2'')*Nx> + (y1''+y2'')*Ny>

   (22) %--------------------------------------------------------------------
   (23) % Example 3: Translate
   (24) % Set Q3's velocity and acceleration in N via two points fixed on B
   (25) %--------------------------------------------------------------------
   (26) Point     Q3            
   (27) RigidBody B                  % Translating/rotating rigid body 
   (28) Variable  qB''               % Angle and time-derivatives
   (29) Constant  L                  % Distance between Bo and Q3
   (30) B.SetAngularVelocityAcceleration( N, qB'*Bz> )
-> (31) w_B_N> = qB'*Bz>
-> (32) alf_B_N> = qB''*Bz>

   (33) Bo.Translate( No, t^2/2*Nx> )
-> (34) p_No_Bo> = 0.5*t^2*Nx>
-> (35) v_Bo_N> = t*Nx>
-> (36) a_Bo_N> = Nx>

   (37) Q3.Translate( Bo, L*Bx>, B )
-> (38) p_Bo_Q3> = L*Bx>
-> (39) v_Q3_N> = L*qB'*By> + t*Nx>
-> (40) a_Q3_N> = -L*qB'^2*Bx> + L*qB''*By> + Nx>

   (41) %--------------------------------------------------------------------
   (42) % Example 4: Translate
   (43) % Set Q4's velocity and acceleration in N via one point moving on B
   (44) %--------------------------------------------------------------------
   (45) Point      Q4, BQ4           % Point of B coincident with Q4
   (46) Variable   x4''  
   (47) Q4.Translate( Bo, x4*Bx>, B, BQ4 )
-> (48) p_Bo_Q4> = x4*Bx>
-> (49) p_Bo_BQ4> = x4*Bx>
-> (50) v_BQ4_N> = x4*qB'*By> + t*Nx>
-> (51) v_Q4_B> = x4'*Bx>
-> (52) v_Q4_N> = x4'*Bx> + x4*qB'*By> + t*Nx>
-> (53) a_BQ4_N> = -x4*qB'^2*Bx> + x4*qB''*By> + Nx>
-> (54) a_Q4_B> = x4''*Bx>
-> (55) a_Q4_N> = (x4''-x4*qB'^2)*Bx> + (2*qB'*x4'+x4*qB'')*By> + Nx>



TranslateAcrossJoint
TranslateAcrossJoint

  Syntax:  QB.TranslateAcrossJoint( fromPoint, positionVector )

   Input:  QB -- name of a point welded to a RigidBody or RigidFrame B.

           fromPoint -- Point whose velocity and acceleration in
                        the NewtonianFrame is known.

           positionVector -- QB's position vector fromPoint.

  Output:  Calls   QB.Translate( fromPoint, positionVector )
           Sets the velocity and acceleration of Bo and Bcm
           in the Newtonian reference frame.
           If B is a RigidFrame, skips Bcm calculations.

  Remark:  The position vector to Bo  from fromPoint and
           the position vector to Bcm from Bo are used.

 Related:  Translate        SetPositionVelocity   SetVelocityAcceleration
           SetPosition      GetPosition   GetDistance  GetDistanceSquared
           SetVelocity      GetVelocity   GetSpeed     GetElongation
           SetAcceleration  GetAcceleration
           SetRotationMatrixAndPosition   TranslateAcrossJoint
           SetVelocityAccelerationForGetGeometry


SetVelocityAccelerationForGetGeometry
SetVelocityAccelerationForGetGeometry

 Purpose:  Sets the velocity and acceleration in the NewtonianFrame
           of the origin and center of mass of a rigid body.

  Syntax:  B.SetVelocityAccelerationForGetGeometry( refFrame, fromPoint )

   Input:  B -- name of a RigidBody or RigidFrame.
           refFrame  -- name of a RigidFrame or RigidBody.
           fromPoint -- Point whose velocity and acceleration
                        in the refFrame is already known.

  Output:  Sets the velocity and acceleration of Bo and Bcm.
           If B is a RigidFrame, skips Bcm calculations.

  Remark:  The position vector to Bo from fromPoint and
           the position vector to Bcm from Bo are used.

 Related:  SetRotationMatrixAndPosition   TranslateAcrossJoint
           SetVelocityAccelerationForGetGeometry


Variable
Variable

 Purpose:  Declares the names of variables.

Syntax 1:  Variable  a,  b,  x+,  y-,  ...
Syntax 2:  Variable  u', q'',  ...
Syntax 3:  Variable  (displays all names declared as Variable)

   Input:  a -- name that starts with a letter, followed by a reasonable
                number of alphanumeric characters (similarly for b).
           a, b, ... are regarded as REAL until SetComplex is ON.

           x+ -- declares x as real and non-negative.
           y- -- declares y as real and non-positive.
           Helps simplification such as  abs(x) = x  or  abs(y) = -y.

           u'  -- declares u' and u as Variables.
           q'' -- declares q'', q', and q as Variables.

  Remark:  The 1st and 2nd ordinary derivatives of y are denoted y' and y''.
           Dt(y) is permitted if y' was also declared - or y was assigned.

  Remark:  Variable  vs.  Specified ??
           Variable:  Regarded as unknown (to be solved).
                      Partial velocities account for assignment of Variable.
           Specified: Regarded as known   (prescribed).
                      Assigned in program  OR  leave "to be specified" in
                      special functions in MATLAB(R), C, and Fortran codes.
                      Partial velocities ignore assignment of Specified.

  Remark:  The name  a{i}bb    declares a1bb ... aibb  (i is positive integer).
           The name  a{i:j}bb  declares aibb ... ajbb  (i >= 0  and  i <= j).
           The name  a{m,n}bb  declares amnbb     (m, n are integers 0 to 9).
           The name  a{m:x,n:y}  declares amn ... axy    (m <= x and n <= y).

  Remark:  The default name of the independent variable is t.

  Remark:  To both declare and assign a Variable, type e.g.,
           Variable x'' = 2*sin(t)

 Related:  Constant  ImaginaryNumber  Specified  Variable
           SetGeneralizedCoordinate  SetGeneralizedSpeed
           SetDt  SolveDt  SetAutoDifferentiate

   (1) %--------------------------------------------------------------------
   (2) % Example 1: Variable  (variables declarations)
   (3) %--------------------------------------------------------------------
   (4) Variable  w,  x+,  y-,  z'+,   e{0:3}'
   (5) b = sin(t)  +  x  -  abs(x)  +  y  +  abs(y)  +  abs(z)
-> (6) b = sin(t) + z

   (7) dtExample1 = Dt(b) + Dt(e0)
-> (8) dtExample1 = cos(t) + e0' + z'

   (9) %--------------------------------------------------------------------
   (10) % Example 2: Variable  (variable declarations and differentiation)
   (11) %--------------------------------------------------------------------
   (12) Variable  q',  u''
   (13) dtExample2 = Dt(q)  +  Dt(u)  + DtDt(u)  +  Dt(u')
-> (14) dtExample2 = q' + u' + 2*u''

   (15) SetDt( q = sin(t) )
-> (16) q = sin(t)
-> (17) q' = cos(t)

   (18) SetDt( u' = t^3 )
-> (19) u' = t^3
-> (20) u'' = 3*t^2



Vector
Vector

 Purpose:  Constructs a vector or three-element column matrix.

Syntax 1:  Vector( A,  x, y, z  )
Syntax 2:  Vector( A,  threeElementMatrix )
Syntax 3:  Vector( A,  vector>  )

   Input:  A -- the name of a RigidFrame or RigidBody.
           x, y, z -- scalar expressions.
           threeElementMatrix -- 3x1 or 1x3 matrix with scalar elements.
           vector> -- a vector  expression

Output 1:  Returns the vector x*Ax> + y*Ay> + z*Az>
Output 2:  Similar to Output 1 (see example)
Output 3:  3x1 matrix whose elements are the Ax>, Ay>, Az> measures of vector>

 Related:  Cross  Dot  GetAngleBetweenVectors  GetAngleBetweenUnitVectors
           GetDistance  GetMagnitude  GetMagnitudeSquared  GetUnitVector
           >  >>  >>>  0> 0>> 1>>   Dyadic  Matrix  Vector  Express

   (1) %--------------------------------------------------------------------
   (2) % Example 1:  Vector( A,  x, y, z )
   (3) %--------------------------------------------------------------------
   (4) RigidFrame A, B
   (5) Constant   x, y, z
   (6) vector1> = Vector( A, x, y, z )
-> (7) vector1> = x*Ax> + y*Ay> + z*Az>

   (8) %--------------------------------------------------------------------
   (9) % Example 2:  Vector( A,  threeElementMatrix )
   (10) %--------------------------------------------------------------------
   (11) vector2> = Vector( A, [x; y; z] )
-> (12) vector2> = x*Ax> + y*Ay> + z*Az>

   (13) %--------------------------------------------------------------------
   (14) % Example 3:  Vector( A,  vector> )
   (15) %--------------------------------------------------------------------
   (16) B.SetRotationMatrixZ( A, t ) 
-> (17) B_A = [cos(t), sin(t), 0;  -sin(t), cos(t), 0;  0, 0, 1]

   (18) matrix1 = Vector( A,  x*Ax> + y*Ay> + z*Az> )
-> (19) matrix1 = [x;  y;  z]

   (20) matrix2 = Vector( B,  x*Ax> + y*Ay> + z*Az> )
-> (21) matrix2 = [x*cos(t) + y*sin(t);  y*cos(t) - x*sin(t);  z]



Zee
Zee   ZeeV    ZeeA   ZeeConstants

 Purpose:  Introduces  Z1, Z2, ...  as  names for expressions and
           makes corresponding replacements.

Syntax 1:  Zee( ExpressionY )
Syntax 2:  Zee( ExpressionY, X )
Syntax 3:  ZeeV( ExpressionY )
Syntax 4:  ZeeA( ExpressionY )
Syntax 5:  ZeeConstants( expressionY )

   Input:  ExpressionY -- a scalar, vector, or dyadic expression or
           a matrix of scalars, vectors, and/or dyadics.

           X -- The name of a scalar symbol (e.g., a constant or variable)
                or a comma-separated list of names of scalar symbols,
                or a matrix of names of scalar symbols,
                that appear linearly in ExpressionY.

Output 1:  ExpressionY expressed in a form involving Z1, Z2, ...

Output 2:  ExpressionY expressed in a form involving Z1, Z2, ... ,
           where Zi do not contain any of the scalar names in X.

Output 3:  ExpressionY expressed in a form involving Z1, Z2, ... ,
           where Zi do not contain independent generalized speeds
           (generalized speeds are named in the SetGeneralizedSpeed command).

Output 4:  ExpressionY expressed in a form involving Z1, Z2, ... ,
           where Zi do not contain any 1st-time-derivatives of independent
           generalized speeds.

Output 5:  ExpressionY expressed in a form involving Z1, Z2, ... ,
           where Zi contain only constants.

  Remark:  Designated names can be excluded from all Zs, provided
           they occur only linearly.  To do this, enter the line
           SetNoZeeSymbol( M ), where M is either a scalar name
           to be excluded or a matrix of scalar names to be excluded.

           ZEE is a dual function; e.g., the command ZEE( F ) can be
           on the right-hand side of an equation or a single expression
           without an equals sign.  In the latter event, an equation
           is created whose left-hand is F.

  Remark:  To be Autolev compatible, use:
           ZeeV( ExpressionY )  instead of  Zee( ExpressionY, U  ),
           ZeeA( ExpressionY )  instead of  Zee( ExpressionY, U' ).

 Related:  Express  SetAutoExpress  SetAutoZee  Zee
           SetNoZeeSymbol  ResetNoZeeSymbol  GetNoZeeSymbol
           FactorLinear  FactorQuadratic

   (1) %--------------------------------------------------------------------
   (2) % Example 1: Zee   (scalar expression)
   (3) %--------------------------------------------------------------------
   (4) Constant   A, B, C
   (5) ScalarExpression = (A-B)*cos(t) + (B-C)*sin(t)
-> (6) ScalarExpression = (A-B)*cos(t) + (B-C)*sin(t)

   (7) Zee( ScalarExpression )
-> (8) z1 = cos(t)
-> (9) z2 = sin(t)
-> (10) z3 = A - B
-> (11) z4 = B - C
-> (12) z5 = z3*z1 + z4*z2
-> (13) ScalarExpression = z5

   (14) %--------------------------------------------------------------------
   (15) % Example 2: ZeeConstants   (vector expression)
   (16) %--------------------------------------------------------------------
   (17) RigidBody  N
   (18) vector> = (A-B)*cos(t)*Nx> + (B-C)*sin(t)*Ny> + cos(A-B)*sin(B-C)*exp(t)*Nz>
-> (19) vector> = (A-B)*cos(t)*Nx> + (B-C)*sin(t)*Ny> + sin(B-C)*cos(A-B)*exp(t)*Nz>

   (20) ZeeConstants( vector> )
-> (21) z6 = sin(B-C)*cos(A-B)
-> (22) vector> = z3*cos(t)*Nx> + z4*sin(t)*Ny> + z6*exp(t)*Nz>

   (23) %--------------------------------------------------------------------
   (24) % Example 3: Zee   (matrix expression)
   (25) %--------------------------------------------------------------------
   (26) Variable x, y
   (27) matrix[1] = 10 + A + B + C + abs(t)*x + sin(t)*exp(t)*cos(t^2)*y
-> (28) matrix[1] = 10 + A + B + C + abs(t)*x + sin(t)*exp(t)*cos(t^2)*y

   (29) matrix[2] = 10 + A^2 + cos(B+C)*tan(t)*x
-> (30) matrix[2] = 10 + A^2 + cos(B+C)*tan(t)*x

   (31) Zee( matrix, x, y )
-> (32) z7 = abs(t)
-> (33) z8 = exp(t)
-> (34) z9 = cos(t^2)
-> (35) z10 = z2*z8*z9
-> (36) z11 = 10 + A + B + C
-> (37) z12 = cos(B+C)
-> (38) z13 = tan(t)
-> (39) z14 = z12*z13
-> (40) z15 = 10 + A^2
-> (41) matrix = [z11 + z7*x + z10*y;  z15 + z14*x]


Copyright (c) 2009-2018 Motion Genesis LLC. All rights reserved.