% Copyright (c) 1988-2026 Motion Genesis LLC and/or Paul Mitiguy.  All rights reserved.
%-------------------------------------------------------------------------------

%Help
%Interface (type  Help Interface  for quick tips):
% !  Clear  Echo  Help  List  GetMemory  Pause  Run  Quit  Save  if
%-------------------------------------------------------------------------------
%Pre-defined symbols (type  HELP SYNTAX  for syntax help):
% pi imaginary  true false  % %%   0>   0>>   1>>   >   >>   :=   &  []
% t  tInitial  tFinal  tStep  absError
%-------------------------------------------------------------------------------
%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  Evaluate        EvaluateToNumber  Exclude   Include  RoundDigits
% Integrate  GetCoefficient  GetRhs   GetTaylorSeries  Linearize  ReplaceString
%-------------------------------------------------------------------------------
%Mathematical simplification (work on scalars, vectors, and matrices):
% Expand  Epsilon   Explicit  Factor  FactorLinear  FactorQuadratic  Zee
%-------------------------------------------------------------------------------
%Logical functions:
% if true false  IsContainSymbol  IsSimplifyEqual IsSimplifyZero IsSimplifyTrue
% Strcmp  Strcmpi  IsNegative  IsNegativeOr0  IsPositiveOr0  IsPositive
%-------------------------------------------------------------------------------
%Roots, solving equations, and setting ordinary derivatives
% GetCubicRoots  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  SetInertia
% GetProductOfInertia  GetRadiusOfGyration  GetInertiaVector    SetMassInertia
%-------------------------------------------------------------------------------
%Vectors and dyadics:
% Cross                   Dot                          Dyadic   Express
% GetAngleBetweenVectors  GetAngleBetweenUnitVectors   GetBasisVector
% GetMagnitude            GetMagnitudeSquared
% GetUnitVector           Vector
%-------------------------------------------------------------------------------
%Matrices:
% GetColumns      GetDeterminant      GetDiagonalMatrix   GetEigen   GetNorm
% 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, acceleration)
% Translate        SetPositionVelocity        SetVelocityAcceleration
% SetPosition      GetPosition   GetDistance  GetDistanceSquared
% SetVelocity      GetVelocity   GetSpeed     GetElongation
% SetAcceleration  GetAcceleration            GetVelocityJacobian  ...
%-------------------------------------------------------------------------------
%Forces:
% AddForce              AddForceDamper AddForceElectrostatic  AddForceGravity
% AddForceInverseSquare AddForceSpring AddForceLinearActuator GetResultantForce
%-------------------------------------------------------------------------------
%Torque and Moments:
% AddTorque   AddTorqueDamper   GetMomentOfForces   GetResultantTorque
%-------------------------------------------------------------------------------
%Potential energy, work, and power
% GetForceGravityPotentialEnergy         GetForceSpringPotentialEnergy
% GetForceElectrostaticPotentialEnergy   GetForceInverseSquarePotentialEnergy
% SetWorkODE                             GetPower
%-------------------------------------------------------------------------------
%Kinetic energy and angular/translational (linear) momentum (also see Gyrostat):
% GetKineticEnergy
% GetAngularMomentum GetTranslationalMomentum 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
% Code  Algebraic  Nonlinear
%-------------------------------------------------------------------------------
%Old commands (for backward compatibility only).
% Angvel  KinDiffs  Dircos  FrStar  Gyrostat  Simprot  V1PT V2PTS A1PT A2PTS
%-------------------------------------------------------------------------------
%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

%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>>
%1>>
%
% Purpose:  1>>  is the unit dyadic whose defining property is
%           Dot( 1>>, anyVector> ) = anyVector>
%
%  Syntax:  1>>
%
% Related:  >  >>  >>>  0>  0>>  1>>  Vector Dyadic

%!
%!
%
% 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).
%           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
%
%  Remark:  You may be prompted to type 4 letters before the operating system
%           command will be performed.
%
% 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 written to 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
%

%&
% &
%
% 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.
%
% 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 the sum of a and b.
%           a - b   returns a + (-b).
%Syntax 2:  Constant  m+
%Syntax 3:  Constant  n-
%
% Input 1:  a, b -- scalars or matrices or vectors or dyadics, etc.
% Input 2:  m:  an inherently non-negative (0 or positive) scalar.
% Input 3:  n:  an inherently non-positive (0 or negative) scalar.
%
%  Remark:  Inherently non-negative or non-positive scalars affect
%           simplification with abs, sqrt, etc.
%
% Related:  +  -  *  /  ^  sign  Constant  Variable  Specified  abs  sqrt

%*
% *  or  /
%
% Purpose:  Multiplies scalars, matrices, vectors, dyadics, etc., or
%           divides these quantities by a scalar.
%
%Syntax 1:  a * b   returns a multiplied by b.
%Syntax 2:  a / s   returns a divided by the scalar s.
%
%   Input:  a, b -- scalars or matrices or vectors or dyadics, etc.
%           s    -- scalar.
%
% Related:  +  -  *  /  ^  sqrt

%^
% ^
%
% Purpose:  Exponentiation of a scalar.
%
%  Syntax:  a ^ b    returns a raised to the power b.
%
%  Remark:  a ^ 0.5  returns sqrt(a).
%           sqrt(-1) returns the imaginary number.
%
%   Input:  a, b -- scalars or scalar expressions.
%
% Related:  +  -  *  /  ^  sqrt

%=
%=   :=   +=   *=   /=   ^=    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   =   :=   +=   *=   /=   ^=

%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
%           t  tInitial  tFinal  tStep  absError  printIntScreen  printIntFile
%           Solve  SolveDt  SolveSetInput  SolveSetInputDt  ...

%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  abs           for absolute value of a real or complex scalar.
%           Use  GetMagnitude  for the magnitude of a vector.
%           Use  GetNorm       for the 2-norm of a real row or column matrix.
%
% Related:  ImaginaryNumber  MathFunctions
%           GetMagnitude     GetMagnitudeSquared     abs     GetNorm

%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  ...

%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  ...

%atan
%atan or atan2
%
% Purpose:  Returns the inverse tangent of a scalar expression or the
%           the numerical value of the two-argument inverse tangent.
%
%Syntax 1:  atan( scalarExpression )
%Syntax 2:  atanDegrees( realNumber )
%Syntax 3:  atan2( y, x )
%Syntax 4:  atan2Degrees( y, x )
%
%   Input:  scalarExpression -- a real or complex scalar expression.
%           realNumber -- an expression that resolves to a real number.
%           y -- an expression that resolves to a real number
%           x -- an 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.
%Output 3:  The angle theta that satisfies the equations:
%
%           sin(theta) = y/(x^2+y^2)   undefined if x = y = 0.
%           cos(theta) = x/(x^2+y^2)   undefined if x = y = 0.
%
%Output 3:  theta in radians in the range -pi  to pi.
%Output 4:  theta in degrees in the range -180 to 180.
%
% Related:  ConvertUnits  ImaginaryNumber  MathFunctions
%           cos  sin  tan  acos  asin  atan  atan2  cosDegrees  ...

%AddForce
%AddForce   ResetForce
%
% Purpose:  Adds (or resets) force on a point or particle.
%
%Syntax 1:  Q.AddForce(       forceVec> )  same as Force_Q>   += forceVec>
%Syntax 2:  Q.AddForce(   P,  forceVec> )  same as Force_Q_P> += forceVec>
%Syntax 3:  Q.ResetForce(     forceVec> )  same as Force_Q>   := forceVec>
%Syntax 4:  Q.ResetForce( P,  forceVec> )  same as Force_Q_P> := forceVec>
%
%   Input:  Q -- the name of a point or particle.
%           P -- the name of a point or particle.
%           forceVec> -- a force vector.
%
%Output 1:  Adds  forceVec>  to  Force_Q>    (accumulates force on Q).
%Output 2:  Adds  forceVec>  to  Force_Q_P>  (accumulates force on Q from P).
%Output 3:  Force_Q>    is reset to  forceVec>.
%Output 4:  Force_Q_P>  is reset to  forceVec>.
%
%  Remark:  Syntax 1 is for "external" forces applied to Q.
%           Force_Q>  denotes the contact and distance forces on Q that are
%           "external" to all objects in any system under consideration
%           (and perhaps also external to the NewtonianFrame).
%           Syntax 1 is frequently used for external forces such as Earth's
%           gravity, air-resistance, contact forces with roads, etc.
%    Note:  Q.GetResultantForce()  accounts for both  Force_Q>  and all
%           action/reaction forces on Q such as Force_Q_P>, Force_Q_S>, etc.
%
%  Remark:  Syntax 2 is for  "action/reaction"  forces applied to Q from P
%           that fully obey Newton's 3rd law (action/reaction), meaning
%           forceVec>  MUST  be parallel to the line joining P and Q.
%           Syntax 2 is frequently used for translational springs/dampers,
%           ropes, rods, planetary gravity, charged particles, etc.
%    Note:  Avoid Syntax 2 if forceVec> is not parallel to line PQ.
%           Instead use:  Q.AddForce( forceVec> );   P.AddForce( -forceVec> )
%    Note:  Q.GetResultantForce(P)  returns  Force_Q_P> - Force_P_Q>.
%           Force_Q_P> denotes a force on Q from P.
%           Force_P_Q> denotes a force on P from Q.
%
%  Remark:  When sensible, use Syntax 2 instead of Syntax 1 as it efficiently
%           accounts for action/reaction forces by knowing whether P and Q
%           are internal, external, or mixed for the system under consideration.
%
%  Remark:  If Q is a point of a RigidFrame or RigidBody B, declare it as
%           Point Q(B).  This helps with subsequent velocity/acceleration
%           and force/moment calculations.
%
% Related:  AddForce  AddForceDamper  AddForceElectrostatic  AddForceGravity
%           AddForceInverseSquare  AddForceLinearActuator  AddForceSpring
%           AddTorque  AddTorqueDamper
%           GetMomentOfForces  GetResultantForce  GetResultantTorque
%           GetForceGravityPotentialEnergy  GetForceSpringPotentialEnergy
%           GetStatics   GetStaticsKane   GetStaticsLagrange
%           GetDynamics  GetDynamicsKane  GetDynamicsLagrange

%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 helps with subsequent velocity/acceleration
%           and force/moment calculations.
%
% Related:  AddForce  AddForceDamper  AddForceElectrostatic  AddForceGravity
%           AddForceInverseSquare  AddForceLinearActuator  AddForceSpring
%           AddTorque  AddTorqueDamper
%           GetMomentOfForces  GetResultantForce  GetResultantTorque
%           GetForceGravityPotentialEnergy  GetForceSpringPotentialEnergy
%           GetStatics   GetStaticsKane   GetStaticsLagrange
%           GetDynamics  GetDynamicsKane  GetDynamicsLagrange

%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 helps with subsequent velocity/acceleration
%           and force/moment calculations.
%
% Related:  AddForce  AddForceDamper  AddForceElectrostatic  AddForceGravity
%           AddForceInverseSquare  AddForceLinearActuator  AddForceSpring
%           AddTorque  AddTorqueDamper
%           GetMomentOfForces  GetResultantForce  GetResultantTorque
%           GetForceGravityPotentialEnergy  GetForceSpringPotentialEnergy
%           GetForceElectrostaticPotentialEnergy  GetCharge  SetCharge
%           GetStatics   GetStaticsKane   GetStaticsLagrange
%           GetDynamics  GetDynamicsKane  GetDynamicsLagrange

%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( gVector )
%Syntax 2:  Q.AddForceGravity( P, G )
%
%   Input:  Object -- the name of a Particle, RigidBody, or System.
%
%           gVector -- A vector directed locally downward and whose magnitude
%                      is the local gravitational acceleration constant.
%           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.
%           Earth's equatorial radius is approximately 6356 km (3949.4 miles).
%
%  Remark:  If Q is a point of a RigidFrame or RigidBody B, declare it as
%           Point Q(B).  This helps with subsequent velocity/acceleration
%           and force/moment calculations.
%
% Related:  AddForce  AddForceDamper  AddForceElectrostatic  AddForceGravity
%           AddForceInverseSquare  AddForceLinearActuator  AddForceSpring
%           AddTorque  AddTorqueDamper
%           GetMomentOfForces  GetResultantForce  GetResultantTorque
%           GetForceGravityPotentialEnergy  GetForceSpringPotentialEnergy
%           GetStatics   GetStaticsKane   GetStaticsLagrange
%           GetDynamics  GetDynamicsKane  GetDynamicsLagrange

%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
%           (a repulsive force pushes Q away from P), whereas
%           a negative coef corresponds to an attractive force,
%           (an attractive force pulls Q towards P).
%
%  Remark:  If Q is a point of a RigidFrame or RigidBody B, declare it as
%           Point Q(B).  This helps with subsequent velocity/acceleration
%           and force/moment calculations.
%
% Related:  AddForce  AddForceDamper  AddForceElectrostatic  AddForceGravity
%           AddForceInverseSquare  AddForceLinearActuator  AddForceSpring
%           AddTorque  AddTorqueDamper
%           GetMomentOfForces  GetResultantForce  GetResultantTorque
%           GetForceGravityPotentialEnergy  GetForceSpringPotentialEnergy
%           GetForceElectrostaticPotentialEnergy
%           GetStatics   GetStaticsKane   GetStaticsLagrange
%           GetDynamics  GetDynamicsKane  GetDynamicsLagrange

%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 helps with subsequent velocity/acceleration
%           and force/moment calculations.
%
% Related:  AddForce  AddForceDamper  AddForceElectrostatic  AddForceGravity
%           AddForceInverseSquare  AddForceLinearActuator  AddForceSpring
%           AddTorque  AddTorqueDamper
%           GetMomentOfForces  GetResultantForce  GetResultantTorque
%           GetForceGravityPotentialEnergy  GetForceSpringPotentialEnergy
%           GetStatics   GetStaticsKane   GetStaticsLagrange
%           GetDynamics  GetDynamicsKane  GetDynamicsLagrange

%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 helps with subsequent velocity/acceleration
%           and force/moment calculations.
%
% Related:  AddForce  AddForceDamper  AddForceElectrostatic  AddForceGravity
%           AddForceInverseSquare  AddForceLinearActuator  AddForceSpring
%           AddTorque  AddTorqueDamper
%           GetMomentOfForces  GetResultantForce  GetResultantTorque
%           GetForceGravityPotentialEnergy  GetForceSpringPotentialEnergy
%           GetStatics   GetStaticsKane   GetStaticsLagrange
%           GetDynamics  GetDynamicsKane  GetDynamicsLagrange

%
%AddImpulse (RESERVED KEYWORDS & SYNTAXES. IN-DEVELOPMENT)
%AddImpulse   ResetImpulse
%
% Purpose:  Adds (or resets) impulse on a point or particle.
%
%Syntax 1:  Q.AddImpulse(       impulseVec )
%Syntax 2:  Q.AddImpulse(   P,  impulseVec )
%Syntax 3:  Q.ResetImpulse(     impulseVec )
%Syntax 4:  Q.ResetImpulse( P,  impulseVec )
%
%   Input:  Q -- the name of a  point  or  particle
%           P -- the name of a  point  or  particle
%           impulseVec -- an impulse vector
%
%Output 1:  impulseVec> is added to Impulse_Q    (accumulates impulse on Q).
%Output 2:  impulseVec> is added to Impulse_Q_P> (accumulates impulse on Q from P)
%Output 3:  Impulse_Q>    is reset to  impulseVec>.
%Output 4:  Impulse_Q_P>  is reset to  impulseVec>.
%
%  Remark:  Syntax 1 is for  "external"  impulses applied to Q.
%           Impulse_Q>  denotes the resultant of contact and distance
%           impulses 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"  impulses applied to Q from A.
%           Impulse_Q_P>  denotes the resultant impulse on Q from A.
%
%           Syntax 2 can only be used for "action/reaction" impulses that obey
%           Newton's 3rd law (i.e., the law of action/reaction):
%           (a) the impulse on Q must be equal and opposite to the impulse on P;
%           (b) impulseVec> must be parallel to Q's position vector from P.
%
%           Avoid Syntax 2 if impulseVec is not parallel to line PQ.  Instead
%           consider:  Q.AddImpulse( impulseVec );  P.AddImpulse( -impulseVec )
%
%  Remark:  Alternate ways to apply an impulse  Vec>  to point Q include:
%           Impulse_Q>  = Vec>   % Resets  Impulse_Q>  to  Vec>
%           Impulse_Q> += Vec>   % Adds       Vec>  to   Impulse_Q>
%           Impulse_Q> -= Vec>   % Subtracts  Vec>  from Impulse_Q>
%
%  Remark:  If Q is a point of a RigidFrame or RigidBody B, declare it as
%           Point Q(B).  This helps with subsequent velocity/acceleration
%           and force/moment calculations.
%
% Related:  AddForce  AddForceDamper  AddForceElectrostatic  AddForceGravity
%           AddForceInverseSquare  AddForceLinearActuator  AddForceSpring
%           AddTorque  AddTorqueDamper
%           GetMomentOfForces  GetResultantForce  GetResultantTorque
%           GetForceGravityPotentialEnergy  GetForceSpringPotentialEnergy
%           GetStatics   GetStaticsKane   GetStaticsLagrange
%           GetDynamics  GetDynamicsKane  GetDynamicsLagrange
%           AddImpulse  AddImpulseTorque  GetResultantImpulse
%           GetResultantImpulseTorque  GetMomentOfImpulses  GetImpulseMomentum

%
%AddImpulseTorque (RESERVED KEYWORDS & SYNTAXES. IN-DEVELOPMENT)
%AddImpulseTorque  ResetImpulseTorque
%
% Purpose:  Adds (or resets) impulse-torque to a RigidFrame or RigidBody.
%
%Syntax 1:  B.AddImpulseTorque(       impulseTorque )
%Syntax 2:  B.AddImpulseTorque(   A,  impulseTorque )
%Syntax 3:  B.ResetImpulseTorque(     impulseTorque )
%Syntax 4:  B.ResetImpulseTorque( A,  impulseTorque )
%
%   Input:  B, A -- names of a RigidFrame or RigidBody.
%           impulseTorqueVector -- an impulse-torque vector
%
%Output 1:  Adds impulseTorque to ImpulseTorque_B>   (accumulates impulse torque on B)
%Output 2:  Adds impulseTorque to ImpulseTorque_B_A> (accumulates impulse torque on B from A)
%Output 3:  ImpulseTorque_B>    is reset to  impulseTorque.
%Output 4:  ImpulseTorque_B_A>  is reset to  impulseTorque.
%
%  Remark:  Syntax 1 is for  "external"  impulse-torques on B.
%           ImpulseTorque_B>  denotes the resultant impulse-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"  impulse-torques on B from A.
%           ImpulseTorque_B_A>  denotes the impulse-torque associated with
%           contact and distance forces on B from A.
%
%  Remark:  Alternate ways to apply an impulse-torque  Vec>  to B include:
%           ImpulseTorque_B>  = Vec>   % Resets  ImpulseTorque_B>  to Vec>
%           ImpulseTorque_B> += Vec>   % Adds       Vec>  to    ImpulseTorque_B>
%           ImpulseTorque_B> -= Vec>   % Subtracts  Vec>  from  ImpulseTorque_B>
%
% Related:  AddForce  AddForceDamper  AddForceElectrostatic  AddForceGravity
%           AddForceInverseSquare  AddForceLinearActuator  AddForceSpring
%           AddTorque  AddTorqueDamper
%           GetMomentOfForces  GetResultantForce  GetResultantTorque
%           GetForceGravityPotentialEnergy  GetForceSpringPotentialEnergy
%           GetStatics   GetStaticsKane   GetStaticsLagrange
%           GetDynamics  GetDynamicsKane  GetDynamicsLagrange
%           AddImpulse  AddImpulseTorque  GetResultantImpulse
%           GetResultantImpulseTorque  GetMomentOfImpulses  GetImpulseMomentum

%
%GetResultantImpulse (RESERVED KEYWORDS & SYNTAXES. IN-DEVELOPMENT)
%GetResultantImpulse
%
% Purpose:  Sums all impulses applied to an object.
%
%Syntax 1:  Object.GetResultantImpulse()
%Syntax 2:  Q.GetResultantImpulse( P )
%
%   Input:  Object -- a Point, Particle, RigidBody, RigidFrame, or System
%           Q, P -- names of points (e.g., Point or Particle).
%
%Output 1:  Resultant of all impulses applied to Object.
%Output 2:  Resultant of all impulses 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 helps with subsequent velocity/acceleration
%           and force/moment calculations.
%
% Related:  AddForce  AddForceDamper  AddForceElectrostatic  AddForceGravity
%           AddForceInverseSquare  AddForceLinearActuator  AddForceSpring
%           AddTorque  AddTorqueDamper
%           GetMomentOfForces  GetResultantForce  GetResultantTorque
%           GetForceGravityPotentialEnergy  GetForceSpringPotentialEnergy
%           GetStatics   GetStaticsKane   GetStaticsLagrange
%           GetDynamics  GetDynamicsKane  GetDynamicsLagrange
%           AddImpulse  AddImpulseTorque  GetResultantImpulse
%           GetResultantImpulseTorque  GetMomentOfImpulses  GetImpulseMomentum

%
%GetResultantImpulseTorque  (RESERVED KEYWORDS & SYNTAXES. IN-DEVELOPMENT)
%GetResultantImpulseTorque
%
% Purpose:  Sums all impulse-torques applied to a rigid object.
%
%Syntax 1:  B.GetResultantImpulseTorque()
%Syntax 2:  B.GetResultantImpulseTorque( A )
%
%   Input:  B, A -- names of a RigidFrame or RigidBody.
%
%Output 1:  Resultant of all impulse-torques applied to B.
%Output 2:  Resultant of all impulse-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
%           AddImpulse  AddImpulseTorque  GetResultantImpulse
%           GetResultantImpulseTorque  GetMomentOfImpulses  GetImpulseMomentum

%
%GetMomentOfImpulses  (RESERVED KEYWORDS & SYNTAXES. IN-DEVELOPMENT)
%GetMomentOfImpulses
%
% Purpose:  Sums the moments of all impulses applied to an object.
%
%  Syntax:  Object.GetMomentOfImpulses( aboutPoint )
%
%   Input:  Object -- name of Point, Particle, RigidFrame, RigidBody, or System.
%           aboutPoint -- the name of a point or Particle.
%
%  Output:  Moment of all impulses 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 helps with subsequent velocity/acceleration
%           and force/moment/impulse calculations.
%
% Related:  AddForce  AddForceDamper  AddForceElectrostatic  AddForceGravity
%           AddForceInverseSquare  AddForceLinearActuator  AddForceSpring
%           AddTorque  AddTorqueDamper
%           GetMomentOfForces  GetResultantForce  GetResultantTorque
%           GetForceGravityPotentialEnergy  GetForceSpringPotentialEnergy
%           GetStatics   GetStaticsKane   GetStaticsLagrange
%           GetDynamics  GetDynamicsKane  GetDynamicsLagrange
%           AddImpulse  AddImpulseTorque  GetResultantImpulse
%           GetResultantImpulseTorque  GetMomentOfImpulses  GetImpulseMomentum

%
%GetImpulseMomentum  (RESERVED KEYWORDS & SYNTAXES. IN-DEVELOPMENT)
%GetImpulseMomentum   GetImpulseMomentumKane   GetImpulseMomentumLagrange
%
% Purpose:  Gets equations of motion associated with impulse-momentum.
%
%Syntax 1:  Object.GetImpulseMomentum()
%Syntax 2:  Object.GetImpulseMomentum( aboutPoint )
%Syntax 3:  System.GetImpulseMomentumKane()
%Syntax 4:  System.GetImpulseMomentumLagrange()
%
%   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.
%Output 2:  Euler's    equation of motion for Object about aboutPoint.
%Output 3:  Kane's     equation of motion for the entire System.
%Output 4:  Lagrange's equation of motion for the entire System.
%
%  Remark:  If Q is a point of a RigidFrame or RigidBody B, declare it as
%           Point Q(B).  This helps with subsequent velocity/acceleration
%           and force/moment/impulse calculations.
%
% Related:  AddForce  AddTorque  SetMass  SetInertia  Rotate  Translate
%           NewtonianFrame  Point  Particle  RigidFrame  RigidBody
%           GetStatics   GetStaticsKane   GetStaticsLagrange
%           GetDynamics  GetDynamicsKane  GetDynamicsLagrange
%           SetGeneralizedCoordinate  SetGeneralizedSpeed
%           AddImpulse  AddImpulseTorque  GetResultantImpulse
%           GetResultantImpulseTorque  GetMomentOfImpulses  GetImpulseMomentum

