Actual Mathomatic output from the examples script
Mathomatic version 15.1.4 (www.mathomatic.org)
Copyright (C) 1987-2010 George Gesslein II.
100 equation spaces available, 1920 kilobytes per equation space.
HTML color mode enabled; disable with the -c option or "set no color".
1—> ; This is a line comment. This file shows some simple examples of Mathomatic usage.
1—>
1—> ; Equations are entered by just typing them in:
1—> c^2=a^2+b^2 ; The Pythagorean theorem, "c" squared equals "a" squared plus "b" squared.
#1: c^2 = (a^2) + (b^2)
1—> ; The entered equation becomes the current equation and is displayed.
1—> display ; The display command by itself displays the current equation again.
#1: c^2 = (a^2) + (b^2)
1—> ; The current equation can be solved by simply typing in a variable name:
1—> c ; which is shorthand for the solve command. Solve for variable "c".
1
#1: c = (((a^2) + (b^2))^-)·sign
2
1—> ; "sign" variables are special two-valued variables that may only be +1 or -1.
1—> b ; Solve for variable "b".
1
#1: b = (((c^2) − (a^2))^-)·sign0
2
1—> ; To output programming language code, use the code command:
1—> code ; C language code is the default.
b = (pow(((c*c) - (a*a)), (1.0/2.0))*sign0);
1—>
1—> code java ; Mathomatic can also generate Java
b = (Math.pow(((c*c) - (a*a)), (1.0/2.0))*sign0);
1—>
1—> code python ; and Python code.
b = ((((c*c) - (a*a))**(1.0/2.0))*sign0)
1—>
1—> ; ********************************************************************
1—> a=b+1/b ; Enter another equation; this is actually a quadratic equation.
1
#2: a = b + -
b
2—> 0 ; Solve for zero.
#2: 0 = (b·(b − a)) + 1
2—> unfactor ; Expand, showing that this is a quadratic polynomial equation in "b".
#2: 0 = (b^2) − (b·a) + 1
2—> solve verify b ; Solve for variable "b", verifying the result.
Equation is a degree 2 polynomial in (b).
Equation was solved with the quadratic formula.
1
(((((a^2) − 4)^-)·sign) + a)
2
#2: b = ----------------------------
2
Solutions verified.
2—> a ; Solve back for "a" and we should get the original equation.
Equation is a degree 0.5 polynomial in (a).
Raising both equation sides to the power of 2 and unfactoring...
((b^2) + 1)
#2: a = -----------
b
2—> simplify ; The simplify command makes expressions simpler and prettier.
1
#2: a = b + -
b
2—> ; ********************************************************************
2—> ; Mathomatic is also handy as an advanced calculator.
2—> ; Expressions without variables entered at the main prompt are instantly evaluated:
2—> 2+3
answer = 5
2—> 2^.5 ; The square root of 2, rounded to the default 14 digits:
answer = 1.4142135623731
2—> e^(pi*i)+1 ; Euler's identity is made of the most important universal constants.
Warning: Complex number roots approximated.
answer = 0
2—> ; ********************************************************************
2—> ; Symbolic logarithms like log(x) are currently not implemented in Mathomatic.
2—> 27^y=9 ; An example that uses numerical logarithms.
#3: 27^y = 9
3—> solve verify y ; Solve for y, verifying the result.
2
#3: y = -
3
Solution verified.
3—> ; ********************************************************************
3—> 0=2x^2-3x-20 ; A simple quadratic equation, to show how the calculate command works.
#4: 0 = (2·(x^2)) − (3·x) − 20
4—> solve verify x ; Solve for x, plugging the results into the original equation to verify.
Equation is a degree 2 polynomial in (x).
Equation was solved with the quadratic formula.
(3 − (13·sign))
#4: x = ---------------
4
Solutions verified.
4—> calculate ; Expand "sign" variables and approximate the RHS (Right Hand Side).
There are 2 solutions.
Solution number 1 with sign = 1:
x = -2.5 = -5/2
Solution number 2 with sign = -1:
x = 4
4—> ; The calculate command also lets you to plug values into a formula with variables, if any.
4—> display; Display the current equation, showing that it was not modified by calculate.
(3 − (13·sign))
#4: x = ---------------
4
Finished reading file "examples.in".
4—>
End of input.
www.mathomatic.org