Sophie

Sophie

distrib > Mandriva > 2010.0 > i586 > media > contrib-release > by-pkgid > 86c3d80c4d6e905f610c100030811165 > files > 9

mathomatic-14.5.5-1mdv2010.0.i586.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

<title>Mathomatic Command Reference</title>

<meta name="description" content="The Command Reference Manual for the Mathomatic computer algebra system.">
<meta name="author" content="George Gesslein II">

<link rel="home" href="http://mathomatic.org">
<link rel="toc" href="index.html">
<link rel="author" href="http://www.google.com/profiles/georgegesslein">
<link rel="copyright" href="http://www.opensource.org/licenses/lgpl-2.1.php">
<link rel="previous" href="manual.html">
<link rel="next" href="mathomatic.1.html">
<link rel="icon" href="favicon.ico" type="image/x-icon">
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon">
<link rel="stylesheet" type="text/css" href="doc.css">
</head>

<body>
<center>
<h1>Mathomatic Command Reference</h1>
<img src="greenfade.png" alt="decoration">
</center>

<h3>Topics</h3>

<ol>
<li>
<a href="#introduction">Introduction</a>
<li>
<a href="#selecting">Selecting Expressions</a>
<li>
<a href="#solving">Solving Equations</a>
</ol>

<h3>Commands</h3>

<blockquote>
<table summary="list of all commands">
<tr valign="top">
<td>
<a href="#approximate">Approximate</a>
<br>
<a href="#calculate">Calculate</a>
<br>
<a href="#clear">Clear</a>
<br>
<a href="#code">Code</a>
<br>
<a href="#compare">Compare</a>
<br>
<a href="#copy">Copy</a>
<br>
<a href="#derivative">Derivative</a>
<br>
<a href="#display">Display</a>
</td>
<td>
<a href="#divide">Divide</a>
<br>
<a href="#echo">Echo</a>
<br>
<a href="#edit">Edit</a>
<br>
<a href="#eliminate">Eliminate</a>
<br>
<a href="#extrema">Extrema</a>
<br>
<a href="#factor">Factor</a>
<br>
<a href="#fraction">Fraction</a>
<br>
<a href="#help">Help</a>
</td>
<td>
<a href="#imaginary">Imaginary</a>
<br>
<a href="#integrate">Integrate</a>
<br>
<a href="#laplace">Laplace</a>
<br>
<a href="#limit">Limit</a>
<br>
<a href="#list">List</a>
<br>
<a href="#nintegrate">NIntegrate</a>
<br>
<a href="#optimize">Optimize</a>
<br>
<a href="#pause">Pause</a>
</td>
<td>
<a href="#product">Product</a>
<br>
<a href="#push">Push</a>
<br>
<a href="#quit">Quit</a>
<br>
<a href="#read">Read</a>
<br>
<a href="#real">Real</a>
<br>
<a href="#replace">Replace</a>
<br>
<a href="#roots">Roots</a>
<br>
<a href="#save">Save</a>
</td>
<td>
<a href="#set">Set</a>
<br>
<a href="#simplify">Simplify</a>
<br>
<a href="#solve">Solve</a>
<br>
<a href="#sum">Sum</a>
<br>
<a href="#tally">Tally</a>
<br>
<a href="#taylor">Taylor</a>
<br>
<a href="#unfactor">Unfactor</a>
<br>
<a href="#variables">Variables</a>
</td>
<td>
<a href="#version">Version</a>
</td>
</tr>
</table>
</blockquote>

<p>
<a href="manual.html">Mathomatic User's Manual</a>

<hr>
<a name="introduction"></a>
<h2>Introduction</h2>
<p>
<b>LHS</b> is shorthand for the Left-Hand Side of an equation.
Similarly, <b>RHS</b> used here always means the Right-Hand Side.
In this document, text enclosed by straight brackets <b>[like this]</b> means
it is optional and may be omitted.
<p>
At the Mathomatic main prompt, you may enter:

<ul>
<li>
a numerical expression, which is instantly evaluated and displayed with the <a href="#calculate">calculate command</a> (autocalc),
<li>
an <a href="manual.html#equations">algebraic expression or equation</a>,
which is stored and made the current equation,
<li>
a variable to <a href="#solving">solve</a> the current equation for (autosolve),
<li>
an equation number to <a href="#selecting">select</a> as the current equation (autoselect),
<li>
a Mathomatic command (listed in this document),
<li>
a question mark (<b>?</b>) for quick, short help (same as the <a href="#help">help command</a>),
<li>
a semicolon (<b>;</b>) followed by a comment
(everything on a line after a semicolon is ignored),
<li>
or an exclamation point (<b>!</b>) followed by a shell or system command.
"!" by itself invokes the default shell.
</ul>

<p>
Mathomatic has about 40 commands that may be typed at the main prompt.
They are simple English words and are described below, in alphabetical order.
If the command is longer than 4 letters, you only need
to type in the first 4 letters for Mathomatic to recognize the command.
Option words and arguments for commands follow the command name and are separated by spaces.
Commands are not executed until you press the Enter key,
and any missing command line arguments that don't have a default are prompted for.
<p>
Many commands have an optional <b>equation number range</b> argument.
An equation number range may be a single equation number,
a range of equation numbers separated by a dash (like "2-7",
which means every equation space between equation numbers 2 and 7, inclusive),
or the word "all", which specifies all equation spaces.
If omitted, the current expression or equation is assumed.
If pluralized (as in <b>"equation-number-ranges"</b>),
multiple equation numbers and ranges may be specified for that command,
separated by spaces.
<p>
A greater-than character (<b>&gt;</b>) may be appended to the end of any command line,
followed by a file name.  This will redirect the output of the command to that file.
If the file already exists, it will be overwritten without asking.
Note that any debugging output will be redirected, too.
Two greater-than characters (<b>&gt;&gt;</b>) next to each other
will <strong>append</strong> command output to a file, like the Unix shell does.
For example:

<pre class="indent">
list export all &gt;filename
</pre>

<p>
will output all stored expressions and equations to a file in exportable,
single-line per equation format,
so they can be read in by a different math program.
<p>
Command option words, such as "export" in the above list command line,
always come immediately after the command name and before anything else on the command line.
These words direct the command to do a different, but related, task.
<p>
If Mathomatic becomes unresponsive (a rare occurrence),
pressing Control-C once will usually safely abort the current operation
and return you to the main prompt.
If not, pressing Control-C three times in a row will exit Mathomatic,
with a warning displayed the second time.