%AddTorque
%AddTorque  ResetTorque
%
% Purpose:  Adds (or resets) torque to a RigidFrame or RigidBody.
%
%Syntax 1:  B.AddTorque(       torqueVec> )  same as Torque_B>   += torqueVec>
%Syntax 2:  B.AddTorque(   A,  torqueVec> )  same as Torque_B_A> += torqueVec>
%Syntax 3:  B.ResetTorque(     torqueVec> )  same as Torque_B>   := torqueVec>
%Syntax 4:  B.ResetTorque( A,  torqueVec> )  same as Torque_B_A> := torqueVec>
%
%   Input:  B, A -- names of a RigidFrame or RigidBody.
%           torqueVec> -- a torque vector.
%
%Output 1:  Adds  torqueVec>  to  Torque_B>    (accumulates torque on B).
%Output 2:  Adds  torqueVec>  to  Torque_B_A>  (accumulates torque on B from A).
%Output 3:  Torque_B>    is reset to  torqueVec>.
%Output 4:  Torque_B_A>  is reset to  torqueVec>.
%
%  Remark:  Syntax 1 is for "external" torques applied to B.
%           Torque_B> denotes the torque associated with contact/distance forces
%           on B that are "external" to any system under consideration
%           (and perhaps also external to the NewtonianFrame).
%    Note:  B.GetResultantTorque()  accounts for both  Torque_B>  and all
%           action/reaction torques on B such as Torque_B_A>, Torque_B_C>, etc.
%
%  Remark:  Syntax 2 is for "action/reaction" torques applied to B from A and is
%           frequently used for torque motors, torsional springs/dampers, etc.
%    Note:  B.GetResultantTorque(A)  returns  Torque_B_A> - Torque_A_B>.
%           Torque_B_A> denotes a torque on B from A.
%           Torque_A_B> denotes a torque on A from B.
%
%  Remark:  When sensible, use Syntax 2 instead of Syntax 1 as it efficiently
%           accounts for action/reaction torques by knowing whether B and A
%           are internal, external, or mixed for the system under consideration.
%
% Related:  AddForce  AddForceDamper  AddForceElectrostatic  AddForceGravity
%           AddForceInverseSquare  AddForceLinearActuator  AddForceSpring
%           AddTorque  AddTorqueDamper
%           GetMomentOfForces  GetResultantForce  GetResultantTorque
%           GetForceGravityPotentialEnergy  GetForceSpringPotentialEnergy
%           GetStatics   GetStaticsKane   GetStaticsLagrange
%           GetDynamics  GetDynamicsKane  GetDynamicsLagrange

%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, A -- names of a 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

%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

%ceil
%ceil   floor
%
% Purpose:  Returns the ceiling or floor of a real scalar expression.
%
%Syntax 1:  ceil( realScalarExpression )
%Syntax 2:  floor( realScalarExpression )
%
%   Input:  realScalarExpression -- a real scalar expression.
%
%Output 1:  Ceiling of realScalarExpression, i.e., the smallest
%           integer greater than or equal to realScalarExpresion.
%
%Output 2:  Floor of realScalarExpression, i.e., the largest
%           integer less than or equal to realScalarExpresion.
%
%  Remark:  The sign function can combine with ceil or floor for if statements:
%           isPositive      = ceil(  sign(t)/2 )              % Returns 0 or  1.
%           isPositiveOr0   = ceil(  sign(t)/2 + 0.1 )        % Returns 0 or  1.
%           isNegative      = floor( sign(t)/2 )              % Returns 0 or -1.
%           isTGreaterThan5 = ceil( sign(t-5) / 2 )           % Returns 0 or  1.
%           isTLessThan9    = ceil( sign(9-t) / 2 )           % Returns 0 or  1.
%           isTBetween5And9 = isTGreaterThan5 * isTLessThan9  % Returns 0 or  1.
%
% Related:  ceil  floor  int  max  min  round  RoundDigits  sign  MathFunctions
%           IsNegative  IsNegativeOr0  IsPositiveOr0  IsPositive

%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()
%
%   Input:  a -- name that starts with a letter, followed by a reasonable
%                number of alphanumeric characters (similarly for b, c, d).
%           a, b  are regarded as REAL constants unless SetComplex is ON.
%           c+    declares c as a real non-negative constant so  abs(c) =  c.
%           d-    declares d as a real non-positive constant so  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 4:  ConstantEncode forces MATLAB(R), C, and Fortran programs to include
%           quantities that may not otherwise appear due to code-optimization.
%
%Output 5:  Creates an array of all names declared as Constant.

%  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 declares its argument name as a non-negative
%           constant if that argument name has not already been declared.
%
%           The SetInertia command declares its moment of inertia arguments
%           as non-negative constants if they are 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

%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).
%
%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
%           Constant,     SetMass,       SetInertia

%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.

%cos
%cos and sec
%
% Purpose:  Returns the cosine or secant of a scalar expression.
%
%Syntax 1:  cos(x)  or  sec(x)
%Syntax 2:  cosDegrees( realNumberDeg )
%
%   Input:  x -- the radian measure of a real or complex scalar expression.
%           realNumberDeg -- expression that resolves to a real number.
%
%Output 1:  cos(x) returns the cosine of x.
%           sec(x) returns the cosecant of x, which is 1/cos(x).
%Output 2:  Cosine of realNumberDeg.
%
% Related:  ConvertUnits  ImaginaryNumber  MathFunctions
%           cos  sin  tan  acos  asin  atan  atan2  cosDegrees  ...

%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.
%
% Remark:   cosh(x) = ( exp(x) + exp(-x) ) / 2
%           sinh(x) = ( exp(x) - exp(-x) ) / 2
%           tanh(x) = sinh(x) / cosh(x)
%           cosh(x)^2 - sinh(x)^2 = 1
%           D( cosh(x), x ) = sinh(x)
%           D( sinh(x), x ) = cosh(x)
%           D( tanh(x), x ) = 1 - tanh(x)^2 = 1 / cosh(x)^2
%
% Related:  ImaginaryNumber  MathFunctions
%           cos  sin  tan  acos  asin  atan  atan2  cosDegrees  ...

%Cross
%Cross   or    Dot
%
% Purpose:  Forms the cross-product or dot-product for vectors, dyadics, etc.
%
%Syntax 1:  Cross( vA, vB )
%Syntax 2:    Dot( vA, vB )
%
%   Input:  vA -- a vector, dyadic, triadic, or a matrix of these.
%           vB -- a vector, dyadic, triadic, or a matrix of these.
%
%Output 1:  Cross-product of vA and vB.
%Output 2:    Dot-product of vA and vB.
%
%  Remark:  When vA and vB are matrices, perform operations in the order defined
%           by matrix multiplication. For the 2x3 matrix vA and 3x5 matrix vB,
%           Cross( vA, vB )  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

%Derivative
%Derivative
%
% Purpose:  Forms the ordinary or partial derivative of a scalar, vector, or
%           dyadic expression or a matrix of such expressions.
%
% See help: Dt  for more information on ordinary derivatives.
%           D   for more information on partial  derivatives.
%
% Related:  D  Dt  DtDt  Integrate  GetPartials  GetJacobian  MathFunctions

%Dt
%Dt
%
% Purpose:  Forms the ordinary derivative of a scalar, vector, or dyadic
%           expression or a matrix of such expressions.
%
%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.
%           vectorOrMatrixExpression -- a scalar, vector, or dyadic expression
%                                       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 vectorOrMatrixExpression in refFrame.
%Output 3:  2nd-ordinary derivative of scalarOrMatrixExpression.
%Output 4:  2nd-ordinary derivative of vectorOrMatrixExpression in refFrame.
%Output 5:  3rd-ordinary derivative of scalarOrMatrixExpression.
%Output 6:  3rd-ordinary derivative of vectorOrMatrixExpression 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  ...

%D
%D
%
% Purpose:  Forms the partial derivative of a scalar, vector, or dyadic
%           expression or a matrix of such expressions.
%
%Syntax 1:  D( scalarOrMatrixExpression, X )
%Syntax 2:  D( vectorOrMatrixExpression, X, refFrame )
%
%   Input:  scalarOrMatrixExpression -- a scalar expression or matrix
%                                       of scalar expressions.
%           vectorOrMatrixExpression -- a scalar, vector, or dyadic expression
%                                       or matrix of such expressions.
%           X -- the name of a scalar or a matrix of scalar names.
%           refFrame -- a reference frame (e.g., a RigidFrame or RigidBody).
%
% Output 1: Partial derivative of scalarOrMatrixExpression with respect to X.
% Output 2: Partial derivative of vectorOrMatrixExpression with respect to X in
%           refFrame.
%
% Related:  D  Dt  DtDt  Integrate  GetPartials  GetJacobian  MathFunctions

%GetJacobian
%GetJacobian   GetVelocityJacobian   GetAngularVelocityJacobian (IN DEVELOPMENT)
%
% Purpose:  Forms a Jacobian whose elements are partial derivatives, e.g.,
%           partial derivatives of velocity with respect to generalized speeds.
%
%Syntax 1:  GetJacobian( scalarTensorMatrix1D, X )
%Syntax 2:  GetJacobian( scalarTensorMatrix1D, X, refFrame )
%Syntax 3:  Q.GetVelocityJacobian(         refFrame )
%           B.GetAngularVelocityJacobian(  refFrame )
%Syntax 4:  Q.GetVelocityJacobian(         refFrame, X )
%           B.GetAngularVelocityJacobian(  refFrame, X )
%Syntax 5:  Bp.GetSpatialVelocityJacobian( refFrame )
%           Bp.GetSpatialVelocityJacobian( refFrame, X )
%
%   Input:  scalarTensorMatrix1D -- a scalar, vector, or dyadic expression or a
%                               1D (one-dimensional) matrix of such expressions.
%           X -- the name of a scalar or 1D matrix of these -- e.g., a variable.
%           refFrame -- a reference frame (e.g., a RigidFrame or RigidBody).
%           Q -- the name of a Point.
%           B -- the name of a RigidFrame or RigidBody.
%           Bp -- the name of a point fixed on rigid body or rigid frame B.
%
%Output 1:  n x m matrix of partial derivatives of the scalar portions of
%           scalarTensorMatrix1D with respect to X.
%           Herein: n = dimension of scalarTensorMatrix1D,  m = dimension of X.
%
%Output 2:  n x m matrix of partial derivatives of scalarTensorMatrix1D
%           with respect to X in refFrame.
%
%Output 3:  1 x m matrix of partial derivatives of Q's velocity in refFrame with
%           respect to the m scalars named in the command SetGeneralizedSpeed.
%           Similarly for B's angular velocity in refFrame.
%
%Output 4:  1 x m matrix of partial derivatives of the scalar portions of
%           Q's velocity in refFrame with respect to X.
%           Similarly for B's angular velocity in refFrame.
%
%Output 5:  Matrix whose first row is B.GetAngularVelocityJacobian(...) and
%           whose second row is Bp.GetVelocityJacobian(...),  where
%           B is the RigidFrame or RigidBody to which point Bp is fixed.
%
% Related:  GetVelocity           GetRelativeVelocity
%           GetPartialVelocity    GetPartialAngularVelocity
%           GetVelocityRemainder  GetAngularVelocityRemainder
%           GetVelocityJacobian   GetAngularVelocityJacobian    D, Dt  ...


%GetPartialVelocity
%GetPartials  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:  If using the old/deprecated command  SetDefaults( AUTOLEV ),
%           the returned quantity may depend on whether the command is
%           issued before or after the CONSTRAIN command.
%
% Related:  GetVelocity           GetRelativeVelocity
%           GetPartialVelocity    GetPartialAngularVelocity
%           GetVelocityRemainder  GetAngularVelocityRemainder
%           GetVelocityJacobian   GetAngularVelocityJacobian    D, Dt  ...

%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>>  Vector  Dyadic  Matrix  Express

