Solving Equations for Any Variable

To solve an equation for a particular variable, tap the "Solve" button and follow the prompts, or use the "solve" command.

The "solve" command is used to symbolically solve an equation for a specified variable.  Using the rules of algebra, the equation is transformed to isolate the variable on the left-hand side of the equation. Once solved, the program offers the option to replace the stored version of the equation with the new "solve"d representation.

Depending on the current "output" and "detail" settings, more or less verbose output will be displayed during the solving process.

Simple Equation Solving

Unlike a spreadsheet, the equations entered are not static.  The program is not limited to working with equations exactly as entered.  Just as in solving univariate equations, the program is able to solve multivariate equations for any variable in any position.  It uses the rules of algebra to manipulate the equation and isolate the unknown variable, whichever one that may be.  The effect is that a single stored equation can be used to evaluate any of its variables.

In the previous example, "F=32+9C/5" was used to find "F" given "C", but it can also be used to find "C" given "F":

> F=98

F = 98

       F = 98

 Undefining 'C' ...

   Solving for C:

                        9 C
              F = 32 + ---
                         5

             9 C   
        32 + --- = F
              5    

             9 C          
             --- = - 32 + F
              5           

               9          
             C - = - 32 + F
               5          

             9 C = 5 (- 32 + F)

           C (9) = 5 (- 32 + F)

                   5 (- 32 + F)
               C = ------------
                        9     

5 (F - 32)
C = ----------
9

       C = 36.6666666666667 (or 110 / 3, or 36 & 2 / 3)

> F=-10

               F = - 10

       F = -10

 Undefining 'C' ...

   Solving for C:

                        9 C
               F = 32 + ---
                        5

             9 C   
        32 + --- = F
              5    

             9 C          
             --- = - 32 + F
              5           

               9          
             C - = - 32 + F
               5          

             9 C = 5 (- 32 + F)

           C (9) = 5 (- 32 + F)

                   5 (- 32 + F)
               C = ------------
                        9     

5 (F - 32)
C = ----------
9

       C = -23.3333333333333 (or -70 / 3, or -23 & 1 / 3)

The ability to use algebra and automatically solve an equation for any unknown variable is what distinguishes this program from simple "expression calculators".  The program treats equations as flexible definitions that can be restructured depending on what is known and unknown in a given situation.  Furthermore, the customizable detail settings present as much (or as little) explanation of the solution as desired.

Stored vs. Derived Equations

The example equation is stored in a form that makes it easy to calculate "F" given "C".  However, every time "C" was calculated given "F", the program repeated the work to solve the equation for "C".  To minimize that kind of repetition, it would be better if the equation were already solved for the variable least likely to be known...

To see how an equation would look if solved for a specific variable, the "solve" command may be used.

> clear all

> list

 (Eq. 1)
                        9 C
F = 32 + ---
                         5

> solve 1 for C

   Solving for C:

                        9 C
               F = 32 + ---
                         5

             9 C   
        32 + --- = F
              5    

             9 C          
             --- = - 32 + F
              5           

               9          
             C - = - 32 + F
               5          

             9 C = 5 (- 32 + F)

           C (9) = 5 (- 32 + F)

                   5 (- 32 + F)
               C = ------------
                        9     

5 (F - 32)
C = ----------
9

   Replace existing equation?  y/[n]: y

 * Existing equation replaced.

> list

 (Eq. 1)
5 (F - 32)
C = ----------
9

(If there had been other equations, the new equation would have been re-numbered to appear at the end of the equation list.)

Once solved, the program offered the option to replace the stored version of the equation with the new form.  It is beneficial to keep the new version if storing the equation in the new form would minimize the likelihood of having to re-derive a different formula.  When needed again, the equation would probably already be solved for the unknown variable.

Now, given values of "F", "C" can be found without deriving the equation:

> F=75

               F = 75

       F = 75

5 (F - 32)
C = ----------
9

       C = 23.8888888888889 (or 215 / 9, or 23 & 8 / 9)

> F=110

               F = 110

       F = 110

 Undefining 'C' ...

