Numeric and Symbolic Constants

Expressions and equations usually include a mix of numbers and variables.  By definition, variables are symbols used to represent unknown or changeable quantities.  Sometimes however, once a variable's value has been found, we need it to retain that value forever, or until explicitly changed.

During normal usage, variables' values can change automatically to maintain consistency.  To prevent these kinds of automatic changes, variables can be turned into constants (and sometimes back again).  There are two methods for turning variables into constants:

  1. Numeric constants
  2. Symbolic constants

Numeric Constants

To turn a variable into a numeric constant, tap the "Constant" button and follow the prompts, or use the "constant" command.  The "constant" command is used to remove a variable (or variables) from the entire set of equations by replacing all occurrences of the variable with its current numeric value.  Once turned into a numeric constant, the variable no longer appears in any equation, and the variable definition is automatically "clear"ed (unless the variable is "lock"ed).

e.g.    f=mg Enter a basic equation from physics.
g=9.8  Define "g", the acceleration of gravity.
constant g   Make "g" a constant, leaving "f=9.8m"

If the need for a constant is not permanent, consider using the "lock" command to create a symbolic constant instead.

Variable Elimination with Constants

The simplest method of eliminating a variable is to turn it into a numeric constant.  The "constant" command is used to remove a variable (or variables) from the entire set of equations by replacing all occurrences of the variable with its current numeric value.  Once turned into a numeric constant, the variable no longer appears in any equation.

Here is a simple example from physics:

> f=ma

This states that force "f" is mass "m" times acceleration "a".  Since there are three variables, any two variables must be defined to find the third:

> f=10

               f = 10

       f = 10

> a=9.8

               a = 9.8

       a = 9.8 (or 49 / 5, or 9 & 4 / 5)

   Solving for m:

               f = a m

             a m = f

             m a = f

                   f
               m = -
                   a

       m = 1.02040816326531 (or 50 / 49, or 1 & 1 / 49)

> list variables

       f = 10
      a = 9.8 (or 49 / 5, or 9 & 4 / 5)
       m = 1.02040816326531 (or 50 / 49, or 1 & 1 / 49)

However, redefining just one of the variables "clear"s the other two dependent variables to avoid any inconsistency:

> f=30

               f = 30

       f = 30

 Undefining 'a' ...

 Undefining 'm' ...

> list variables

       f = 30

Turning a variable into a numeric constant reduces (by one) the number of variables in all the equations in which the variable appears.  In this example, to assume that acceleration "a" is a constant, assign a value to "a" and use the "constant" command:

> clear f

> a=9.8

               a = 9.8

       a = 9.8 (or 49 / 5, or 9 & 4 / 5)

> constant a

> list

 (Eq. 1)
               f = 9.8 m

The acceleration variable "a" no longer appears in any equation or even as a variable at all.  Since the equation has been reduced to two variables, only one variable assignment is needed to find the other:

> m=17

               m = 17

       m = 17

               f = 9.8 m

       f = 166.6 (or 833 / 5, or 166 & 3 / 5)

> list variables

       m = 17
       f = 166.6 (or 833 / 5, or 166 & 3 / 5)

> f=42

               f = 42

       f = 42

 Undefining 'm' ...

   Solving for m:

               f = 9.8 m

           9.8 m = f

         m (9.8) = f

                    f
               m = ---
                   9.8

       m = 4.28571428571429 (or 30 / 7, or 4 & 2 / 7)

> list variables

       f = 42
       m = 4.28571428571429 (or 30 / 7, or 4 & 2 / 7)

Converting a variable to a numeric constant cannot be undone!  To revert to an earlier state, the variable would have to be redefined, and the changed equations would have to be removed and re-added.  When the need for a constant is only temporary, creating a symbolic constant (using the "lock" command) is usually a better choice:  At any time, a symbolic constant can be reversed using the "unlock" command, and even redefined by changing its value and recreating the lock.

Symbolic Constants

To turn a variable into a symbolic constant, tap the "Lock" button and follow the prompts, or use the "lock" command.  The "lock" command prevents a defined variable's value from being altered by any of the normal processes that change or clear variable values.  The "lock" command can not pre-lock undefined variables, but additional locks can appear automatically based on equation constraints.  The "unlock" command removes locks, allowing the variables to change normally.

The "all" keyword allows locking or unlocking all defined variables at once.

Note:  The "lock" command is a non-destructive alternative to the "constant" command since a "lock" can always be undone with an "unlock" command.

e.g.    y=mx+b        Enter a simple equation with four unknowns.
        m=3.7         Define an unknown.
        b=2           Define another unknown.
        x=17          Define "x".  "y" automatically gets evaluated.
        lock m b      Lock the values of some "fixed" variables.
        x=23          Re-define "x".  Only "y" clears & re-evaluates!
        unlock all    Remove all locks.