%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               Stop reading from file (switch to keyboard input)
%           \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
%           \\               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(" Renee says \"Hello world!\" \n and also says 2 + 2 = 4" )
% Renee says "Hello world!"
% and also says 2 + 2 = 4
%
%   (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

%Epsilon
%Epsilon
%
% Purpose:  Rounds numbers that are suitably close to an integer.
%
%Syntax 1:  Epsilon( mathExpression, absEpsilon )
%Syntax 2:  Epsilon( mathExpression, absEpsilon, relEpsilon )
%
%   Input:  mathExpression -- A scalar, vector, dyadic, or matrix expression.
%           absEpsilon a real number r such that:   0  <=  r  < 0.5
%           relEpsilon a real number r such that:   0  <=  r  < 0.5
%
%Output 1:  In mathExpression, rounds any number that is within absEpsilon of
%           an integer to that integer.  For a number of the form  x.y,  no
%           rounding occurs if  absEpsilon <  abs(0.y)  < 1 - absEpsilon
%
%Output 2:  Rounds any number d within abs( d * relEpsilon) of an integer
%           to that integer.  Also does the rounding described by Output 1.
%
% Remark:   If  SetAutoEpsilon( d )  has also been employed,
%           absEpsilon should be greater than or equal to d.
%
% Remark:   Also see RoundDigits.
%
% Related:  Epsilon  Evaluate  Expand  Explicit
%           Factor  FactorLinear  FactorQuadratic  ReplaceString  RoundDigits
%           SetAutoEpsilon  SetDigits

%Euler
%Euler -- one of the greatest engineer / mathematician of all time.
%
% Related:  AngularMomentum  GetEigen  Inertia  Lagrange  Optimize  Quaternion

%Gibbs
%Gibbs -- one of the greatest engineer / mathematician of all time.
%
% Related:  Vectors  Dyadics

%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  RoundDigits  SetAutoRhs  SetUnitSystem

%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

%Expand
%Expand or ExpandDeep
%
% Purpose:  Produces an expression that is mathematically equivalent to the
%           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 )
%Syntax x:  ExpandDeep( mathExpression, ... )        is the same as
%           Expand( Explicit(mathExpression, ...) )  Hence
%           ExpandDeep( mathExpression, 1:2, X) )    is the same as
%           Expand( Explict(mathExpression, X),  1:2, 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.
%           Expand( expression )     does not re-factor the expression.
%           y = Expand( expression )     may  re-factor the expression.
%
% Related:  Epsilon  Evaluate  Expand  Explicit
%           Factor  FactorLinear  FactorQuadratic  ReplaceString  RoundDigits

%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.
%           SetNoZeeSymbol helps ensure certain symbols remain explicit.
%
%  Remark:  See also ExpandDeep() which is equivalent to
%           Expand( Explicit(mathExpression), ... )
%
% Related:  Evaluate  Expand  Explicit
%           Factor  FactorLinear  FactorQuadratic  ReplaceString
%           GetRhs  SetAutoRhs  SetNoZeeSymbol

%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.

%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:  Evaluate  Expand  Explicit
%           Factor  FactorLinear  FactorQuadratic  ReplaceString
%           FactorLinearShallow   FactorQuadraticShallow
%           SetAutoFactor

%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:  Evaluate  Expand  Explicit
%           Factor  FactorLinear  FactorQuadratic  ReplaceString
%           GetQuadraticRoots  SolveQuadraticPositiveRoot

%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  RoundDigits  sign  MathFunctions

%
%FlexibleBody
%FlexibleBody  or  FlexBody (RESERVED KEYWORDS & SYNTAXES. IN-DEVELOPMENT)
%
% Purpose:  Declares flexible bodies or displays the names of all flexible bodies.
%
%Syntax 1:  FlexBody  A, B, ...
%Syntax 2:  FlexBody               (displays all names declared as FlexBody)
%
%   Input:  A -- name that starts with a letter, followed by a reasonable
%                number of alphanumeric characters (similarly for B).
%
%Output 1:  Creates flexible bodies A, B, etc.  For example, declares B as a
%           linearly-deformable body (with a linear stress-strain relationship).
%
%Output 2:  Displays the names of all flexible bodies.
%
% Related:  NewtonianFrame  Particle  Point  RigidBody  RigidFrame  System
%           RigidSystem  FlexBeam  FlexPlate  FlexShell  FlexBody  FlexFrame

%
%FlexibleFrame
%FlexibleFrame  or  FlexFrame  (RESERVED KEYWORDS & SYNTAXES. IN-DEVELOPMENT)
%
% Purpose:  Declares flexible frames or displays the names of all flexible frames.
%
%Syntax 1:  FlexFrame  A, B, ...
%Syntax 2:  FlexFrame               (displays all names declared as FlexFrame)
%
%   Input:  A -- name that starts with a letter, followed by a reasonable
%                number of alphanumeric characters (similarly for B).
%
%Output 1:  Creates a flexible frames A with origin B and with a unitary basis
%           Ax>, Ay>, Az> which may not be orthogonal (mutually perpendicular).
%
%Output 2:  Displays the names of all flexible frames.
%
% Related:  NewtonianFrame  Particle  Point  RigidBody  RigidFrame  System
%           RigidSystem  FlexBeam  FlexPlate  FlexShell  FlexBody  FlexFrame

%
%FlexibleBeam
%FlexibleBeam  or  FlexBeam  (RESERVED KEYWORDS & SYNTAXES. IN-DEVELOPMENT)
%
% Purpose:  Declares flexible beams or displays the names of all flexible beams.
%
%Syntax 1:  FlexBeam  A, B, ...
%Syntax 2:  FlexBeam                   (displays all names declared as FlexBeam)
%
%   Input:  A -- name that starts with a letter, followed by a reasonable
%                number of alphanumeric characters (similarly for B).
%
%Output 1:  Creates flexible beams A, B, etc.
%
% Related:  NewtonianFrame  Particle  Point  RigidBody  RigidFrame  System
%           RigidSystem  FlexBeam  FlexPlate  FlexShell  FlexBody  FlexFrame

%
%FlexiblePlate
%FlexiblePlate  or  FlexPlate  (RESERVED KEYWORDS & SYNTAXES. IN-DEVELOPMENT)
%
% Purpose:  Declares flexible plates or displays the names of all flexible plates.
%
%Syntax 1:  FlexPlate  A, B, ...
%Syntax 2:  FlexPlate                  (displays all names declared as FlexPlate)
%
%   Input:  A -- name that starts with a letter, followed by a reasonable
%                number of alphanumeric characters (similarly for B).
%
%Output 1:  Creates flexible plates A, B, etc.
%
% Related:  NewtonianFrame  Particle  Point  RigidBody  RigidFrame  System
%           RigidSystem  FlexBeam  FlexPlate  FlexShell  FlexBody  FlexFrame

%
%FlexibleShell
%FlexibleShell  or  FlexShell  (RESERVED KEYWORDS & SYNTAXES. IN-DEVELOPMENT)
%
% Purpose:  Declares flexible shells or displays the names of all flexible shells.
%
%Syntax 1:  FlexShell  A, B, ...
%Syntax 2:  FlexShell                  (displays all names declared as FlexShell)
%
%   Input:  A -- name that starts with a letter, followed by a reasonable
%                number of alphanumeric characters (similarly for B).
%
%Output 1:  Creates flexible beams A, B, etc.
%
% Related:  NewtonianFrame  Particle  Point  RigidBody  RigidFrame  System
%           RigidSystem  FlexBeam  FlexPlate  FlexShell  FlexBody  FlexFrame

%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 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
%           Evaluate  Expand  Explicit
%           Factor  FactorLinear  FactorQuadratic

%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
%           Evaluate  Expand  Explicit
%           Factor  FactorLinear  FactorQuadratic

%GetAcceleration
%GetAcceleration  or  GetRelativeAcceleration
%
% Purpose:  Gets a point's acceleration in a reference frame or gets a point's
%           acceleration relative to another point in a reference frame.
%
%Syntax 1:  Q.GetAcceleration( refFrame )
%Syntax 2:  Q.GetAccelerationRelative( P, refFrame )
%           Q.GetRelativeAcceleration( P, refFrame )
%
%   Input:  Q, P -- names of points (e.g., Point or Particle).
%           refFrame -- name of a RigidFrame or RigidBody..
%
%Output 1:  Returns Q's acceleration in refFrame.
%Output 2:  Returns Q's acceleration relative to P in refFrame, defined as
%           Q.GetAcceleration(refFrame) - P.GetAcceleration(refFrame) or as
%           DtDt( Q.GetPosition(P), refFrame ).
%
% Related:  Translate        SetPositionVelocity        SetVelocityAcceleration
%           SetPosition      GetPosition   GetDistance  GetElongation
%           SetVelocity      GetVelocity   GetSpeed     GetRelativeVelocity
%           SetAcceleration  GetAcceleration            GetRelativeAcceleration

%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, FORTRAN, ...
%
%  Remark:  A negative angle can result if a senseVector> is provided and
%           the cross-product of v> and w> has a 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

%GetAngularAcceleration
%GetAngularAcceleration
%
% Purpose:  Gets a rigid frame/body's angular acceleration in a reference frame.
%
%  Syntax:  B.GetAngularAcceleration( A )
%
%   Input:  B, A -- names of a RigidFrame or RigidBody.
%
%  Output:  Returns B's angular acceleration in A.
%
% Related:  GetAngularAcceleration  GetAngularVelocity  GetRotationMatrix
%           SetAngularAcceleration  SetAngularVelocity  SetRotationMatrix

%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 P in refFrame is defined
%           Cross( Q.GetPosition(P), Q.GetTranslationalMomentum(refFrame) )
%
% Related:  GetAngularMomentum  GetTranslationalMomentum  GetGeneralizedMomentum
%           GetKineticEnergy    GetMomentOfForces  GetResultantForce
%           GetStatics   GetStaticsKane   GetStaticsLagrange
%           GetDynamics  GetDynamicsKane  GetDynamicsLagrange

%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, A -- names of a 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

%GetAngularVelocity
%GetAngularVelocity
%
% Purpose:  Gets a rigid frame/body's angular velocity in a reference frame.
%
%  Syntax:  B.GetAngularVelocity( A )
%
%   Input:  B, A -- names of a RigidFrame or RigidBody.
%
%  Output:  Returns B's angular velocity in A.
%
% Related:  GetAngularAcceleration  GetAngularVelocity  GetRotationMatrix
%           SetAngularAcceleration  SetAngularVelocity  SetRotationMatrix

%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

%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

%GetCMAcceleration
%GetCMAcceleration  (also see GetCMPosition, GetCMVelocity)
%
% Purpose:  Gets a system's center of mass acceleration in a reference frame.
%
%  Syntax:  S.GetCMAcceleration( refFrame )
%
%   Input:  S -- the name of a System (which may be a RigidBody or Particle).
%           refFrame -- the name of a RigidFrame or RigidBody.
%           If the refFrame argument is missing, the NewtonianFrame is assumed.
%
%  Output:  The acceleration of S's center of mass in refFrame.
%
% Related:  SetMass          GetMass         SetInertia
%           GetCMPosition    GetCMVelocity   GetCMAcceleration
%           Translate        SetPositionVelocity   SetVelocityAcceleration
%           SetPosition      GetPosition     GetDistance
%           SetVelocity      GetVelocity     GetSpeed   GetElongation
%           SetAcceleration  GetAcceleration

%GetCMPosition
%GetCMPosition  (also see GetCMVelocity, GetCMAcceleration)
%
% Purpose:  Gets a system's center of mass position from another point.
%
%  Syntax:  S.GetCMPosition( fromPoint )
%
%   Input:  S -- the name of a System (which may be a RigidBody or Particle).
%           fromPoint -- name of a point.
%
%  Output:  The position vector of S's center of mass from fromPoint.
%
% Remark:   The following are used for the GetCMPosition command:
%           (a) the mass of each relevant particle and/or body
%           (b) the position vector fromPoint to each particle
%           (c) the position vector fromPoint 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

%GetCMVelocity
%GetCMVelocity  (also see GetCMPosition, GetCMAcceleration)
%
% Purpose:  Gets a system's center of mass velocity in a reference frame.
%
%  Syntax:  S.GetCMVelocity( refFrame )
%
%   Input:  S -- the name of a System (which may be a RigidBody or Particle).
%           refFrame -- the name of a RigidFrame or RigidBody.
%           If the refFrame argument is missing, the NewtonianFrame is assumed.
%
%  Output:  The velocity of S's center of mass in refFrame.
%
% Related:  SetMass          GetMass         SetInertia
%           GetCMPosition    GetCMVelocity   GetCMAcceleration
%           Translate        SetPositionVelocity   SetVelocityAcceleration
%           SetPosition      GetPosition   GetDistance
%           SetVelocity      GetVelocity   GetSpeed   GetElongation
%           SetAcceleration  GetAcceleration

%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

%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( mat )
%Syntax 2:  GetColumns( mat )
%Syntax 3:     GetRows( mat,  i, j, k,  n:m,  ... )
%Syntax 4:  GetColumns( mat,  i, j, k,  n:m,  ... )
%
%   Input:  mat     -- a matrix or matrix expression.
%           i, j, k -- positive integers.
%           n:m     -- A range of positive integers from n to m.
%
%  Remark:  i, j, k, n, m must be positive integers that are less than or
%           equal to the number of rows (or columns) in the matrix mat.
%           n may be larger, smaller, or equal to m.
%
%Output 1:  Number of rows    in mat.
%Output 2:  Number of columns in mat.
%Output 3:  Matrix whose rows    are the i, j, n:m rows    of mat.
%Output 4:  Matrix whose columns are the i, j, n:m columns of mat.
%
%  Remark:  To select one element of mat, use e.g., mat[ 2, 3 ].
%           For a submatrix, use mat[ 2:3, 1:5 ].  See HELP [].
%
% Related:  GetColumns     GetDeterminant  GetDiagonalMatrix  GetEigen
%           GetElement []  GetInverse      GetIdentityMatrix  GetNorm  GetRows
%           GetTrace       GetTranspose    GetZeroMatrix      Solve

%GetDefaults
%GetDefaults  and  SetDefaults
%
%Syntax 1:  GetDefaults
%Syntax 2:  SetDefaults( AUTOLEV )         // Type HELP AUTOLEV for more info.
%Syntax 3:  SetDefaults( MotionGenesis )   // This is the default setting.
%
%Output 1:  Displays the settings of default preferences.
%
%Output 2:  Sets program defaults to be compatible with Autolev, e.g.,
%           SetBasisSubscripts( 1, 2, 3 )
%           SetCMSymbol( o )
%           Restricts how AUTOZ symbols are introduced (backward compatible).
%
%Output 3:  Sets program defaults to be compatible with MotionGenesis, e.g.,
%           SetBasisSubscripts( x, y, z )
%           SetCMSymbol( cm )
%           SetOriginSymbol( o )
%           Allows more efficient computation with AUTOZ symbols.
%
%  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  SetPauseOnWarning
%

%AUTOLEV
%AUTOLEV
%
% Purpose:  Sets defaults to be compatible with older versions of the program.
%
%Syntax 1:  SetDefaults( AUTOLEV )
%Syntax 2:  SetDefaults( MotionGenesis )   // This is the default setting.
%
%Output 1:  Sets program defaults to be compatible with Autolev, e.g.,
%           SetBasisSubscripts( 1, 2, 3 )
%           SetCMSymbol( o )
%           Restricts how AUTOZ symbols are introduced (backward compatible).
%
%Output 2:  Sets program defaults to be compatible with MotionGenesis, e.g.,
%           SetBasisSubscripts( x, y, z )
%           SetCMSymbol( cm )
%           SetOriginSymbol( o )
%           Allows more efficient computation with AUTOZ symbols.
%
%  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 AUTOLEV 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   GetTranslationalMomentum,
%                           and           GetAngularMomentum,
%                           and           GetGeneralizedMomentum.
%      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  SetDefaults
%

%GetCofactor
%GetCofactor   GetMinor
%
% Purpose:  Calculates the minor or cofactor of a matrix.
%
%Syntax 1:  GetMinor(    squareMatrix, i, j )
%Syntax 2:  GetCofactor( squareMatrix, i, j )
%
%   Input:  squareMatrix -- a  square matrix
%           i -- an integer designating a row in squareMatrix.
%           j -- an integer designating a column in squareMatrix.
%
%Output 1:  Mij, the determinant of the submatrix formed by eliminating the
%           ith row and jth column of squareMatrix.
%Output 2:  (-1)^(i+j) * Mij
%
% Related:  GetColumns     GetDeterminant  GetDiagonalMatrix  GetEigen
%           GetElement []  GetInverse      GetIdentityMatrix  GetNorm  GetRows
%           GetTrace       GetTranspose    GetZeroMatrix      Solve

%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 []  GetInverse      GetIdentityMatrix  GetNorm  GetRows
%           GetTrace       GetTranspose    GetZeroMatrix      Solve

%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 []  GetInverse      GetIdentityMatrix  GetNorm  GetRows
%           GetTrace       GetTranspose    GetZeroMatrix      Solve

%GetDistance
%GetDistance  GetLength   GetDistanceSquared  GetLengthSquared
%
% Purpose:  Gets the distance (or its square) between two points.
%
%Syntax 1:  Q.GetDistance( P )
%           Q.GetLength( P )
%Syntax 2:  Q.GetDistanceSquared( P )
%           Q.GetLengthSquared( 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

%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()
%
%   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 helps with subsequent velocity/acceleration
%           and force/moment calculations.
%
%  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

%
%GetDynamicsOrderN  (RESERVED KEYWORDS & SYNTAXES. IN-DEVELOPMENT)
%GetDynamicsOrderN
%
% Purpose:  Gets equations of motion using an Order-N formulation.
%
%  Syntax:  System.GetDynamicsOrderN()
%
%   Input:  None.
%
%  Output:  Order-N equation of motion for the System.
%
%  Remark:  For Newton/Euler equations, type  Help GetDynamics
%           For Kane's       equations, type  Help GetDynamicsKane
%           For Lagranges's  equations, type  Help GetDynamicsLagrange
%           For Order-N      equations, type  Help GetDynamicsOrderN
%
% Related:  AddForce  AddTorque  SetMass  SetInertia  Rotate  Translate
%           NewtonianFrame  Point  Particle  RigidFrame  RigidBody
%           GetStatics   GetStaticsKane   GetStaticsLagrange   GetStaticsOrderN
%           GetDynamics  GetDynamicsKane  GetDynamicsLagrange  GetDynamicsOrderN
%           SetGeneralizedCoordinate  SetGeneralizedSpeed

%GetEffectiveForce
%GetEffectiveForce    GetInertiaForce
%
% 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)
%
%  Remark:  To form inertia force, simply use a command like
%           inertiaForce = -1 * Object.GetEffectiveForce()
%
% Related:  GetAngularMomentum  GetTranslationalMomentum  GetGeneralizedMomentum
%           GetKineticEnergy    GetMomentOfForces  GetResultantForce
%           GetEffectiveForce  GetMomentOfEffectiveForce
%           GetStatics   GetStaticsKane   GetStaticsLagrange
%           GetDynamics  GetDynamicsKane  GetDynamicsLagrange

%GetEigen
%GetEigen
%
% Purpose:  Calculates the eigenvalues or the eigenvalues and eigenvectors of
%           a real square matrix or a dyadic whose measures are real numbers.
%
%Syntax 1:  GetEigen( M )
%Syntax 2:  GetEigen( M, eigVectorMatrixName )
%Syntax 3:  GetEigen( dyadic>> )
%Syntax 4:  GetEigen( dyadic>>, eigVectorMatrixName )
%
%   Input:  M -- a square matrix whose elements are real numbers.
%           dyadic>> -- a dyadic whose measures are real numbers.
%
%           eigVectorMatrixName -- 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 eigVectorMatrixName.
%Output 3:  Returns the eigenvalues of dyadic>>.
%Output 3:  Returns the eigenvalues of dyadic>>.  Assigns eigVectorMatrixName.
%
%  Remark:  The COLUMNS of eigVectorMatrixName are the eigenvectors of M.
%
% Related:  GetColumns     GetDeterminant  GetDiagonalMatrix  GetEigen
%           GetElement []  GetInverse      GetIdentityMatrix  GetNorm  GetRows
%           GetTrace       GetTranspose    GetZeroMatrix      Solve

%[]
%[]
%
% Purpose:  Assigns or returns one or more elements of a matrix.
%           Use  GetElement  to return elements for an unnamed matrix.
%
%Syntax 1:  mat1D[ index ]
%Syntax 2:  mat1D[ indexStart : indexStop ]
%Syntax 3:  mat2D[ i, j ]
%Syntax 4:  mat2D[ iStart : iStop,  jStart : jStop ]
%
%   Input:  mat1D -- 1D (one-dimensional) matrix (row or column matrix).
%           mat2D -- 2D (two-dimensional) matrix.
%           index  -- integer identifying ith element of a 1D matrix.
%           indexStart : indexStop -- integer range for elements in a 1D matrix.
%           i -- integer identifying a row    in a 2D matrix.
%           j -- integer identifying a column in a 2D matrix.
%           iStart : iStop -- integers identifying rows in a 2D matrix.
%           jStart : jStop -- integers identifying columns in a 2D matrix.
%
%Output 1:  The element of mat1D located at index.
%Output 2:  A sub-matrix whose elements are chosen by  indexStart : indexStop.
%Output 3:  Element in the ith row and jth column of mat2D.
%Output 4:  A sub-matrix with rows iStart : iStop  and columns  jStart : jStop.
%
%  Remark:  Alternatively, select rows or columns with GetRows or GetColumns.
%           Use GetElement to select elements from an unnamed matrix expression.
%
% Related:  GetColumns     GetDeterminant  GetDiagonalMatrix  GetEigen
%           GetElement []  GetInverse      GetIdentityMatrix  GetNorm  GetRows
%           GetTrace       GetTranspose    GetZeroMatrix      Solve

%GetElement
%GetElement
%
% Purpose:  Returns one or more elements from an unnamed matrix expression.
%           Type  Help []  for simpler syntax for a named matrix.
%
%Syntax 1:  GetElement( mat1DExpression,  index )
%Syntax 2:  GetElement( mat1DExpression,  indexStart : indexStop )
%Syntax 3:  GetElement( mat2DExpression,  i, j )
%Syntax 4:  GetElement( mat2DExpression,  iStart : iStop,  jStart : jStop )
%
%   Input:  mat1DExpression -- 1D (one-dimensional) matrix or matrix expression.
%           mat2DExpression -- 2D (two-dimensional) matrix or matrix expression.
%           index  -- integer identifying ith element of a 1D matrix.
%           indexStart : indexStop -- integer range for elements in a 1D matrix.
%           i -- integer identifying a row    in a 2D matrix.
%           j -- integer identifying a column in a 2D matrix.
%           iStart : iStop -- integers identifying rows in a 2D matrix.
%           jStart : jStop -- integers identifying columns in a 2D matrix.
%
%Output 1:  The element of mat1DExpression located at index.
%Output 2:  A sub-matrix whose elements are chosen by  indexStart : indexStop.
%Output 3:  Element in the ith row and jth column of mat2D or mat2DExpression.
%Output 4:  A sub-matrix with rows iStart : iStop  and columns  jStart : jStop.
%
%  Remark:  Alternatively, select rows or columns with GetRows or GetColumns.
%           Use [] to select elements from a named matrix.
%
% Related:  GetColumns     GetDeterminant  GetDiagonalMatrix  GetEigen
%           GetElement []  GetInverse      GetIdentityMatrix  GetNorm  GetRows
%           GetTrace       GetTranspose    GetZeroMatrix      Solve

%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

%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
%           was in: Mitiguy, Paul, "Advanced Dynamics & Motion Simulation".

%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 a potential energy for an electrostatic force.
%
%  Syntax:  Q.GetForceElectrostaticPotentialEnergy( P, k )
%
%   Input:  Q -- the name of a point or particle.
%           P -- the name of a point or particle.
%           k -- scalar representing the electrostatic proportionality
%                constant, approximately 8.9875518E+09 N*m^2/Coulomb^2.
%
%  Output:  Potential energy for an inverse square law electrostatic force
%           between P and Q.
%
%  Remark:  Ensure charges are assigned to Q and P with the commands:
%           Q.SetCharge(...)  and  P.SetCharge(...).
%
%  Remark:  Q's position vector from P must be available.
%
%  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

%GetForceInverseSquarePotentialEnergy
%GetForceInverseSquarePotentialEnergy
%
% Purpose:  Calculates a potential energy for an inverse-square force.
%
%  Syntax:  Q.GetForceInverseSquarePotentialEnergy( P, coef )
%
%   Input:  Q -- the name of a point or particle.
%           P -- the name of a point or particle.
%           coef -- a scalar expression
%
%  Output:  Potential energy for an inverse square law force between P and Q.
%
%  Remark:  Potential energy is calculated as:  coef / Q.GetDistance(P)
%           Note: Q's position vector from P must be available.
%
%  Remark:  A positive coef corresponds to a repulsive force (pushes Q away
%           from P), whereas a negative coef corresponds to an attractive
%           force (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

%GetForceGravityPotentialEnergy
%GetForceGravityPotentialEnergy
%
% Purpose:  Calculates a potential energy for uniform gravity forces.
%
%Syntax 1:  Object.GetForceGravityPotentialEnergy( gVector, refPoint )
%Syntax 2:  Q.GetForceGravityPotentialEnergy( P, G )
%
%   Input:  Object -- The name of a Particle, RigidBody, or System.
%           gVector -- A vector directed locally downward and whose magnitude
%                      is the local gravitational acceleration constant.
%           refPoint -- A point fixed on the attracting object (e.g., Earth).
%                       Above this point, potential energy is positive whereas
%                       below this point, 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 for an 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.
%           Earth's equatorial radius is approximately 6356 km (3949.4 miles).
%
% Related:  AddForce  AddForceDamper  AddForceElectrostatic  AddForceGravity
%           AddForceInverseSquare  AddForceLinearActuator  AddForceSpring
%           AddTorque  AddTorqueDamper
%           GetMomentOfForces  GetResultantForce  GetResultantTorque
%           GetForceGravityPotentialEnergy  GetForceSpringPotentialEnergy
%           GetStatics   GetStaticsKane   GetStaticsLagrange
%           GetDynamics  GetDynamicsKane  GetDynamicsLagrange

%GetForceSpringPotentialEnergy
%GetForceSpringPotentialEnergy
%
% Purpose:  Calculates a potential energy for 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 or particle.
%           P -- the name of a point or particle.
%           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 for a spring force on Q from P whose magnitude is
%           k * stretch, where stretch = L - Ln (L is distance between Q and P).
%
%Output 2:  Potential energy for a spring force on Q from P whose magnitude is
%           k * stretch^stretchExponent, where stretch = L - Ln.
%
%  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

%GetGeneralizedEffectiveForce
%GetGeneralizedEffectiveForce    GetGeneralizedInertiaForce
%
% 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:  To form generalized inertia forces, simply use a command like
%           genInertiaForces = -1 * Object.GetGeneralizedEffectiveForce()
%
%  Remark:  If using the old/deprecated command  SetDefaults( AUTOLEV ),
%           the results produced by this command depend on whether
%           the command precedes or follows a CONSTRAIN command.
%
% Related:  GetGeneralizedEffectiveForce  GetGeneralizedForce
%           GetMomentOfEffectiveForce   GetEffectiveForce
%           GetAngularMomentum  GetTranslationalMomentum  GetGeneralizedMomentum
%           GetKineticEnergy    GetMomentOfForces  GetResultantForce
%           Gyrostat  SetGeneralizedCoordinate  SetGeneralizedSpeed
%           SetMass  SetInertia  Rotate  Translate
%           GetStatics   GetStaticsKane   GetStaticsLagrange
%           GetDynamics  GetDynamicsKane  GetDynamicsLagrange

%GetGeneralizedForce
%GetGeneralizedForce
%
% Purpose:  Gets generalized forces associated with various forces and torques.
%
%Syntax 1a: Q.GetGeneralizedForce( P )
%       1b: Q.GetGeneralizedResultantForce( P )
%
%Syntax 2a: Q.GetGeneralizedExternalForce()
%       2b: Q.GetGeneralizedResultantForce()
%
%Syntax 3a: B.GetGeneralizedTorque( A )
%       3b: B.GetGeneralizedResultantTorque( A )
%
%Syntax 4a: B.GetGeneralizedExternalTorque()
%       4b: B.GetGeneralizedResultantTorque()
%
%Syntax 5:  System.GetGeneralizedForce()
%
%   Input:  Q, P -- names of points (e.g., Point or Particle).
%           B, A -- name of a RigidFrame or RigidBody.
%
%Output 1a: Generalized force for Force_Q_P> (action/reaction force on Q from P)
%       1b  Generalized force for Force_Q_P> and Force_P_Q>.
%
%Output 2a: Generalized force for Force_Q>   (Force_Q> is "external" force on Q)
%       2b: Generalized force for all forces on Q, i.e., for external force
%           Force_Q> and all action/reaction forces on Q.
%
%Output 3a: Generalized torque for Torque_B_A> (action/reaction torque on B from A).
%       3b  Generalized torque for Torque_B_A> and Torque_A_B>.
%
%Output 4a: Generalized torque for Torque_B> ("external" torque on B).
%       4b: Generalized torque for all torques on B, i.e., for external torque
%           Torque_B> and all action/reaction torques on B.
%
%Output 5:  Generalized force for all forces and torques in the system.
%
%  Remark:  Outputs a column matrix, with each element being the contribution of
%           forces and torques to one generalized force in the NewtonianFrame.
%
%  Remark:  If using the old/deprecated command  SetDefaults( AUTOLEV ),
%           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  GetTranslationalMomentum  GetAngularMomentum
%           SetGeneralizedCoordinate  SetGeneralizedSpeed
%           SetMass  SetInertia  Rotate  Translate
%           GetStatics   GetStaticsKane   GetStaticsLagrange
%           GetDynamics  GetDynamicsKane  GetDynamicsLagrange

%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:  If using the old/deprecated command  SetDefaults( AUTOLEV ),
%           the results produced by this command depend on whether
%           the command precedes or follows a CONSTRAIN command.
%
% Related:  GetAngularMomentum  GetTranslationalMomentum  GetGeneralizedMomentum
%           GetKineticEnergy    GetMomentOfForces  GetResultantForce
%           Gyrostat  SetGeneralizedCoordinate  SetGeneralizedSpeed
%           SetMass  SetInertia  Rotate  Translate
%           GetStatics   GetStaticsKane   GetStaticsLagrange
%           GetDynamics  GetDynamicsKane  GetDynamicsLagrange

%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 []  GetInverse      GetIdentityMatrix  GetNorm  GetRows
%           GetTrace       GetTranspose    GetZeroMatrix      Solve

%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

%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

%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   SetMassInertia
%           GetCMPosition    GetCMVelocity   GetCMAcceleration
%           GetInertiaDyadic  GetInertiaMatrix  GetMomentOfInertia
%           GetProductOfInertia  GetRadiusOfGyration  GetInertiaVector

%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   SetMassInertia
%           GetCMPosition    GetCMVelocity   GetCMAcceleration
%           GetInertiaDyadic  GetInertiaMatrix  GetMomentOfInertia
%           GetProductOfInertia  GetRadiusOfGyration  GetInertiaVector

%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 []  GetInverse      GetIdentityMatrix  GetNorm  GetRows
%           GetTrace       GetTranspose    GetZeroMatrix      Solve

%GetTranslationalMomentum
%GetTranslationalMomentum  or  GetLinearMomentum
%
% Purpose:  Gets translational (linear) momentum in a reference frame.
%
%Syntax 1:  Object.GetTranslationalMomentum()
%Syntax 2:  Object.GetTranslationalMomentum( refFrame )
%
%   Input:  Object -- The name of a Particle, RigidBody, or System.
%           refFrame -- The name of a RigidFrame or RigidBody
%
%Output 1:  Object's translational (linear) momentum in the NewtonianFrame.
%Output 2:  Object's translational (linear) momentum in refFrame.
%
%  Remark:  A particle Q's translational momentum in refFrame is defined
%           Q.GetMass() * Q.GetVelocity(refFrame)
%
% Related:  GetAngularMomentum  GetTranslationalMomentum  GetGeneralizedMomentum
%           GetKineticEnergy    GetMomentOfForces  GetResultantForce
%           Gyrostat  SetGeneralizedCoordinate  SetGeneralizedSpeed
%           SetMass  SetInertia  Rotate  Translate
%           GetStatics   GetStaticsKane   GetStaticsLagrange
%           GetDynamics  GetDynamicsKane  GetDynamicsLagrange

%
%GetMinimum
%Max  Min  Optimize
%
% Type HELP for one of the previously listed commands.
%

%
%GetLocalMinimum  (RESERVED KEYWORDS & SYNTAXES. IN-DEVELOPMENT)
%GetLocalMinimum   GetLocalMinimumWithConstraints
%GetLocalMaximum   GetLocalMaximumWithConstraints
%
% Purpose:  Finds a local maximum or minimum of a function.
%
%Syntax 1:  GetLocalMaximum( function, x1=Guess1, x2=Guess2 ... )
%           GetLocalMinimum( function, x1=Guess1, x2=Guess2 ... )
%           GetLocalMaximumWithConstraints( EqnsToSolve, function, x1=Guess1, x2=Guess2 ... )
%           GetLocalMinimumWithConstraints( EqnsToSolve, function, x1=Guess1, x2=Guess2 ... )
%
%Syntax 2:  answer = GetLocalMaximum( function, x1=Guess1, x2=Guess2 ... )
%           answer = GetLocalMaximum( function, x1=Guess1, x2=Guess2 ... )
%           answer = GetLocalMaximumWithConstraint( EqnsToSolve, function, x1=Guess1, x2= ... )
%           answer = GetLocalMinimumWithConstraint( EqnsToSolve, function, x1=Guess1, x2= ... )
%
%   Input:  function - scalar expression of x1, x2, ...
%
%   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 1:  Values in the neighborhood of Guess1, Guess2, ... that
%           maximize or minimize function are assigned to x1, x2, ...
%
%Output 1:  Values in the neighborhood of Guess1, Guess2, ... that
%           maximize or minimize function are returned in a matrix.
%           Solutions are NOT assigned to x1, x2, ...
%
% Remark:   A solution may be reported even though one does not exist.
%           Associated 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
%
% Related:  ODE  Solve  SolveDt  SolveSetInput  SolveSetInputDt  ...
%           GetPolynomialRoots  GetQuadraticRoots  GetQuadraticPositiveRoot  ...
%           SolveQuadraticPositiveRoot  SolveQuadraticPositiveRootDt  ...
%           GetLocalMaximum  GetLocalMinimum  GetLocalMaximumWithConstraints
%           Max  Min

%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  GetTranslationalMomentum  GetGeneralizedMomentum
%           GetKineticEnergy    GetMomentOfForces  GetResultantForce
%           Gyrostat  SetGeneralizedCoordinate  SetGeneralizedSpeed
%           SetMass  SetInertia  Rotate  Translate   GetPower
%           GetStatics   GetStaticsKane   GetStaticsLagrange
%           GetDynamics  GetDynamicsKane  GetDynamicsLagrange

%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 absolute value of a real or complex scalar.
%           Use  GetMagnitude  for the magnitude of a vector.
%           Use  GetNorm       for the 2-norm of a real row or column matrix.
%
% Related:  GetMagnitude           GetMagnitudeSquared     abs     GetNorm
%           GetDistance            GetDistanceSquared
%           GetSpeed               GetSpeedSquared
%           GetAngularSpeed        GetAngularSpeedSquared
%           GetAngleBetweenVectors GetAngleBetweenUnitVectors
%           GetPosition            SetPosition       Translate
%           GetVelocity            SetVelocity       SetPositionVelocity
%           GetAcceleration        SetAcceleration   SetVelocityAcceleration
%           GetUnitVector          GetElongation     Vector   Dot

%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   SetMassInertia
%           GetCMPosition    GetCMVelocity   GetCMAcceleration
%           GetInertiaDyadic  GetInertiaMatrix  GetMomentOfInertia
%           GetProductOfInertia  GetRadiusOfGyration  GetInertiaVector

%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

%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    GetMomentOfInertiaForce (inertia torque)
%
% 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) )
%
%  Remark:  To form moment of inertia force, simply use a command like
%           inertiaTorque = -1 * Object.GetMomentOfEffectiveForce( aboutPoint )
%
% Related:  GetTranslationalMomentum  GetAngularMomentum  GetEffectiveForce
%           GetMomentOfForces  GetResultantForce  GetMomentOfEffectiveForce
%           GetStatics   GetStaticsKane   GetStaticsLagrange
%           GetDynamics  GetDynamicsKane  GetDynamicsLagrange

%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 helps with subsequent velocity/acceleration
%           and force/moment calculations.
%
% Related:  AddForce  AddForceDamper  AddForceElectrostatic  AddForceGravity
%           AddForceInverseSquare  AddForceLinearActuator  AddForceSpring
%           AddTorque  AddTorqueDamper
%           GetMomentOfForces  GetResultantForce  GetResultantTorque
%           GetForceGravityPotentialEnergy  GetForceSpringPotentialEnergy
%           GetStatics   GetStaticsKane   GetStaticsLagrange
%           GetDynamics  GetDynamicsKane  GetDynamicsLagrange

%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   SetMassInertia
%           GetCMPosition    GetCMVelocity   GetCMAcceleration
%           GetInertiaDyadic  GetInertiaMatrix  GetMomentOfInertia
%           GetProductOfInertia  GetRadiusOfGyration  GetInertiaVector

