# Mathomatic Command Reference

## Topics:

1. Introduction
2. Selecting Equations
3. Solving Equations

## Commands:

> Calculate Clear Code Compare Copy Derivative Divide | Edit Eliminate Extrema Factor FList Fraction Help | Imaginary Integrate Laplace Limit List NIntegrate Optimize | Pause Product Push Quit Read Real Replace | Roots Save Set Simplify Solve Sum Tally | Taylor Unfactor Version

## Introduction

At the Mathomatic prompt, you can enter:

- a numerical expression, which is instantly evaluated and displayed (autocalc),
- an algebraic expression or equation, which is stored and made the current equation,
- a variable to solve the current equation for (autosolve),
- an equation number to select as the current equation,
- a Mathomatic command (listed in this document),
- a question mark (?) for quick help,
- a semicolon (;) followed by a comment (everything on a line after a semicolon is ignored),
- or an exclamation point (!) followed by a shell (or system) command.

Mathomatic has about 37 different commands. They 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. The command is not executed until you press the Enter key. Most commands operate on the current expression or equation by default. Some commands only operate on the current expression or RHS (Right Hand Side) of the current equation.

Many commands have an equation number range argument. An equation number range may be a single equation number, a range of equation numbers separated by a dash (-), or the word "all", which specifies all stored expressions and equations. If a number is omitted, the current expression or equation is assumed.

A greater-than symbol (>) may be appended to any command line, followed by a file name. This will redirect command output to a file. If the file already exists, it will be overwritten without asking. Two greater-than symbols (>>) next to each other will append command output to a file. For example:

    list export all >filename

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.

## Selecting Equations

Syntax: #["+" or "-"]equation-number