<hr>
<a name="selecting"></a>
<h2>Selecting Expressions</h2>
<p>
Syntax: <b>#["+" or "&minus;"]equation-number</b>
<p>
To change the current equation number at the main prompt,
type a pound sign (<b>#</b>) followed by the <b>equation number</b>
you wish to select.
The <b>equation number</b> may be preceded by plus (<b>+</b>) or minus (<b>&minus;</b>),
to select an equation relative to the current equation.
This syntax also works when prompted for an expression,
the RHS or expression at that equation number is substituted.
<p>
New feature: Selecting expressions is now possible by typing only
the <b>equation number</b> at the main prompt.
This is called the "autoselect" option.

<hr>
<a name="solving"></a>
<h2>Solving Equations</h2>
<p>
Syntax: <b>variable or "0"</b>
<p>
Mathomatic can solve symbolic equations for any <b>variable</b> or for <b>zero</b>.
Solving is accomplished internally by applying identical
mathematical operations to both sides of the equation and simplifying
or by plugging the coefficients into the quadratic equation.
The Mathomatic solve algorithm is the best possible for general algebra,
however the result is not verified by plugging the solutions into the original equation,
this can be done automatically with the "<a href="#solve">solve</a> verify" command.
<p>
To automatically solve the current equation for a variable,
type the <b>variable</b> name at the main prompt.
Mathomatic will proceed to manipulate the current equation
until all of the solutions for the specified <b>variable</b> are determined.
If successful, the current equation is replaced with the solutions and then displayed.
<p>
Automatic cubic and quintic polynomial equation solving is not supported.
Quartic (fourth degree) polynomial equations
can be solved if they are biquadratic; that is,
containing only degree four, degree two, and degree zero terms of the solve variable.
Biquadratic polynomial equations of degree four and higher can be solved
because they can be plugged into the quadratic equation.
<p>
Note that running the <a href="#simplify">simplify command</a> is a good idea after solving.
The solve routine only <a href="#unfactor">unfactors</a> the equation as needed to solve it
and the result is not completely simplified.
<p>
To solve for zero, type in <b>"0"</b> at the main prompt.
Zero solving is a special solve that will always be successful
and will transform most divide operators into equivalent multiplications and subtractions,
so that the result will more likely be a valid polynomial equation:

<pre class="sample">
1&mdash;&gt; a=b+1/b

            1
#1: a = b + -
            b

1&mdash;&gt; 0 ; solve for zero

#1: 0 = (b*(b - a)) + 1

1&mdash;&gt; unfactor ; show that it is a quadratic polynomial equation in "b"

#1: 0 = (b^2) - (b*a) + 1

1&mdash;&gt; b ; solve for "b"
Equation was quadratic.

                       1
        (((((a^2) - 4)^-)*sign1) + a)
                       2
#1: b = -----------------------------
                      2

1&mdash;&gt; a ; solve for "a", to check the answer
Raising both sides to the power of 2 and unfactoring...

        ((b^2) + 1)
#1: a = -----------
             b

1&mdash;&gt; simplify

            1
#1: a = b + -
            b

1&mdash;&gt;
</pre>

<p>
You can prefix the solve <b>variable</b> name with "=" to solve and swap equation sides.
Typing "=" by itself will swap sides of the current equation and display.
<p>
To see all the steps performed during a solve operation,
type "<a href="#set">set</a> debug 2" before solving.

<hr>
<a name="approximate"></a>
<h2>Approximate command</h2>
<p>
Syntax: <b>approximate [equation-number-ranges]</b>
<p>
This command operates on the current or specified equation spaces.
It substitutes the special constants <b>pi#</b> and <b>e#</b>
(which stand for the universal constants <b>pi</b> and <b>e</b>)
with their respective floating point values and approximates all constants and roots.
This allows them to combine with other constants and may help with simplification and comparisons.

<hr>
<a name="calculate"></a>
<h2>Calculate command</h2>
<p>
Syntax: <b>calculate ["repeat"] ["factor"] [variable number-of-iterations]</b>
<p>
This command is the formula calculator that
prompts for the value of each normal variable in the
current expression or the RHS of the current equation, if any.
It then simplifies, approximates, and substitutes all "sign" variables
with all possible combinations of values (+1 and -1), displaying each solution as it does so.
If all variables are supplied with constant values, then each solution will be a constant,
otherwise the result will contain the variables you didn't enter values for.
Nothing is modified by this command.
<p>
This command is used to temporarily plug in values
and approximate expressions and expand "sign" variables.
When an expression with only numbers is entered at the main prompt,
the calculate command is automatically invoked on it,
displaying the calculated result without storing.
<p>
To only simplify and expand "sign" variables in stored expressions without approximating,
use the "<a href="#simplify">simplify</a> sign" command.
<p>
If a <b>variable</b> and <b>number of iterations</b> are specified on the
calculate command line,
you will be prompted for the initial value of the <b>variable</b>,
and the calculation will be iterated, with the simplified result
repeatedly plugged back into the <b>variable</b>.
This will be done until convergence (the output equals the input)
or when the specified <b>number of iterations</b> have been performed,
whichever comes first.
<p>
"calculate <b>factor</b>" factors all integers and variables before display.
<p>
"calculate <b>repeat</b>" causes this command to repeat until empty lines are entered.
<p>
Examples of using the calculate command:

<pre class="sample">
1&mdash;&gt; y=x^2+x

#1: y = (x^2) + x

1&mdash;&gt; x ; solve for x
Equation is a degree 2 polynomial in x.
Equation was quadratic.

                              1
        -1&middot;(1 + (((1 + (4&middot;y))^&mdash;)&middot;sign))
                              2
#1: x = &mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;
                       2

1&mdash;&gt; calculate
Enter y: 0
There are 2 solutions.

Solution number 1 with sign = 1:
 x = -1

Solution number 2 with sign = -1:
 x = 0

1&mdash;&gt;
</pre>

<p>
An example of iteration:

<pre class="sample">
1&mdash;&gt; x_new=(x_old+(y/x_old))/2 ; iterative formula for calculating the square root of y

                       y
            (x_old + -----)
                     x_old
#2: x_new = ---------------
                   2

2&mdash;&gt; calculate x_old 1000 ; iterate up to 1000 times to calculate the square root of 100
Enter y: 100
Enter initial x_old: 1
Convergence reached after 9 iterations.

 x_new = 10

2&mdash;&gt;
</pre>

<hr>
<a name="clear"></a>
<h2>Clear command</h2>
<p>
Syntax: <b>clear [equation-number-ranges]</b>
<p>
This command clears the specified equation spaces so that they are empty and can be reused.
They are deleted from RAM only.
<p>
"clear all" quickly clears all equation spaces and restarts Mathomatic.

<hr>
<a name="code"></a>
<h2>Code command</h2>
<p>
Syntax: <b>code ["c" or "java" or "python" or "integer"] [equation-number-ranges]</b>
<p>
This command outputs the current or specified equations as floating point or integer
assignment statements in C, Java, or Python programming language code.
The default is C double precision floating point code.
This output should compile correctly and emulate the equation from Mathomatic
if no warnings are given.
<p>
With "code integer", integer arithmetic is assumed,
otherwise double precision floating point arithmetic is assumed.
"code integer" is more generic and should work with any language.
<p>
To represent factorials, the user supplied function <code>fact()</code> is called,
since there is no equivalent function or operator in these languages.
<code>fact()</code> functions for several languages are supplied in the
directory "factorial" in the Mathomatic source distribution.
<p>
Complex number arithmetic is supported with Python only.
In C and Java, complex number arithmetic as generated by this command may fail to compile
or work correctly, because it has not been anticipated or tested.
<p>
For the most efficient code, use the <a href="#simplify">simplify</a>
and <a href="#optimize">optimize</a> commands on your equations
before running this code command.
<p>
The C and Java languages require that all variables be defined before use.
The <a href="#variables">variables command</a> is provided for this.

<hr>
<a name="compare"></a>
<h2>Compare command</h2>
<p>
Syntax: <b>compare ["symbolic"] equation-number ["with" equation-number]</b>
<p>
This command compares two equation spaces to see if they are the same (equal).
If only one <b>equation number</b> is supplied, the comparison is between
the current equation and the specified equation.
The comparison will be faster and more accurate if
both equations are previously solved for the same variable.
<p>
The <a href="#simplify">simplify command</a> is automatically used on both expressions if needed.
If this compare command says the equations or expressions are identical,
then they are definitely identical.
If this command says the equations or expressions differ,
then they might be identical if
they are too hard for Mathomatic to simplify completely.
<p>
The "symbolic" option uses the "<a href="#simplify">simplify</a> symbolic" option when simplifying.
This option sometimes simplifies more, but is not 100% mathematically correct.

<hr>
<a name="copy"></a>
<h2>Copy command</h2>
<p>
Syntax: <b>copy [equation-number-range]</b>
<p>
This command simply duplicates the current or specified equation spaces.
The new, duplicated expressions are stored in the next available equation spaces
and displayed, along with their new equation numbers.

<hr>
<a name="derivative"></a>
<h2>Derivative command</h2>
<p>
Syntax: <b>derivative ["nosimplify"] [variable or "all"] [order]</b>
<br>
Alternate command name: <b>differentiate</b>
<p>
This command computes the exact symbolic derivative of a function
with respect to the specified <b>variable</b>,
using the current expression or RHS of the current equation as the function.
It does this by recursively applying the proper rule of differentiation for each operator encountered.
The result is fully simplified with the <a href="#simplify">simplify command</a>,
unless the "nosimplify" option is specified.
If successful, the derivative is placed in the next available equation space, displayed,
and becomes the current equation.
The original equation is not modified.
<p>
Specifying "all" computes the derivative of the current expression with respect to all normal
variables.  It is equivalent to adding together the derivatives with
respect to each variable.
<p>
Specifying the <b>order</b> allows you to repeatedly differentiate and simplify.
The default is to differentiate once (<b>order</b>=1).
<p>
If differentiation fails, it is probably because symbolic logarithms are required.
Symbolic logarithms are not implemented in Mathomatic.
Also, factorial, modulus, and integral divide operators
cannot be differentiated if they contain the specified <b>variable</b>.
Because this command handles almost everything, a numerical differentiation command is not needed.
<p>
Some examples:

<pre class="sample">
1&mdash;&gt; x^3+x^2+x+1

#1: (x^3) + (x^2) + x + 1

1&mdash;&gt; derivative ; no need to specify the variable if there is only one
Differentiating with respect to (x) and simplifying...

#2: (3*(x^2)) + (2*x) + 1

2&mdash;&gt; a*x^n

#3: a*(x^n) ; show a general rule of differentiation

3&mdash;&gt; derivative x
Differentiating with respect to (x) and simplifying...

#4: a*n*(x^(n - 1))

4&mdash;&gt; integrate x ; undo the differentiation

#5: a*(x^n)

5&mdash;&gt;
</pre>

<hr>
<a name="display"></a>
<h2>Display command</h2>
<p>
Syntax: <b>display ["factor"] [equation-number-ranges]</b>
<p>
This command displays stored expressions in nice looking
multi-line 2D (two dimensional) fraction format,
where division is displayed as a numerator over a fractional line
(made up of dashes) over a denominator.
If the width (number of columns) required for this 2D display exceeds the screen width,
the expression is displayed instead in single-line format
by the <a href="#list">list command</a>.
The screen width is set by the "<a href="#set">set</a> columns" option.
<p>
Non-integer constants are converted to reduced fractions,
if they are exactly equal to a simple fraction and it would improve readability.
<p>
The "factor" option causes all integers, less than or equal to 15 decimal digits long,
to be factored into their prime factors before display,
including the numerator and denominator of fractions.
To always factor integers like this before display,
use the "<a href="#set">set</a> factor_integers" option.

<hr>
<a name="divide"></a>
<h2>Divide command</h2>
<p>
Syntax: <b>divide [variable]</b>
<p>
This command is for doing and experimenting with polynomial
and numerical division and Greatest Common Divisors (GCD).
It simply prompts for two expressions and divides them, displaying the result and the GCD.
Mathomatic has general symbolic polynomial division and GCD routines
used by the <a href="#simplify">simplify command</a>
which this divide command calls without any other processing if two polynomials are entered.
<p>
This command prompts for
the dividend (the main polynomial) and then the divisor (what you want to
divide the main polynomial by).
The polynomial quotient, remainder, and GCD are displayed.
The power of the highest power term in the dividend must be greater than or equal to
the power of the highest power term in the divisor, otherwise the polynomial division will fail
(as it should).
In other words, the degree of the divisor polynomial
must be less than or equal to the degree of the dividend polynomial.
A <b>variable</b> may be specified on the command line as the base variable of the two polynomials,
but is usually not necessary because a base variable is automatically selected.
<p>
If two numbers are entered instead of polynomials,
the result of the numerical division, the GCD,
and the Least Common Multiple (LCM) are displayed.
The LCM is the smallest positive number that can be evenly divided by both numbers
separately, without remainder.
The LCM is the same as the Lowest Common Denominator (LCD) of two fractions and
is the two numbers multiplied together, divided by the GCD.
<p>
The Greatest Common Divisor of <b>a</b> and <b>b</b> is defined as the greatest
positive number or polynomial that evenly divides both <b>a</b> and <b>b</b> without remainder.
In Mathomatic, the GCD is not necessarily integer, unless both <b>a</b> and <b>b</b> are integers.
The Euclidean GCD algorithm is used by Mathomatic to compute the GCD for numbers and polynomials.
<p>
The GCD is the best way to reduce any fraction to its simplest form.
Just divide the numerator and denominator by their GCD,
and replace them with the quotients (there will be no remainder),
and the fraction is completely reduced.
The GCD is also used when factoring polynomials and for simplifying.
<p>
The Euclidean GCD algorithm of successive divides is the best way to compute the
GCD for numbers and polynomials.
Multivariate polynomial GCD computation usually
requires recursion of the GCD algorithm or other methods.
Currently the polynomial GCD routine in Mathomatic
is not recursive, making it univariate and simpler and faster.
Because it is univariate, Mathomatic may be unable
to find the GCD of polynomials with many variables.
<p>
The polynomial division algorithm in Mathomatic
is generalized and able to handle any number of variables (multivariate),
and division is always done with one selected base variable to be proper polynomial division.
Being generalized, the coefficients of the polynomials
may be any mathematical expression.
<p>
An example of polynomial division:

<pre class="sample">
1&mdash;&gt; divide
Enter dividend: (x^4) - (7*(x^3)) + (18*(x^2)) - (22*x) + 12
Enter divisor: (x^2) - (2*x) + 2

Polynomial division successful using variable (x).
The quotient is:
6 + (x^2) - (5*x)

The remainder is:
0

Polynomial Greatest Common Divisor (iterations = 1):
(x^2) - (2*x) + 2
1&mdash;&gt;
</pre>

<p>
The number of iterations displayed is the number of polynomial divides
done to compute the GCD with the Euclidean algorithm.

<hr>
<a name="echo"></a>
<h2>Echo command</h2>
<p>
Syntax: <b>echo [text]</b>
<p>
This command outputs a line of <b>text</b>, followed by a newline.

<hr>
<a name="edit"></a>
<h2>Edit command</h2>
<p>
Syntax: <b>edit [file-name]</b>
<p>
This command invokes the ASCII text editor specified by the EDITOR environment variable.
By default, all equation spaces are edited.
Access to shell (<i>/bin/sh</i>) is required for this command to work.
<p>
Type "edit" at the Mathomatic prompt to edit all expressions and equations
you have entered for the current session.
When you are done editing Mathomatic expressions and commands,
save and exit the editor to have them automatically read in by Mathomatic.
If Mathomatic gets an error reading in its new input,
observe where the error is and continue, to
automatically re-enter the editor.
<p>
To edit an existing file and have it read in, specify the <b>file name</b>
on the edit command line.

<hr>
<a name="eliminate"></a>
<h2>Eliminate command</h2>
<p>
Syntax: <b>eliminate ["repeat"] variables or "all" ["using" equation-number]</b>
<p>
This command is used to combine simultaneous equations,
by automatically substituting variables in the current equation.
It will scan the command line from left to right,
replacing all occurrences of the specified <b>variables</b>
in the current equation with the RHS of solved equations.
The equation to solve can be specified with the "using" argument.
If "using" is not specified, Mathomatic will search backwards,
starting at the current equation minus one,
for the first equation that contains the specified variable.
The equation to solve is solved for the specified variable,
then the RHS is inserted at every occurrence of the
specified variable in the current equation.
This effectively eliminates the specified variable
from the current equation, resulting in one less unknown.
<p>
There is an advantage to eliminating multiple variables in
one command: each equation will be used only once.
If the same equation is solved and substituted into the current
equation more than once, it will cancel out.
<p>
"eliminate all" is shorthand for specifying all normal variables on the command line.
"eliminate repeat all" will eliminate all variables repeatedly until nothing more can be substituted,
using each equation only once.
<p>
Here is a simple example of combining two equations:

<pre class="sample">
1&mdash;&gt; ; This arrives at the distance between two points in 3D space from the
1&mdash;&gt; ; Pythagorean theorem (distance between two points on a 2D plane).
1&mdash;&gt; ; The coordinate of point 1, 2D: (x1, y1), 3D: (x1, y1, z1).
1&mdash;&gt; ; The coordinate of point 2, 2D: (x2, y2), 3D: (x2, y2, z2).
1&mdash;&gt;
1&mdash;&gt; L^2=(x1-x2)^2+(y1-y2)^2 ; Distance formula for a 2D Cartesian plane.

#1: L^2 = ((x1 &minus; x2)^2) + ((y1 &minus; y2)^2)

1&mdash;&gt; distance^2=L^2+(z1-z2)^2 ; Add another leg.

#2: distance^2 = (L^2) + ((z1 &minus; z2)^2)

2&mdash;&gt; eliminate L ; Combine the two equations.
Solving equation #1 for (L) and substituting into the current equation...

#2: distance^2 = ((x1 &minus; x2)^2) + ((y1 &minus; y2)^2) + ((z1 &minus; z2)^2)

2&mdash;&gt; distance ; Solve to get the distance formula for 3D space.

                                                                1
#2: distance = ((((x1 &minus; x2)^2) + ((y1 &minus; y2)^2) + ((z1 &minus; z2)^2))^&mdash;)&middot;sign2
                                                                2

Finished reading file "pyth3d.in".
2&mdash;&gt;
</pre>

<hr>
<a name="extrema"></a>
<h2>Extrema command</h2>
<p>
Syntax: <b>extrema [variable] [order]</b>
<p>
This command computes possible extrema (the minimums and maximums)
of the current expression by default,
or possible inflection points when <b>order</b> is 2.
The result is placed in the next available equation space, displayed,
and becomes the current equation.
The original expression is not modified.
<p>
By default (<b>order</b>=1) this command computes stationary points.
The stationary points of function <b>f(x)</b> are the values of <b>x</b>
when the slope (<a href="#derivative">derivative</a>) equals zero.
Stationary points are likely the local minimums and maximums of the function,
unless the point is determined to be an inflection point.
<p>
For <b>y=f(x)</b>, where <b>f(x)</b> is the RHS and <b>x</b> is the specified <b>variable</b>,
this command gives the values of <b>x</b> that make the minimums and maximums of <b>y</b>.
This is computed by taking the derivative of <b>f(x)</b>, setting it equal to zero,
and then solving for <b>x</b>.
<p>
The number of derivatives to take before solving
can be specified by the <b>order</b> argument (default is 1).
When <b>order</b> is 2, possible points of inflection are determined.
A point of inflection is a point on a curve at which the second derivative changes sign
from positive to negative or negative to positive.

<pre class="sample">
1&mdash;&gt; y=x^2

#1: y = x^2

1&mdash;&gt; extrema x

#2: x = 0

2&mdash;&gt;
</pre>

<p>
This function is a parabola, with the minimum at <b>x=0</b>.

<hr>
<a name="factor"></a>
<h2>Factor command</h2>
<p>
Syntax: <b>factor ["number" [integers]] or ["power"] [equation-number-range] [variables]</b>
<br>
Alternate command name: <b>collect</b>
<p>
This command will factor manually entered <b>integers</b>
when "<b>numbers</b>" is specified on the command line,
otherwise this command will factor <b>variables</b>
in expressions in the specified equation spaces.
This command does not factor polynomials.
To factor polynomials with repeated or symbolic factors,
use the <a href="#simplify">simplify command</a>.
To factor integers in equation spaces and display,
use the "<a href="#display">display</a> factor" command.
<p>
"factor <b>number</b>" will prompt for an integer to factor,
which may be up to 15 decimal digits.
The plural "factor <b>numbers</b>" will repeatedly prompt for <b>integers</b> to factor.
Multiple <b>integers</b> can be specified on the same line
and should be separated with spaces.
<p>
Without the "number" option, this command will factor out
repeated sub-expressions in equation spaces.
When factoring expressions, this command does some basic simplification and
factors out any common (equal) sub-expressions it can,
unless <b>variables</b> are specified on the command line,
in which case only common sub-expressions
containing those variables are factored out.
This collects together terms involving those variables.
<p>
For example, with the following expression:

<pre class="indent">
(b*c) + (b*d)
</pre>

<p>
variable <b>b</b> factors out and the result of this command is:

<pre class="indent">
b*(c + d)
</pre>

<p>
If no variables are specified on the command line,
this command factors even more:
the bases of common (equal) bases raised to any power are factored out.
This is called Horner factoring or Horner's rule.
<p>
For example:

<pre class="sample">
1&mdash;&gt; (2+3x)^2*(x+y)

#1: ((2 + (3&middot;x))^2)&middot;(x + y)

1&mdash;&gt; unfactor ; expand

#1: (4&middot;x) + (12&middot;(x^2)) + (9&middot;(x^3)) + (4&middot;y) + (12&middot;x&middot;y) + (9&middot;(x^2)&middot;y)

1&mdash;&gt; factor x ; collect terms containing x

#1: (x&middot;(4 + (12&middot;y))) + ((x^2)&middot;(12 + (9&middot;y))) + (9&middot;(x^3)) + (4&middot;y)

1&mdash;&gt; x^3+2x^2+3x+4 ; enter another expression

#2: (x^3) + (2&middot;(x^2)) + (3&middot;x) + 4

2&mdash;&gt; factor ; Horner factoring

#2: (x&middot;((x&middot;(x + 2)) + 3)) + 4

2&mdash;&gt; 
</pre>

<p>
To undo any kind of factoring in selected equation spaces,
use the <a href="#unfactor">unfactor command</a>.

<hr>
<a name="fraction"></a>
<h2>Fraction command</h2>
<p>
Syntax: <b>fraction [equation-number-range]</b>
<br>
Alternate command name: <b>together</b>
<p>
This command reduces and converts expressions with any algebraic fractions in them
into a single simple algebraic fraction (usually the ratio of two polynomials),
similar to what <a href="http://maxima.sourceforge.net/docs/manual/en/maxima_12.html#Item_003a-rat">Maxima's rat()</a> function does.
It does this by combining all terms
added together with like and unlike denominators
to a single simple fraction with a like denominator.
Unlike denominators are combined by converting
the terms to what they would be over like (common) denominators.
Fractions are reduced by
cancelling out the Greatest Common Divisor (GCD) of the numerator and denominator.
The result of this command is equivalent to the original expression.
Note that algebraic fractions added together with like denominators are
automatically combined by almost any Mathomatic command.
<p>
Example:

<pre class="sample">
1&mdash;&gt; 1/x+1/y+1/z

    1   1   1
#1: &mdash; + &mdash; + &mdash;
    x   y   z

1&mdash;&gt; fraction

    (((y + x)&middot;z) + (x&middot;y))
#1: &mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;
           (x&middot;y&middot;z)

1&mdash;&gt; unfactor

    ((y&middot;z) + (x&middot;z) + (x&middot;y))
#1: &mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;
            (x&middot;y&middot;z)

1&mdash;&gt; unfactor fully

    1   1   1
#1: &mdash; + &mdash; + &mdash;
    x   y   z

1&mdash;&gt;
</pre>

<p>
If more simplification is needed, use the "<a href="#simplify">simplify</a> fraction" command instead.

<hr>
<a name="help"></a>
<h2>Help command</h2>
<p>
Syntax: <b>help [topic or command-names]</b>
<p>
This command is provided as a quick reference while running Mathomatic.
If the argument is a command name,
a one line description and one line syntax of that command are displayed.
Command names may be abbreviated.
<p>
Entering this command by itself will display a list of topics and commands.
"help copyright" will display the copyright and license preamble
for the currently running version of Mathomatic.
<p>
To create a quick reference of all Mathomatic commands, type:

<pre class="indent">
help all &gt;quickref.txt
</pre>

<hr>
<a name="imaginary"></a>
<h2>Imaginary command</h2>
<p>
Syntax: <b>imaginary [variable]</b>
<p>
This command copies the imaginary part of a complex expression to the
next available equation space.
If the current expression or RHS of the current equation is not complex,
it will tell you and abort.
A complex expression contains both imaginary and real parts.
To copy the real part, see the <a href="#real">real command</a>.
<p>
The separation <b>variable</b> may be specified on the command line, the default is <b>i#</b>.
<b>i#</b> is really a mathematical constant equal to the square root of -1,
but it can often be specified where variables are required in Mathomatic.
<p>
If successful, the result will contain one or more of <b>i#</b> or the specified separation <b>variable</b>.

<pre class="sample">
1&mdash;&gt; (a+b*i#)/(c+d*i#)

    (a + (b&middot;i#))
#1: &mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;
    (c + (d&middot;i#))

1&mdash;&gt; imaginary

    i#&middot;((b&middot;c) &minus; (a&middot;d))
#2: &mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;
     ((c^2) + (d^2))

2&mdash;&gt;
</pre>

<hr>
<a name="integrate"></a>
<h2>Integrate command</h2>
<p>
Syntax: <b>integrate ["constant" or "definite"] variable [order]</b>
<br>
Alternate command name: <b>integral</b>
<p>
This command computes the exact symbolic integral of a polynomial function
with respect to the specified <b>variable</b>,
using the current expression or RHS of the current equation as the function.
If successful, the simplified integral is placed in the next available equation space,
displayed, and becomes the current equation.
<p>
The default is to compute and display the <b>indefinite integral</b>,
also known as the <b>antiderivative</b> or <b>primitive</b>.
The antiderivative is the inverse transformation of the
<a href="#derivative">derivative</a>.
<p>
"integrate constant" simply adds a uniquely named <b>constant of integration</b>
("C_1", "C_2", etc.) to each integration result.
The constants of integration here are actually variables that may be set to any constant.
<p>
"integrate definite" also integrates, but prompts you for the lower and upper
bounds for <b>definite integration</b>.
If <b>g(x)</b> is the indefinite integral (antiderivative) of <b>f(x)</b>,
the definite integral is:

<pre class="indent">
g(upper_bound) &minus; g(lower_bound)
</pre>

<p>
Specifying the <b>order</b> allows you to repeatedly integrate.
The default is to integrate once (<b>order</b>=1).
<p>
This command is only capable of integrating polynomials.

<pre class="sample">
1&mdash;&gt; x^3+x^2+x+1

#1: (x^3) + (x^2) + x + 1

1&mdash;&gt; integrate x

    (x^4)   (x^3)   (x^2)
#2: ----- + ----- + ----- + x
      4       3       2

2&mdash;&gt; derivative x ; check the result
Differentiating with respect to (x) and simplifying...

#3: (x^3) + (x^2) + x + 1

3&mdash;&gt; compare 1
Comparing #1 with #3...
Expressions are identical.
3&mdash;&gt;
</pre>

<hr>
<a name="laplace"></a>
<h2>Laplace command</h2>
<p>
Syntax: <b>laplace ["inverse"] variable</b>
<p>
This command computes the Laplace transform of a polynomial function of the specified <b>variable</b>,
using the current expression or RHS of the current equation as the function.
If successful, the transformed function is placed in the next available equation space,
displayed, and becomes the current equation.
<p>
This command only works with polynomials.
<p>
A Laplace transform can be undone by applying the <b>inverse</b> Laplace transform.
This is accomplished by specifying the "inverse" option.

<pre class="sample">
1&mdash;&gt; y=1

#1: y = 1

1&mdash;&gt; laplace x ; compute the Laplace transform of 1

        1
#2: y = -
        x

2&mdash;&gt; a*x^n ; a general polynomial term

#3: a*(x^n)

3&mdash;&gt; laplace x

      a*(n!)
#4: -----------
    (x^(n + 1))

4&mdash;&gt; laplace inverse x

#5: a*(x^n)

5&mdash;&gt;
</pre>

<hr>
<a name="limit"></a>
<h2>Limit command</h2>
<p>
Syntax: <b>limit variable expression</b>
<p>
This command takes the limit of the current expression as <b>variable</b>
goes to the specified <b>expression</b>.
The result is always an equation and
placed in the next available equation space and displayed.
<p>
L'Hopital's rule for taking limits is not used by this command.
Instead the limit is taken by simplifying, solving, and substituting.
This command is experimental and does not know about negative infinity
and occasionally gives a wrong answer when dealing with infinities.

<pre class="sample">
1&mdash;&gt; 2x/(x+1)

      2&middot;x
#1: &mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;
    (x + 1)

1&mdash;&gt; limit x inf ; take the limit as x goes to infinity
Solving...

#2: answer = 2

1&mdash;&gt;
</pre>

<hr>
<a name="list"></a>
<h2>List command</h2>
<p>
Syntax: <b>list ["export" or "maxima"] [equation-number-ranges]</b>
<p>
This command displays stored expressions in single-line (one dimensional) format.
<p>
"list export" outputs expressions in exportable, single-line format.
You can cut-and-paste the expressions or redirect them to a file,
so they can be read in with a different math program.
<p>
"list maxima" is for making output compatible 
with the computer algebra system <a href="http://wxmaxima.sourceforge.net">Maxima</a>.
<p>
This command simply outputs expressions and equations as stored internally by Mathomatic.
There is no simplification and nothing more is done.
<p>
To display equation spaces in better looking multi-line fraction format,
use the <a href="#display">display command</a>.

<hr>
<a name="nintegrate"></a>
<h2>NIntegrate command</h2>
<p>
Syntax: <b>nintegrate ["trapezoid"] variable [partitions]</b>
<p>
This is a numerical integrate command that will work with almost any expression and will
not generally compute the exact symbolic integral except for the simplest of expressions.
This command will prompt you for the lower
and upper bounds to perform numerical definite integration
on the current expression or the RHS of the current equation,
with respect to the specified <b>variable</b>.
These bounds may be any expression not containing infinity.
<p>
This command uses Simpson's rule to do the approximation.
Accuracy varies widely, depending on the expression integrated,
the interval between the lower and upper bounds, and the number of <b>partitions</b>.
Setting the number of partitions greater than 10000 seldom is helpful,
because of accumulated floating point round-off error.
<p>
If "trapezoid" is specified on the command line,
the trapezoid method is used instead, which is usually less
accurate than Simpson's rule.
The way the trapezoid method works is: the interval from the lower bound to the
upper bound is divided into 1000 <b>partitions</b> to produce 1000 trapezoids,
then the area of each trapezoid is added together to produce the result.
This means that the accuracy usually decreases as the interval increases.
Simpson's rule uses the same method,
with quadratic curves bounding the top of each trapezoid,
instead of straight lines, so that curves are approximated better.
<p>
If the integration fails, chances of success are greater if
you reduce the number of variables involved in the integration.
<p>
If there are any singularities, such as division by zero, between the bounds of integration,
the computed result will be wrong.
<p>
Here is an example of successful numerical integration:

<pre class="sample">
1&mdash;&gt; y=x^0.5/(1-x^3)

              1
           (x^&mdash;)
              2
#1: y = &mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;
        (1 &minus; (x^3))

1&mdash;&gt; nintegrate x
Warning: Singularity detected, result of numerical integration may be wrong.
Enter lower bound: 2
Enter upper bound: 4
Approximating the definite integral using Simpson's rule (1000 partitions)...
Numerical integration successful.

#2: y = -0.16256117185712

2&mdash;&gt;
</pre>

<p>
This example avoids the singularity at <b>x=1</b> and is accurate to 12 digits.

<hr>
<a name="optimize"></a>
<h2>Optimize command</h2>
<p>
Syntax: <b>optimize [equation-number-range]</b>
<p>
This command splits the specified equations into smaller, more efficient equations
with no repeated expressions.
Each repeated sub-expression becomes
a new equation solved for a temporary variable (named "temp").
<p>
Note that the resulting assignment statements may be in the wrong order for inclusion in
a computer program with the <a href="#code">code command</a>;
the order and generated code should be visually checked before using.
<p>
To undo this command and substitute the split up equations into the original
equation, use the <a href="#eliminate">eliminate command</a>.

<pre class="sample">
1&mdash;&gt; y = (a+b+c+d)^(a+b+c+d)

#1: y = (a + b + c + d)^(a + b + c + d)

1&mdash;&gt; optimize

#2: temp = a + b + c + d


#1: y = temp^temp

1&mdash;&gt; eliminate temp ; undo the optimization
Solving equation #2 for (temp)...

#1: y = (a + b + c + d)^(a + b + c + d)

1&mdash;&gt;
</pre>

<hr>
<a name="pause"></a>
<h2>Pause command</h2>
<p>
Syntax: <b>pause [text]</b>
<p>
This command waits for the user to press the Enter key.
It is useful in text files (scripts) that are read in to Mathomatic.
Optionally, a one line text message may be displayed.
<p>
Typing "quit" or "exit" before pressing the Enter key will fail this command
and abort the current script.
<p>
This command is ignored during test mode and when input is not a terminal.

<hr>
<a name="product"></a>
<h2>Product command</h2>
<p>
Syntax: <b>product variable start end [step-size]</b>
<p>
This command performs a mathematical product (&prod;) of the current expression
or the RHS of the current equation
as the index <b>variable</b> goes from <b>start</b> to <b>end</b>
in steps of <b>step-size</b> (default 1).
The result is stored and displayed.
The current equation is not modified.

<pre class="sample">
1&mdash;&gt; y=a*x

#1: y = a*x

1&mdash;&gt; product
Enter variable: x
x = 1
To: 10

#2: y = 3628800*(a^10)

1&mdash;&gt; 10!
 Answer = 3628800
1&mdash;&gt;
</pre>

<hr>
<a name="push"></a>
<h2>Push command</h2>
<p>
Syntax: <b>push [equation-number-range]</b>
<p>
This command pushes the current or specified expressions into the readline
history, for easy editing and re-entry.
After this command, the pushed expressions are
accessed by using the cursor UP key.
<p>
This command only exists if Mathomatic was compiled with readline support.

<hr>
<a name="quit"></a>
<h2>Quit command</h2>
<p>
Syntax: <b>quit [exit-value]</b>
<br>
Alternate command name: <b>exit</b>
<p>
Type in this command to exit Mathomatic.
All expressions in memory are discarded.
To save all your expressions stored in equation spaces,
use the <a href="#save">save command</a> before quitting.
<p>
The optional decimal <b>exit value</b> argument is the exit status returned to the operating system.
The default is 0, meaning OK.
<p>
Another way to quickly exit Mathomatic is to enter your operating system's End-Of-File (EOF) character
at the beginning of an input line.
The EOF character for Unix-like operating systems is Control-D.

<hr>
<a name="read"></a>
<h2>Read command</h2>
<p>
Syntax: <b>read file-name</b>
<p>
This command reads in a text file as if you
typed the text of the file in at the prompts.
The text file (also known as a script)
should contain Mathomatic expressions and commands.
Read commands may be nested.
If any command or operation returns with an error,
the read operation is aborted.
<p>
Equations saved with the <a href="#save">save command</a>
are restored using this read command.
<p>
This command is automatically executed when you start up Mathomatic with
file names on the shell command line.
<p>
The default file name extension for Mathomatic input files is ".in".
A file name extension is not required.

<hr>
<a name="real"></a>
<h2>Real command</h2>
<p>
Syntax: <b>real [variable]</b>
<p>
This command copies the real part of a complex expression to the
next available equation space.
If the current expression or RHS of the current equation is not complex,
it will tell you and abort.
A complex expression contains both imaginary and real parts.
To copy the imaginary part, see the
<a href="#imaginary">imaginary command</a>.
<p>
The separation <b>variable</b> may be specified on the command line, the default is <b>i#</b>.
<p>
There will be no imaginary numbers in the result.

<pre class="sample">
1&mdash;&gt; (a+b*i#)/(c+d*i#)

    (a + (b&middot;i#))
#1: &mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;
    (c + (d&middot;i#))

1&mdash;&gt; real

    ((a&middot;c) + (b&middot;d))
#2: &mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;&mdash;
    ((c^2) + (d^2))

2&mdash;&gt;
</pre>

<hr>
<a name="replace"></a>
<h2>Replace command</h2>
<p>
Syntax: <b>replace [variables ["with" expression]]</b>
<p>
By default, this command prompts you for a replacement expression
for each variable in the current expression or equation.
If an empty line is entered for a variable, that variable remains unchanged.
The result is placed in the current expression or equation and displayed.
<p>
This command is very useful for renaming or substituting variables.
It is smart enough to do variable interchange.
<p>
If <b>variables</b> are specified on the command line,
you will be prompted for those variables only and
all other variables will be left unchanged.
<p>
If "with" is specified,
you won't be prompted and all <b>variables</b> specified will be
replaced with the <b>expression</b> that follows.

<hr>
<a name="roots"></a>
<h2>Roots command</h2>
<p>
Syntax: <b>roots root real-part imaginary-part</b>
<p>
This command displays all complex number roots
of a given positive integer <b>root</b> of a complex number.
The number of the <b>root</b> equals the number of correct solutions.
For example, "3" would give the 3 roots of the cubed root.
This command will also convert rectangular coordinates to polar coordinates.
<p>
The floating point <b>real part</b> (X coordinate)
and <b>imaginary part</b> (Y coordinate)
of the complex number are prompted for.
Just enter an empty line if the value is zero.
The polar coordinates of the given complex number are displayed first,
which consist of an amplitude (distance from the origin)
and an angle (direction).
Then each root is calculated and displayed, along with an "Inverse check" value,
which should equal the original complex number.
The "Inverse check" is calculated by repeated complex number multiplication of the root times itself.
<p>
Since double precision floating point is used, the results are only accurate from 10 to 12 decimal digits.

<pre class="sample">
1&mdash;&gt; roots
Enter root (positive integer): 3
Enter real part (X): 8
Enter imaginary part (Y):

The polar coordinates before root taking are:
8 amplitude and 0 radians (0 degrees).

The 3 roots of (8)^(1/3) are:

2
Inverse check: 8

-1 +1.73205080757*i
Inverse check: 8

-1 -1.73205080757*i
Inverse check: 8

1&mdash;&gt;
</pre>

<hr>
<a name="save"></a>
<h2>Save command</h2>
<p>
Syntax: <b>save file-name</b>
<p>
This command saves all expressions in all equation spaces into the specified text file.
If the file exists, Mathomatic will ask you if you want to overwrite it.
The saved expressions and equations can be reloaded (restored) at a later time
by using the <a href="#read">read command</a>.
You can edit the saved expressions with your favorite ASCII text editor.

<hr>
<a name="set"></a>
<h2>Set command</h2>
<p>
Syntax: <b>set [["no"] option]</b>
<p>
This command sets various options listed below, for the current session.
They remain in effect until you exit Mathomatic.
Typing "set" without arguments shows all current option settings.
<p>
The specified <b>option</b> is turned on, unless it is preceded by "no", which turns it off.
Some options can be followed by a number and some options can be followed by text,
setting that option to the following value.
<p>
To permanently change the default settings of Mathomatic,
set options can be put in the file <i>~/.mathomaticrc</i>
(for Microsoft Windows: <i>mathomatic.rc</i> in the same directory as the Mathomatic executable).
It should be a text file with one set option per line, without the word "set".
This file is loaded every time Mathomatic starts up, when not in test or secure mode.
The command "set <b>save</b>" conveniently saves all current session options in this file,
making them permanent.
"set no <b>save</b>" removes this file, so that Mathomatic starts up with all options
set to the defaults.

<h3>Options:</h3>
<blockquote>
<p>
"set <b>precision</b>" followed by an integer
less than or equal to 14 sets the display precision
in number of decimal digits for most numerical output.
All arithmetic in Mathomatic is double precision floating point,
so it is not useful to set this higher than 14 digits.
Display output is rounded to the precision set by this option,
though internally all constants are only rounded to fit in a double precision float data type
of approximately 15 decimal digits precision.
<p>
"set no <b>autosolve</b>" will disable solving by typing the solve variable at the main prompt,
unless an equals sign (=) is included.
This allows entry of single variable expressions into equation spaces.
<p>
"set no <b>autocalc</b>" will disable automatic approximation (calculation) of
purely numerical input entered at the main prompt.
Instead, numerical input will be entered into equation
spaces, so it can be operated on by commands.
<p>
"set no <b>autoselect</b>" will disable selecting of equation spaces by only typing in
the equation number.
Selecting is still possible using the <a href="#selecting">"<b>#</b>" operator</a>.
<p>
"set <b>auto</b>" and "set no <b>auto</b>" turn on and off all three of the above options
at once.
If turned off, all expressions entered at the main prompt will be entered into equation spaces,
so they can be operated on by Mathomatic commands.
<p>
"set <b>debug</b>" followed by an integer sets the debug level number.
The initial debug level is 0, for no debugging.
If the level number is 2 ("set debug=2"),
Mathomatic will show you how it solves equations.
Level 4 debugs the <a href="#simplify">simplify</a>
command and its polynomial routines.
Levels 5 and 6 show all intermediate expressions.
Set the debug level to -1 for suppression of warnings and helpful messages.
<p>
"set <b>case_sensitive</b>" will set alphabetic case sensitive mode, while
"set no case" will set case insensitive mode (all alphabetic characters
will be converted to lower case).
"set case" is the default.
<p>
"set <b>color</b>" enables color mode.
When color mode is on (which is the default),
ANSI color escape sequences are output to make expressions easier to read.
Requires a terminal emulator that supports ANSI color escape sequences.
Put the line "no color" in your <i>~/.mathomaticrc</i> file
to always startup Mathomatic with color mode disabled,
unless the <b>-c</b> or <b>-b</b> option is given.
<p>
"set <b>bold_colors</b>" enables highlighting in color mode.
It makes all output brighter.
Use this if any colors are difficult to see.
This command can be shortened to "set bold".
The <b>-b</b> option also sets this.
<p>
"set <b>columns</b>" followed by a positive integer sets the expected number of
character columns (width) on a terminal screen with line wrap.
When an expression is displayed in fraction format and it is wider
than the number of screen columns, single-line format is used, instead.
"set no columns" or "set columns=0" does no checking for screen size and always
displays in fraction format.
In most cases, this value is set automatically on startup.
This value only affects 2D output.
<p>
"set no <b>display2d</b>" will set the display mode to single-line format (one dimensional)
using the <a href="#list">list command</a>,
instead of the default fraction format (two dimensional)
using the <a href="#display">display command</a>.
Single-line format is useful when feeding Mathomatic output into another program.
<p>
"set no <b>prompt</b>" turns off Mathomatic prompt output,
exactly like the <b>-q</b> (quiet mode) option does.
<p>
"set <b>preserve</b>" will set "preserve_surds" mode, which suppresses approximation
of real roots of real rational numbers, if the result will be irrational.
A surd is a quantity which can not be expressed by rational numbers.
For example, <b>2^.5</b> (the square root of two, which is irrational and a surd)
will remain <b>2^.5</b> unless explicitly approximated
or "set no preserve" is entered.
This option is turned on by default ("set preserve_surds"),
allowing exact arithmetic and simplification of surds.
Surds can always be manually approximated with the
<a href="#approximate">approximate</a> and <a href="#calculate">calculate</a> commands.
<p>
"set <b>rationalize</b>" will set the "rationalize_denominators" option,
which attempts to move radicals from the denominator of fractions
to the numerator during simplification.  This is the default.
<p>
"set <b>modulus_mode</b>" requires an integer from 0 to 2.
When modulo arithmetic is performed with the modulus (%) operator,
mode 0 returns a result that is the same sign as the dividend (same as C's % operator gives),
mode 1 returns a result the same sign as the divisor (same as Python's % operator gives),
mode 2 returns an always positive or zero result.
Mode 2 is the default and is 100% mathematically correct and the
type of modulo operation that can be generally simplified.
Mode 0 is the remainder modulus used by the C and Java computer languages.
This mode only affects modulo (<b>%</b>) operator numeric calculations.
All modulus simplification rules are enabled, regardless of this mode.
<p>
"set <b>finance</b>" sets finance mode (fixed point display),
which displays all constants with 2 digits after the decimal point (for example: "2.00")
and negative numbers are always parenthesized (for example: "(-2.00)").
Displayed constants are rounded to the nearest cent,
though internally there is no loss of accuracy.
The number of digits to display after the decimal point may be specified with "set finance=number".
This is not truly fixed point arithmetic, it is floating point displayed as fixed point.
With double precision floating point,
only the most significant 15 decimal digits will ever be correct.
The default is no fixed point display (finance=0).
<p>
"set <b>factor_integers</b>" sets automatic factoring of integers for all displayed expressions.
When set, all integers of up to 15 decimal digits are factored into their prime factors before
the result of any command is displayed.
This command can be shortened to "set factor".
<p>
"set <b>right_associative_power</b>" associates power operators from right to left
in the absence of parentheses, so that <b>x^a^b</b> is interpreted as <b>x^(a^b)</b>.
Other math programs typically associate power operators from right to left.
The default is "set no right", which associates power operators the same as all other operators,
from left to right, resulting in <b>(x^a)^b</b>.
<p>
"set no <b>negate_highest_precedence</b>" changes
the behavior of the mathematical expression parser
to be the same as most other math programs, like Maxima.
The default is "set negate",
which gives the negate (&minus;) operator the highest precedence of all
operators, like programming languages and classic math do;
for example, giving <b>25</b> for <b>-5^2</b>.
"set no negate" gives the the negate operator the same precedence as the times
and divide operators, giving <b>-25</b> for <b>-5^2</b>,
which seems to be standard among modern math programs.
<p>
"set <b>special_variable_characters</b>" followed by 8-bit characters will allow Mathomatic
to use those characters in variable names, in addition to the normal variable name characters.
For example, "set special $" will allow variable names like "$a" and "a$",
and "set special []" will allow entry of array elements like "a[3]" for simulated array arithmetic.
There is nothing special about the specified characters, they are just allowed in variable names.
The default is backslash (<b>\</b>).
<p>
"set <b>directory</b>" followed by a directory name will change the current working directory
to that directory.
Not specifying a directory name defaults to your home directory.
This command can be shortened to "set dir".
</blockquote>

<hr>
<a name="simplify"></a>
<h2>Simplify command</h2>
<p>
Syntax: <b>simplify ["sign"] ["symbolic"] ["quick"] ["fraction"] [equation-number-range]</b>
<p>
This command fully simplifies expressions in selected equation spaces.
The result is usually the smallest possible, easily readable expression
that is equivalent to the original expression.
<p>
Use this command whenever you think an expression is not completely
simplified or if you don't like the way an expression is factored.
Sometimes simplifying more than once or using the "symbolic" option
simplifies even more.
<p>
More than one option may be specified at a time.

<h3>Options:</h3>
<blockquote>
<p>
"simplify <b>sign</b>" conveniently expands all "sign" variables
by substituting them with all possible combinations of values (+1 and -1),
storing the unique results into new equation spaces and fully simplifying.
This will effectively create one simplified equation for each solution.
<p>
The <b>"symbolic"</b> option indicates <b>(a^n)^m</b> should always be reduced to <b>a^(n*m)</b>.
This often simplifies more and removes any absolute value operations:
(<b>(a^2)^.5 = a^(2*.5) = a^1 = a</b>).
Try this "symbolic" option if the simplify command doesn't simplify well,
it often helps with powers raised to powers,
though it is sometimes not 100% mathematically correct.
<p>
The <b>"quick"</b> option skips expanding sums raised to the power of 2 or higher, like <b>(x+1)^5</b>.
Also, algebraic fractions will be simpler (less fractions within fractions) with this option.
<p>
The <b>"quickest"</b> option basically simplifies without any unfactoring nor factoring.
Running the simplify command with this option makes it complete almost instantaneously.
<p>
"simplify <b>fraction</b>" fully simplifies any expression with
division in it down to the ratio of two polynomials
or expressions,
like <a href="http://maxima.sourceforge.net/docs/manual/en/maxima_12.html#Item_003a-ratsimp">Maxima's ratsimp()</a> function does.
The result will be a single simple algebraic fraction,
like the <a href="#fraction">fraction command</a> produces,
the difference here being it will be completely simplified.
This is accomplished by full simplification without doing
"<a href="#unfactor">unfactor</a> fully" and without doing
polynomial or smart (algebraic) division on the divide operators.
</blockquote>

<p>
This simplify command applies many algebraic transformations
and their inverses (for example, <a href="#unfactor">unfactor</a> and then <a href="#factor">factor</a>)
and then tries to combine and reduce algebraic fractions and rationalize their denominators.
Complex fractions are converted to simple fractions by
making the denominators of fractions added together the same, combining and simplifying.
Polynomials with repeated or symbolic factors are factored next.
Then smart (heuristic) and polynomial division are tried on any divides,
possibly making complex fractions if it reduces the expression size.
Lastly, the expressions are nicely factored and displayed.
<p>
Smart division is a symbolic division like polynomial division,
but it tries every term in the dividend,
instead of only the term with the base variable raised to the highest power,
to make the expression smaller.

<pre class="sample">
1&mdash;&gt; (x+2^.5)^3 ; an irrational polynomial with repeated factors

            1
#1: (x + (2^-))^3
            2

1&mdash;&gt; unfactor ; multiply it out

                        1                   1
#1: (x^3) + (3*(x^2)*(2^-)) + (6*x) + (2*(2^-))
                        2                   2

1&mdash;&gt; simplify ; put it back together, since factored is its simplest form

            1
#1: (x + (2^-))^3
            2

1&mdash;&gt;
</pre>

<hr>
<a name="solve"></a>
<h2>Solve command</h2>
<p>
Syntax: <b>solve ["verify"] ["for"] variable or "0"</b>
<p>
This command automatically solves the current equation
for the specified <b>variable</b> or for zero.
The current equation is replaced with the result.
See <a href="#solving">Solving Equations</a>.
<p>
The <b>"verify"</b> option checks the result
by plugging all solutions into the original equation and simplifying and comparing.
If the resulting equation sides are identical, a "Solutions verified" message is displayed,
meaning that all solutions are correct.
Otherwise "Solution may be incorrect" is displayed, meaning at least one of the solutions
is incorrect or unverifiable.
The "verify" option only works when solving for a single variable.
<p>
The <b>"for"</b> option has no effect and is to make entering the solve command more natural.
Any options may be omitted in Mathomatic.

<hr>
<a name="sum"></a>
<h2>Sum command</h2>
<p>
Syntax: <b>sum variable start end [step-size]</b>
<p>
This command performs a mathematical summation (&sum;) of the current expression
or the RHS of the current equation
as the index <b>variable</b> goes from <b>start</b> to <b>end</b>
in steps of <b>step-size</b> (default 1).
The result is stored and displayed.
The current equation is not modified.

<pre class="sample">
1&mdash;&gt; y=a*x

#1: y = a*x

1&mdash;&gt; sum
Enter variable: x
x = 1
To: 10

#2: y = 55*a

1&mdash;&gt;
</pre>

<hr>
<a name="tally"></a>
<h2>Tally command</h2>
<p>
Syntax: <b>tally ["average"]</b>
<p>
This command prompts for a value, adds it to a running (grand)
total, simplifies and displays the running total and optional average, and repeats.
The average is the arithmetic mean, that is the running total divided by the number of entries.
No equation spaces are used.
<p>
It is a convenient way of adding, subtracting, and averaging many numbers and/or variables.
Enter a minus sign (&minus;) before each value you wish to subtract.
Enter an empty line to end.

<hr>
<a name="taylor"></a>
<h2>Taylor command</h2>
<p>
Syntax: <b>taylor variable order point</b>
<p>
This command computes the Taylor series expansion of the current
expression or RHS of the current equation, with respect to the specified <b>variable</b>.
The Taylor series uses <a href="#derivative">differentiation</a>
and is often used to approximate expressions near the specified <b>point</b>.
<p>
The Taylor series of <b>f(x)</b> at <b>point a</b> is the power series:

<pre class="indent">
f(a) + f'(a)*(x-a)/1! + f''(a)*(x-a)^2/2! + f'''(a)*(x-a)^3/3! + ...
</pre>

<p>
where <b>f'(x)</b> is the first derivative of <b>f(x)</b> with respect to <b>x</b>,
<b>f''(x)</b> is the second derivative, etc.
<p>
This command prompts you for the <b>point</b> of expansion,
which is usually a variable or 0, but may be any expression.
Typically 0 is used to generate Maclaurin polynomials.
<p>
Then it prompts you for the <b>order</b>
of the series, which is an integer indicating how many derivatives to
take in the expansion.
The default is a large number,
stopping when the derivative reaches 0.
<p>
The result is placed in the next available
equation space, displayed, and becomes the current equation.
The original expression is not modified.

<pre class="sample">
1&mdash;&gt; e^x

#1: e#^x

1&mdash;&gt; taylor
Taylor series expansion around x = point.
Enter point: 0
Enter order (number of derivatives to take): 6
6 derivatives applied.

            (x^2)   (x^3)   (x^4)   (x^5)   (x^6)
#2: 1 + x + &mdash;&mdash;&mdash;&mdash;&mdash; + &mdash;&mdash;&mdash;&mdash;&mdash; + &mdash;&mdash;&mdash;&mdash;&mdash; + &mdash;&mdash;&mdash;&mdash;&mdash; + &mdash;&mdash;&mdash;&mdash;&mdash;
              2       6      24      120     720

2&mdash;&gt;
</pre>

<hr>
<a name="unfactor"></a>
<h2>Unfactor command</h2>
<p>
Syntax: <b>unfactor ["fully"] ["quick"] ["power"] [equation-number-range]</b>
<br>
Alternate command name: <b>expand</b>
<p>
This command algebraically expands expressions in selected equation spaces by
multiplying out products of sums and exponentiated sums and then simplifying a little.
One or more options may be specified.
<p>
To illustrate what unfactoring does, suppose you have the following equations:

<pre class="sample">
1&mdash;&gt; a=b*(c+d)

#1: a = b*(c + d)

1&mdash;&gt; z=(x+y)^2

#2: z = (x + y)^2

2&mdash;&gt; unfactor all

#1: a = (b*c) + (b*d)


#2: z = (x^2) + (2*x*y) + (y^2)

2&mdash;&gt;
</pre>

<p>
<b>(x+y)^2</b> is called an exponentiated sum and
is converted to <b>(x+y)*(x+y)</b> and then multiplied out,
unless the <b>"quick"</b> option is given.
Because this is a general but inefficient expansion method,
exponentiated sums usually fail expansion when the power is greater than 10,
growing larger than will fit in an equation space.
"unfactor <b>quick</b>" only expands products of sums,
and not exponentiated sums.
<p>
The opposite of unfactoring is <a href="#factor">factoring</a>.
Careful and neat factoring is always done by the <a href="#simplify">simplify command</a>.
<p>
"unfactor <b>fully</b>" by itself expands algebraic fractions by also
expanding division of sums,
multiplying out each fraction with a sum in the numerator into the sum of
smaller fractions with the same denominator for each term in numerator.
See the example under the <a href="#fraction">fraction command</a>.
<p>
"unfactor <b>power</b>" does only power expansion, that is, <b>(a*b)^n</b>
is transformed to <b>(a^n)*(b^n)</b>, etc.

<hr>
<a name="variables"></a>
<h2>Variables command</h2>
<p>
Syntax: <b>variables ["c" or "java" or "integer"] [equation-number-range]</b>
<p>
Output all variable names used within the specified equations,
from most frequent to least frequently occurring.
The programming language options output the variable definitions
required to make <a href="#code">code</a> from the specified equations.
This does not initialize any variables, it only defines them as needed for a C or Java compiler.
This command is not necessary for generating Python code.

<hr>
<a name="version"></a>
<h2>Version command</h2>
<p>
Syntax: <b>version</b>
<p>
Outputs the version number,
Mathomatic specific compile defines used,
maximum possible memory usage, and license summary,
for the currently running version of Mathomatic.
The maximum memory usage displayed is the amount of
RAM used when all equation spaces have been filled.
It does not include stack size (which varies) or executable (code) size.

<hr>
<font color="red">Copyright &copy; 1987-2009 George Gesslein II</font>

<hr>
<span style="float:left"><a href="index.html">Up to the documentation index</a></span>
<span style="float:right"><a href="http://mathomatic.org"><img src="mathomatic16x16.png" alt="Mathomatic icon"> mathomatic.org</a></span>

</body>
</html>