%GetPolynomialRoots
%GetPolynomialRoots GetQuadraticRoots       GetCubicRoots       ...
%GetPolynomial      GetQuadraticPolynomial  GetCubicPolynomial  ...
%
% Purpose:  GetPolynomialRoots  gets the roots of a polynomial of degree
% Purpose:  GetPolynomial       creates a polynomial function from a matrix
%           of coefficients or determines the coefficients of the leading
%           terms of the Taylor-series expansion of a function about 0.
%
%Syntax 1:  GetPolynomialRoots(       M  )       % M  is row or column matrix.
%           GetLinearRoots(           M2 )       % M2 is 2-element matrix.
%           GetQuadraticRoots(        M3 )       % M3 is 3-element matrix.
%           GetCubicRoots(            M4 )       % M4 is 4-element matrix.
%           GetQuarticRoots(          M5 )       % M5 is 5-element matrix.
%           GetQuinticRoots(          M6 )       % M6 is 6-element matrix.
%           GetQuadraticPositiveRoot( M2 )
%           GetQuadraticNegativeRoot( M2 )
%Syntax 2:  GetPolynomialRoots(       expression = 0,  x, p )
%           GetLinearRoots(           expression = 0,  x )
%           GetQuadraticRoots(        expression = 0,  x )
%           GetCubicRoots(            expression = 0,  x )
%           GetQuarticRoots(          expression = 0,  x )
%           GetQuinticRoots(          expression = 0,  x )
%           GetQuadraticPositiveRoot( expression = 0,  x )
%           GetQuadraticNegativeRoot( expression = 0,  x )
%Syntax 3:  GetPolynomial(          M,  x )      % M  is row or column matrix.
%           GetLinearPolynomial(    M2, x )      % M2 is 2-element matrix.
%           GetQuadraticPolynomial( M3, x )      % M3 is 3-element matrix.
%           GetCubicPolynomial(     M4, x )      % M4 is 4-element matrix.
%           GetQuarticPolynomial(   M5, x )      % M5 is 5-element matrix.
%           GetQuinticPolynomial(   M6, x )      % M6 is 6-element matrix.
%Syntax 4:  GetPolynomial(          expression, x, p )
%           GetLinearPolynomial(    expression, x )
%           GetQuadraticPolynomial( expression, x )
%           GetCubicPolynomial(     expression, x )
%           GetQuarticPolynomial(   expression, x )
%           GetQuinticPolynomial(   expression, x )
%
%   Input:  M -- row or column matrix with scalar elements.  For example,
%           M = [2, 5, 7, 9]  may represent  2*x^3 + 5*x^2 + 7*x + 9.
%
%           p   -- positive integer.
%           x   -- scalar name (variable, constant, specified, ...)
%           expression -- scalar expression that is a function of x.  A polynomial
%           is created from a Taylor series expansion of expression about x = 0.
%
%Output 1:  Row or column matrix whose elements are the roots of the
%           polynomial represented by M.
%
%           For special case of quadratic formula:  a*x^2 + b*x + c = 0,
%           GetQuadraticPositiveRoot  returns (-b + sqrt(b^2 - 4*a*c)) / 2*a
%           GetQuadraticNegativeRoot  returns (-b - sqrt(b^2 - 4*a*c)) / 2*a
%
%           Note: To also assign results to x, use
%           SolveQuadraticPositiveRoot  or  SolveQuadraticNegativeRoot.
%
%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 expression about x = 0.  For example,
%
%           taylorSeriesRoots = 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 expression about x = 0.
%
% Related:  GetPolynomial  GetPolynomialRoots  GetQuadraticRoots  ...
%           SolveQuadraticPositiveRoot  SolveQuadraticPositiveRootDt  ...
%           Solve  SolveDt  SolveSetInput
%           Spline (Line, Cubic, Bell, Pulse, Step, Transition, Polynomial, ...)
%           FactorLinear  FactorQuadratic

%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, Likins, Levinson: Spacecraft Dynamics, McGraw-Hill, Ch. 1, and
%           Mitiguy, Paul: "Advanced Dynamics & Motion Simulation".
%
% Related:  Rotate  RotateX  RotateY  RotateZ
%           RotateNegativeX  RotateNegativeY  RotateNegativeZ
%           SetRotationMatrixX  SetRotationMatrixY  SetRotationMatrixZ
%           SetRotationMatrixNegativeX  SetRotationMatrixNegativeY  ...
%           SetRotationMatrix  SetAngularVelocity  SetAngularAcceleration
%           GetRotationMatrix  GetAngularVelocity  GetAngularAcceleration
%           SetRotationMatrixODE   SetRigidTransform

%GetPosition
%GetPosition
%
% Purpose:  Gets the position of a point from another point.
%
%  Syntax:  Q.GetPosition( fromPoint )
%
%   Input:  Q, fromPoint -- names of points (e.g., Point or Particle).
%
%  Output:  Q's position vector from fromPoint.
%
% Related:  Translate        SetPositionVelocity   SetVelocityAcceleration
%           SetPosition      GetPosition   GetDistance  GetDistanceSquared
%           SetVelocity      GetVelocity   GetSpeed     GetElongation
%           SetAcceleration  GetAcceleration

%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 associated with various forces and torques.
%
%Syntax 1a: Q.GetPowerForce( P )
%       1b: Q.GetPowerResultantForce( P )
%
%Syntax 2a: Q.GetPowerExternalForce()
%       2b: Q.GetPowerResultantForce()
%
%Syntax 3a: B.GetPowerTorque( A )
%       3b: B.GetPowerResultantTorque( A )
%
%Syntax 4a: B.GetPowerExternalTorque()
%       4b: B.GetPowerResultantTorque()
%
%Syntax 5:  System.GetPower()
%
%   Input:  Q, P -- names of a Point or Particle.
%           B, A -- name of a RigidFrame or RigidBody.
%
%Output 1a: Power of Force_Q_P>    (Force_Q_P> is action/reaction on Q from P)
%       1b  Power of Force_Q_P> and Force_P_Q>.
%
%Output 2a: Power of Force_Q>      (Force_Q> is the "external" force on Q).
%       2b: Power of all forces on Q, i.e., power of external force
%           Force_Q> and all action/reaction forces on Q.
%
%Output 3a: Power of Torque_B_A>   (Torque_B_A> is action/reaction on B from A).
%       3b  Power of Torque_B_A> and Torque_A_B>.
%
%Output 4a: Power of Torque_B>     (Torque_B> is the "external" torque on B).
%       4b: Power of all torques on B, i.e., power of external torque
%           Torque_B> and all action/reaction torques on B.
%
%Output 5:  Power of all forces and torques in the system.
%
%  Remark:  Power is calculated in the NewtonianFrame.  To calculate in a
%           different reference frame, temporarily reassign NewtonianFrame.
%
% Related:  AddForce  AddForceDamper  AddForceElectrostatic  AddForceGravity
%           AddForceInverseSquare  AddForceLinearActuator  AddForceSpring
%           AddTorque  AddTorqueDamper
%           GetMomentOfForces  GetResultantForce  GetResultantTorque
%           GetForceGravityPotentialEnergy  GetForceSpringPotentialEnergy
%           GetStatics   GetStaticsKane   GetStaticsLagrange   SetWorkODE
%           GetDynamics  GetDynamicsKane  GetDynamicsLagrange  GetKineticEnergy

%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   SetMassInertia
%           GetCMPosition    GetCMVelocity   GetCMAcceleration
%           GetInertiaDyadic  GetInertiaMatrix  GetMomentOfInertia
%           GetProductOfInertia  GetRadiusOfGyration  GetInertiaVector

%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   SetMassInertia
%           GetCMPosition    GetCMVelocity   GetCMAcceleration
%           GetInertiaDyadic  GetInertiaMatrix  GetMomentOfInertia
%           GetProductOfInertia  GetRadiusOfGyration  GetInertiaVector

%GetResultantForce
%GetResultantForce  GetNetForce  (synonymous)
%
% Purpose:  Returns the sum of forces applied to an object.
%
%Syntax 1:  Object.GetResultantForce()
%Syntax 2:  Q.GetResultantForce( P )
%
%   Input:  Object -- a Point, Particle, RigidBody, RigidFrame, or System
%           Q, P -- names of points (e.g., Point or Particle).
%
%Output 1:  Sum of all forces applied to Object.
%Output 2:  Sum of all forces applied to Q by P.
%
%  Remark:  If Q is a point of a RigidFrame or RigidBody B, declare it as
%           Point Q(B).  This helps with subsequent velocity/acceleration
%           and force/moment calculations.
%
%  Remark:  Force_Q>  denotes the inherently "external" forces on Q whereas
%           Q.GetResultantForce() also accounts for all action/reaction
%           forces applied to Q from all other points in the system.
%
%           Force_Q_P>  denotes the action/reaction force on Q from P whereas
%           Q.GetResultantForce(P)  returns  Force_Q_P> - Force_P_Q>.
%
%  Remark:  Q.GetForce(P) is deprecated for Q.GetResultantForce(P).
%
%  Remark:  The NewtonianFrame is not part of the "System" for the command
%           System.GetResultantForce().  Type HELP SYSTEM for more information.
%
% Related:  AddForce  AddForceDamper  AddForceElectrostatic  AddForceGravity
%           AddForceInverseSquare  AddForceLinearActuator  AddForceSpring
%           AddTorque  AddTorqueDamper
%           GetMomentOfForces  GetResultantForce  GetResultantTorque
%           GetForceGravityPotentialEnergy  GetForceSpringPotentialEnergy
%           GetStatics   GetStaticsKane   GetStaticsLagrange
%           GetDynamics  GetDynamicsKane  GetDynamicsLagrange

%GetResultantTorque
%GetResultantTorque  GetNetTorque  (synonymous)
%
% Purpose:  Returns the sum of 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:  Sum of all torques applied to Object.
%Output 2:  Sum of all torques applied to B by A.
%
%  Remark:  Torque_B>  denotes the inherently "external" torque on B whereas
%           B.GetResultantTorque() also accounts for all action/reaction
%           torques applied to B from all other objects in the system.
%
%           Torque_B_A>  denotes the torque on B from A whereas
%           B.GetResultantTorque(A)  returns  Torque_B_A> - Torque_A_B>.
%
%  Remark:  B.GetTorque(A) is deprecated for B.GetResultantTorque(A).
%
%  Remark:  The NewtonianFrame is not part of the "System" for the command
%           System.GetResultantTorque().  Type HELP SYSTEM for more information.
%
% Related:  AddForce  AddForceDamper  AddForceElectrostatic  AddForceGravity
%           AddForceInverseSquare  AddForceLinearActuator  AddForceSpring
%           AddTorque  AddTorqueDamper
%           GetMomentOfForces  GetResultantForce  GetResultantTorque
%           GetForceGravityPotentialEnergy  GetForceSpringPotentialEnergy
%           GetStatics   GetStaticsKane   GetStaticsLagrange
%           GetDynamics  GetDynamicsKane  GetDynamicsLagrange

%GetRhs
%GetRhs
%
% Purpose:  Returns the expression that is assigned to a name.
%           For example, if  y = 3*sin(t),  GetRhs(y)  returns 3*sin(t).
%
%Syntax 1:  GetRhs( scalarName )
%Syntax 2:  GetRhs( mathExpression )
%
% Input 1:  scalarName -- the name of a scalar quantity (e.g., y).
% Input 2:  mathExpression -- a scalar, vector, dyadic, or matrix expression.
%
%Output 1:  The expression assigned to scalarName.  If scalarName does
%           not have a right-hand-side, then scalarName is returned.
%Output 2:  The expression that results when each scalarName appearing in
%           mathExpression is replaced with its assigned right-hand-side.
%
%  Remark:  Use the Explicit command to produce an expression that is solely in
%           terms of scalar quantities that do not have a right-hand-side
%           (e.g., names appearing in Constant or Variable declarations).
%
%  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

%GetRotationMatrix
%GetRotationMatrix
%
% Purpose:  Gets the rotation matrix relating two sets of bases vectors.
%
%  Syntax:  B.GetRotationMatrix( N )
%
%   Input:  B, N -- name of a RigidFrame or RigidBody.
%
%  Output:  Rotation matrix B_N that relates Bx>, By>, Bz>  to  Nx>, Ny>, Nz>.
%
% Remark:   Each syntax of the command SetRotationMatrix() has
%           a corresponding syntax for GetRotationMatrix().  Example:
%           B.GetRotationMatrix( A, BodyXY, q1, q2 )   forms the same matrix as
%           B.SetRotationMatrix( A, BodyXY, q1, q2 ).  Example:
%           B.GetRotationMatrixZ( theta )   calculates  the same matrix as
%           B.SetRotationMatrixZ( theta ).
%           "Set" methods calculate and store rotation matrices whereas
%           "Get" methods just calculate rotation matrices (no storage).
%
% Related:  GetAngularAcceleration  GetAngularVelocity  GetRotationMatrix
%           SetAngularAcceleration  SetAngularVelocity  SetRotationMatrix
%           GetRotationMatrixDyadic

%GetRotationMatrixDyadic
%GetRotationMatrixDyadic
%
% Purpose:  Gets the rotation matrix dyadic relating two sets of bases vectors.
%
%  Syntax:  B.GetRotationMatrixDyadic( A )
%
%   Input:  B, A -- name of a RigidFrame or RigidBody.
%
%  Output:  Rotation dyadic B_A>> that relates Bx>, By>, Bz>  to  Ax>, Ay>, Az>.
%
% Related:  GetAngularAcceleration  GetAngularVelocity  GetRotationMatrix
%           SetAngularAcceleration  SetAngularVelocity  SetRotationMatrix

%GetState
%GetState  and  GetDtState   (EXPERIMENTAL COMMAND, NOT RECOMMEND FOR USE).
%
% Purpose:  Creates an array of all names that are currently regarded as state.
%
%Syntax 1:  GetState()
%Syntax 2:  GetDtState()
%
%Output 1:  Creates an array of all names that are currently regarded as state.
%           These names are usually named in a Variable or Specified declaration.
%Output 2:  The time-derivative of the matrix returned by State().
%
% Related:  Constant  ImaginaryNumber  Specified  Variable
%           SetGeneralizedCoordinate  SetGeneralizedSpeed
%           GetGeneralizedCoordinate  GetGeneralizedSpeed
%           SetDt  SolveDt  SetAutoDifferentiate

%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.
%
%  Remark:  To set generalized speeds for Kane's method, use:
%           SetGeneralizedSpeed
%
% Related:  GetMagnitude           GetMagnitudeSquared
%           GetDistance            GetDistanceSquared
%           GetSpeed               GetSpeedSquared
%           GetAngularSpeed        GetAngularSpeedSquared
%           GetAngleBetweenVectors GetAngleBetweenUnitVectors
%           GetPosition            SetPosition       Translate
%           GetVelocity            SetVelocity       SetPositionVelocity
%           GetAcceleration        SetAcceleration   SetVelocityAcceleration
%           GetUnitVector          GetElongation     Vector   Dot

%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 helps with subsequent velocity/acceleration
%           and force/moment calculations.
%
%  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

%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 []  GetInverse      GetIdentityMatrix  GetNorm  GetRows
%           GetTrace       GetTranspose    GetZeroMatrix      Solve

%GetTaylorSeries
%GetTaylorSeries
%
% Purpose:  Expands functions in Taylor series.
%           Use Linearize  for a Taylor series with the 0th and 1st terms.
%           Use Linearize1 for a Taylor series with just the 1st term.
%
%  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 expansions
%           may make it advantageous to issue a command such as
%           SetAutoEpsilon( 1.0E-13 ).
%
% Related:  GetTaylorSeries  Linearize  SetAutoLinearize  SetAutoTaylorSeries

%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, ... )  --  0th and 1st terms.
%           Linearize0( F, arg1, arg2, ... )  --  same as Evaluate.
%           Linearize1( F, arg1, arg2, ... )  --  1st term of Taylor series.
%
%   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 expansions
%           may make it advantageous to issue a command such as
%           SetAutoEpsilon( 1.0E-13 ).
%
% Related:  GetDefaults  SetAutoZee
%           GetTaylorSeries  Linearize  SetAutoLinearize  SetAutoTaylorSeries
%           FactorLinear  FactorQuadratic

%GetNorm
%GetNorm
%
% Purpose:  Forms the 2-norm of a real one-dimensional (row or column) matrix.
%
%  Syntax:  GetNorm( matrixExpression )
%
%   Input:  matrixExpression -- row or column matrix.
%
%  Output:  sqrt( matrixExpression * transpose(matrixExpression) )
%
%  Remark:  Use  abs           for absolute value of a real or complex scalar.
%           Use  GetMagnitude  for the magnitude of a vector.
%           Use  GetNorm       for the 2-norm of a real row or column matrix.
%
% Related:  GetColumns     GetDeterminant  GetDiagonalMatrix  GetEigen
%           GetElement []  GetInverse      GetIdentityMatrix  GetNorm  GetRows
%           GetTrace       GetTranspose    GetZeroMatrix      Solve
%           abs            GetMagnitude    GetMagnitudeSquared

%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 []  GetInverse      GetIdentityMatrix  GetNorm  GetRows
%           GetTrace       GetTranspose    GetZeroMatrix      Solve

%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 []  GetInverse      GetIdentityMatrix  GetNorm  GetRows
%           GetTrace       GetTranspose    GetZeroMatrix      Solve

%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

%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  or  GetRelativeVelocity
%
% Purpose:  Gets a point's velocity in a reference frame or gets a point's
%           velocity relative to another point in a reference frame.
%
%Syntax 1:  Q.GetVelocity( refFrame )
%Syntax 2:  Q.GetVelocityRelative( P, refFrame )
%           Q.GetRelativeVelocity( P, refFrame )
%
%   Input:  Q, P -- names of points (e.g., Point or Particle).
%           refFrame -- name of a RigidFrame or RigidBody.
%
%Output 1:  Returns Q's velocity in refFrame.
%Output 2:  Returns Q's velocity relative to P in refFrame, defined as
%           Q.GetVelocity(refFrame) - P.GetVelocity(refFrame) or as
%           Dt( Q.GetPosition(P), refFrame ).
%
% Related:  Translate        SetPositionVelocity        SetVelocityAcceleration
%           SetPosition      GetPosition   GetDistance  GetElongation
%           SetVelocity      GetVelocity   GetSpeed     GetRelativeVelocity
%           SetAcceleration  GetAcceleration            GetRelativeAcceleration

%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:  If using the old/deprecated command  SetDefaults( AUTOLEV ),
%           the returned quantity may depend on whether the command is
%           issued before or after the CONSTRAIN command.
%
% Related:  GetPartialVelocity    GetPartialAngularVelocity
%           GetVelocityRemainder  GetAngularVelocityRemainder
%           Exclude

%if
%if  else  elseif  (used for control flow in scripts, also see IsPositive, etc.)
%
% Purpose:  Controls whether or not certain lines are executed in a script
%           depending on whether a logical expression evaluates to true.
%           If true, statements contained within braces are executed.
%           Otherwise, the statements are skipped.
%           Note: if statements only work in a script -- not when entering
%           commands interactively at the MotionGenesis line prompt.
%
%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 which
%           are evaluates using logic in the command IsSimplifyZero.
%
%           ==   equal to
%           !=   not 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.
%
%           &&   Logical AND separates logical expressions.
%           ||   Logical OR  separates logical expressions.
%
%  Braces:  The left and right braces should appear on the same line or
%           use the "Allman brace style" which means the
%           opening brace { is on a line by itself and the
%           closing brace } is on a line by itself, e.g., as
%           if( a==2 && b==3 )
%           {
%             Fred = 12 * 4
%             Jill = 20 * 3
%           }
%
%  Remark:  See: IsNegative,  IsNegativeOr0,  IsPositiveOr0,  IsPositive
%           To implement   if t < 0,  Fx = sin(t),  else Fx = cos(t),  use:
%           Fx = IsNegative(t) * sin(t)  +  IsPositiveOr0(t) * cos(t)
%
%  Remark:  Alternatively, use MATLAB, C, or Fortran to control code flow.
%           For example, the following shows how to make x = 0 when t >= pi.
%
%           Specified sintOrZero = sin(t)
%           Variable y' = sintOrZero               % Valid when t <= pi.
%           Input   tFinal = 4,  y = 0             % Arbitrary input values.
%           Output  t, y,  y'
%           %% if( t > pi ) sintOrZero = 0;  end
%           ODE()  simulateWithIfStatement.m       % Create MATLAB program.
%
%           Edit simulateWithIfStatement.m and verify it contains the line
%           %% if( t > pi ) sintOrZero = 0;  end
%           Un-comment and move this line so the MATLAB code has
%
%           sintOrZero = sin(t);
%           if( t > pi ) sintOrZero = 0;  end
%
% Related:  !  %  &  Clear  Save  Run  Quit  if  else  elseif  ceil  floor  sign
%           IsNegative  IsNegativeOr0  IsPositiveOr0  IsPositive
%           IsSimplifyEqual  IsSimplifyZero  IsSimplifyTrue
%
%--------------------------------------------------------------------
%Example 1a: if                   % Results in x = 18.
%--------------------------------------------------------------------
% if( 5 != 4 )  { x = 6*3 }
%
%--------------------------------------------------------------------
%Example 1b: if                   % Results in x = 18   and  y = 24.
%--------------------------------------------------------------------
% if( (5 >= 6  ||  2*pi >= 6)  &&  8 < 9 )  { x = 6*3;  y=6*4 }
%
%--------------------------------------------------------------------
%Example 2: if  else              % Results in x = 3   and  y = 4.
%--------------------------------------------------------------------
% if( 5 >= 6 )  { x = 6*3;  y=6*4 }
% else          { x = 3;    y=4  }
%
%--------------------------------------------------------------------
%Example 3: if  elseif            % Results in x = 17.
%--------------------------------------------------------------------
% if( 5 >= 6  )           { x = 6*3;  y=6*4 }
% elseif( sqrt(5) > 2 )   { x = 17 }
%
%--------------------------------------------------------------------
%Example 4: if  elseif  else      % Results in x = 18  and  y = 24.
%--------------------------------------------------------------------
% if( 5 >= 6  )           { x = 6*3;  y=6*4 }
% elseif( sqrt(5) >  9 )  { x = 17 }
% elseif( sqrt(4) == 2 )  { x = 16 }
% else
% {
%    x = 6 * 3
%    y = 6 * 4
% }
%--------------------------------------------------------------------
%Example 5:  if t < 0,  Fx = sin(t),  else Fx = cos(t)
%--------------------------------------------------------------------
% Fx = IsNegative(t) * sin(t)  +  IsPositiveOr0(t) * cos(t)
%
%--------------------------------------------------------------------
%Example 6:  if 5 < t < 9,  Fy = exp(t),  else Fy = 0
%--------------------------------------------------------------------
% isTimeGreaterThan5 = IsPositive( t - 5 )
% isTimeLessThan9    = IsNegative( t - 9 )
% isTimeBetween5And9 = isTimeGreaterThan5 * isTimeLessThan9
% Fy = isTimeBetween5And9 * exp(t)

%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

%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

%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 noUnits
%Syntax 2:  Input
%Syntax 3:  Input( a )           or  Input( a + 2*b + 3*c )
%Syntax 4:  InputNoConvert( a )  or  InputNoConvert( a + 2*b + 3*c )
%Syntax 5:  InputConvert( a )    or  InputConvert( a + 2*b + 3*c )
%Syntax 6:  ClearInput( a, b, c )
%
%           a, b, c, d     -- names of scalars or a 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 the input value of  a   (no units conversion).
%Output 4:  Returns the input value of  a   (no units conversion).
%           Same as Input( a, NoUnitSystem ).
%Output 5:  Returns the input value of  a   multiplied by the conversion factor
%           from a's units to the current units in SetUnitSystem.
%           Same as Input( a, GetUnitSystem ).
%Output 6:  Clears the input values and units assigned to  a, b, c.
%
%  Remark:  Use InputConvert()   as shorthand for InputWithConversion().
%           Use InputNoConvert() as shorthand for InputNoConversion().
%
%  Remark:  Input values and units can also be assigned by declarations in:
%           Constant, SetMass, SetInertia, and SetMassInertia
%
%  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
%           t  tInitial  tFinal  tStep  absError  printIntScreen  printIntFile
%           Solve  SolveDt  SolveSetInput  SolveSetInputDt  ...

%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  RoundDigits  sign  MathFunctions

%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

%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
%

%IsPositive
%IsNegative  IsNegativeOr0  IsPositiveOr0  IsPositive    (subject to change).
%
% Purpose:  Return a value that depends on the sign of a real scalar expression.
%
%Syntax 1:  IsNegative( x )       % Returns  true  if x <  0,  otherwise  false.
%Syntax 2:  IsNegativeOr0( x )    % Returns  true  if x <= 0,  otherwise  false.
%           IsNonPositive( x )
%Syntax 3:  IsPositiveOr0( x )    % Returns  true  if x >- 0,  otherwise  false.
%           IsNonNegative( x )
%Syntax 4:  IsPositive( x )       % Returns  true  if x >  0,  otherwise  false.
%
%   Input:  x -- a real scalar expression.
%
%  Remark:  The derivative of these functions can be assumed to be 0.
%
%  Remark:  To implement  if t < 0, Fx = sin(t),  else Fx = cos(t), use:
%           Fx = IsNegative(t) * sin(t)  +  IsPositiveOr0(t) * cos(t)
%
%  Remark:  IsPositive can be used to implement a logical OR whereas the
%           multiplication operator * can mimic a logical AND.
%           IsPositive( false + false )   returns false
%           IsPositive( false + true  )   returns true
%           IsPositive( true  + false )   returns true
%           IsPositive( true  + true  )   returns true
%                       false * false     returns false
%                       false * true      returns false
%                       true  * false     returns false
%                       true  * true      returns true
%
% Related:  ceil  floor  int  max  min  round  sign  MathFunctions
%           IsNegative  IsNegativeOr0  IsPositiveOr0  IsPositive

%IsContainSymbol
%IsContainSymbol   (semi-experimental command)
%
% Purpose:  Checks whether an expression contains a certain symbol.
%
%  Syntax:  IsContainSymbol( expression, X )
%
%   Input:  expression -- an expression or matrix of expressions.
%           X -- the name of a scalar, unit vector, zero vector, zero dyadic,
%           or unit dyadic or  or matrix of these -- e.g., a Variable.
%
%   Output: True or false (or a matrix of true/false) depending on whether
%           expression contains X.
%
% Related:  D  Dt  DtDt  Integrate  GetPartials  GetJacobian  MathFunctions