Locking Variables

As was shown in the previous example, redefining a variable causes other, related variables in resolved equations to be undefined and reevaluated.  By definition, all variables that appear in an equation together are related.  As a result, all of the other variables in resolved equations that contain the changed variable get undefined, followed by the variables in resolved equations containing THOSE variables, and so on... until all variables directly or indirectly related to the changed variable have been undefined.  Then, using the new value of the changed variable as a starting point, any variable(s) that can be derived will be derived.

The program's strategy of clearing ALL variables directly and indirectly related to the changed variable(s) ensures that variables do not maintain values that could contradict the change.  However, that strategy can get in the way of the user's intentions if any equation contains three or more variables...

When an equation contains three or more variables, the value of any one of them depends on the values of at least two other variables.  Changing one variable causes ALL of the others to get undefined, but that may be more than the problem (or the user) requires.

For example, a general equation for a line contains four variables:

> y=mx+b

The y-coordinate "y" depends on the values of three other variables: the slope "m", the x-coordinate "x", and the intercept "b":

> m=2

               m = 2

       m = 2

> x=5

               x = 5

       x = 5

> b=-3

               b = - 3

       b = -3

               y = b + m x

       y = 7

Ideally, to find the value of "y" for a different "x", one should simply have to change "x":

> x=12

               x = 12

       x = 12

 Undefining 'y' ...

 Undefining 'b' ...

 Undefining 'm' ...

However, since "y", "m", and "b" are related to "x", they ALL got cleared when "x" changed, leaving too little information for "y" to be derived.  The previous values of "m" and "b" would have to be re-established for "y" to be found:

> m=2

               m = 2

       m = 2

> b=-3

               b = - 3

       b = -3

               y = b + m x

       y = 21

When the program cleared the values of "y", "m", and "b", the user was actually free to choose completely different values for ANY of those variables and have the program derive the remaining variable...  However in this case, the intent was to find the value of "y" for a different "x" (with the implicit assumption that the values of "m" and "b" would stay the same).  The implicit assumption had to be made explicit by re-establishing the values of "m" and "b".  Unfortunately, every time "y" needs to be found for a different "x", both "m" and "b" would need to be re-established:

> x=8

               x = 8

       x = 8

 Undefining 'y' ...

 Undefining 'b' ...

 Undefining 'm' ...

> m=2

               m = 2

       m = 2

> b=-3

               b = - 3

       b = -3

               y = b + m x

       y = 13

To prevent the need to repeatedly redefine a variable to some fixed value, the program provides the "lock" command.  A locked variable can not be altered by any of the normal processes that change or clear variable values, effectively turning the variable into a symbolic constant:

> lock m b

> list y m x b

 (Eq. 3)
              y = b + m x


       y = 13
       m = 2  [locked]
       x = 8
       b = -3  [locked]

The "list" command shows that "m" and "b" are locked.  Now, if "x" were re-defined, "m" and "b" would retain their values.  As intended, only "y" would get cleared and reevaluated:

> x=13

               x = 13

       x = 13

 Undefining 'y' ...

               y = b + m x

       y = 23

Cascading Locks

Since locks restrict variables to certain, fixed values, locked variables act much like numeric constants.  Whenever locked variables sufficiently constrain an unlocked variable to a specific value, the program automatically applies a lock to the constrained variable as well:

> list m b

 (Eq. 3)
              y = b + m x

       m = 2  [locked]
       b = -3  [locked]

Since both "m" and "b" are locked, a three-variable equation containing both of them will constrain the remaining variable:

> w=m-b

               w = m - b

       w = 5

 * Warning: Lock constraints in 'w=m-b' force 'w' to be locked.

> list w

 (Eq. 4)
               w = m - b


       w = 5  [locked]

Since "m" and "b" are locked, "w" can have only one value.  Automatically locking it prevents the user from giving it a value that contradicts the equation.  Even if "w" is manually unlocked, a lock is automatically applied since it is still constrained by the variables it is related to:

> w=99

               w = 99


 * Warning: Variable 'w' is locked.

       w = 5  [locked]

> unlock w

 * Warning: Lock constraints in 'w=m-b' force 'w' to be locked.

> list w

 (Eq. 4)
               w = m - b


       w = 5  [locked]

In general, when all but one of an equation's variables are locked, the remaining variable will be automatically locked in order to help maintain consistency.  Much as with the "clear" command, multiple dependent locks may need to be removed simultaneously to prevent automatic locks from re-appearing:

> unlock w m

> list w m b

 (Eq. 3)
              y = b + m x

 (Eq. 4)
               w = m - b


       w = 5
       m = 2
       b = -3  [locked]