To change the current equation number at the main prompt, type a pound sign (#) followed by the number of the equation you wish to select.

The equation number may be preceded by "+" or "-", to select an equation number relative to the current equation number.

This syntax also works when prompted for an expression. The RHS or expression at that equation number is substituted.

New feature: Selecting equations is now possible by typing only the equation number at the main prompt.

## Solving Equations

Syntax: variable-to-solve-for

Mathomatic can solve the current equation for any single variable or for zero. Solving is usually accomplished internally by applying identical mathematical operations to both sides of the equation. The Mathomatic solve algorithm is the best possible for general algebra and works perfectly.

To automatically solve for a variable, type the variable name in at the prompt. Mathomatic will proceed to manipulate the current equation until all of the solutions for the specified variable are determined. If successful, the solutions are stored in the current equation and displayed. Cubic and quintic equation solving is not supported. Quartic equations (fourth degree polynomials) can be solved if they are bi-quadratic (only degree four and degree two terms).

To solve for zero, type in "0" at the prompt. Zero solving is a special solve that will always be successful and will eliminate most divide operators from the equation.

To see all the steps performed during a solve operation, type "set debug 2" before solving.

An example of solving:

    1-> a=b+1/b

                1
    #1: a = b + -
                b

    1-> b ; solve for "b"
    Equation was quadratic.

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

    1-> 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-> simplify

                1
    #1: a = b + -
                b

    1->

## Calculate

Syntax: calculate [variable number-of-iterations]

This command prompts you for the values of each variable in the current expression or the RHS of the current equation. It then simplifies, approximates, and substitutes all "sign" variables with all possible combinations of values, displaying each solution as it does so. Nothing is modified by this command.

This command is used to approximate expressions and expand confusing "sign" variables. It is also automatically invoked when you type in a numeric expression, without any variables, at the Mathomatic prompt. No need to get out your calculator when you are using Mathomatic!

If a variable and number of iterations are supplied, you will be prompted for the initial value of the variable, and the calculation will be iterated, with the result repeatedly plugged back into the specified variable. This will be done until convergence (the output equals the input) or the number of iterations is performed.

Some examples of using the calculate command:

    1-> y=x^2+x ; the simplest quadratic equation

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

    1-> x ; solve for "x"
    Equation was quadratic.

                                  1
            -1*(1 + (((1 + (4*y))^-)*sign1))
                                  2
    #1: x = --------------------------------
                           2

    1-> calculate
    Enter y: 0
    Solution #1 with sign1 = 1:
     x = -1
    Solution #2 with sign1 = -1:
     x = 0
    1-> a=b+1 ; an example of iteration

    #2: a = b + 1

    2-> calculate b 10
    Enter initial b: b
     a = b + 10
    2->

## Clear

Syntax: clear [equation-numbers-or-ranges]

This command clears equation spaces so that they can be reused. The specified equations are deleted from memory.

"clear all" clears all memory, as if Mathomatic was restarted.

Multiple equation numbers and/or ranges may be specified, only in this command, for ease in clearing out equation spaces.

## Code

Syntax: code ["c" or "java" or "python" or "integer"] [equation-number-range]

This command outputs the current or specified equations in optimal C, Java, or Python language code. The default is C code. This output should compile correctly and emulate the equation from Mathomatic. Just define and assign the independent variables used in the actual program.

With "code integer", integer arithmetic is assumed, otherwise double precision floating point arithmetic is assumed. "code integer" is more generic and should work with the C, Java, and Python languages.

To represent factorials, the user supplied function "fact()" is called, since there is no equivalent function or operator in these languages. "fact()" functions for several languages are supplied in the directory "factorial" in the Mathomatic source distribution.

Complex number arithmetic is supported with Python only.

For the most efficient code, use the simplify and optimize commands on your equations before running this command.

## Compare

Syntax: compare equation-number ["with" equation-number]

This command compares two equations or expressions for equality. If only one argument 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.

If this command says the equations or expressions are identical, then they are definitely identical. If this command says the equations or expressions may differ, then they might be identical if one of them is too hard for Mathomatic to simplify completely.

## Copy

Syntax: copy [equation-number-range]

This command simply duplicates the current or specified equations and displays them.

## Derivative

Syntax: derivative [variable or "all"] [order]
Alternate command name: differentiate

This command computes the symbolic derivative of the current expression or equation with respect to the specified variable. It does this by recursively applying the rule of differentiation for each operator encountered and simplifying. If it is an equation, the RHS is differentiated. If successful, the derivative is placed in the next available equation space, displayed, and becomes the current equation. The original equation is not modified.

Specifying "all" computes the derivative with respect to all normal variables. It is equivalent to adding together the derivatives with respect to each variable.

Specifying the order allows you to repeatedly differentiate all at once. The default is to differentiate only once (order = 1).

If differentiation fails, it is probably because symbolic logarithms are required. Symbolic logarithms are not implemented in Mathomatic. Also, factorial and modulus cannot be differentiated.

Some examples:

    1-> x^3+x^2+x+1

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

    1-> derivative x

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

    2-> a*x^n ; Show a general rule of differentiation.

    #3: a*(x^n)

    3-> derivative x

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

    4->

## Divide

Syntax: divide [variable]

This command is for doing and experimenting with polynomial, complex number, and numerical division and Greatest Common Divisors (GCD). Mathomatic has a symbolic polynomial division routine which this command calls without any other processing.

This command prompts for the dividend (the main polynomial) and the divisor (what you want to divide the main polynomial by). The quotient and remainder are displayed. Then the GCD is displayed. If numbers were entered, the LCM (Least Common Multiple) is also displayed. The LCM is the same as the Lowest Common Denominator and is the two numbers multiplied together, divided by the GCD.

A variable 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.

The Greatest Common Divisor of a and b (gcd(a, b)) is defined as the greatest positive number or polynomial that evenly divides both a and b. The Euclidean algorithm is used by Mathomatic to compute the GCD for numbers and polynomials.

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.

The Euclidean algorithm of successive divides is the best way to compute the GCD for numbers and univariate polynomials. Multivariate polynomials require recursion or other methods.

An example of polynomial division:

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

The number of iterations displayed is the number of polynomial divides done to compute the GCD.

## Edit

Syntax: edit [file-name]

This command invokes the editor specified in the "EDITOR" environment variable.

Type "edit" at the Mathomatic prompt to edit all equations stored in the equation spaces. When you are done editing Mathomatic equations 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.

To edit an existing file and have it read in, specify the file name on the edit command line.

## Eliminate

Syntax: eliminate variables or "all" ["using" equation-number]

This command is used to combine simultaneous equations. It will scan the command line from left to right, replacing all occurrences of the specified variables in the current equation with the RHS of solved equations. If you are eliminating only one variable, 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 Right Hand Side 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.

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.

"eliminate all" is shorthand for specifying all normal variables on the command line. "eliminate all all" will eliminate all variables twice over, using each equation only once.

Here is a simple example of combining two equations:

    1-> ; This input to Mathomatic arrives at the distance between two points
    1-> ; in 3D space from the Pythagorean theorem (distance between two points
    1-> ; in 2D space).
    1->
    1-> l^2=(x1-x2)^2+(y1-y2)^2 ; Distance formula for 2D space.

    #1: l^2 = ((x1 - x2)^2) + ((y1 - y2)^2)

    1-> d^2=l^2+(z1-z2)^2 ; Add another leg.

    #2: d^2 = (l^2) + ((z1 - z2)^2)

    2-> eliminate l ; Combine the two equations.
    Solving equation #1 for (l)...

    #2: d^2 = ((x1 - x2)^2) + ((y1 - y2)^2) + ((z1 - z2)^2)

    2-> d ; Solve to get the distance formula for 3D space.

                                                             1
    #2: d = ((((x1 - x2)^2) + ((y1 - y2)^2) + ((z1 - z2)^2))^-)*sign2
                                                             2

    2-> ; The coordinate of point 1 is (x1, y1, z1) and point 2 is (x2, y2, z2).

## Extrema

Syntax: extrema variable
Alternate command name: extremum

This command computes the minimums and maximums of the current expression or the RHS of the current equation. The result is placed in the next available equation space, displayed, and becomes the current equation. The original expression is not modified.

y = f(x), where f(x) is the RHS and x is the specified variable, this command gives the values of x that make the minimums and maximums of y. This is computed by taking the derivative of f(x), setting it equal to zero, and then solving for x.

The extrema of a function are simply the values of x when the slope equals zero.

    1-> y=x^2

    #1: y = x^2

    1-> extrema x

    #2: x = 0

    2->

This function is a parabola, with a minimum at x = 0.

## Factor

Syntax: factor ["number" [integers]] or [equation-number-range] [variables]

This command will factor manually entered integers or trivially factor expressions in equation spaces.

"factor number" will prompt for integers to factor, which may be up to 14 digits. The integers should be separated with spaces. Otherwise, this command factors variables in the current or specified expressions.

When factoring expressions, it does some basic simplification and trivially factors out any common sub-expressions it can, unless variables are specified on the command line, in which case only common sub-expressions containing those variables are factored out.

For example, with the following expression:

    (b*c) + (b*d)

variable "b" factors out and the result of this command is:

    b*(c + d)

If no variables are specified on the command line, this command factors even more. All equal bases raised to any power are factored. This is called Horner factoring or Horner's rule. For example:

    1-> x^3+2x^2+3x+4

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

    1-> factor

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

    1->

To undo the factoring, use the unfactor command.

This command cannot factor polynomials. To factor polynomials with repeated or symbolic factors, use the simplify command.

## FList

Syntax: flist ["factor"] [equation-number-range] Alternate command name: display

This command displays stored expressions in multi-line fraction format.

Non-integer constants are converted to reduced fractions, if they are exactly equal to a fraction and it would improve readability.

The "factor" option causes all integers, less than or equal to 14 digits long, to be factored into their prime factors, including the numerator and denominator of fractions.

## Fraction

Syntax: fraction [equation-number-range]

This command converts expressions with any algebraic fractions in them into a single simple algebraic fraction (usually the ratio of two polynomials). It does this by combining all algebraic fractions added together with unlike denominators.

Example:

    1-> 1/x+1/y+1/z

        1   1   1
    #1: - + - + -
        x   y   z

    1-> fraction

        (((y + x)*z) + (x*y))
    #1: ---------------------
               (x*y*z)

    1-> simplify

        1   1   1
    #1: - + - + -
        x   y   z

    1->

## Help

Syntax: help [topic or command-name]

This command is provided as a quick reference. If the argument is a command name, a one line description and syntax of that command are displayed. The command name may be abbreviated.

Entering this command by itself will display a list of topics and commands.

To create a command quick reference text file, type:

    help all >quick_ref.txt

A question mark (?) is shorthand for this help command.

## Imaginary

Syntax: imaginary [variable]

This command copies the imaginary part of a complex expression to the next available equation space. If the expression or RHS of the 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 real command.

The separation variable may be specified on the command line, the default is i#.

If you want to exclude i# from the result, type the following command after the imaginary command:

    replace i# with 1

For example:

    1-> (a+b*i#)/(c+d*i#)

        (a + (b*i#))
    #1: ------------
        (c + (d*i#))

    1-> imaginary

        ((b*i#*c) - (a*d*i#))
    #2: ---------------------
           ((c^2) + (d^2))

    2-> replace i# with 1

        ((b*c) - (a*d))
    #2: ---------------
        ((c^2) + (d^2))

    2->

## Integrate

Syntax: integrate ["definite"] variable [order]
Alternate command name: integral

This command computes the symbolic integral of a function with respect to the specified variable, using the RHS of the current equation as the function. If successful, the integral is placed in the next available equation space, displayed, and becomes the current equation. The default is to compute and display the indefinite integral.

"integrate definite" also integrates, but prompts you for the lower and upper bounds for definite integration. If g(x) is the indefinite integral (anti-derivative) of f(x), the definite integral is:

    g(upper_bound) - g(lower_bound)

Specifying the order allows you to repeatedly integrate all at once. The default is to integrate only once (order = 1).

This command is not very sophisticated and is only for integrating polynomials.

    1-> x^3+x^2+x+1

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

    1-> integrate x

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

    2-> derivative x ; Check the result.

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

    3->

## Laplace

Syntax: laplace ["inverse"] variable

This command computes the Laplace transform of a function with respect to the specified variable, using the RHS of the current equation as the function. If successful, the transform is placed in the next available equation space, displayed, and becomes the current equation.

This command only works with polynomials.

Inverse Laplace transforms are done with the "inverse" option.

    1-> y=a*x^n

    #1: y = a*(x^n)

    1-> laplace x

              a*(n!)
    #2: y = -----------
            (x^(n + 1))

    2-> laplace inverse x

    #3: y = a*(x^n)

    3->

## Limit

Syntax: limit variable expression

This command takes the limit of the current expression or equation as "variable" goes to "expression", approaching "expression" from both sides. "expression" may be anything, including infinity. The result is placed in the next available equation space, displayed, and becomes the current equation.

L'Hopital's rule is not used by this command. Instead the limit is taken by solving and substitution. This command does not yet know about negative infinity.

    1-> 2x/(x+1)

          2*x
    #1: -------
        (x + 1)

    1-> limit x inf ; take the limit as x goes to infinity

    #2: answer = 2

    2->

## List

Syntax: list ["export" or "maxima"] [equation-number-range]

This command displays stored expressions in single line format.

The "export" option allows display in exportable, single line format. You can cut-and-paste the equations or redirect them to a file, so they can be read in with a different math program. "list maxima" is for making output compatible with the program Maxima.

This command simply outputs expressions and equations as stored internally by Mathomatic. There is no simplification and nothing more is done.

To display equations in fraction format, see the flist command.

## NIntegrate

Syntax: nintegrate ["trapezoid"] variable [partitions]

This is a numerical integrate command and it 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 variable. These bounds may be any expression not containing infinity.

This command uses Simpson's rule to do the approximation. Accuracy varies widely, depending on the expression integrated and the interval.

If "trapezoid" (can be shortened to "trap") 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 partitions to produce 1000 trapezoids. Then the area of each trapezoid is added together to produce the result. This means that the accuracy decreases as the interval increases. Simpson's rule uses the same method, except parabolas are used, instead of trapezoids.

If the integration fails, chances of success are greater if you reduce the number of variables involved in the integration.

If there are any singularities between the bounds of integration, the computed result will be wrong.

    1-> y=x+1

    #1: y = x + 1

    1-> nintegrate x
    Enter lower bound: 0
    Enter upper bound: x
    Approximating the definite integral using Simpson's rule...
    Integration successful.

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

    2->

This works because if g(x) is the indefinite integral (anti-derivative) of f(x), the definite integral is:

    g(upper_bound) - g(lower_bound)

In this case, it is g(x) - g(0), which is g(x) - 0, which is simply g(x).

    1-> y=x^0.5/(1-x^3)

                  1
               (x^-)
                  2
    #1: y = -----------
            (1 - (x^3))

    1-> 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...
    Integration successful.

    #2: y = -0.162561171857

    2->

This example avoids the singularity at x = 1 and is accurate to 12 digits.

## Optimize

Syntax: optimize [equation-number-range]

This command splits the specified equations into smaller multiple equations with no repeated expressions. Each repeated expression becomes a new equation solved for a temporary variable (named "temp"). Note that this command will only work if the whole expression (anything within parentheses) is repeated. It should work with partial expressions too, to be perfect.

To undo this command and substitute the split up equations into the original equation, use the eliminate command.

    1-> y = (a+b+c+d)^(a+b+c+d)

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

    1-> optimize

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

    #1: y = temp^temp

    1-> eliminate temp ; undo the optimization
    Solving equation #2 for (temp)...

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

    1->

## Pause

Syntax: pause [text]

This command waits for the user the press the Enter key. It is useful in text files that are read in to Mathomatic. Optionally, a one line text message may be displayed.

## Product

Syntax: product variable start end [step]

This command performs a mathematical product of an expression or the RHS of the current equation as the index "variable" goes from "start" to "end" in steps of "step" (default 1). The result is stored and displayed. The current equation is not modified.

    1-> y=a*x

    #1: y = a*x

    1-> product
    Enter variable: x
    x = 1
    To: 10

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

    1-> 10!
     Answer = 3628800
    1->

## Push

Syntax: push [equation-number-range]

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.

This command only exists if Mathomatic was compiled with readline support.

## Quit

Syntax: quit
Alternate command name: exit

Type in this command to exit Mathomatic. All equations and expressions in memory are discarded.

To save your stored equations and expressions, see the save command.

## Read

Syntax: read file-name

This command reads in a text file as if you typed the text of the file in at the prompts. The text file should contain Mathomatic equations and commands. Read commands may be nested. If any command or operation returns with an error, the read operation is aborted.

Equations saved with the save command are restored using this read command.

This command is automatically executed when you start up Mathomatic with file names on the command line.

The default file name extension for Mathomatic input files is ".in".

## Real

Syntax: real [variable]

This command copies the real part of a complex expression to the next available equation space. If the expression or RHS of the 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 imaginary command.

The separation variable may be specified on the command line, the default is i#.

There will be no imaginary numbers in the result.

    2-> (a+b*i#)/(c+d*i#)

        (a + (b*i#))
    #3: ------------
        (c + (d*i#))

    3-> real

        ((a*c) + (b*d))
    #4: ---------------
        ((c^2) + (d^2))

    4->

## Replace

Syntax: replace ["constants"] or [variables ["with" expression]]

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.

This command is very useful for renaming or substituting variables. It is smart enough to do variable interchange.

If variables are specified on the command line, you will be prompted for those variables only and all other variables will be left unchanged.

If "with" is specified, you won't be prompted and all variables specified will be replaced with the expression that follows.

"replace constants" approximates constants and substitutes pi and e# in the current expression or equation with their respective floating point values. This allows them to combine with other constants and may help sometimes.

## Roots

Syntax: roots root real-part imaginary-part

This command displays all complex roots of a given root of a complex number. The number of the root 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.

The real and imaginary parts of the complex number are prompted for. Just enter an empty line if the value is zero. The polar coordinates of the complex number are displayed. Polar coordinates consist of an amplitude (distance from the origin) and an angle (direction). Then each root is displayed, along with an "Inverse Check" value, which should equal the original complex number.

Since double precision floating point is used, the results may not be exact.

    1-> roots
    Enter root (positive integer): 3
    Enter real part (X): 8
    Enter imaginary part (Y):

    The polar coordinates 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->

## Save

Syntax: save file-name

This command saves all equations in the specified text file. If the file exists, Mathomatic will ask you if you want to overwrite it. The saved equations can be reloaded at a later time by using the read command. You can edit the saved equations with your favorite ASCII text editor.

## Set

Syntax: set [["no"] options]

This command sets various options for the current session. They remain in effect until you exit Mathomatic. Typing "set" without arguments shows you the current option settings.

To change the default settings of Mathomatic, put your set options in the file "~/.mathomaticrc" ("mathomatic.rc" in the same directory as the executable under Windows). It should be a text file with one set option per line, without the word "set".

### Options:

> "set no autosolve" will disable solving by typing the variable at the prompt. This allows entry of single variable expressions. When disabled, use the solve command.

> "set no autocalc" will disable automatic approximation (calculation) of purely numerical input. Instead, numerical input will be entered into equation spaces, so it can be operated on by commands.

> "set debug" followed by an integer sets the debug level number. The initial debug level is 0, for no debugging. If the level number is 2, Mathomatic will show you how it solves equations. Level 4 debugs the simplify command and its polynomial routines. Levels 5 and 6 show all intermediate expressions. Set the debug level to -1 for suppression of unnecessary helpful messages.

> "set case" 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.

> "set color" enables color mode. When color mode is on, ANSI color escape sequences are output to make equations easier to read. Requires a terminal emulator that supports ANSI color escape sequences.

> "set bold_colors" enables highlighting in color mode. It makes all output brighter. Use this if any colors are difficult to see.

> "set columns" followed by a positive integer sets the number of character columns on the screen. 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" does no checking for screen size and always displays in fraction format. In most cases, this value is set automatically on startup.

> "set no display2d" will set the display mode to single line format, instead of fraction format. Single line format is useful when feeding Mathomatic output into another program. An additional effect of "set no display2d" is constants will not be converted to fractions (i.e.: 1/2 will display as 0.5). By default, expressions are displayed in fraction format for easier reading.

> "set preserve" will set "preserve_roots" mode, which suppresses approximation of roots of rational numbers, if the result will be irrational. For example, 2^.5 will remain 2^.5 unless explicitly approximated. This is the default.

> "set true_modulus" will set true modulus mode, which is 100% mathematically correct. Pseudo-modulus mode is used by default, which is the modulus used by computer languages. Pseudo-modulus only gives the remainder of the division, which may be negative and will sometimes fail the simplification rules employed by Mathomatic. True modulus always gives a positive value or zero. This mode only affects modulo operator calculations. All true modulus simplification rules are enabled, regardless of this mode.

> "set finance" sets finance mode, which displays all constants with exactly 2 digits after the decimal point (for example: "2.00"). Displayed constants are always rounded to the nearest cent, though internally there is no loss of accuracy.

> "set factor_integers" sets automatic factoring of integers for all displayed expressions.

> "set special_variable_character" followed by an ASCII character will allow Mathomatic to use that character in variable names. For example, "set special $" will allow variable names like "$a" and "a$".

> "set directory" followed by a directory name will change the current working directory to that directory. This command can be shortened to "set dir".

## Simplify

Syntax: simplify ["symbolic"] ["quick"] [equation-number-range]

This command completely and automatically simplifies the current or specified expressions or equations.

Use this command whenever you think an expression is not completely simplified or if you don't like the way an expression is factored.

More than one option may be specified at a time.

### Options:

> The "symbolic" option indicates (a^n)^m should always be reduced to a^(n*m). This removes any absolute value operations: ((a^2)^.5 = a^(2*.5) = a^1 = a).

> The "quick" option skips expanding expressions raised to the power of 2 or higher, like (x+1)^5. Algebraic fractions are kept simple (no fractions within fractions) only when using this option.

This command applies many algebraic transformations and then tries to combine and reduce algebraic fractions and rationalize their denominators. Then smart (heuristic) and polynomial division are tried on any divides. Polynomials with repeated or symbolic factors are factored.

Smart division is like polynomial division, but it tries every term in the dividend, instead of the term raised to the highest power, to make the expression smaller.

    1-> (x+2^.5)^3 ; an irrational polynomial with repeated factors

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

    1-> unfactor ; multiply it out

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

    1-> simplify ; put it back together, since factored is its simplest form

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

    1->

## Solve

Syntax: solve variable or "0"

This command solves the current equation for the specified variable or for zero. See Solving Equations.

## Sum

Syntax: sum variable start end [step]

This command performs a mathematical summation of an expression or the RHS of the current equation as the index "variable" goes from "start" to "end" in steps of "step" (default 1). The result is stored and displayed. The current equation is not modified.

    1-> y=a*x

    #1: y = a*x

    1-> sum
    Enter variable: x
    x = 1
    To: 10

    #2: y = 55*a

    1->

## Tally

Syntax: tally

This command prompts for a value, adds it to a running total, simplifies, displays the running total and average, and repeats. No equation spaces are used.

It is a convenient way of adding, subtracting, and averaging many numbers and/or variables. Enter an empty line to end.

## Taylor

Syntax: taylor [variable] [order] [point]

This command computes the Taylor series expansion of the current expression or RHS of the current equation, with respect to the specified variable.

It prompts you for the point of expansion, which is usually a variable or 0, but may be any expression. Use 0 to generate Maclaurin polynomials.

Then it prompts you for the order of the series, which is an integer indicating how many derivatives to take in the expansion (default is infinity, until the derivative reaches 0).

The result is placed in the next available equation space, displayed, and becomes the current equation. The original expression is not modified.

    1-> e#^x

    #1: e#^x

    1-> taylor x
    Taylor approximation of current equation about x = point.
    Enter point: 0
    Enter order (number of derivatives to take): 10

                (x^2)   (x^3)   (x^4)   (x^5)   (x^6)   (x^7)   (x^8)   (x^9)    (x^10)
    #2: 1 + x + ----- + ----- + ----- + ----- + ----- + ----- + ----- + ------ + -------
                  2       6      24      120     720    5040    40320   362880   3628800

    2->

## Unfactor

Syntax: unfactor ["fully"] [equation-number-range]
Alternate command name: expand

This command algebraically expands expressions.

"unfactor fully" will fully expand algebraic fractions. Use this if just plain "unfactor" doesn't do enough.

Unfactoring is known as "expanding" or "multiplying out". To illustrate what unfactoring does, suppose you have the following equations:

    1-> a=b*(c+d)

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

    1-> z=(x+y)^2

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

    2-> unfactor all

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

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

    2->

(x+y)^2 is converted to (x+y)*(x+y) and then multiplied out.

## Version

Syntax: version

Outputs the Mathomatic version number and compile flags used.

Copyright © 1987-2006 George Gesslein II

Mathomatic Home Page