%IsSimplifyZero
%IsSimplifyZero     (semi-experimental command)
%
% Purpose:  Determines whether a mathematical expression simplifies to zero
%           (or within a numerical tolerance of zero).
%
%Syntax 1:  IsSimplifyZero( expression )
%Syntax 2:  IsSimplifyZero( expression,  absEpsilon )
%Syntax 3:  IsSimplifyZero( expression,  absEpsilon, relEpsilon )
%
%   Input:  expression -- a scalar, vector, tensor, or matrix expression.
%           absEpsilon -- a real number r with   0  <=  r  < 0.5
%           relEpsilon -- a real number r with   0  <=  r  < 0.5
%
%Output 1:  true if expression simplifies to zero, otherwise false.
%Output 2:  true if expression simplifies to zero after calling
%           Epsilon( expression,  absEpsilon ).
%Output 3:  true if expression simplifies to zero after calling
%           Epsilon( expression,  absEpsilon, relEpsilon ).
%
%  Remark:  Output is false if current simplification algorithms cannot simplify
%           to zero (future simplification algorithms may change result).
%           If output seems to improperly resolve to false, try:
%           IsSimplifyZero( Expand(expression, 0:2) ).
%  Remark:  To debug IsSimplifyZero, view the output produced by:
%                    Expand(expression, 0:2)   and/or
%           Epsilon( Expand(expression, 0:2),  absEpsilon, relEpsilon ).
%  Remark:  The Epsilon command describes absEpsilon and relEpsilon.
%
% Related:  IsSimplifyEqual  IsSimplifyZero  IsSimplifyTrue  Strcmp  Strcmpi
%           IsNegative  IsNegativeOr0  IsPositiveOr0  IsPositive
%           Epsilon  RoundDigits  Expand  Explicit

%IsSimplifyTrue
%IsSimplifyTrue     (semi-experimental command)
%
% Purpose:  Determines whether a mathematical expression simplifies to true
%           (or within a numerical tolerance of zero).
%
%Syntax 1:  IsSimplifyTrue( expression )
%Syntax 2:  IsSimplifyTrue( expression,  absEpsilon )
%Syntax 3:  IsSimplifyTrue( expression,  absEpsilon, relEpsilon )
%
%   Input:  expression -- a scalar, vector, tensor, or matrix expression.
%           absEpsilon -- a real number r with   0  <=  r  < 0.5
%           relEpsilon -- a real number r with   0  <=  r  < 0.5
%
%Output 1:  true if expression simplifies to true, otherwise false.
%Output 2:  true if expression simplifies to true after calling
%           Epsilon( expression,  absEpsilon ).
%Output 3:  true if expression simplifies to zero after calling
%           Epsilon( expression,  absEpsilon, relEpsilon ).
%
%  Remark:  Output is false if current simplification algorithms cannot simplify
%           to true (future simplification algorithms may change result).
%  Remark:  The Epsilon command describes absEpsilon and relEpsilon.
%
% Related:  IsSimplifyEqual  IsSimplifyZero  IsSimplifyTrue  Strcmp  Strcmpi
%           IsNegative  IsNegativeOr0  IsPositiveOr0  IsPositive
%           Epsilon  RoundDigits  Expand  Explicit

%IsSimplifyEqual
%IsSimplifyEqual    (semi-experimental command)
%
% Purpose:  Determines whether two expressions simplify to the same result
%           (or are within a numerical tolerance of the same result).
%
%Syntax 1:  IsSimplifyEqual( mathA, mathB )
%Syntax 2:  IsSimplfiyEqual( mathA, mathB,  absEpsilon )
%Syntax 3:  IsSimplifyEqual( mathA, mathB,  absEpsilon, relEpsilon )
%
%   Input:  mathA -- a scalar, vector, tensor, or matrix expression.
%           mathB -- a scalar, vector, tensor, or matrix expression.
%           absEpsilon -- a real number r with   0  <=  r  < 0.5
%           relEpsilon -- a real number r with   0  <=  r  < 0.5
%
%Output 1:  true if mathA == mathB  (with current simplification algorithms).
%Output 2:  true if mathA == mathB  with given absEpsilon and relEpsilon = 0.
%Output 3:  true if mathA == mathB  with given absEpsilon and relEpsilon.
%
%  Remark:  IsSimplifyEqual( x, y ) is similar to IsSimplifyZero( x - y ).
%           Read the help for IsSimplifyZero for useful debugging tips.
%
% Related:  IsSimplifyEqual  IsSimplifyZero  IsSimplifyTrue  Strcmp  Strcmpi
%           IsNegative  IsNegativeOr0  IsPositiveOr0  IsPositive
%           Epsilon  RoundDigits  Expand  Explicit

%Strcmp
%Strcmp  Strcmpi
%
% Purpose:  Compares two strings and returns:
%           -1  if stringA  <  stringB
%            0  if stringA  =  stringB  (strings are regarded as equal)
%            1  if stringA  >  stringB
%
%Syntax 1:  Strcmp(  stringA, stringB )
%Syntax 2:  Strcmpi( stringA, stringB )
%
%   Input:  stringA -- a string which may be enclosed within quotes.
%           stringB -- a string which may be enclosed within quotes.
%
%Output 1:  -1, 0, or 1 from case sensitive comparison of stringA and stringB.
%Output 2:  -1, 0, or 1 from case insensitive comparison of stringA and stringB.
%
%  Remark:  Strcmp  is a case   sensitive string comparison.
%           Strcmpi is a case insensitive string comparison.
%           A string within quotes differs from a string without quotes.
%           For example, "abc" is not the same as abc.
%
% Related:  IsSimplifyEqual  IsSimplifyZero  IsSimplifyTrue  Strcmp  Strcmpi
%           IsNegative  IsNegativeOr0  IsPositiveOr0  IsPositive
%           Epsilon  RoundDigits  Expand  Explicit

%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

%License
%License  LicenseNetwork  LicenseAgreement
%
%Syntax 1:  License
%           Displays information about the program's license on your computer.
%           Asks if you would like to generate a license.
%
%Syntax 2:  LicenseNetwork  or  LicenseServer
%           Displays information about the program's license on your computer.
%           Asks if you would like to generate a license for a network/server.
%
%Syntax 3:  LicenseAgreement
%           Displays the program's license agreement.
%
%Remark:    End-user and/or computer/IT administrators are responsible for all
%           computer security.  We recommend the software be installed on a
%           computer/account with restricted privileges as all users who access
%           the software may have privileges at least equal to the account under
%           which the software is installed.  All users who access the software
%           must have read/write privileges for the file MGLicense.txt.
%
%Optional:  Instructions relevant only for a server/network license (rare).
%           All users who access the software must have read/write privileges
%           for the file MGLicense.txt.  If you have a server/network version,
%           you need to change read/write permissions for MGLicense.txt.
%           For example, from a MacOSX terminal, cd to the MotionGenesis folder
%           and type the Unix command:  chmod a+x MGLicense.txt
%           For PC/Windows, do something like the following:
%        1. Navigate to C:\MotionGenesis (the folder containing MGLicense.txt).
%        2. Right-click on MGLicense.txt and select "Properties".
%        3. Click on the "Security" tab.
%        4. Click on "Users" from the "Group or user names" section
%           (if needed, press the "Edit" button to open "Edit Permissions").
%        5. Check the "Allow" checkbox under the "Full Control" option to
%           enable all users read/write access to the file MGLicense.txt.
%        6. Press "OK" to save the changes.

%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

%MathFunctions
%MathFunctions
%
% Absolute value:           abs
% Exponential,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, minimum:         max, min
% Square, 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>    )  or  Vector( A,  vector>  )
%Syntax 2:  Matrix( A,  dyadic>>   )  or  Dyadic( A,  dyadic>> )
%Syntax 3:  Matrix( A,  triadic>>> )
%Syntax 4:  Matrix( A,  [ v1>, ...  vn> ]  )
%
%   Input:  A -- the name of a RigidFrame or RigidBody
%           vector>    -- a vector  expression
%           dyadic>>   -- a dyadic  expression
%           triadic>>> -- a triadic expression
%           [v1> ...  vn>] -- one dimensional (row or column) matrix of vectors
%
%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>>>.
%
%Output 4:  n x 3  or  3 x n  matrix whose elements are the Ax>, Ay>, Az>
%           measures of v1> ... vn>
%
%  Remark:  To select one element of the matrix m, use e.g., m[ 2, 3 ].
%           For a submatrix, use m[ 2:3, 1:5 ].  See HELP [].
%
% Related:  Express        Vector          Dyadic             Matrix  SkewMatrix
%           GetColumns     GetDeterminant  GetDiagonalMatrix  GetEigen
%           GetElement []  GetInverse      GetIdentityMatrix  GetNorm  GetRows
%           GetTrace       GetTranspose    GetZeroMatrix      Solve

%SkewMatrix
%SkewMatrix
%
% Purpose:  Constructs a skew-symmetric matrix from a vector.
%
%Syntax 1:  SkewMatrix( A, vector> )
%Syntax 2:  SkewMatrix( vector> )
%
%   Input:  A -- the name of a RigidFrame or RigidBody.
%           vector> -- a vector expression.
%
%Output 1:  3 x 3 skew-symmetric matrix whose off-diagonal elements are the
%           Ax>, Ay>, Az> measures of vector>.  For example, if
%           vector> = vx*Ax> + vy*Ay> + vz*Az>,  the output is
%           [ 0,  -vz,   vy;
%            vz,    0,  -vx;
%           -vy,   vx,    0]
%
%Output 2:  Same as Output 1 when vector> is expressed in terms of only unit
%           vectors expressed in terms of the same RigidFrame or RigidBody A.
%
%  Remark:  The output skew-symmetric matrix helps represent cross products
%           through matrix multiplication and matrices.  For example,
%           SkewMatrix( A, v1> ) * Matrix( A, v2> ) is a 3 x 1 column matrix
%           representation of Cross( v1>, v2> ) expressed with Ax>, Ay>, Az>.
%
%  Remark:  In general, a skew-symmetric matrix S is a square matrix with the
%           property  Transpose(S) = -S.  Matrix S has zeros along its diagonal.
%           The off-diagonal elements of S have the property Sji = -Sij.
%
% Related:  Express        Vector          Dyadic             Matrix  SkewMatrix
%           GetColumns     GetDeterminant  GetDiagonalMatrix  GetEigen
%           GetElement []  GetInverse      GetIdentityMatrix  GetNorm  GetRows
%           GetTrace       GetTranspose    GetZeroMatrix      Solve

%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  RoundDigits  sign  MathFunctions

%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)
%Syntax 3:  #NewtonianFrame#      (string substitution with the NewtonianFrame)
%
%   Input:  N -- name that starts with a letter, followed by a reasonable number
%                of alphanumeric characters (e.g., less than 12 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

%numerator
%numerator  or  denominator  (experimental command -- subject to change).
%
% Purpose:  Returns the numerator or a denominator of a fraction.
%
%Syntax 1:  numerator(   fractionExpression )
%Syntax 2:  denominator( fractionExpression )
%
%   Input:  fractionExpression -- an expression that resolves to fraction.
%
%Output 1:  The numerator   of fractionExpression.
%Output 2:  The denominator of fractionExpression.
%
% Related:  MathFunctions

%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
%           t  tInitial  tFinal  tStep  absError  printIntScreen  printIntFile
%           Solve  SolveDt  SolveSetInput  SolveSetInputDt  ...

%Optimize
%Optimize   EXPERIMENTAL METHOD (SUBJECT TO CHANGE).
%
% Purpose:  Forms a set of equations which when solved optimizes a function
%           (e.g., finds a local minimum or maximum), with or without
%           equality constraints.
%
%Syntax:    eqnsZero = Optimize( CostFunction,  Constraints = 0,  x1, x2, ... )
%           eqnsZero = Optimize( CostFunction,                    x1, x2, ... )
%
%   Input   CostFunction -- Single scalar expression that depends on x1, x2, ...
%
%           Constraints -- a scalar expression or a matrix of scalar expressions
%           that are functions of x1, x2, ..., and regarded as equal to zero.
%           Constraints may be a combination of statics/dynamics equations,
%           geometry constraints, motion constraints, etc.
%           x1, x2, ... -- the names of scalars or a matrix of scalar names.
%
%Output:    Matrix of scalar expressions (herein arbitrary named eqnsZero) that
%           are equal to zero and which generally are functions of x1, x2 ...
%           If there are Constraints, eqnsZero depend on Lagrange multipliers
%           e.g., lambda1, lambda2, ... which are auto-declared as Variables.
%           eqnsZero can be subsequently solved (e.g., with one of the many
%           variants of the Solve command) to determine x1, x2, ...
%           If there are Constraints, also solve for lambda1, lambda2, ...
%
% Remark:   Depending on CostFunction and Constraints, the matrix of returned
%           equations (herein eqnsZero) may be linear or nonlinear in x1, x2.
%           For example, the quadratic cost function CostFunction = x1^2 + x2^2
%           is associated with least-square optimization. Optimizing a quadratic
%           cost function that has no associated constraints or has Constraints
%           that also happen to be linear in  x1, x2, ... return a matrix of
%           equations (herein eqnsZero) that are linear in x1, x2, ...
%           Note: 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.
%
% Related:  ODE  Solve  SolveDt  SolveSetInput  SolveSetInputDt  Optimize ...
%           GetPolynomial  GetPolynomialRoots  GetQuadraticRoots  ...
%           SolveQuadraticPositiveRoot  SolveQuadraticPositiveRootDt  ...
%           SetAutoDifferentiate  SetAutoOverwrite
%           SetDt  SetNoDt   =   :=   +=   *=   /=   ^=

%SolveOptimize (RESERVED KEYWORD & SYNTAXES. IN-DEVELOPMENT)
%SolveOptimize (RESERVED KEYWORD & SYNTAXES. IN-DEVELOPMENT)
%
% Purpose:  Forms a set of equations which when solved optimizes a function
%           (e.g., finds a local minimum or maximum), with or without
%           equality constraints (e.g., a combination of statics, dynamics,
%           and/or geometry and motion constraints).
%
%Syntax 1:  SolveOptimize( CostFunction,  Constraints,  x1,  x2, ... )
%           SolveOptimize( CostFunction,                x1,  x2, ... )
%Syntax 2:  SolveOptimize( CostFunction,  Constraints,  x1=Guess1,  x2=Guess2 )
%           SolveOptimize( CostFunction,                x1=Guess1,  x2=Guess2 )
%Syntax 3:  answer = SolveOptimize( CostFunction, Constraints, x1=Guess1, x2=Guess2 )
%           answer = SolveOptimize( CostFunction,              x1=Guess1, x2=Guess2 )
%
%   Input   CostFunction -- Single scalar expression that depends on x1, x2, ...
%
%           Constraints -- one or more scalar expressions (in a matrix) that
%           are functions of x1, x2, ..., and regarded as equal to zero.
%           Treated as:  Constraints[1] = 0,   Constraints[2] = 0,  ...
%
%           x1, x2, ... -- the names of scalars or a matrix of scalar names.
%
%           Guess1, Guess2 -- expressions that resolve to real numbers.
%
%Output 1:  Matrix of scalar expressions (herein arbitrary named eqnsZero) that
%           are equal to zero and which generally are functions of x1, x2 ...
%           If there are Constraints, eqnsZero depend on Lagrange multipliers
%           lambda1, lambda2, ... which are auto-declared as Variables..
%           eqnsZero can be subsequently solved (e.g., with one of the many
%           variants of the Solve command) to determine x1, x2, ...
%           (and if there are Constraints, lambda1, lambda2, ...).
%
%Output 2:  Convenience function to do the following
%           eqnsEqualZero = Optimize( CostFunction,  Constraints,  x1,  x2, ... )
%           Solve( eqnsEqualZero = 0,  x1,  x2, lambda1, lambda2, ... )
%           eqnsEqualZero = Optimize( CostFunction,  x1,  x2, ... )
%           Solve( eqnsEqualZero = 0,  x1,  x2, lambda1, lambda2, ... )
%Output 3:  Solutions (real numbers) are returned in a matrix.
%           Solutions are NOT assigned to x1, x2, ...
%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. A CostFunction
%           of the form  CostFunction = x1^2 + x2^2  is associated with
%           least-square optimization and if Constraints happen to be
%           linear in x1, x2, the returned matrix of equation(s) (herein called
%           eqnsEqualZero) are linear in x1, x2, ...
%           Note: 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 ...
%           GetPolynomial  GetPolynomialRoots  GetQuadraticRoots  ...
%           SolveQuadraticPositiveRoot  SolveQuadraticPositiveRootDt  ...
%           SetAutoDifferentiate  SetAutoOverwrite
%           SetDt  SetNoDt   =   :=   +=   *=   /=   ^=

%Output
%Output  OutputPlot  OutputEncode
%
% Purpose:  Causes programs created by the ODE and CODE 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, ...
%
%           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 programs to calculate output without writing
%           to data files or displaying them on-screen.
%
%Response:  Output statements are entered before an ODE or CODE command.
%
% Remark:   In the event that x1, x2, ... is a matrix, the associated programs
%           calculate the matrix elements, but do not display 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.
%
%           Type  GetUnitSystem  for a list of units
%--------------------------------------------------------------------
%   Remark: To clear some or all of previously entered Output, OutputPlot,
%           or OutputEncode statements, use:
%
%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.
%--------------------------------------------------------------------
%Syntax 3:  Output  or  OutputPlot  or  OutputEncode
%           Displays a list of Output, OutputPlot, OutputEncode statements.
%--------------------------------------------------------------------
%
% Related:  ODE  Input  Output  OutputPlot  Plot  SetPlotInterface  Animate
%           ConvertUnits  GetUnitSystem  SetUnitSystem  SetDigits
%           t  tInitial  tFinal  tStep  absError  printIntScreen  printIntFile

%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
%           SetMass

%PathToMotionGenesis
%PathToMotionGenesis  (Unnecessary for regular program use).
%
% Purpose:  Specifies the operating system path to the MotionGenesis folder.
%           This is the top-level directory (folder) for the program.
%           Its sub-directories contains files used by the program.
%
%  Windows 10:
%
%           To permanently set the operating system environment variable
%           1. Open the Start Search (click on the Windows key).
%           2. Type env
%           3. Choose Edit the system environment variables
%           4. Click the Environment Variables ... button.
%           5. Under the user variables panel, click on the New button.
%           6. Enter the variable name  as  PathToMotionGenesis
%           7. Enter the variable value as  pathToProgram
%              where pathToProgram is something like C:\MotionGenesis
%
%           To temporarily set this operating system environment variable
%           1.  Open a operating system terminal window -- which can be done in
%               many ways, e.g., browse to the MotionGenesis folder and click on
%               the fileMotionGenesisTerminal.lnk.
%           2.  At the terminal prompt, type the following where pathToProgram
%               is the path to the MotionGenesis folder, e.g., C:\MotionGenesis
%
%               SET PathToMotionGenesis=pathToProgram
%
%  Unix and Macintosh OSX:
%
%           To permanently set the environment variable, edit the file .cshrc
%           and add the following line where pathToProgram is something like
%           /applications/MotionGenesis
%
%                setenv PathToMotionGenesis pathToProgram
%
%           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 and usually finds its associated files.
%
%  Remark:  Before March 2020, PathToMotionGenesis was named MOTIONGENESISPATH
%
% Related:  GetDefaults  GetWorkingDirectory  SetWorkingDirectory
%           GetEnvironmentValue   SetScratchDirectory
%

% Older Instructions
%  Windows 95/98/Millenium:
%
%           Add the following line to the file Autoexec.bat, which
%           resides on the C:\ drive:
%
%               SET PathToMotionGenesis=pathToProgram
%
%           For example, if the program was installed in the directory
%           C:\Fred, the line that belongs in the file Autoexec.bat is
%
%               SET PathToMotionGenesis=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  PathToMotionGenesis
%           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 PathToMotionGenesis 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.

%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
%
%  Value:   3.14159265358979323846264338327950288419716939937510582 ...
%
% Related:  Constant  ImaginaryNumber  Specified  Variable  true false
%           SetGeneralizedCoordinate  SetGeneralizedSpeed  t

%Plot
%Plot       For PC/Windows and with proper install of Java JDK on 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]
%Syntax 5:  PlotTest
%
%   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 1:  Starts the interactive plotting program (graphical user interface).
%Output 2:  Starts the plotting program and plots the data in dataFile1.
%Output 3:  Plots the data in dataFile1, dataFiel2, dataFile3.
%Output 4:  Plots columns 2 vs 1, 3 vs 1, 4 vs 1 in dataFile1.
%           Plots columns 4 vs 1, 3 vs 1  in dataFile2.
%Output 5:  Tests the plotting program by displaying a sample plot.
%
%  Remark:  Alternatively, you can invoke the plotting program from the
%           OS (operating system) command line by typing, e.g.,
%           MotionGenesis  Plot  dataFile1
%           MotionGenesis  Plot  dataFile1, dataFile2, dataFile3
%           MotionGenesis  Plot  dataFile1 [1,2,3,4]  dataFile2 [1,4,3]
%
%  Remark:  There are many ways to plot (with or without a license).
%           At the operating system prompt, type:  MotionGenesis dataFile1
%           PC/Windows: Drag and drop one or more data files onto the icon for
%           MotionGenesis  or  MotionGenesisStartHere
%           See more HELP (and many other options) after starting the Plot tool.
%
% Related:  ODE  Solve  Input  Output  OutputPlot  Plot  Animate
%           SetPlotInterface

%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

%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 a machine specific number (e.g., 32767).
%
% Related:  ceil  floor  int  max  min  round  RoundDigits  sign  MathFunctions

%ReplaceString
%ReplaceString
%
% Purpose:  Replaces strings in an expression with new strings.
%           Truncates numbers in an expression (possibly simplifying it) by
%           using the number of significant digits determined by SetDigits.
%
%Syntax 1:  ReplaceString( mathExpression )
%Syntax 2:  ReplaceString( mathExpression, string1=rhs1, string2=rhs2, ... )
%Syntax 3:  QueryReplaceString( mathExpression, string1=rhs1, string2=rhs2 )
%
%   Input:  mathExpression -- A scalar, vector, dyadic or 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 which is determined by SetDigits
%           (generally, less precise numbers are displayed than stored).
%
%Output 2:  Returns mathExpression with stringi replaced by rhsi
%           wherever stringi appears in mathExpression.
%           Numbers are also truncated as described above.
%
%Output 3:  Similar to Output 2 except that for each occurrence of stringi
%           in mathExpression, queries whether or not replacement should occur.
%
%  Remark:  The  ReplaceString  command  uses a string replacement
%           which ignores mathematical rules as shown in Example 1:
%
%  Remark:  Also see RoundDigits.
%
% Related:  Epsilon  Evaluate  Expand  Explicit
%           Factor  FactorLinear  FactorQuadratic  ReplaceString  RoundDigits
%           GetRhs  SetAutoRhs  SetDigits

%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
%           SetMass         SetInertia   SetMassInertia

%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

%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.
%           Positive numbers with a fractional part of 0.5 round up whereas
%           negative numbers with a fractional part of -0.5 round down.
%
%  Remark:  Also see RoundDigits.
%
% Related:  ceil  floor  int  max  min  round  RoundDigits  sign  MathFunctions

%RoundDigits
%RoundDigits
%
% Purpose:  Truncates numbers in an expression to a number of significant digits.
%
%  Syntax:  RoundDigits( expression, n )
%
%   Input:  expression -- a scalar, vector, dyadic, or matrix expression.
%           n -- a positive integer less than or equal to 16.
%
%  Output:  An approximation of expression in which all its numbers are
%           truncated to n significant digits.
%
%  Remark:  Also see Epsilon and ReplaceString.
%
% Related:  Epsilon  Evaluate  Expand  Explicit
%           Factor  FactorLinear  FactorQuadratic  ReplaceString  RoundDigits
%           GetRhs  SetAutoRhs  SetDigits

