.TH thmath 1 "March 22, 2005" "version 1.0" "ThMath Manual"
.SH NAME
\fBthmath\fR \- it'th a thmath to uthe thtring math...
.SH SYNOPSIS
.nf
\fBthmath\fR \fIoperation\fR [\fIargument1\fR] [\fIargument2\fR]
.fi
.SH DESCRIPTION
\fBthmath\fR is a command line interface to the C++ library Thmath, written by Jonathan Bettencourt for use by the PXI Project Team.
.PP
\fBthmath\fR will perform math operations on strings, using arbitrary precision.
.SH OPTIONS
\fIOperation\fR is one of the following:
.PP
.nf
Testing:
listops test signtest signtest2
Arithmetic:
zero equal compare trim
add subtract multiply divide
div mod square sqrt
pow trunc abs sign
Logarithms:
ln exp
Trigonometry:
sin cos tan
cot sec csc
asin acos atan
acot asec acsc
Hyperbolic:
sinh cosh tanh
coth sech csch
asinh acosh atanh
acoth asech acsch
Gamma:
factorial gamma
Complex Numbers:
czero cequal ccompare ctrim
cadd csubtract cmultiply cdivide
cdiv cmod csquare csqrt
cpow ctrunc cabs csign
.fi
.PP
\fBlistops\fR and \fBtest\fR take no arguments.
.PP
\fBzero\fR, \fBtrim\fR, \fBsquare\fR, \fBsqrt\fR, \fBtrunc\fR, \fBabs\fR, \fBsign\fR, \fBln\fR, \fBexp\fR, \fBsin\fR, \fBcos\fR, \fBtan\fR, \fBcot\fR, \fBsec\fR, \fBcsc\fR, \fBasin\fR, \fBacos\fR, \fBatan\fR, \fBacot\fR, \fBasec\fR, \fBacsc\fR, \fBsinh\fR, \fBcosh\fR, \fBtanh\fR, \fBcoth\fR, \fBsech\fR, \fBcsch\fR, \fBasinh\fR, \fBacosh\fR, \fBatanh\fR, \fBacoth\fR, \fBasech\fR, \fBacsch\fR, \fBfactorial\fR, \fBgamma\fR, \fBczero\fR, \fBctrim\fR, \fBcsquare\fR, \fBcsqrt\fR, \fBctrunc\fR, \fBcabs\fR, and \fBcsign\fR take one argument.
.PP
\fBsigntest\fR, \fBsigntest2\fR, \fBequal\fR, \fBcompare\fR, \fBadd\fR, \fBsubtract\fR, \fBmultiply\fR, \fBdivide\fR, \fBdiv\fR, \fBmod\fR, \fBpow\fR, \fBcequal\fR, \fBccompare\fR, \fBcadd\fR, \fBcsubtract\fR, \fBcmultiply\fR, \fBcdivide\fR, \fBcdiv\fR, \fBcmod\fR, and \fBcpow\fR take two arguments.
.PP
Arguments are strings of the digits 0\-9, optionally with a minus sign (\-) at the beginning indicating a negative number, and/or a decimal point (. or ,) anywhere in the string indicating a non\-integer number. Any other characters in the string, including spaces and duplicate decimal points, will cause unexpected behavior.
.PP
The complex number functions take complex numbers of the form a\;b (equivalent to a+bi) as their arguments. The semicolon (\;) is used to separate the real part (a) from the imaginary part (b). For example, \fBthmath cdivide 4\;2 3\;-1\fR will return \fB1\;1\fR [(4+2i)/(3-i) = 1+i] and \fBthmath cmultiply 3\;2 3\;-2\fR will return \fB13\fR [(3+2i)(3\-2i) = 13]. Depending on your shell, you may have to escape the semicolon character with a backslash (\\).
.PP
Zero, equality, comparison, addition, subtraction, truncation, absolute value, and sign are the fastest operations. Multiplication and squaring are about 30 times slower than addition, and division and square root are about 200 times slower than multiplication. All of these basic operations should finish within a second with reasonable lengths of numbers.
.PP
Integer powers, factorials of multiples of 1/2, and logarithms of powers of 2 should finish within a second. Regular hyperbolic and trigonometric functions and the exponential function usually finish within minutes. Inverse hyperbolic and trigonometric functions and the natural logarithm function can take a few minutes or a few hours to compute. Non\-integer powers and other factorials take even longer.
.SH EXAMPLES
.nf
thmath multiply 12 12
=> 144
thmath multiply 88888888 88888888
=> 7901234409876544
thmath square 88888888
=> 7901234409876544
thmath cmultiply 3\;2 3\;-2
=> 13
thmath cdivide 3\;7 4\;5
=> 1\;1
thmath gamma 10
=> 362880
thmath cmultiply 3\;7 4\;5
=> -23\;43
thmath multiply 7 2,5
=> 17.5
.fi
.SH OUTPUT
For most operations, \fBthmath\fR will output the result of the mathematical operation or function.
.PP
For the \fBtest\fR operation, \fBthmath\fR will return the number of additions, subtractions, multiplications, divisions, fifth powers, and square roots it can perform on 20-digit numbers in a second.
.PP
For the \fBsigntest\fR operation, \fBthmath\fR will return all possible combinations of adding, subtracting, multiplying, and dividing both positive and negative versions of the two arguments.
.PP
For the \fBsigntest2\fR operation, \fBthmath\fR will return all possible combinations of comparing and exponentiating both positive and negative versions of the two arguments.
.PP
If an invalid number of parameters is passed, \fBthmath\fR will output:
.PP
.nf
Not enough parameters given to operation.
.fi
.PP
If an unknown operation is specified, \fBthmath\fR will output:
.PP
.nf
Unknown operation.
.fi
.PP
.SH EXIT STATUS
\fBthmath\fR always returns 0 for the exit status.
.SH AUTHOR
.nf
Jonathan Bettencourt,
Kreative Korporation
(heyyou (at) kreativekorp.cjb.net)
.fi