Entering Equations

Equations can be stored simply by entering them into the Command line.  Two expressions joined by an equals sign (=) form an equation.  Equations in one variable are solved for the variable; its value is stored as the result of the right-hand side expression.  Equations in two or more variables are always stored in the equation list.  Those "multivariate" equations automatically solve for their unknown variable when the other variable(s) are known.

`e.g.    x=4             Enter simple definition of "x".        1+5(x+2)=9x-5   Define "x" using a more complex equation.        y=mx+b          Enter and store the equation of a line.`

Two expressions joined by an equals sign (=) form an equation.  Equations come in two basic forms:

1. Equations with one variable are called Univariate
2. Equations with two or more variables are called Multivariate

The program ignores equations with no variables since variable values cannot be set or derived from them!

Univariate Equations

The simplest kind of univariate equation has already been used for defining variables.  Since variables can be defined as "variable=number", they are in fact very simple univariate equations.  However, variables do not have to be defined as a literal number.  They can be the result of an arbitrary expression:

`> y=3(5)+9               y = 24  y = 24`

Furthermore, variable assignments are not even limited to the simple form "variable=expression".  The program is able to use the rules of algebra to manipulate equations and systematically isolate the variable on the left-hand side.  Therefore, the variable can appear anywhere in the equation.  When a univariate equation is encountered, whether simple or complex, the program immediately "solves" the equation in terms of its variable.  The right-hand side of the equation is evaluated, and that result is used to define (or redefine) the variable.

Here are some examples of defining a variable by simple equation solving:

`> 3(5)+9=y   Solving for y:              24 = y               y = 24       y = 24> 9=y-3(5)   Solving for y:                9 = - 15 + y         - 15 + y = 9                y = 24       y = 24> -3(5)=-y+9   Solving for y:             - 15 = 9 - y            9 - y = - 15              - y = - 24          y (- 1) = - 24                y = 24       y = 24`
• The equations as listed sometimes differed slightly from how they were entered.  Integer arithmetic is automatically performed, and operands are sometimes reordered to simplify expressions.  All equations (even those that are entered) have some basic simplification performed on them that can restructure the equation.  A detail setting of "verbose" or "explicit" would show those steps at the time the equation or expression were entered.

The equation solving process is very general, so a variable may appear multiple times in an equation.

`> 2x-7=5+x   Solving for x:       - 7 + 2 x = 5 + x             2 x = 12 + x         2 x - x = 12       x (2 - 1) = 12               x = 12       x = 12`

The only limitation is that equations involving higher powers of the variable being solved-for are beyond the program's capability.  Solving many kinds of non-linear equations requires special techniques for each power and tracking multiple values for each variable.

Multivariate Equations

Equations in two or more variables are called multivariate equations.  Here is a simple multivariate equation used to convert a temperature measured in degrees Celsius to its equivalent on the Fahrenheit scale:

`> F=32+9/5C`

When multivariate equations are entered, the program keeps track of them by storing them in an equation list.  The "list equations" command shows the equations that have been stored.

`> list equations (Eq. 1)                        9 C               F = 32 + ---                         5 `
• The equation as listed differs slightly from how it was entered.  In this case, the factor "C" in "9/5C" was collected over the denominator to give "9C/5".  All equations (even those that are entered) have some basic simplification performed on them that can restructure the equation.  A detail setting of "verbose" or "explicit" would show those steps at the time the equation or expression were entered.

The equation says that "F" can be found if "C" is known.  In other words, given a value for "C", a value for "F" can be calculated.  Giving a value to "C" is straightforward:

`> C=50               C = 50       C = 50                        9 C               F = 32 + ---                         5        F = 122`

Once the program had a value for "C" it was able to use the stored equation to calculate the value of "F", and it did so automatically.

• All multivariate equations have their unknown solved-for when all of the other variable(s) are known.

The unqualified "list" command can be used to show the stored equation(s) and evaluated variable(s).

`> list (Eq. 1)                        9 C               F = 32 + ---                         5        C = 50       F = 122`

To recalculate "F" for a different value of "C", simply assign a different value to the variable "C".  Here are a few more values of "F" given values for "C":

`> C=0               C = 0       C = 0 Undefining 'F' ...                        9 C               F = 32 + ---                         5        F = 32> C=100               C = 100       C = 100 Undefining 'F' ...                        9 C               F = 32 + ---                         5        F = 212`

Since the variable "F" is dependent on the value of "C", the program automatically "clear"ed the value of "F" when "C" changed.  Since "C" was known, "F" could be re-evaluated.  This behavior will be discussed further in the section "Consistency in Multivariate Equations".