%Rotate
%Rotate
%
% Purpose:  Sets 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, matrix33 )
%Syntax 2:  B.Rotate( A, aboutUnitVector, theta )
%Syntax 3:  B.Rotate( A, SequenceIJK, q1, q2, q3 )
%Syntax 4:  B.Rotate( A, EulerParameters, e0, e1, e2, e3 )
%           B.Rotate( A, Quaternion,      e0, e1, e2, e3 )
%Syntax 5:  B.Rotate( A, RodriguesParameters, rho1, rho2, rho3 )
%Syntax 6:  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, A -- names of a RigidFrame or RigidBody.
%
%           matrix33 -- 3x3 rotation matrix (direction cosine matrix).
%
%           theta, q1, q2, q3 -- angles (scalar expressions).
%
%           e0, e1, e2, e3 -- expressions for Euler parameters (quaternion).
%
%           rho1, rho2, rho3 -- expressions for Rodrigues parameters.
%
%           aboutUnitVector -- 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 B_A that is associated with
%           right-handed rotations of B relative to A.  This rotation matrix
%           relates unit vectors Bx>, By>, Bz>  to  Ax>, Ay>, Az>.
%
%           B's angular velocity and angular acceleration in A are also
%           formed if rotation matrix can be time-differentiated.
%
%           B's angular velocity and angular acceleration 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.
%
%  Remark:  Definitions of orientation angles, Euler parameters (quaternion),
%           Rodrigues parameters and direction cosines are in
%           Kane, Likins, Levinson: Spacecraft Dynamics, McGraw-Hill, Ch. 1, and
%           Mitiguy, Paul, "Advanced Dynamics & Motion Simulation".
%
%  Remark:  The command SetRotationMatrixODE also forms ODEs for the
%           associated variables, e.g., the angles, or quaternion or ...
%
% Related:  Rotate  RotateX  RotateY  RotateZ
%           RotateNegativeX  RotateNegativeY  RotateNegativeZ
%           SetRotationMatrixX  SetRotationMatrixY  SetRotationMatrixZ
%           SetRotationMatrixNegativeX  SetRotationMatrixNegativeY  ...
%           SetRotationMatrix  SetAngularVelocity  SetAngularAcceleration
%           GetRotationMatrix  GetAngularVelocity  GetAngularAcceleration
%           SetRotationMatrixODE

%
%ROTATE (RESERVED KEYWORDS & SYNTAXES. IN-DEVELOPMENT)
%Rotate
%
%Syntax 2:  B.Rotate( A, aboutUnitVector, theta, u )
%Syntax 3:  B.Rotate( A, SequenceI,   q1 )
%Syntax 4:  B.Rotate( A, SequenceIJ,  q1, q2 )
%Syntax 6:  B.Rotate( A, EulerParameters, e0, e1, e2, e3 )
%           B.Rotate( A, Quaternion,      e0, e1, e2, e3 )
%Syntax 7:  B.Rotate( A, RodriguesParameters, rho1, rho2, rho3 )
%Syntax 7:  B.Rotate( A, PoissonParameters, Rxx,Rxy,Rxz, ... Rzz )
%
%   Input:  B, A -- name of a RigidFrame or RigidBody.
%
%           theta, q1, q2, q3 -- angles (scalar expressions).
%           u  -- The name of a velocity variable
%
%           aboutUnitVector -- 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.
%
%Output 1:  Output associated with a rotation of B in A aboutUnitVector.
%
%Output 2:  Output 1 and a differential equation relating theta' to u.
%
%Output 3:  Output associated with a successive rotations of B in A.

%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 )
%           B.RotatePositiveX( A, q )
%Syntax 2:  B.RotateNegativeX( A, q )
%Syntax 3:  B.RotatePositiveX( A, q, u )
%Syntax 4:  B.RotateNegativeX( A, q, u )
%
%   Input:  B, A -- name of a 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.
%           By convention, when q = 0:  Ay> = By> and  Az> = Bz>.
%
%           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 B rotates about  -Ax> = -Bx>.
%
%Output 3:  Same as Output 1, except tries to form an ODE relating q' to u that
%           allows for more efficient angular velocity/acceleration expressions.
%
% Related:  Rotate  RotateX  RotateY  RotateZ
%           RotateNegativeX  RotateNegativeY  RotateNegativeZ
%           SetRotationMatrixX  SetRotationMatrixY  SetRotationMatrixZ
%           SetRotationMatrixNegativeX  SetRotationMatrixNegativeY  ...
%           SetRotationMatrix  SetAngularVelocity  SetAngularAcceleration
%           GetRotationMatrix  GetAngularVelocity  GetAngularAcceleration
%           SetRotationMatrixODE

%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 )
%           B.RotatePositiveY( A, q )
%Syntax 2:  B.RotateNegativeY( A, q )
%Syntax 3:  B.RotatePositiveY( A, q, u )
%Syntax 4:  B.RotateNegativeY( A, q, u )
%
%   Input:  B, A -- name of a 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.
%           By convention, when q = 0:  Ax> = Bx> and  Az> = Bz>.
%
%           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 B rotates about  -Ay> = -By>.
%
%Output 3:  Same as Output 1, except tries to form an ODE relating q' to u that
%           allows for more efficient angular velocity/acceleration expressions.
%
% Related:  Rotate  RotateX  RotateY  RotateZ
%           RotateNegativeX  RotateNegativeY  RotateNegativeZ
%           SetRotationMatrixX  SetRotationMatrixY  SetRotationMatrixZ
%           SetRotationMatrixNegativeX  SetRotationMatrixNegativeY  ...
%           SetRotationMatrix  SetAngularVelocity  SetAngularAcceleration
%           GetRotationMatrix  GetAngularVelocity  GetAngularAcceleration
%           SetRotationMatrixODE

%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 )
%           B.RotatePositiveZ( A, q )
%Syntax 2:  B.RotateNegativeZ( A, q )
%Syntax 3:  B.RotatePositiveZ( A, q, u )
%Syntax 4:  B.RotateNegativeZ( A, q, u )
%
%   Input:  B, A -- name of a 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.
%           By convention, when q = 0:  Ax> = Bx> and  Ay> = By>.
%
%           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 B rotates about  -Az> = -Bz>.
%
%Output 3:  Same as Output 1, except tries to form an ODE relating q' to u that
%           allows for more efficient angular velocity/acceleration expressions.
%
% Related:  Rotate  RotateX  RotateY  RotateZ
%           RotateNegativeX  RotateNegativeY  RotateNegativeZ
%           SetRotationMatrixX  SetRotationMatrixY  SetRotationMatrixZ
%           SetRotationMatrixNegativeX  SetRotationMatrixNegativeY  ...
%           SetRotationMatrix  SetAngularVelocity  SetAngularAcceleration
%           GetRotationMatrix  GetAngularVelocity  GetAngularAcceleration
%           SetRotationMatrixODE

%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
%--------------------------------------------------------------------

%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
%           SaveOverwrite FileName.all
%Syntax 3:  SaveOverwrite FileName.html
%           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.all   overwrites abc.all  (no prompt to user).
%           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.html).
%
%  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, if Q does not move on B (but is not welded or a
%           physical point of B), use Q.SetVelocityAcceleration( B, 0> )
%
% Related:  Translate        SetPositionVelocity   SetVelocityAcceleration
%           SetPosition      GetPosition   GetDistance  GetDistanceSquared
%           SetVelocity      GetVelocity   GetSpeed     GetElongation
%           SetAcceleration  GetAcceleration

%SetAngularAcceleration
%SetAngularAcceleration
%
% Purpose:  Sets a reference frame's angular acceleration.
%
%Syntax 1:  B.SetAngularAcceleration( N, angularAccelerationVector )
%Syntax 2:  B.SetAngularAcceleration( N )
%
%   Input:  B, N -- name of a 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

%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, N -- name of a 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, Likins, Levinson: Spacecraft Dynamics, McGraw-Hill, Ch. 1, and
%           Mitiguy, Paul, "Advanced Dynamics & Motion Simulation".
%
% Related:  Rotate  RotateX  RotateY  RotateZ
%           RotateNegativeX  RotateNegativeY  RotateNegativeZ
%           SetRotationMatrixX  SetRotationMatrixY  SetRotationMatrixZ
%           SetRotationMatrixNegativeX  SetRotationMatrixNegativeY  ...
%           SetRotationMatrix  SetAngularVelocity  SetAngularAcceleration
%           GetRotationMatrix  GetAngularVelocity  GetAngularAcceleration
%           SetRotationMatrixODE   SetRigidTransform
%           SetAngularVelocityAcceleration

%SetAngularVelocityAcceleration
%SetAngularVelocityAcceleration
%
% Purpose:  Sets a reference frame's angular velocity and angular acceleration.
%
%  Syntax:  B.SetAngularVelocityAcceleration( A, angularVelocityVector )
%
%   Input:  B, A -- name of a 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

%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   =   :=   +=   *=   /=   ^=

%SetAutoEpsilon
%SetAutoEpsilon
%
% Purpose:  In every expression, rounds numbers suitably close to an integer.
%
%Syntax 1:  SetAutoEpsilon( absEpsilon )
%Syntax 2:  SetAutoEpsilon( absEpsilon, relEpsilon )
%Syntax 3:  GetAutoEpsilonAbsolute()
%Syntax 4:  GetAutoEpsilonRelative()
%
%   Input:  absEpsilon a real number r such that:   0  <=  r  < 0.5
%           relEpsilon a real number r such that:   0  <=  r  < 0.5
%
%Output 1:  In expressions, rounds any number that is within absEpsilon of
%           an integer to that integer.  For a number of the form  x.y,  no
%           rounding occurs if  absEpsilon <  abs(0.y)  <  1 - absEpsilon
%
%Output 2:  Rounds any number d within abs( d * relEpsilon) of an integer to
%           that integer.  Also does the rounding described by Output 1.
%
%Output 3:  The first argument previously set by SetAutoEpsilon (or 0).
%Output 4:  The second argument previously set by SetAutoEpsilon (or 0).
%
%  Remark:  Program default is SetAutoEpsilon( 0, 0 ), i.e., no rounding.
%  Remark:  Use with caution.  AutoEpsilon has simplification side-effects.
%           SetAutoEpsilon( 1.0E-14 )
%           Expand( 2E-15 * t * (sin(t) + 3E+15 * t) )  simplifies to  6*t^2
%                   2E-15 * t * (sin(t) + 3E+15 * t)    simplifies to  0.
%
% Related:  Epsilon  SetAutoEpsilon  SetDigits  RoundDigits  GetDefaults

%SetAutoExpress
%SetAutoExpress
%
% Purpose:  For each rigid body, determines whether the body's angular velocity
%           and angular acceleration in the NewtonianFrame are automatically
%           expressed in terms of the body's unit vectors or in terms of
%           unit vectors associated with the body's inertia dyadic.
%
%  Syntax:  SetAutoExpress( SETTING )
%
%   Input:  SETTING -- ON or OFF
%
%  Remark:  For a RigidBody B,  SetAutoExpress( ON )  affects B's angular
%           velocity and angular acceleration in the NewtonianFrame
%           only if B's central inertia dyadic has been set.
%
%  Remark:  Program default is SetAutoExpress( ON ).
%
% Related:  Express  GetDefaults

%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

%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 a 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:  Use  :;  at the end of a statement to change SETTING to ON for only
%           that statement. Thereafter, SETTING reverts to its previous value.
%
%  Remark:  Program default is SetAutoOverwrite( OFF ).
%
% Related:  GetDefaults   SetAutoDifferentiate  SetAutoOverwrite
%           Solve  SolveDt  SolveSetInput  SolveSetInputDt  ...
%           SolveQuadraticPositiveRoot  SolveQuadraticPositiveRootDt  ...
%           SetDt  SetNoDt   =   :=   +=   *=   /=   ^=

%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

%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

%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
%           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

%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

%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

%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

%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

%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:  n -- a positive integer less than or equal to 17.
%           expression -- a scalar, vector, dyadic, or matrix expression.
%
%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  ReplaceString

%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  ...

%SetGeneralizedSpeed
%SetGeneralizedSpeed       ResetGeneralizedSpeed       GetGeneralizedSpeed
%SetGeneralizedCoordinate  ResetGeneralizedCoordinate  GetGeneralizedCoordinate
%
%  Purpose: Names generalized speeds for Kane's method.
%           Names generalized coordinates for Lagrange and Kane methods and for
%           calculating generalized forces associated with potential energy.
%           Returns a column matrix of generalized speeds or coordinates.
%
%Syntax 1:  GetGeneralizedSpeed()
%           GetGeneralizedCoordinate()
%Syntax 2:  SetGeneralizedSpeed( qA', qB', wz )
%           SetGeneralizedCoordinate( x, y, theta )
%Syntax 3:  ResetGeneralizedSpeed( wx, wy )
%           ResetGeneralizedCoordinate( x, y )
%Syntax 4:  ResetGeneralizedSpeed()
%           ResetGeneralizedCoordinate()
%
%   Input:  qA', qB', wz, x, y, theta -- names that start with a letter
%           followed by a reasonable number of alphanumeric characters,
%           Generalized speeds may end with one or more prime symbols '.
%
%Output 1:  Gets the column matrix of names declared as generalized speeds or
%           gets the column matrix of names declared as generalized coordinates.
%Output 2:  Appends qA', qB', wz to the matrix of generalized speeds or
%           appends x, y, theta  to the matrix of generalized coordinates.
%           Returns the matrix described by Output 1.
%Output 3:  Resets generalized speeds to just wx, wy and returns [wx;  wy]  or
%           resets generalized coordinates to just x, y and returns [x;  y].
%Output 4:  Resets to no generalized speeds and returns [0] or
%           resets to no generalized coordinates and returns [0].
%
%  Remark:  Use Dt( GetGeneralizedSpeed() ) to form a column matrix of the
%           time derivatives of generalized speeds.
%
% Related:  Constant  ImaginaryNumber  Specified  Variable
%           SetGeneralizedCoordinate  SetGeneralizedSpeed
%           GetStatics   GetStaticsKane   GetStaticsLagrange
%           GetDynamics  GetDynamicsKane  GetDynamicsLagrange

%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

%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

%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( mB = 10 kg )
%Syntax 3:  B.SetMass( mB = expression )
%Syntax 4:  B.SetMass( expression )
%
%   Input:   B -- Name of a Particle or RigidBody.
%           mB -- Scalar name.
%           expression -- Scalar expression, e.g., sin(t).
%
%Output 1:  Sets B's mass to mB.  If mB is not yet declared, declares mB as a
%           non-negative mass constant. Returns mB.
%
%Output 2:  Sets B's mass to mB.  If mB is not yet declared, declares mB as a
%           non-negative mass constant. Assigns the input value of mB to 10 kg.
%           Returns mB.
%
%Output 3:  Sets B's mass to mB.  Assigns mB to expression.
%           Returns mB or expression.
%
%Output 4:  Sets B's mass to expression and returns expression.
%
% Related:  SetMass          GetMass         SetInertia   SetMassInertia
%           GetCMPosition    GetCMVelocity   GetCMAcceleration
%           GetInertiaDyadic  GetInertiaMatrix  GetMomentOfInertia
%           GetProductOfInertia  GetRadiusOfGyration  GetInertiaVector

%SetMassInertia
%SetMassInertia   (also see SetMass and SetInertia)
%
% Purpose:  Sets a RigidBody's mass and its inertia dyadic about a point.
%           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,    I11, I22, I33 )
%Syntax 4:  B.SetMassInertia( mB, aboutPoint, A, I11, I22, I33 )
%Syntax 5:  B.SetMassInertia( mB, aboutPoint, A, I11, I22, I33, I12, I23, I31 )
%Syntax 6:  B.SetMassInertia( mB, aboutPoint, symmetricInertiaDyadic )
%Syntax 7:  B.SetMassInertia( mB, aboutPoint, threeElementMatrix )
%Syntax 8:  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 = 2*mA + 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>, Bz>, respectively.
%
%           IBxy, IByz, IBzx -- B's products of inertia about aboutPoint
%                               for  Bx>*By>,  By>*Bz>, Bz>*Bx>.
%
%           A -- The name of a RigidBody or RigidFrame.
%
%           I11, I22, I33 -- B's moments  of inertia about aboutPoint
%                            for Ax>, Ay>, Az>, respectively.
%
%           I12, I23, I31 -- B's products of inertia about aboutPoint
%                            for  Ax>*Ay>,  Ay>*Az>,  Az>*Ax>.
%                            Note the cyclical permutation ordering.
%
%           symmetricInertiaDyadic -- 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 B's mass and B's inertia dyadic about aboutPoint.
%           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 4:  B.SetMassInertia( aboutPoint, A, I11, I22, I33 )
%Output i:  Corresponding  B.SetInertia( .... )  commands  (i = 5, 6, 7, 8).
%
%  Remark:  Declares mB as a non-negative mass constant (if not yet declared),
%           declares IBxx, IByy, IBzz  as non-negative inertia constants and
%           IBxy, IByz, IBzx as inertia constants (if not yet declared).
%
%           Mass and inertia scalars can be declared along with an input value,
%           e.g., as  mB = 3 kg,  IBxx = 3 kg*m^2.  Alternatively, they can be
%           an expression such as  mB = t^2,  IBxx = m*r^2/2,  IBxy = -m*x*y.
%
%  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  SetMassInertia
%           GetCMPosition        GetCMVelocity        GetCMAcceleration
%           GetInertiaDyadic     GetInertiaMatrix     GetMomentOfInertia
%           GetProductOfInertia  GetRadiusOfGyration  GetInertiaVector

%
%SetMassInertiaSolidBlock (RESERVED KEYWORDS & SYNTAXES. IN-DEVELOPMENT)
%SetMassInertiaSolidBlock
%           Declares mB, IBxx, IByy, IBzz, a, b, c, r, h, thickness
%                    as non-negative constants (if not yet declared).
%
%Output 2:  B.SetMassInertiaSolidBlock( mB, IBxx, IByy, IBzz )
%           IBxx = m / 12 * (b^2 + c^2)
%           IByy = m / 12 * (a^2 + c^2)
%           IBzz = m / 12 * (a^2 + b^2)
%           For a thin plate, use  0  for either  a  or  b  or  c.
%
%Syntax 2:  B.SetMassInertiaSolidBlock(  mB, a, b, c )
%Syntax 3:  B.SetMassInertiaSolidSphere( m, r )
%Syntax 4:  B.SetMassInertiaSolidEllipse(  m, a, b, c )
%           B.SetMassInertiaThinWalledBlock(  mB, a, b, c )
%           B.SetMassInertiaThickWalledBlock( mB, a, b, c, thickness )
%           B.SetMassInertiaThinWalledSphere(  m, r  )
%           B.SetMassInertiaThickWalledSphere( m, r, thickness )
%           B.SetMassInertiaThinWalledEllipse(  m, a, b, c )
%           B.SetMassInertiaThickWalledEllipse( m, a, b, c, thickness )
%           B.SetMassInertiaSolidCylinder(       m, r, h )
%           B.SetMassInertiaThinWalledHollowCylinder(  m, r, h )
%           B.SetMassInertiaThinWalledHollowCylinder(  m, r, h )
%           B.SetMassInertiaThickWalledCappedCylinder( m, r, h, thickness )
%           B.SetMassInertiaThickWalledCappedCylinder( m, r, h, thickness )
%           B.SetMassInertiaLine( m, h )
%           B.SetMassInertiaSolidCircle(        m, r, h )
%           B.SetMassInertiaThinWalledCircle(   m, r, h )
%           B.SetMassInertiaThickWalledCircle(  m, r, h, thickness )
%           B.SetMassInertiaSolidHalfCircle(        )
%           B.SetMassInertiaThinWalledHalfCircle(   )
%           B.SetMassInertiaThickWalledHalfCircle(  , thickness)
%           B.SetMassInertiaSolidCircularSection(  )
%           B.SetMassInertiaThinWalledCircularSection( )
%           B.SetMassInertiaThickWalledCircularSection( , thickness)

%SetInertia
%SetInertia   (also see SetMassInertia)
%
% 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>, Bz>, respectively.
%
%           IBxy, IByz, IBzx -- B's products of inertia about aboutPoint
%                               for  Bx>*By>,  By>*Bz>,  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>, Az>, respectively.
%
%           I12, I23, I31 -- B's products of inertia about aboutPoint
%                            for  Ax>*Ay>,  Ay>*Az>,  Az>*Ax>.
%                            Note the cyclical permutation ordering.
%
%           symmetricInertiaDyadic -- 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 inertia constants.
%
%           If products of inertia such as IBxy are not already declared, they
%           are declared as inertia constants (negative, zero, or positive).
%
%           Inertia scalars can be declared along with an input value, e.g., as
%           IBxx = 3 kg*m^2.  Alternatively, they can be an expression such as
%           IBxx = m*r^2/2  or   IBxy = -m*x*y.
%
%  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   SetMassInertia
%           GetCMPosition    GetCMVelocity   GetCMAcceleration
%           GetInertiaDyadic  GetInertiaMatrix  GetMomentOfInertia
%           GetProductOfInertia  GetRadiusOfGyration  GetInertiaVector

%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
%

%           B.SetRotationMatrix( A, AxisAngle, aboutUnitVector, theta )
%           B.SetRotationMatrix( A, AxisAngle, [ux, uy, uz],    theta )
%           B.SetRotationMatrix( A, AngleAxis, theta, aboutUnitVector )
%           B.SetRotationMatrix( A, AngleAxis, theta, [ux, uy, uz] )

%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, theta )
%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, Indirect,  pB>, qB>, rB>,  pA>, qA>, rA> )
%           B.SetRotationMatrix( A, Indirect,  pB>, qB>,       pA>, qA>      )
%Syntax 9:  B.SetRotationMatrix( A, matrix33 )
%Syntax 10: B.SetRotationMatrix( A )
%Syntax 11: 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, A -- name of a RigidFrame or RigidBody.
%
%           theta, q1, q2, q3 -- angles (scalar expressions).
%
% Input 1:  aboutUnitVector -- unit vector that can be expressed in terms of
%                              either  Ax>, Ay>, Az>  or  Bx>, By>, Bz>.
%
% Input 2:  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.
%
% Input 3:  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.
%
% Input 4:  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.
%
% Input 5:  e0, e1, e2, e3 -- expressions for Euler parameters (quaternion).
%
% Input 6:  rho1, rho2, rho3 -- expressions for Rodrigues parameters.
%
% Input 7:  Rxx,Rxy,Rxz, Ryx,Ryy,Ryz, Rzx,Rzy,Rzz - expressions for elements.
%
% Input 8:  pB>, qB>, rB> -- vectors expressed in terms of Bx>, By>, Bz>.
%           pA>, qA>, rA> -- the same vectors pB>, qB>, rB> (same magnitude and
%           same direction) but instead of expressed in terms of Bx>, By>, Bz>,
%           pA>, qA>, rA> are expressed in terms of Ax>, Ay>, Az>.
%           See Mitiguy, Paul, "Advanced Dynamics & Motion Simulation".
%
% Input 9:   matrix33 -- 3x3 rotation matrix (direction cosine matrix).
%
%  Output:  Sets and returns the rotation matrix B_A that is associated with
%           right-handed rotations of B relative to A.  This rotation matrix
%           relates unit vectors Bx>, By>, Bz>  to  Ax>, Ay>, Az>.
%
%Output 8:  Uses indirect determination of orientation to form the B_A
%           rotation matrix with the algorithm in the textbook:
%           Mitiguy, Paul, "Advanced Dynamics & Motion Simulation".
%
%Output 10: Attempts to calculate B.GetRotationMatrix(A) e.g., by successive
%           matrix multiplication of previously stored rotation matrices and
%           then sets and returns the rotation matrix B_A.
%
%  Remark:  The command SetRotationMatrixODE also forms ODEs for the
%           associated variables, e.g., the angles, or quaternion or ...
%
%  Remark:  Definitions of orientation angles, Euler parameters (quaternion),
%           Rodrigues parameters, and direction cosines are in
%           Kane, Likins, Levinson: Spacecraft Dynamics, McGraw-Hill, Ch. 1, and
%           Mitiguy, Paul, "Advanced Dynamics & Motion Simulation".
%
% Related:  Rotate  RotateX  RotateY  RotateZ
%           RotateNegativeX  RotateNegativeY  RotateNegativeZ
%           SetRotationMatrixX  SetRotationMatrixY  SetRotationMatrixZ
%           SetRotationMatrixPositiveX  SetRotationMatrixPositiveY  ...
%           SetRotationMatrixNegativeX  SetRotationMatrixNegativeY  ...
%           SetRotationMatrix  SetAngularVelocity  SetAngularAcceleration
%           GetRotationMatrix  GetAngularVelocity  GetAngularAcceleration
%           SetRotationMatrixODE   SetRigidTransform

%SetRotationMatrixAndPosition
%SetRotationMatrixAndPosition
%
% Purpose:  Sets the rotation matrix and position vector associated with
%           two rigid frames (or rigid bodies).
%
%  Syntax:  B.SetRotationMatrixAndPosition( A, rotMatrix33, posVector )
%
%   Input:  A, B -- names of reference frames (RigidFrame or RigidBody).
%
%           rotMatrix33 -- expression that resolves to a 3x3 rotation matrix.
%                          SetRotationMatrix shows may ways this can be done.
%           posVector   -- expression that resolves to a vector
%                          Example: x*Ax> + y*Ay> + z*Az>
%                          or if posVector is the 3 element matrix [x, y, z],
%                          posVector resolves to x*Ax> + y*Ay> + z*Az>.
%
%  Output:  Assigns the rotation matrix B_A and position vector p_Ao_Bo> as:
%           B.SetRotationMatrix( A, rotMatrix33 )
%           Bo.SetPosition( Ao, posVector )
%
%           Returns true if this method succeeds.
%
%  Remark:  This is a convenience command. For clarity, we recommend:
%           B.SetRotationMatrix( A, rotMatrix33 )
%           Bo.SetPosition( Ao, posVector )
%
% Related:  SetRotationMatrix   SetPosition
%           SetRigidTransform   GetRigidTransform
%           SetVelocityAccelerationForGetGeometry  TranslateAcrossJoint

