At the Mathomatic prompt, you can enter:
Mathomatic has about 30 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 equation by default.
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 equations. If omitted, the operation is performed on the current equation.
A greater-than symbol (>) may be appended to any command line, followed by a file name. This will redirect equation output to a file. Two greater-than symbols (>>) next to each other will append equation output to a file. For example:
list export all >filename
will output all equations to a file in exportable, single-line per equation format, so they can be read in by a different math program.
Syntax: #equation-number-to-select[[:] new-equation]
To change the current equation number, type a pound sign (#) followed by the number of the equation you wish to select. If the number is followed by a space and a new equation, the equation at the number is replaced with the new equation. To enter an equation without any simplification, append a colon (:) to the equation number.
Syntax: variable-to-solve-for
Mathomatic can solve the current equation for any single variable or for zero.
To solve for a variable, just type the variable 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. A solve operation for zero will always be successful.
To see all the steps performed during a solve operation, type "set debug 2" before solving.
An example:
1-> a=b+1/b 1 #1: a = b + - b 1-> b ; solve for "b" Unfactoring... Solving for zero... The highest power of (b) in equation is 2 Equation was quadratic. 1 (a - ((((a^2) - 4)^-)*sign1)) 2 #1: b = ----------------------------- 2 1-> a ; solve for "a", to check the answer Unfactoring... Solving for zero... Unfactoring... Raising both sides to the power of 2 and unfactoring... ((b^2) + 1) #1: a = ----------- b 1-> simplify 1 #1: a = b + - b 1->
Syntax: calculate [equation-number]
This command prompts you for the values of each variable in the Right Hand Side of the current or specified equation. It then simplifies the result and automatically substitutes "sign" variables with all possible values, 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 the values for. The equation is not modified by this command.
This command is used to approximate the RHS and expand confusing "sign" variables in a solved equation. 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!
An example:
1-> y=x^2+x+1 #1: y = (x^2) + x + 1 1-> x Unfactoring... Solving for zero... The highest power of (x) in equation is 2 Equation was quadratic. 4*y 1 -1*(1 + (((3*(--- - 1))^-)*sign1)) 3 2 #1: x = ---------------------------------- 2 1-> calculate Enter y: 0 Solution #1 with sign1 = 1: x = (-0.86602540378444*i#) - 0.5 Solution #2 with sign1 = -1: x = (0.86602540378444*i#) - 0.5 1->
Syntax: clear [equation-number-range]
This command clears equation spaces so that they can be reused. The specified equations are deleted from memory.
The argument may be the equation number to delete, a range of equation numbers to delete, or "all" to delete all equations. As with other commands, the default equation is the current equation.
Syntax: code ["c" or "java" or "integer"] [equation-number-range]
This command displays the current or specified equations in C or Java 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 C or Java program.
With "code integer", integer variables are assumed, otherwise double precision floating point arithmetic is assumed. There are two reasons an equation may not be listable with "code integer": if it contains non-integer constants or if it requires the "pow()" function.
To represent factorials, the user supplied function "fact()" is called, since there is no equivalent function or operator in the C or Java language.
For the most efficient code, use the "simplify" and "optimize" commands on your equation before running this command.
1-> y=(a+b+c)^(a+b+c) #1: y = (a + b + c)^(a + b + c) 1-> optimize #2: temp = a + b + c #1: y = temp^temp 1-> code c all y = pow(temp, temp); temp = (a + b + c); 1->
Note that in the above example, you have to swap the lines around to assign the "temp" variable first.
Syntax: compare equation-number ["with" equation-number]
This command compares two equations 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 are identical, then the equations are definitely identical. If this command says the equations may differ, then the equations might be identical if one of the equations is too hard for Mathomatic to simplify completely.
This command first compares the Right Hand Sides of both equations, if they are solved for a variable. If they are not equal, it solves both equations for zero, so it can compare the whole equations.
An example:
1-> y=e#^x #1: y = e#^x 1-> derivative x #2: y' = e#^x 2-> compare 1 with 2 Comparing equation #1 with #2... Variable (y) in the first equation is equal to (y') in the second equation. 2->
Syntax: copy [equation-number-range]
This command simply duplicates the current or specified equations and displays them.
Syntax: derivative [variable or "all"] [order]
This command computes the symbolic derivative of a function with respect to the specified variable, using the Right Hand Side of the current equation as the function. 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).
Some examples:
1-> y=x^3+x^2+x+1 #1: y = (x^3) + (x^2) + x + 1 1-> derivative x #2: y' = (3*(x^2)) + (2*x) + 1 2-> y=a*x^n ; Show a general rule of differentiation. #3: y = a*(x^n) 3-> derivative x #4: y' = a*n*(x^(n - 1)) 4->
Syntax: divide [variable]
This command is for doing and experimenting with polynomial and numerical division and Greatest Common Divisors. 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 (Greatest Common Divisor) is displayed. If just numbers were entered, the LCM (Least Common Multiple) is also displayed. The LCM is the same as the Lowest Common Denominator.
A variable may be specified on the command line as the base variable of the two polynomials, but it is usually not necessary because Mathomatic automatically selects a base variable.
The Greatest Common Divisor of "a" and "b" is defined as the greatest number or polynomial that evenly divides both "a" and "b". The Euclidean algorithm is used by Mathomatic to compute the GCD for both numbers and polynomials.
The GCD is the best way to reduce any fraction to its simplest form. Just divide the numerator and denominator by the GCD, and replace them with the quotients (there will be no remainder), and your fraction is completely reduced. The GCD is also used when factoring polynomials.
The Euclidean algorithm of successive divides is the best way to compute the GCD for numbers and univariate polynomials. Multivariate polynomials usually require something more.
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 Found polynomial Greatest Common Divisor (iterations = 1): (x^2) - (2*x) + 2 1->
Syntax: edit [file-name]
This command invokes the editor specified in the "EDITOR" environment variable.
Just 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, just specify the file name on the "edit" command line.
Syntax: eliminate variables or "all" ["using" equation-number]
This command is used to combine simultaneous equations. It will replace all occurrences of the specified variables in the current equation with solved equations, essentially eliminating the specified variables from the current equation. If you are eliminating only one variable, the equation to solve can be specified using the "using" argument. If the "using" equation number 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.
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).
Syntax: factor ["number" [integers]] or [equation-number-range] [variables]
This command will factor integers or equations.
"factor number" will prompt for an integer to factor, which may be up to 14 digits. Otherwise, the "factor" command factors variables in the current or specified equations.
When factoring an equation, it does some basic simplification and trivially factors any variables it can, unless variables are specified on the command line, in which case only those variables are factored out.
For example, with the following equation:
a = (b*c)+(b*d)
variable "b" factors out and the result of this command is:
a = 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. For example:
1-> y=b^2+b #1: y = (b^2) + b 1-> factor #1: y = b*(b + 1) 1->
This command usually cannot factor polynomials. To factor polynomials, use the "simplify" command.
Syntax: group ["factor"] [equation-number-range]
This command groups divisors together and displays equations in fraction format. It makes equations with divides in it more readable. For example, "a/b/c" will convert to "a/(b*c)", and then be displayed as:
a ----- (b*c)
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.
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 is displayed. The command name may be abbreviated.
Entering this command by itself will display a list of topics and commands.
Syntax: imaginary [equation-number]
This command copies the imaginary part of a complex equation to the next available equation space. If the equation is not complex, it will tell you and abort. A complex equation is an equation that contains both imaginary and real parts. To copy the real part, see the "real" command.
The equation to be separated should first be solved and simplified. If you want to exclude "i#" from the result, type the following command after the "imaginary" command:
replace i# with 1
Syntax: integrate variable [order]
This command computes the symbolic anti-derivative of a function with respect to the specified variable, using the Right Hand Side of the current equation as the function. If successful, the indefinite integral is placed in the next available equation space, displayed, and becomes the current equation.
Specifying the order allows you to repeatedly integrate all at once. The default is to integrate only once (order = 1).
Currently, only polynomials may be integrated.
An example:
1-> y=x^3+x^2+x+1 #1: y = (x^3) + (x^2) + x + 1 1-> integrate x (x^4) (x^3) (x^2) #2: y = ----- + ----- + ----- + x 4 3 2 2-> derivative x ; Check the result. #3: y' = (x^3) + (x^2) + x + 1 3->
Syntax: laplace ["inverse"] variable
This command computes the Laplace transform of a function with respect to the specified variable, using the Right Hand Side 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.
Currently, only polynomials in the specified variable will work. Inverse Laplace is done with the "inverse" option.
An example:
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->
Syntax: list ["export"] [equation-number-range]
This command displays the current equation in single line format, if typed with no arguments. It is typically used with the argument "all" to display all stored equations.
The "export" option allows display in exportable, single line format. You can cut-and-paste or redirect to a file the equations, so they can be read in with a different math program.
To display equations in fraction format, see the "group" command.
Syntax: optimize [equation-number]
This command splits the specified equation into smaller multiple equations with no repeated expressions. Each repeated expression becomes a new equation solved for a temporary variable ("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.
An example:
1-> y=(a+b+c)^(a+b+c) #1: y = (a + b + c)^(a + b + c) 1-> optimize #2: temp = a + b + c #1: y = temp^temp 1-> eliminate temp ; undo the optimization Solving equation #2 for (temp)... #1: y = (a + b + c)^(a + b + c) 1->
Syntax: pause
This command waits for the user the press the Enter key. It is useful in text files that are read in to Mathomatic.
Syntax: product variable low high
This command performs a mathematical product of the RHS of the current equation as the index "variable" varies from "low" to "high". "low" and "high" must be integers. The result is stored and displayed as a new equation, unless the result is just a constant, which is just displayed. The current equation is not modified.
You are prompted for the variable and range, if not specified on the command line.
An example:
1-> y=a*x #1: y = a*x 1-> product Enter variable: x x = 1 To: 10 #2: y = 3628800*(a^10) 2-> 10! Answer = 3628800 2->
Syntax: quit
Type in this command to exit Mathomatic. All equations are discarded.
To save your equations, see the "save" command.
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".
Syntax: real [equation-number]
This command copies the real part of a complex equation to the next available equation space. If the equation is not complex, it will tell you and abort. A complex equation is an equation that contains both imaginary and real parts. To copy the imaginary part, see the "imaginary" command.
The equation should be solved and simplified before this command is executed. There will be no imaginary numbers in the result.
Syntax: replace [variables ["with" expression]]
By default, this command prompts you for a replacement expression for each variable in the current equation. If an empty line is entered for a variable, the variable remains unchanged. The result is placed in the current equation and displayed.
This command is very useful for renaming or substituting variables in an equation. 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, all variables specified will be replaced with the expression that follows.
Syntax: roots
This command displays all complex roots of a given root of a complex or real number. The number of the root is prompted for, first. For example, "3" would give the 3 roots of the cubed root. Next, the real and imaginary parts of the complex number are prompted for. Just enter an empty line if the value is zero. Then each root is displayed, along with an "Inverse Check" value, which should equal the original complex number.
1-> roots Enter root (positive integer): 3 Enter real part: 8 Enter imaginary part: The 3 roots of (8 + 0*i#)^(1/3) are: 2 + 0*i# Inverse Check: 8 + 0*i# -1 + 1.7320508075689*i# Inverse Check: 8 + -5.1781495757908e-15*i# -1 + -1.7320508075689*i# Inverse Check: 8 + -1.2338871244189e-14*i# 1->
Note in the above example that slight floating point errors are introduced, due to many arithmetic operations being performed.
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.
Syntax: sensitivity variables
This command creates, stores, and then displays the exact sensitivity equation for the specified variable or variables in the current equation. The current equation must first be solved for a normal variable. The sensitivity equation is placed in the next available equation space and becomes the current equation. The original equation is not modified.
The sensitivity equation will show you what percent the output variable value changes when the input variable changes a certain percent. It does NOT show you the maximum change within an interval, instead it shows you the exact change at a certain percent.
If you have an equation:
y = f(x)
the sensitivity of "x" is found by using the following equation:
f(x)*(1+(y_percent_change/100)) = f(x*(1+(x_percent_change/100)))
and then solving for "y_percent_change".
An example:
1-> y=a*x #1: y = a*x 1-> sensitivity x #2: y_percent_change = x_percent_change 2->
Syntax: set ["no"] [option]
This command sets various options for the current session. They remain in effect until you exit Mathomatic. Typing "set" with no arguments shows you the current option settings.
"set debug" followed by an integer sets the debug level number. 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. The initial debug level is 0, for no debugging.
"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 no case" is the default.
"set color" enables ANSI color mode.
"set columns" followed by a positive integer sets the number of character columns on the screen. When an equation 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, equations 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" in all Mathomatic operations. The default is "set no preserve".
"set directory" followed by a directory name will change the current working directory to that directory. This command can be shortened to "set dir".
Syntax: simplify ["symbolic" or "quick" or "poly"] [equation-number-range]
This command completely simplifies the current or specified equations.
Use this command whenever you think an equation is not completely simplified or if you don't like the way an equation is factored.
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.
The "poly" option treats expressions like polynomials and sometimes simplifies better. The only difference for now is that polynomial division is tried before smart division.
This command applies some algebraic transformations and then tries to reduce fractions by finding and dividing by the GCD. 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 just the term raised to the highest power, to make the expression smaller.
Syntax: sum variable low high
This command performs a mathematical summation of the RHS of the current equation as the index "variable" varies from "low" to "high". "low" and "high" must be integers. The result is stored and displayed as a new equation, unless the result is just a constant, which is just displayed. The current equation is not modified.
You are prompted for the variable and range, if not specified on the command line.
An example:
1-> y=a*x #1: y = a*x 1-> sum Enter variable: x x = 1 To: 10 #2: y = 55*a 2->
Syntax: tally
This command prompts for a value, adds it to a running total, simplifies, displays the running total, and repeats. No equations are modified. It is a convenient way of adding and subtracting many numbers. Enter an empty line to end.
Syntax: taylor variable
This command computes the Taylor series expansion of the current equation with respect to the variable specified on the command line. The expansion is performed on the expression to the right of the equals sign only.
It prompts you for the "point" of expansion, which is usually a variable, but may be a constant or expression. Then it prompts you for the order of the series, which is an integer indicating how many derivatives to take in the expansion. The result is placed in the next available equation space, displayed, and becomes the current equation.
An example:
1-> y=e#^x #1: y = e#^x 1-> tayl 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: y = 1 + x + ----- + ----- + ----- + ----- + ----- + ----- + ----- + ------ + ------- 2 6 24 120 720 5040 40320 362880 3628800 2->
Syntax: unfactor ["fully"] [equation-number-range]
This command algebraically expands the current equation if typed with no arguments. The argument specifies which equations to expand.
"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:
a = b*(c+d) z = (x+y)^2
If you unfactor the above equations, you will get:
a = (b*c)+(b*d) z = (x^2)+(2*x*y)+(y^2)
((x+y)^2) is converted to ((x+y)*(x+y)) and then multiplied out.
Copyright © 2000 George Gesslein II