5 (F - 32)
C = ----------
9

      C = 43.3333333333333 (or 130 / 3, or 43 & 1 / 3)

Consistency in Multivariate Equations

At all times, the program will present a consistent picture of variable values, given the equations that exist.  This is evident when the program automatically solves for the unknown variable when all others are known.  That process happens whenever a variable's value changes in any way.

> list

 (Eq. 1)
5 (F - 32)
C = ----------
9

       F = 110
       C = 43.3333333333333 (or 130 / 3, or 43 & 1 / 3)

> clear C

5 (F - 32)
C = ----------
9

       C = 43.3333333333333 (or 130 / 3, or 43 & 1 / 3)

> clear F

   Solving for F:

                   5 (- 32 + F)
               C = ------------
                        9     

    5 (- 32 + F)   
    ------------ = C
         9         

       5 F   160   
       --- - --- = C
        9     9    

             5 F   160   
             --- = --- + C
              9     9    

               5   160   
             F - = --- + C
               9    9    

             5 F = 160 + 9 C

           F (5) = 160 + 9 C

                   160 + 9 C
               F = ---------
                       5   

       F = 110

Even though a variable was manually "clear"ed, it was automatically redefined to maintain consistency between the equations and all derivable variables.  This behavior prevents "clear"ing a variable and then giving it a value that contradicts the rest of the workspace.  To prevent any automatic redefinition, multiple dependent variables may have to be "clear"ed at the same time.

> clear C F

> list

 (Eq. 1)
5 (F - 32)
C = ----------
9

To extend the current example, a second equation will be introduced into the workspace:

> C+273=K

> list equations

 (Eq. 1)
5 (F - 32)
C = ----------
9

 (Eq. 2)
         273 + C = K

The new equation represents that fact that temperature in degrees Kelvin is 273 added to the temperature in degrees Celsius.  As before, given any known temperature, the temperature in the other units of measurement can be calculated:

> C=35

               C = 35

       C = 35

   Solving for F:

                   5 (- 32 + F)
               C = ------------
                        9     

    5 (- 32 + F)   
    ------------ = C
         9         

       5 F   160   
       --- - --- = C
        9     9    

             5 F   160   
             --- = --- + C
              9     9    

               5   160   
             F - = --- + C
               9    9    

             5 F = 160 + 9 C

           F (5) = 160 + 9 C

                   160 + 9 C
               F = ---------
                       5   

       F = 95

   Solving for K:

         273 + C = K

               K = 273 + C

       K = 308

> list variables

       C = 35
       F = 95
       K = 308

Since the program automatically maintains consistency, (re)defining a variable causes any dependent variables to be cleared and (re)evaluated:

> F=110

               F = 110

       F = 110

 Undefining 'C' ...

 Undefining 'K' ...

5 (F - 32)
C = ----------
9

       C = 43.3333333333333 (or 130 / 3, or 43 & 1 / 3)

   Solving for K:

         273 + C = K

               K = 273 + C

       K = 316.333333333333 (or 949 / 3, or 316 & 1 / 3)

> list variables

       F = 110
       C = 43.3333333333333 (or 130 / 3, or 43 & 1 / 3)
       K = 316.333333333333 (or 949 / 3, or 316 & 1 / 3)

The process works regardless of which variable is redefined:

> K=100

               K = 100

       K = 100

 Undefining 'C' ...

 Undefining 'F' ...

   Solving for C:

         273 + C = K

               C = - 273 + K

       C = -173

   Solving for F:

                   5 (- 32 + F)
               C = ------------
                        9     

    5 (- 32 + F)   
    ------------ = C
         9         

       5 F   160   
       --- - --- = C
        9     9    

             5 F   160   
             --- = --- + C
              9     9    

               5   160   
             F - = --- + C
               9    9    

             5 F = 160 + 9 C

           F (5) = 160 + 9 C

                   160 + 9 C
               F = ---------
                       5   

       F = -279.4

> list variables

       K = 100
       C = -173
      F = -279.4

Any number of related equations and variables could be defined and have their unknowns solved-for in a similar way.