%SetRigidTransform
%SetRigidTransform   (EXPERIMENTAL COMMAND, NOT RECOMMEND FOR USE).
%
% Purpose:  Sets the rotation matrix and position vector associated with
%           two rigid frames (or rigid bodies).
%
%Syntax 1:  B.SetRigidTransform( A, rotMatrix33, posVector )
%Syntax 2:  B.SetRigidTransform( A, matrix34 )
%Syntax 3:  B.SetRigidTransform( A, matrix44 )
%
%   Input:  A, B -- names of reference frames (RigidFrame or RigidBody).
%
% Input 1:  rotMatrix33 -- expression that resolves to a 3x3 rotation matrix.
%           posVector   -- expression that resolves to a vector. For example,
%                          if posVector is the 3 element matrix [x, y, z],
%                          posVector resolves to x*Ax> + y*Ay> + z*Az>.
%
% Input 2:  matrix34  -- 3x4 matrix that contains a 3x3 rotation matrix and a
%                        3x1 position vector matrix expressed in A, i.e.,
%                        [ A_B  |  p_Ao_Bo ]
%
% Input 3:  matrix44  -- 4x4 matrix that contains a 3x3 rotation matrix, a
%                        3x1 position vector matrix expressed in A, and
%                        a bottom row of 0, 0, 0, 1, i.e.,
%                        [   A_B    |  p_Ao_Bo ]
%                        [ 0, 0, 0  |    1     ]
%
%  Output:  Assigns a rotation matrix and position vector, e.g., as follows:
%           A_B = Transpose( rotMatrix33 )  % i.e., B_A = rotMatrix33
%           p_Ao_Bo> = posVector
%
%           Returns true if this method succeeds.
%
% Related:  SetRotationMatrix   SetPosition
%           SetRigidTransform   GetRigidTransform
%           SetVelocityAccelerationForGetGeometry  TranslateAcrossJoint

%GetRigidTransform
%GetRigidTransform34  or  GetRigidTransform44   (RESERVED SYNTAX)
%
% Purpose:  Gets a matrix that contains the rotation matrix and position vector
%           matrix associated with two rigid frames (or rigid bodies).
%
%Syntax 1:  GetRigidTransform34( A, B )
%Syntax 2:  GetRigidTransform44( A, B )
%
%   Input:  A, B -- names of reference frames (RigidFrame or RigidBody).
%
%Output 1:  Contains a 3x3 rotation matrix and 3x1 position vector matrix, with:
%           A_B = A.GetRotationMatrix( B )
%           p_Ao_Bo = Dot( p_Ao_Bo>, [Ax>; Ay>; Az>] )
%           Returns 3x4 matrix:  [   A_B    |  p_Ao_Bo ]
%
%Output 2:  Returns 4x4 matrix:  [   A_B    |  p_Ao_Bo ]
%                                [ 0, 0, 0  |    1     ]
%
% Related:  SetRotationMatrix   SetPosition
%           SetRigidTransform   GetRigidTransform
%           SetVelocityAccelerationForGetGeometry  TranslateAcrossJoint

%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, A -- name of a 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).
%
%  Always:  Sets and returns the rotation matrix B_A 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, Likins, Levinson: Spacecraft Dynamics, McGraw-Hill, Ch. 1, and
%           Mitiguy, Paul, "Advanced Dynamics & Motion Simulation".
%
% Related:  Rotate  RotateX  RotateY  RotateZ
%           RotateNegativeX  RotateNegativeY  RotateNegativeZ
%           SetRotationMatrixX  SetRotationMatrixY  SetRotationMatrixZ
%           SetRotationMatrixNegativeX  SetRotationMatrixNegativeY  ...
%           SetRotationMatrix  SetAngularVelocity  SetAngularAcceleration
%           GetRotationMatrix  GetAngularVelocity  GetAngularAcceleration
%           SetRotationMatrixODE  SetEulerParameterODE  SetRodriguesParameterODE
%           SetPoissonParameterODE

%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, A -- name of a 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, Likins, Levinson: Spacecraft Dynamics, McGraw-Hill, Ch. 1, and
%           Mitiguy, Paul, "Advanced Dynamics & Motion Simulation".
%
% Related:  Rotate  RotateX  RotateY  RotateZ
%           RotateNegativeX  RotateNegativeY  RotateNegativeZ
%           SetRotationMatrixX  SetRotationMatrixY  SetRotationMatrixZ
%           SetRotationMatrixNegativeX  SetRotationMatrixNegativeY  ...
%           SetRotationMatrix  SetAngularVelocity  SetAngularAcceleration
%           GetRotationMatrix  GetAngularVelocity  GetAngularAcceleration
%           SetRotationMatrixODE  SetEulerParameterODE  SetRodriguesParameterODE
%           SetPoissonParameterODE

%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, A -- name of a 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, Likins, Levinson: Spacecraft Dynamics, McGraw-Hill, Ch. 1, and
%           Mitiguy, Paul, "Advanced Dynamics & Motion Simulation".
%
% Related:  Rotate  RotateX  RotateY  RotateZ
%           RotateNegativeX  RotateNegativeY  RotateNegativeZ
%           SetRotationMatrixX  SetRotationMatrixY  SetRotationMatrixZ
%           SetRotationMatrixNegativeX  SetRotationMatrixNegativeY  ...
%           SetRotationMatrix  SetAngularVelocity  SetAngularAcceleration
%           GetRotationMatrix  GetAngularVelocity  GetAngularAcceleration
%           SetRotationMatrixODE  SetEulerParameterODE  SetRodriguesParameterODE
%           SetPoissonParameterODE

%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, A -- name of a 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, Likins, Levinson: Spacecraft Dynamics, McGraw-Hill, Ch. 1, and
%           Mitiguy, Paul, "Advanced Dynamics & Motion Simulation".
%
% Related:  Rotate  RotateX  RotateY  RotateZ
%           RotateNegativeX  RotateNegativeY  RotateNegativeZ
%           SetRotationMatrixX  SetRotationMatrixY  SetRotationMatrixZ
%           SetRotationMatrixNegativeX  SetRotationMatrixNegativeY  ...
%           SetRotationMatrix  SetAngularVelocity  SetAngularAcceleration
%           GetRotationMatrix  GetAngularVelocity  GetAngularAcceleration
%           SetRotationMatrixODE  SetEulerParameterODE  SetRodriguesParameterODE
%           SetPoissonParameterODE

%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, A -- name of a 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

%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, A -- name of a 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

%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, A -- name of a 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

%SetPosition
%SetPosition
%
% Purpose:  Sets a point's position from another point.
%
%  Syntax:  Q.SetPosition( fromPoint, positionVector )
%
%   Input:  Q, fromPoint -- names of points (e.g., Point or Particle).
%           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

%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, if Q does not move on B (but is not welded or a
%           physical point of B), use Q.SetVelocityAcceleration( B, 0> )
%
% Related:  Translate        SetPositionVelocity   SetVelocityAcceleration
%           SetPosition      GetPosition   GetDistance  GetDistanceSquared
%           SetVelocity      GetVelocity   GetSpeed     GetElongation
%           SetAcceleration  GetAcceleration

%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

%SetPlotInterface
%SetPlotInterface  (experimental command -- subject to change).
%
% Purpose:  Designates how plots are displayed.
%
%Syntax 1:  SetPlotInterface  OFF
%           No plots are displayed (plotting is disabled).
%
%Syntax 2:  SetPlotInterface  Gnuplot
%           Plots are displayed with Gnuplot only.
%           On MacOSX, requires XQuartz to be installed.
%
%Syntax 3:  SetPlotInterface  PlotGenesis
%           Plots are displayed with the easy-to-use PlotGenesis interface.
%           On MacOSX, requires XQuartz and Java JDK to be installed.
%
%Syntax 4:  SetPlotInterface  AUTO
%           If possible, plots are displayed with PlotGenesis.
%           Otherwise, attempts to use Gnuplot.
%           On MacOSX, requires XQuartz to be installed.
%
%  Remark:  SetPlotInterface can be set in the MGDefaultPreferences.txt file
%           that resides in the program's MGToolbox folder.
%
% Related:  GetDefaults  Plot  OutputPlot  SetPlotInterface

%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

%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, if Q does not move on B (but is not welded or a
%           physical point of B), use Q.SetVelocityAcceleration( B, 0> )
%
% Related:  Translate        SetPositionVelocity   SetVelocityAcceleration
%           SetPosition      GetPosition   GetDistance  GetDistanceSquared
%           SetVelocity      GetVelocity   GetSpeed     GetElongation
%           SetAcceleration  GetAcceleration

%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, if Q does not move on B (but is not welded or a
%           physical point of B), use Q.SetVelocityAcceleration( B, 0> )
%
% Related:  Translate        SetPositionVelocity   SetVelocityAcceleration
%           SetPosition      GetPosition   GetDistance  GetDistanceSquared
%           SetVelocity      GetVelocity   GetSpeed     GetElongation
%           SetAcceleration  GetAcceleration

%SetWorkODE
%SetWorkODE
%
% Purpose:  Forms an ODE (ordinary differential equation) that governs the work
%           of a force or torque (or set of forces and/or torques).
%
%Syntax 1:  SetWorkODE( workName, power )
%
%   Input:  workName -- scalar name which will be declared as a variable and
%                       whose first derivative will be declared as a variable.
%           power -- scalar expression with units of power that will be
%                    time-integrated to calculate workName.
%
%  Output:  Creates the ODE workName' = power, and sets the initial value of
%           workName to 0, (with units that depend on SetUnitSystem), e.g., as:
%
%           Variable  work' = power
%           Input  work = 0 Joules
%
% Related:  AddForce  AddForceDamper  AddForceElectrostatic  AddForceGravity
%           AddForceInverseSquare  AddForceLinearActuator  AddForceSpring
%           AddTorque  AddTorqueDamper
%           GetMomentOfForces  GetResultantForce  GetResultantTorque
%           GetForceGravityPotentialEnergy  GetForceSpringPotentialEnergy
%           GetStatics   GetStaticsKane   GetStaticsLagrange   GetPower
%           GetDynamics  GetDynamicsKane  GetDynamicsLagrange  GetKineticEnergy

%sign
%sign   sign0IsPositive1   sign0IsNegative1   signDerivative
%
% Purpose:  Returns the sign of a real scalar expression.
%
%Syntax 1:  sign( x )               % 1 if x > 0,   0 if x = 0,   -1 if x < 0.
%Syntax 2:  sign0IsPositive1( x )   % Returns  1  if x >= 0,  otherwise -1.
%Syntax 3:  sign0IsNegative1( x )   % Returns -1  if x <= 0,  otherwise  1.
%Syntax 4:  signDerivative( x )     % Undefined   if x =  0,  otherwise  0.
%
%   Input:  x -- a real scalar expression.
%
%  Remark:  The sign function can combine with ceil or floor for if statements:
%           isPositive      = ceil(  sign(t)/2 )              % Returns 0 or  1.
%           isPositiveOr0   = ceil(  sign(t)/2 + 0.1 )        % Returns 0 or  1.
%           isNegative      = floor( sign(t)/2 )              % Returns 0 or -1.
%           isTGreaterThan5 = ceil( sign(t-5) / 2 )           % Returns 0 or  1.
%           isTLessThan9    = ceil( sign(9-t) / 2 )           % Returns 0 or  1.
%           isTBetween5And9 = isTGreaterThan5 * isTLessThan9  % Returns 0 or  1.
%
% Related:  ceil  floor  int  max  min  round  sign  MathFunctions
%           IsNegative  IsNegativeOr0  IsPositiveOr0  IsPositive

%sin
%sin and csc
%
% Purpose:  Returns the sine or cosecant of a scalar expression.
%
%Syntax 1:  sin(x)  or  csc(x)
%Syntax 2:  sinDegrees( realNumberDeg )
%
%   Input:  x -- the radian measure of a real or complex scalar expression.
%           realNumberDeg -- expression that resolves to a real number.
%
%Output 1:  sin(x) returns the sine of x.
%           csc(x) returns the secant of x, which is 1/sin(x).
%Output 2:  Returns the sine of realNumberDeg.
%
% Related:  ConvertUnits  ImaginaryNumber  MathFunctions
%           cos  sin  tan  acos  asin  atan  atan2  cosDegrees  ...

%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 has various forms, whose examples include:
%           EqnsToSolve          2*x - 8*t
%           EqnsToSolve  = 0     2*x - 8*t  = 0
%           EqnsToSolve := 0     2*x - 8*t := 0  (overwrites x without query)
%           EqnsToSolve  = Rhs   2*x = 8*t
%           EqnsToSolve := Rhs   2*x = 8*t       (overwrites x without query)
%
%           x1, x2 -- the names of scalars or a matrix of scalar names.
%
%           METHOD -- Minors, MinorsImplicit, MinorsExplicit,
%                     Gauss,  GaussImplicit,  GaussExplicit,  Implicit, or
%                     relError = smallNumber (where smallNumber is e.g., 1E-7).
%           When METHOD is anything other than relError = smallNumber,
%           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 meter/second
%           (by default SetUnitSystem has units of radians, kg, meter, second).
%
% 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   =   :=   +=   *=   /=   ^=

%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, ...
%           EqnsToSolve has various forms, whose examples include:
%           EqnsToSolve          2*x - 8*t
%           EqnsToSolve  = 0     2*x - 8*t  = 0
%           EqnsToSolve := 0     2*x - 8*t := 0  (overwrites x without query)
%           EqnsToSolve  = Rhs   2*x = 8*t
%           EqnsToSolve := Rhs   2*x = 8*t       (overwrites x without query)
%
%           x1, x2 -- the names of scalars or a matrix of scalar names.
%
%           METHOD -- Minors, MinorsImplicit, MinorsExplicit,
%                     Gauss,  GaussImplicit,  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 exist).
%
%  Remark:  The command SolveDtSetDt() is similar to the command SolveDt() but
%           SolveDtSetDt() continues to assign derivatives when there is a mix
%           of x1, x2, ... that have derivatives and that do not have derivatives.
%
%  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   =   :=   +=   *=   /=   ^=

%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, ...
%           EqnsToSolve has various forms, whose examples include:
%           EqnsToSolve          2*x - 8*t
%           EqnsToSolve  = 0     2*x - 8*t  = 0
%           EqnsToSolve := 0     2*x - 8*t := 0  (overwrites x without query)
%           EqnsToSolve  = Rhs   2*x = 8*t
%           EqnsToSolve := Rhs   2*x = 8*t       (overwrites x without query)
%
%           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   =   :=   +=   *=   /=   ^=

%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, ...
%           EqnsToSolve has various forms, whose examples include:
%           EqnsToSolve          2*x - 8*t
%           EqnsToSolve  = 0     2*x - 8*t  = 0
%           EqnsToSolve := 0     2*x - 8*t := 0  (overwrites x without query)
%           EqnsToSolve  = Rhs   2*x = 8*t
%           EqnsToSolve := Rhs   2*x = 8*t       (overwrites x without query)
%
%           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   =   :=   +=   *=   /=   ^=

%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( expression = 0,  x )
%           SolveQuadraticNegativeRoot( expression = 0,  x )
%           SolveQuadraticPositiveRoot( M,  x )
%           SolveQuadraticNegativeRoot( M,  x )
%Syntax 2:  SolveQuadraticPositiveRootDt( expression = 0,  x )
%           SolveQuadraticNegativeRootDt( expression = 0,  x )
%           SolveQuadraticPositiveRootDt( M,  x )
%           SolveQuadraticNegativeRootDt( M,  x )
%
%   Input:  M -- row or column matrix with 3 elements.  For example,
%           M = [3, 5, 7]  may represent  3*x^2 + 5*x + 7.
%
%           x   -- scalar name (variable, constant, specified, ...)
%           expression -- scalar expression that is a function of x.
%           A 2nd-order polynomial of the form  a*x^2 + b*x + c  is created
%           from a Taylor series expansion of expression about x = 0.
%
%Output 1:  For quadratic formula:  a*x^2 + b*x + c = 0,
%           SolveQuadraticPositiveRoot sets  x = (-b + sqrt(b^2 - 4*a*c)) / 2*a
%           SolveQuadraticNegativeRoot sets  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 2 element matrix (without assigning the result to x).
%           Use  GetQuadraticPositiveRoot  to return the positive root without
%           assigning the result to x.  Similarly for GetQuadraticNegativeRoot.
%
% Related:  GetQuadraticPolynomial( expression, x )
%           returns a 3x1 column matrix whose elements are the coefficients of
%           the polynomial created from a Taylor series expansion about x = 0.
%
% Related:  GetPolynomialRoots  GetQuadraticRoots  GetQuadraticPositiveRoot  ...
%           SetDt  Solve  SolveDt  SolveSetInput  SolveSetInputDt  ...
%           SolveQuadraticPositiveRoot  SolveQuadraticPositiveRootDt  ...
%           FactorLinear  FactorQuadratic

%Specified
%Specified  or  SpecifiedEncode
%
% Purpose:  Declares the names of specified quantities.
%           Creates an array of all names declared as Specified.
%
%Syntax 1:  Specified        a,  b,  x+,  y-,  ...
%Syntax 2:  Specified        u',  q'',  ...
%Syntax 3:  SpecifiedEncode  u',  q'',  ...
%Syntax 4:  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.
%
%Output 4:  Creates an array of all names declared as Specified.
%
%  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

%Spline
%Spline
%
% Purpose:  Fits a curve through two points with various functions: transition,
%           step, pulse, bell, and polynomial.  The examples below use a
%           function y(t) that connects points (t0,y0) and (tF,yF).
%
%Syntax 1:  Spline( TRANSITION, t, t0, tF, y0, yF )
%Syntax 2:  Spline( STEP,       t, t0, tF, y0, yF )
%Syntax 3:  Spline( PULSE,      t, t0, tF, y0, yExtremum )
%Syntax 4:  Spline( BELL,       t, t0, tF, y0, yExtremum )
%Syntax 5:  Spline( LINE,       t, t0, tF, y0, yF )
%           Spline( 1,          t, t0, tF, y0, yF )
%Syntax 6:  Spline( CUBIC,      t, t0, tF, y0, yF, dy/dt(t0), dy/dt(tF) )
%           Spline( 3,          t, t0, tF, y0, yF, dy/dt(t0), dy/dt(tF) )
%Syntax 7:  Spline( n,          t, t0, tF, y0, yF,
%                               d1_y0, d1_yF, d2_y0, d2_yF, ... )
%
%   Input:  t -- name of the function's independent variable
%
%           t0 -- value of t at one   endpoint of the function
%           tF -- value of t at other endpoint of the function
%
%           y0 -- value of the function at t = t0
%           yF -- value of the function at t = tF
%
%           yExtremum -- yMax or yMin (function's maximum or minimum value)
%
%           n -- 1,  3,  5,  7,  9
%
%           di_y0 --  the function's ith derivative with respect to t,
%                     evaluated at t = t0.
%
%           di_yF --  the function's ith derivative with respect to t,
%                     evaluated at t = tF
%
%Output 1:  Spline(  TRANSITION,  t, t0, tF, y0, yF )
%           y0 + (yF-y0)*(t-t0)/(tF-t0) - (yF-y0)/(2*pi)*sin[2*pi*(t-t0)/(tF-t0)]
%       or  y0 + (yF-y0)*dT - (yF-y0)/(2*pi) * sin(2*pi*dT)  dT = (t-t0)/(tF-t0)
%
%           The function attains its minimum and maximum values at end-points.
%           The function's 1st and 2nd (but not 3rd) derivatives with respect
%           to t are zero at both the initial and terminal point of the curve.
%             y(t=t0) = y0      y(t=tF) = yF
%            y'(t=t0) = 0      y'(t=tF) = 0
%           y''(t=t0) = 0     y''(t=tF) = 0
%
%Output 2:  Spline(  STEP,  t, t0, tF, y0, yF )
%           0.5*y0 + 0.5*yF - (1/pi)*(y0-yF)*atan(31.821*(t0+tF-2*t)/(t0-tF))
%
%           The function approaches y0 as t approaches negative infinity.
%           The function approaches yF as t approaches positive infinity.
%           At t = t0, the function is y0 + 0.01*(yF - y0).
%           At t = tF, the function is y0 + 0.99*(yF - y0).
%
%Output 3:  Spline(  PULSE,  t, t0, tF, y0, yMax )
%           y0 + (yMax-y0)/(1-5*pi/16)*( pi*(-dT + 2*dT^3 - dT^4) + sin(pi*dT) )
%           where dT = (t-t0)/(tF-t0)
%
%           The function's end-points have the same value.
%           The function has its maximum (or minimum) value midway
%           between its end points, e.g., at t = (t0 + tF)/2
%           The function's 1st and 2nd derivatives with respect to t are both
%           zero at both the initial and terminal point of the curve.
%             y(t=t0) =   y(y=tF) = y0        y(t=tF/2) = yMax
%            y'(t=t0) =  y'(y=tF) = 0        y'(t=tF/2) = 0
%           y''(t=t0) = y''(y=tF) = 0
%
%Output 4:  Spline(  BELL,  t, t0, tF, y0, yMax )
%           y0 - (y0-yMax)*exp( -2 * log(10) * (t0+tF-2*t)^2/(t0-tF)^2 )
%
%           The function approaches y0 as t approaches +- infinity.
%           The function has its maximum (or minimum) value midway
%           between its end points, e.g., at t = (t0 + tF)/2
%           At t = t0 and t = tF, the function is  y0 + 0.01*(yF - y0).
%
%Output 5:  Spline(  LINE,  t, t0, tF, y0, yF )
%           y0 + (yF-y0) * dT    where dT = (t-t0)/(tF-t0)
%
%           This function is linear in t (polynomial of degree 1 in t).
%           At t = t0, the function is equal to y0.
%           At t = tF, the function is equal to yF.
%           The function has a constant slope.
%             y(t=t0) = y0    y(y=tF) = yF    y'(t) = (yF-y0) / (tF-t0)
%
%Output 6:  Spline(  CUBIC,  t, t0, tF, y0, yF, slope0, slopeF )
%
%           This function is cubic in t (polynomial of degree 3 in t).
%           At t = t0, the function is equal to y0 and its slope is slope0.
%           At t = tF, the function is equal to yF and its slope is slopeF.
%             y(t=t0) = y0           y(y=tF) = yF
%            y'(t=t0) = slope0      y'(t=tF) = slopeF
%
%Output 7:  Polynomial of degree n in t   (n = 1, 3, 5, 7, or 9).
%           For n = 1, no derivatives are needed.
%           For n = 3, d1_y0, d1_yF are needed.
%           For n = 5, d1_y0, d1_yF, d2_y0, d2_yF are needed.
%           For n = 7, d1_y0, d1_yF, d2_y0, d2_yF, d3_y0, d3_yF are needed.
%           For n = 9, d1_y0, d1_yF, d2_y0, d2_yF, d3_y0, d3_yF, d4_y0, d4_yF.

%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

%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

%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).GetTranslationalMomentum()
%
%   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 translational (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
%           GetAngularMomentum  GetTranslationalMomentum  GetGeneralizedMomentum
%           GetResultantForce   GetResultantMoment        GetResultantTorque
%           GetKineticEnergy    GetPower                  GetEnergyCheckKane
%           GetStatics          GetDynamics
%           GetStaticsKane      GetDynamicsKane
%
% Related:  NewtonianFrame  Particle  Point  RigidBody  RigidFrame  System

%
%RigidSystem  (RESERVED KEYWORDS & SYNTAXES. IN-DEVELOPMENT)
%RigidSystem
%
% Purpose:  Declares a system of rigidly-connected objects.
%
%Syntax 1:  RigidSystem  A( B, C, D, ... )
%Syntax 2:  RigidSystem           (displays all names declared as RigidSystem)
%
%   Input:  A -- name that starts with a letter, followed by a reasonable
%                number of alphanumeric characters.
%
%Output 1:  Creates a RigidSystem A consisting of objects B, C, D, etc.,
%           which are Point, Particle, RigidFrame, or RigidBody.
%
% Related:  NewtonianFrame  Particle  Point  RigidBody  RigidFrame  System

%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_#>      torque of external couples on RigidFrame or RigidBody #.
%                For example, Torque_B> is the torque on B.
%
% Torque_#_$>    torque of couples applied to # from $, where each of # and $
%                have been declared as a RigidFrame or RigidBody.
%                For example, Torque_B_A> is the torque on B from A.
%
% Force_#>       external contact and distance forces on Point or Particle #.
%                For example, Force_Q> is the force on Q.
%
% Force_#_$>     action/reaction force applied to # from $, where each of
%                # and $ were declared as a Point or Particle.
%                For example, 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 old CONSTRAIN command.
% DEPENDENT[j]   jth constraint function used by the old 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
% pi             3.1415926...
% imaginary      default name for the square root of -1
% t              time
% tInitial       Initial value for independent variable t (for ODE command).
% tFinal         Final   value for independent variable t (for ODE command).
% tStep          Numerical integration step for t         (for ODE command).
% absError       Numerical integration absolute error tolerance (for numerics).

%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  Variable  t  tInitial  tFinal  tStep  absError

%tan
%tan and cot
%
% Purpose:  Returns the tangent or cotangent of a scalar expression.
%
%Syntax 1:  tan(x)  or  cot(x)
%Syntax 2:  tanDegrees( realNumberDeg )
%
%   Input:  x -- the radian measure of a real or complex scalar expression.
%           realNumberDeg -- expression that resolves to a real number.
%
%Output 1:  tan(x) returns the   tangent of x.
%           cot(x) returns the cotangent of x, which is 1/tan(x).
%Output 2:  Returns the tangent of realNumberDeg.
%
% Related:  ConvertUnits  ImaginaryNumber  MathFunctions
%           cos  sin  tan  acos  asin  atan  atan2  cosDegrees  ...

%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, if Q does not move on B (but is not welded or a
%           physical point of B), use Q.SetVelocityAcceleration( B, 0> )
%
% Related:  Translate        SetPositionVelocity   SetVelocityAcceleration
%           SetPosition      GetPosition   GetDistance  GetDistanceSquared
%           SetVelocity      GetVelocity   GetSpeed     GetElongation
%           SetAcceleration  GetAcceleration

%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
%           SetRigidTransform TranslateAcrossJoint
%           SetVelocityAccelerationForGetGeometry

%TrueFalse
%true  false
%
% Purpose:  Special names that are helpful for true/false logic.
%
% Syntax 1: true        % true  simplifies to 1 in math expressions.
% Syntax 2: false       % false simplifies to 0 in math expressions.
%
%  Remark:  The multiplication operator * can mimic a logical AND whereas
%           the IsPositive command can be used to mimic a logical OR.
%
% Related:  IsSimplifyEqual  IsSimplifyZero  IsSimplifyTrue
%           IsNegative  IsNegativeOr0  IsPositiveOr0  IsPositive
%
% Builtin:  pi   imaginary   true false   0>   0>>   1>>
%           t  tInitial  tFinal  tStep  absError

%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:  SetRigidTransform   TranslateAcrossJoint
%           SetVelocityAccelerationForGetGeometry

%Units
%Units      ConvertUnits,  Input,  Output,  Constant,  SetMass,  SetInertia
%           GetUnitSystem, SetUnitSystem
%           GetMassUnit,  GetLengthUnit, GetTimeUnit, GetAngleUnit

%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)
%Syntax 4:  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.
%
%Output 4:  Creates an array of all names declared as Variable.
%
%  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

