amath/amath.1

214 lines
7.1 KiB
Groff
Raw Normal View History

2021-01-11 19:37:42 +00:00
.\" Copyright (c) 2014-2021 Carsten Sonne Larsen <cs@innolan.net>
2017-04-12 22:50:51 +00:00
.\" All rights reserved.
2021-01-11 19:37:42 +00:00
.\"
2017-04-12 22:50:51 +00:00
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
2021-01-11 19:37:42 +00:00
.\"
2017-04-12 22:50:51 +00:00
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2021-01-11 20:10:34 +00:00
.TH amath 1 "Version 1.9.0" "January 11 2021"
2017-03-11 22:37:45 +00:00
.SH NAME
2017-03-24 19:09:05 +00:00
amath \- Simple command line calculator
2017-03-11 22:37:45 +00:00
.SH SYNOPSIS
2017-07-20 23:25:08 +00:00
\fC[ \fB--noansi\fR ] [ \fB--shell\fR |
.IR expression
]
2017-04-12 22:50:51 +00:00
.SH DESCRIPTION
2017-07-21 20:36:04 +00:00
\fBamath\fP features a case sensitive command line interface, internal
2017-03-11 22:37:45 +00:00
IEEE 754 calculations with 15 significant digits, calculations with
real and complex numbers, variables and user defined functions,
logarithmic and exponential functions, trigonometric and hyperbolic
function and selected mathematical constants and rounding functions.
2017-07-20 23:25:08 +00:00
.SH OPTIONS
.TP
.BR \-\-noansi
Disable output of ANSI escape codes. Default is enable.
.TP
.BR \-\-shell
Open an interactive shell.
.SH OPERATORS
2017-03-11 22:37:45 +00:00
.nf
2017-03-24 19:09:05 +00:00
+ Mathematical addition
- Mathematical subtraction
* Mathematical multiplication
/ Mathematical division
^ Mathematical exponentiation
= Assignment of variable values
| Absolute value of number
2017-07-20 23:25:08 +00:00
.fi
.SH VARIABLES AND CONSTANT
2017-03-11 22:37:45 +00:00
.nf
pi Trigonometric constant
e Euler's number
i Imaginary unit
ins Result of last calculation
.fi
2017-07-20 23:25:08 +00:00
.SH MISCELLANEOUS FUNCTIONS
2017-03-11 22:37:45 +00:00
.nf
abs Absolute value of number
sgn Mathematical signum function
round Round to nearest integer number
trunc Discard fraction part of number
floor Mathematical floor function
ceil Mathematical ceiling function
sqrt Square root function (exp 1/2)
cbrt Cube root function (exp 1/3)
lb Binary logarithm function (base 2)
ln Natural logarithm function (base e)
lg Common logarithm function (base 10)
.fi
2017-07-20 23:25:08 +00:00
.SH TRIGONOMETRIC FUNCTIONS
2017-03-11 22:37:45 +00:00
.nf
sin Trigonometric sine function
cos Trigonometric cosine function
tan Trigonometric tangent function
cot Trigonometric cotangent function
sec Trigonometric secant function
csc Trigonometric cosecant function
2017-04-12 22:50:51 +00:00
crd Trigonometric chord function
exsec Trigonometric exsecant function
excsc Trigonometric excosecant function
2017-03-11 22:37:45 +00:00
arcsin Inverse trigonometric sine function
arccos Inverse trigonometric cosine function
arctan Inverse trigonometric tangent function
arccot Inverse trigonometric cotangent function
arcsec Inverse trigonometric secant function
arccsc Inverse trigonometric cosecant function
2017-04-12 22:50:51 +00:00
arccrd Inverse trigonometric chord function
arcexsec Inverse trigonometric exsecant function
arcexcsc Inverse trigonometric excosecant function
2017-03-11 22:37:45 +00:00
.fi
2017-07-20 23:25:08 +00:00
.SH HYPERBOLIC FUNCTIONS
2017-03-11 22:37:45 +00:00
.nf
sinh Hyperbolic sine function
cosh Hyperbolic cosine function
tanh Hyperbolic tangent function
coth Hyperbolic cotangent function
sech Hyperbolic secant function
csch Hyperbolic cosecant function
arcsinh Inverse hyperbolic sine function
arccosh Inverse hyperbolic cosine function
arctanh Inverse hyperbolic tangent function
arccoth Inverse hyperbolic cotangent function
arcsech Inverse hyperbolic secant function
arccsch Inverse hyperbolic cosecant function
.fi
2017-07-20 23:25:08 +00:00
.SH EARLY TRIGONOMETRIC FUNCTIONS
2017-03-11 22:37:45 +00:00
.nf
ver Versed sine function
vcs Versed cosine function
cvs Coversed sine function
cvc Coversed cosine function
hv Haversed sine function
hvc Haversed cosine function
hcv Hacoversed sine function
hcc Hacoversed cosine function
arcver Inverse versed sine function
arcvcs Inverse versed cosine function
arccvs Inverse coversed sine function
arccvc Inverse coversed cosine function
archv Inverse haversed sine function
archvc Inverse haversed cosine function
archcv Inverse hacoversed sine function
archcc Inverse hacoversed cosine function
.fi
2017-07-20 23:25:08 +00:00
.SH STATEMENTS
.nf
2018-08-05 20:38:42 +00:00
about Show about text
2017-07-20 23:25:08 +00:00
clear Clear console window
def Define function
delete Delete variable or function
digits Set number of significant digits
eval Evaluate arithmetic expression
execute Execute statements in a file
functions Show list of user defined functions
input Change numeral input system
help Show basic help text
output Change numeral output system
list Show content of a directory
show Show content of a file
load Load variable and functions from file
save Save variable and functions to file
variables Show list of variables
version Show version string
2018-08-05 20:38:42 +00:00
license Show copyright and license texts
2017-07-20 23:25:08 +00:00
memory Show internal memory usage
exit Exit program
.fi
.SH EXIT STATUS
2017-07-21 20:36:04 +00:00
\fBamath\fP exits 0 on success and >0 if an error occurs.
2017-07-20 23:25:08 +00:00
.SH EXAMPLES
Add two numbers:
.RS
$ amath 1.3 + 2.6
.RE
.PP
Find cosine of pi/2:
.RS
$ amath "cos(pi/2)"
.RE
.PP
Find square root of minus 25:
.RS
$ amath "sqrt(-25)"
.RE
.PP
2017-07-21 20:36:04 +00:00
Show only 5 digits in the result of a division:
2017-07-20 23:25:08 +00:00
.RS
$ amath "digits 5;34/11"
.RE
.PP
Script block with functions:
.RS
2017-03-11 22:37:45 +00:00
.nf
round(1.5461);round(-1.5461);
ceil(43.5461);ceil(-43.5461);
floor(39.9531);floor(-39.9531);
trunc(23.827);trunc(-23.827);
sqrt(100);sqrt(52.23);
.fi
2017-07-20 23:25:08 +00:00
.RE
.PP
Script block with user defined functions:
.RS
2017-03-11 22:37:45 +00:00
.nf
f(x)=x*2+1;
g(y)=y^2+y*1.5+2;
a=2;b=3;c=a+b;
f(2.2);c+1.1;
.fi
2017-07-20 23:25:08 +00:00
.RE
2017-07-21 20:36:04 +00:00
.SH BUGS
2017-07-16 21:07:14 +00:00
.IP \[bu] 2
2017-07-21 20:36:04 +00:00
If \fBamath\fP is linked with system libraries (-lm) sometimes the real part
2017-07-16 21:07:14 +00:00
of a result of arccosh of a complex number, is negative instead of positive.
.IP \[bu]
coth() with complex numbers is inaccurate on the 14th digit.
2017-07-21 20:36:04 +00:00
.sp
Please report any other bugs that you encounter via:
.br
\fIhttps://gitlab.com/rnger/amath/issues\fR.
2017-04-12 22:50:51 +00:00
.SH HOMEPAGE
2017-07-14 09:30:24 +00:00
https://amath.innolan.net/
2017-07-21 20:36:04 +00:00
.SH SEE ALSO
amathc(3), amathr(3), amathi(3)
2017-04-12 22:50:51 +00:00
.SH AUTHORS
2017-07-20 23:25:08 +00:00
Written by Carsten Sonne Larsen <cs@innolan.net>. Floating point to string
conversion is based on software written by Ryan Juckett. The code in complex
calculations is derived from software written by Stephen L. Moshier. The code
in MemSet and MemCopy is derived from software contributed to Berkeley by
2017-07-21 20:36:04 +00:00
Mike Hibler and Chris Torek.