Actual timed Mathomatic output from the examples script
Mathomatic version 15.8.4
Copyright © 1987-2012 George Gesslein II.
200 equation spaces available in memory,
1920 kilobytes per equation space.
HTML color mode enabled; manage by typing "help color".
1−>
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−> ; 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−> repeat echo *
*******************************************************************************
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
Solving equation #2 for b with verification...
Equation is a degree 2 polynomial equation in (b).
Equation was solved with the quadratic formula.
1
((((a^2 − 4)^–)·sign) + a)
2
#2: b = ––––––––––––––––––––––––––
2
All solutions verified.
2−> a ; Solve back for "a" and we should get the original equation.
Equation is a degree 0.5 polynomial equation in (a).
Raising both equation sides to the power of 2 and expanding...
(b^2 + 1)
#2: a = –––––––––
b
2−> simplify ; The simplify command makes expressions simpler and prettier.
1
#2: a = b + –
b
2−> repeat echo *
*******************************************************************************
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
3−> 495/44 ; Fractions are always reduced to their simplest form:
answer = 11.25 = 45/4
4−> ; Fractions greater than 1 can easily be displayed as mixed fractions.
4−> display mixed ; Display above fraction as a mixed fraction:
1
#4: answer = 11 + –
4
4−> display factor ; Integers and fractions are easily factored:
(3^2·5)
#4: answer = –––––––
2^2
4−> 2^.5 ; The square root of 2, rounded to the default 14 digits:
answer = 1.4142135623731
5−>
5−> repeat echo *
*******************************************************************************
5−> ; Symbolic logarithms like log(x) are not implemented, yet.
5−> 27^y=9 ; An example that uses numeric logarithms.
#6: 27^y = 9
6−> solve verify y
Solving equation #6 for y with verification...
2
#6: y = –
3
Solution verified.
6−>
6−> repeat echo *
*******************************************************************************
6−> 0=2x^2-3x-20 ; A simple quadratic equation, to show how the calculate command works.
#7: 0 = (2·x^2) − (3·x) − 20
7−> solve verify x ; Solve for x, plugging the results into the original equation to verify.
Solving equation #7 for x with verification...
Equation is a degree 2 polynomial equation in (x).
Equation was solved with the quadratic formula.
(3 − (13·sign))
#7: x = –––––––––––––––
4
All solutions verified.
7−> 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
7−> ; The calculate command also lets you plug values into a formula with variables, if any.
7−> display; Display the current equation, showing that it was not modified by calculate.
(3 − (13·sign))
#7: x = –––––––––––––––
4
Successfully finished reading file "examples.in".
7−>
End of input.
real 0.00 user 0.00 sys 0.00 seconds total execution time.
www.mathomatic.org