%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  Express  Vector  Dyadic  Matrix >  >>  >>>  0> 0>> 1>>
%           GetAngleBetweenVectors  GetAngleBetweenUnitVectors
%           GetDistance  GetMagnitude  GetMagnitudeSquared    GetUnitVector

%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

%__Superseded__
% The remaining functions below are or will be superseded by other methods.
%----------------------------------------------------------------------------

%Algebraic
%Algebraic  (Also see Solve)
%
% Purpose:  Writes a MATLAB, C, or Fortran program to solve for Output
%           and perhaps to solve coupled LINEAR algebraic equations.
%
%Syntax 1:  Algebraic()                             Filename.Ext
%Syntax 2:  Algebraic( EqnsToSolve, x1, x2, ... )   Filename.Ext
%Syntax 3:  Algebraic()                             Filename.Ext( Tx, Ty, Tz )
%Syntax 4:  Algebraic() [A = Astart, Astop, Astep]  Filename.Ext
%Note:      The various options in Syntax 1-4 can be used together.
%
%   Input:  Filename -- a valid file name (letters, numbers, or underscores)
%           Ext -- .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, ...
%
%           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:  Filename.m( Tx N*m,  Ty N*cm,  Tz lbf*ft )
%
%           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 performs all calculations necessary to
%           determine values of quantities named in OUTPUT statements.
%
%Output 2:  Same as Output 1.  Also solves EqnsToSolve for x1, x2, ...
%
%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 ALGEBRAIC command.  It does not affect calculation accuracy.
%
%  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  Algebraic  Solve  Input  Output  OutputPlot  Plot  Animate
%           ConvertUnits  GetUnitSystem  SetUnitSystem  SetDigits  SetLineWidth
%           Solve  SolveDt  SolveSetInput  SolveSetInputDt  ...

%Angvel
%Angvel  and  AngvelAccel
%
% Purpose:  Calculates and sets angular velocity in terms of orientation angles,
%           Euler parameters, Rodrigues parameters, or elements of rotation
%           matrices (direction cosines) and their time-derivatives.
%
%Syntax 1:  Angvel(      A, B, TYPE,  q1, q2, q3 )
%           AngvelAccel( A, B, TYPE,  q1, q2, q3 )
%Syntax 2:  Angvel(      A, B, Euler, e1, e2, e3, e4 )
%           AngvelAccel( A, B, Euler, e1, e2, e3, e4 )
%Syntax 3:  Angvel(      A, B, Rodrigues, rho1, rho2, rho3 )
%           AngvelAccel( A, B, Rodrigues, rho1, rho2, rho3 )
%Syntax 4:  Angvel(      A, B )
%           AngvelAccel( A, B )
%
%   Input:  A, B -- names of reference frames (RigidFrame or RigidBody).
%
%           TYPE -- BODYx  or  SPACEx, where x is one of 123, 132,
%           231, 213, 312, 321, 121, 131, 232, 212, 313, 323
%
%           q1, q2, q3 -- orientation angles characterizing
%           the relative orientation of frames A and B.
%
%           e1, e2, e3, e4 -- Euler parameters characterizing
%           the relative orientation of frames A and B.
%
%           rho1, rho2, rho3 -- Rodrigues parameters characterizing
%           the relative orientation of frames A and B.
%
%Output 1:  Sets frame B's angular velocity in frame A, expressed in terms of
%           q1, q2, q3, q1', q2', q3', and unit vectors fixed in B.
%           AngvelAccel also sets B's angular acceleration in A.
%
%Output 2:  Sets frame B's angular velocity in frame A, expressed in terms of
%           e1 ... e4,  e1' ... e4', and unit vectors fixed in B.
%           AngvelAccel also sets B's angular acceleration in A.
%
%Output 3:  Sets frame B's angular velocity in frame A, expressed in terms of
%           rho1 ... rho3,  rho1' ... rho3', and unit vectors fixed in B.
%           AngvelAccel also sets B's angular acceleration in A.
%
%Output 4:  Frame B's angular velocity in A, expressed in terms of direction
%           cosines, their time-derivatives, and unit vectors fixed in B.
%           AngvelAccel also sets B's angular acceleration in A.
%
%  Remark:  Definitions of orientation angles, Euler parameters,
%           Rodrigues parameters, and direction cosines are in
%           Kane, Likins, Levinson: Spacecraft Dynamics, McGraw-Hill, Ch. 1, and
%           Mitiguy, Paul, "Advanced Dynamics & Motion Simulation".
%
% Related:  Rotate  RotateX  RotateY  RotateZ
%           RotateNegativeX  RotateNegativeY  RotateNegativeZ
%           SetRotationMatrixX  SetRotationMatrixY  SetRotationMatrixZ
%           SetRotationMatrixNegativeX  SetRotationMatrixNegativeY  ...
%           SetRotationMatrix  SetAngularVelocity  SetAngularAcceleration
%           GetRotationMatrix  GetAngularVelocity  GetAngularAcceleration
%           SetRotationMatrixODE  SetEulerParameterODE  SetRodriguesParameterODE
%           ANGVEL  KINDIFFS  SetDefaults( AUTOLEV )

%Code
%CODE       (Mostly superseded by ODE and Solve)
%
% Purpose:  Writes a Fortran, C, or MATLAB program or immediately
%           executes a program for a variety of purposes.
%
%Syntax 1:  Code ODE()                               Filename.Ext
%           Code ODE( MatrixOfEqns, UNKNOWNS )       Filename.Ext
%
%Syntax 2:  Code Algebraic()                         Filename.Ext
%           Code Algebraic( MatrixOfEqns, UNKNOWNS ) Filename.Ext
%
%Syntax 3:  Code Nonlinear( MatrixOfEqns, UNKNOWNS ) Filename.Ext
%
%   Input:  Filename -- a valid file name, e.g., one that starts with a
%           letter and is followed by letters, numbers, or underscores.
%
%           Ext -- nothing (produces immediate solution)
%               -- .c    (produces C code)
%               -- .f    (produces FORTRAN code)
%               -- .for  (produces FORTRAN code with 72 character line length)
%               -- .m    (produces MATLAB code)
%
%           MatrixOfEqns -- a matrix of scalar expressions (e.g., f1, ..., fn)
%           that are functions of the UNKNOWNS and which are regarded to be
%           equal to zero, i.e., fi = 0  (i = 1, ..., n).
%
%           UNKNOWNS -- the names of scalars separated by commas or a
%           matrix of names of scalars.
%
%Output 1:  Solves or creates code to solve a set of simultaneous ordinary
%           differential equations or coupled differential/algebraic equations
%               *** Type HELP ODE for details. ***
%
%Output 2:  Creates code to solve a set of coupled or uncoupled
%           nonlinear, algebraic (nondifferential) equations
%               *** Type HELP NONLINEAR for details. ***
%
%Output 3:  Creates code to carry out successive substitutions or to
%           solve a set of simultaneous, linear equations
%               *** Type HELP ALGEBRAIC for details. ***
%
%  Remark:  The program's license may limit the type of CODE
%           that can be generated (e.g., to a specific Ext).
%
%  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:  CODE  ALGEBRAIC  NONLINEAR  ODE  Input  Output  Animate
%           ConvertUnits  GetUnitSystem  SetUnitSystem  SetDigits  SetLineWidth
%           absError  relError  tInitial  tFinal  tStep  printInt
%           Solve  SolveDt  SolveSetInput  SolveSetInputDt  ...

%Nonlinear
%Nonlinear  (Also see Solve)
%
% Purpose:  Writes a MATLAB, C, or Fortran program to solve coupled nonlinear
%           algebraic equations and calculate Output.
%
%Syntax 1:  Nonlinear( EqnsToSolve, x1, x2, ... )  Filename.Ext
%Syntax 2:  Nonlinear( EqnsToSolve, x1, x2, ... )  Filename.Ext( Tx, Ty, Tz )
%Syntax 3:  Nonlinear( EqnsToSolve, x1, x2, ... )  [A = Astart, Astop, Astep]
%
%   Input:  Filename -- a valid file name (letters, numbers, or underscores)
%           Ext -- .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 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.
%
%           Tx, Ty, Tz -- scalar names (maybe with units) that allow for
%           passing command-line arguments to MATLAB or C programs.
%           Example:  Filename.m( Tx N*m,  Ty N*cm,  Tz lbf*ft )
%
%           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:  Produces a program that solves the nonlinear algebraic equations,
%           outputs numerical results for x1, x2, ..., and outputs numerical
%           values of quantities named in OUTPUT statements.
%
%Output 2:  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 3:  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 a solution may be reported even
%           though one does not exists.  The accuracy of the solution 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-7 cm
%
%  Remark:  Nonlinear algebraic equations may have 0, 1, 2, 3, ..., solutions.
%
% Related:  CODE  ALGEBRAIC  NONLINEAR  ODE  Input  Output  Animate
%           ConvertUnits  GetUnitSystem  SetUnitSystem  SetDigits  SetLineWidth
%           Solve  SolveDt  SolveSetInput  SolveSetInputDt  ...

%Dircos
%Dircos     (Superseded by SetRotationMatrix)
%
% Purpose:  Calculates and sets the direction cosine matrix (rotation matrix)
%           relating two sets of dextral, orthogonal unit vectors in terms of
%           orientation angles, Euler parameters, or Rodrigues parameters.
%
%Syntax 1:  Dircos( A, B, TYPE,  q1, q2, q3 )
%Syntax 2:  Dircos( A, B, EULER, e1, e2, e3, e4)
%Syntax 3:  Dircos( A, B, RODRIGUES, rho1, rho2, rho3 )
%
%   Input:  A, B -- names of reference frames (RigidFrame or RigidBody).
%
%           TYPE -- BODYx  or  SPACEx, where x is one of 123, 132,
%           231, 213, 312, 321, 121, 131, 232, 212, 313, 323
%
%           q1, q2, q3 -- orientation angles characterizing
%           the relative orientation of frames A and B.
%
%           e1, e2, e3, e4 -- Euler parameters characterizing
%           the relative orientation of frames A and B.
%
%           rho1, rho2, rho3 -- Rodrigues parameters characterizing
%           the relative orientation of frames A and B.
%
%Output 1:  Calculates and sets the direction cosine matrix A_B,
%           expressed in terms of q1, q2, q3
%
%Output 2:  Calculates and sets the direction cosine matrix A_B,
%           expressed in terms of e1, e2, e3, e4
%
%Output 3:  Calculates and sets the direction cosine matrix A_B,
%           expressed in terms of rho1, rho2, rho3
%
%  Remark:  Definitions of orientation angles, Euler parameters,
%           Rodrigues parameters, and direction cosines are in
%           Kane, Likins, Levinson: Spacecraft Dynamics, McGraw-Hill, Ch. 1, and
%           Mitiguy, Paul, "Advanced Dynamics & Motion Simulation".
%
% Related:  Rotate   RotateX   RotateY   RotateZ
%           RotateNegativeX  RotateNegativeY  RotateNegativeZ
%           SetRotationMatrixX  SetRotationMatrixY  SetRotationMatrixZ
%           SetRotationMatrixNegativeX  SetRotationMatrixNegativeY  ...
%           SetRotationMatrix  SetAngularVelocity  SetAngularAcceleration
%           GetRotationMatrix  GetAngularVelocity  GetAngularAcceleration
%           SetRotationMatrixODE  SetEulerParameterODE  SetRodriguesParameterODE
%           ANGVEL  DIRCOS  KINDIFFS  SIMPROT  SetDefaults( AUTOLEV )

%FrStar
%FrStar     (superseded by the negative of GetGeneralizedEffectiveForce)
%
% Purpose:  Forms  expressions  for  generalized inertia forces or
%           contributions to generalized inertia forces.
%
%Syntax 1:  FrStar()
%Syntax 2:  FrStar( A1, A2, ... )
%
%   Input:  A1, A2, ... -- a massive object, e.g., a Particle or RigidBody.
%
%Output 1:  a column matrix, each element of which is the sum of the contri-
%           butions of all massive objects to one generalized inertia force.
%
%Output 2:  a column matrix, each element of which is the sum of the contri-
%           butions of A1, A2, ... to one generalized inertia force.
%
%  Remark:  If using the old/deprecated command  SetDefaults( AUTOLEV ),
%           the results produced by this command depend on whether
%           the command precedes or follows a CONSTRAIN command.
%
% Related:  GetGeneralizedEffectiveForce  GetGeneralizedForce
%           GetGeneralizedMomentum  GetTranslationalMomentum  GetAngularMomentum
%           Constrain  MotionVariable  MotionVariable'  SetGeneralizedSpeed
%           Gyrostat  SetMass  SetInertia  Rotate  Translate
%           GetDynamics  GetDynamicsKane  GetStatics  GetStaticsKane
%           FR  FRSTAR  SetDefaults( AUTOLEV )

%Gyrostat
%Gyrostat   (may be superseded in future versions)
%
% Purpose:  Calculates expressions related to angular momentum, kinetic energy,
%           and generalized inertia forces for systems containing gyrostats.
%
%Syntax 1:  Gyrostat( Quantity, CYLINDER, Carrier, Rotor, J )
%Syntax 2:  Gyrostat( Quantity, SPHERE,   Carrier, Rotor, K )
%
%   Input:  Quantity -- FrStar, KE, or ANGMOM
%
%           Carrier -- the  name of the carrier portion of a gyro-
%           stat, named in a RigidBody declaration
%
%           Rotor -- the  name of a rotor portion of the gyrostat,
%           named in a RigidFrame declaration
%
%           J -- the cylindrical Rotor's axial moment of inertia.
%
%           K -- the spherical Rotor's diametral moment of inertia.
%
%  Output:  The Quantity associated with Rotor's motion in Carrier, e.g.,
%           when Quantity is KE, the portion of the gyrostat's kinetic energy
%           (in NewtonianFrame) attributable to the Rotor's motion in Carrier.
%
%  Remark:  The mass, center of mass, and inertia properties attributed
%           to Carrier must be those of the gyrostat.
%           The Rotor's angular in Carrier is used by the Gyrostat command.
%
% Related:  GetAngularMomentum  GetDynamics  GetDynamicsKane  GetKineticEnergy
%           GetTranslationalMomentum  GetGeneralizedMomentum
%           GetGeneralizedEffectiveForce  SetGeneralizedSpeed
%           FRSTAR  MotionVariable  MotionVariable'  SetDefaults( AUTOLEV )

%KinDiffs
%KinDiffs  (superseded by  SetRotationMatrixODE,  SetEulerParameterODE,
%           SetRodriguesParameterODE  SetPoissonParameterODE)
%
% Purpose:  Sets the first time-derivatives of orientation angles,
%           Euler parameters, Rodrigues parameters, or direction
%           cosines in terms of angular velocity measure numbers.
%
%Syntax 1:  KinDiffs( A, B, SequenceIJK,  q1, q2, q3 )
%Syntax 2:  KinDiffs( A, B, Euler, e1, e2, e3, e4 )
%Syntax 3:  KinDiffs( A, B, Rodrigues, rho1, rho2, rho3 )
%Syntax 4:  KinDiffs( A, B  Poisson, C11,C12,C13,
%                           C21,C22,C23, C31,C32,C33 )
%
%   Input:  A, B -- names of reference frames (RigidFrame or RigidBody).
%
%           SequenceIJK -- BodyIJK or SpaceIJK, where IJK is one of:
%           123, 132, 231, 213, 312, 321, 121, 131, 232, 212, 313, 323
%
%           q1, q2, q3 -- names of radian measures of orientation angles
%           characterizing the relative orientation of frames A and B.
%
%           e1, e2, e3, e4 -- names of Euler parameters
%           characterizing the relative orientation of frames A and B.
%
%           rho1, rho2, rho3 -- names of Rodrigues parameters
%           characterizing the relative orientation of frames A and B.
%
%           C11, C12, ..., C33 -- names of direction cosines
%           characterizing the relative orientation of frames A and B.
%
%Output 1:  Expresses q1', q2', and q3' in terms of q1, q2, q3,
%           and frame B's angular velocity in frame A.
%
%Output 2:  Expresses e1', e2', e3', and e4' in terms of e1, e2, e3, e4,
%           and frame B's angular velocity in frame A.
%
%Output 3:  Expresses rho1', rho2', and rho3' in terms of rho1, rho2, rho3,
%           and frame B's angular velocity in frame A.
%
%Output 4:  Expresses C11', ... C33' in terms of C11, ... C33,
%           and frame B's angular velocity in frame A.
%
%  Remark:  Frame B's angular velocity in frame A or its equivalent must be
%           in the workspace before the KinDiffs command is issued.
%
%  Remark:  Definitions of orientation angles, Euler parameters,
%           Rodrigues parameters, and direction cosines are in
%           Kane, Likins, Levinson: Spacecraft Dynamics, McGraw-Hill, Ch. 1, and
%           Mitiguy, Paul, "Advanced Dynamics & Motion Simulation".
%
% Related:  Rotate  RotateX  RotateY  RotateZ
%           RotateNegativeX  RotateNegativeY  RotateNegativeZ
%           SetRotationMatrixX  SetRotationMatrixY  SetRotationMatrixZ
%           SetRotationMatrixNegativeX  SetRotationMatrixNegativeY  ...
%           SetRotationMatrix  SetAngularVelocity  SetAngularAcceleration
%           GetRotationMatrix  GetAngularVelocity  GetAngularAcceleration
%           SetRotationMatrixODE  SetEulerParameterODE  SetRodriguesParameterODE
%           ANGVEL  KINDIFFS  SetDefaults( AUTOLEV )

%Simprot
%Simprot    (superseded by SetRotationMatrixX, RotateX, etc)
%
% Purpose:  Forms rotation matrices associated with a simple rotation
%           of one reference frame in another reference frame.
%
%Syntax 1:  Simprot( A, B, Integer, Angle )
%Syntax 2:  Simprot( A, B, Vec,     Angle )
%
%   Input:  A, B -- names of reference frames (RigidFrame or RigidBody).
%
%           Integer -- 1, 2, 3, -1, -2, or -3.
%
%           Angle -- scalar expression.
%
%           Vec -- vector whose orientation in A and B remains unaltered
%           during the simple rotation of B in A.
%
%  Output:  Sets the rotation matrix (direction cosine matrix)
%           A_B expressed in terms of sines and cosines of Angle.
%
%  Remark:  Simprot is superseded by SetRotationMatrixX, RotateX, etc.
%
% Related:  Rotate  RotateX  RotateY  RotateZ
%           RotateNegativeX  RotateNegativeY  RotateNegativeZ
%           SetRotationMatrixX  SetRotationMatrixY  SetRotationMatrixZ
%           SetRotationMatrixNegativeX  SetRotationMatrixNegativeY  ...
%           SetRotationMatrix  SetAngularVelocity  SetAngularAcceleration
%           GetRotationMatrix  GetAngularVelocity  GetAngularAcceleration
%           SetRotationMatrixODE  SetEulerParameterODE  SetRodriguesParameterODE
%           ANGVEL  DIRCOS  KINDIFFS  SIMPROT  SetDefaults( AUTOLEV )

%V1PT
%V1PT       (Superseded by SetVelocity)
%A1PT       (Superseded by SetAcceleration)
%
% Purpose:  Calculates and sets the velocity (or acceleration) of a point
%           moving on a reference frame.
%
%Syntax 1:  V1PT( N, B, BQ, Q )
%Syntax 2:  A1PT( N, B, BQ, Q )
%
%   Input:  N -- a reference frame (e.g., a RigidFrame or RigidBody).
%           B -- a reference frame (e.g., a RigidFrame or RigidBody).
%           BQ -- the point fixed on B that is coincident with Q.
%           Q -- a point moving on B that is coincident with BQ.
%
%Output 1:  Calculate and sets V_Q_N>, Q's velocity in N.
%Output 2:  Calculate and sets A_Q_N>, Q's acceleration in N.
%
%  Remark:  The V1PT calculation uses the following quantities:
%           --  B's  angular velocity in N
%           --  BQ's velocity in N
%           --  Q's  velocity in B
%  Remark:  The A1PT calculation uses the following quantities:
%           --  B's  angular velocity and angular acceleration in N
%           --  BQ's acceleration in N
%           --  Q's  velocity and acceleration in B
%
%  Remark:  V1PT(N, B, BQ, Q) is superseded by Q.SetVelocity(N, fromPoint, B, BQ)
%           A1PT(N, B, BQ, Q) is now Q.SetAcceleration(N, fromPoint, B, BQ)
%           where fromPoint is a point fixed on BFrame.
%
% Related:  Translate        SetPositionVelocity   SetVelocityAcceleration
%           SetPosition      GetPosition   GetDistance
%           SetVelocity      GetVelocity   GetSpeed   GetElongation
%           SetAcceleration  GetAcceleration
%           A1PT  A2PTS  V1PT  V2PTS  SetDefaults( AUTOLEV )

%V2PTS
%V2PTS      (Superseded by SetVelocity)
%A2PTS      (Superseded by SetAcceleration)
%VA2PTS     (Superseded by SetVelocityAcceleration)
%
% Purpose:  For two points fixed on a reference frame (RigidBody or RigidFrame)
%           calculates and sets the velocity (or acceleration) of one point
%           from the velocity (or acceleration) of the other.
%
%Syntax 1:  V2PTS(  N, B, P, Q )
%Syntax 2:  A2PTS(  N, B, P, Q )
%Syntax 3:  VA2PTS( N, B, P, Q )
%
%   Input:  N -- a reference frame (e.g., a RigidFrame or RigidBody).
%           B -- a reference frame (e.g., a RigidFrame or RigidBody).
%           P -- a point fixed on B, whose velocity (or acceleration)
%               in N is known.
%           Q -- a point fixed on B, whose velocity (or acceleration)
%               in N is to be determined.
%
%Output 1:  Calculate and sets v_Q_N>, Q's velocity in N.
%Output 2:  Calculate and sets a_Q_N>, Q's acceleration in N.
%Output 3:  Calculate and sets v_Q_N> and a_Q_N>.
%
%  Remark:  The V2PTS and VA2PTS calculation uses the following quantities:
%           --  B's angular velocity in N
%           --  P's velocity in N
%           --  Q's position vector from P
%           The A2PTS and VA2PTS calculation uses the following quantities:
%           --  B's angular velocity and angular acceleration in N
%           --  P's acceleration in N
%           --  Q's position vector from P
%
%  Remark:  V2PTS( N, B, P, Q ) is superseded by Q.SetVelocity( N, P, B )
%           A2PTS( N, B, P, Q ) is superseded by Q.SetAcceleration( N, P, B )
%           VA2PTS(N, B, P, Q ) is now Q.SetVelocityAcceleration( N, P, B )
%
% Related:  Translate        SetPositionVelocity   SetVelocityAcceleration
%           SetPosition      GetPosition   GetDistance
%           SetVelocity      GetVelocity   GetSpeed   GetElongation
%           SetAcceleration  GetAcceleration
%           A1PT  A2PTS  V1PT  V2PTS  SetDefaults( AUTOLEV )

