Simple command line calculator http://amath.innolan.net
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

amath.1 7.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214
  1. .\" Copyright (c) 2014-2018 Carsten Sonne Larsen <cs@innolan.net>
  2. .\" All rights reserved.
  3. .\"
  4. .\" Redistribution and use in source and binary forms, with or without
  5. .\" modification, are permitted provided that the following conditions
  6. .\" are met:
  7. .\" 1. Redistributions of source code must retain the above copyright
  8. .\" notice, this list of conditions and the following disclaimer.
  9. .\" 2. Redistributions in binary form must reproduce the above copyright
  10. .\" notice, this list of conditions and the following disclaimer in the
  11. .\" documentation and/or other materials provided with the distribution.
  12. .\"
  13. .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
  14. .\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
  15. .\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  16. .\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
  17. .\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
  18. .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  19. .\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  20. .\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  21. .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  22. .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  23. .TH amath 1 "Version 1.8.4" "August 05 2018"
  24. .SH NAME
  25. amath \- Simple command line calculator
  26. .SH SYNOPSIS
  27. \fC[ \fB--noansi\fR ] [ \fB--shell\fR |
  28. .IR expression
  29. ]
  30. .SH DESCRIPTION
  31. \fBamath\fP features a case sensitive command line interface, internal
  32. IEEE 754 calculations with 15 significant digits, calculations with
  33. real and complex numbers, variables and user defined functions,
  34. logarithmic and exponential functions, trigonometric and hyperbolic
  35. function and selected mathematical constants and rounding functions.
  36. .SH OPTIONS
  37. .TP
  38. .BR \-\-noansi
  39. Disable output of ANSI escape codes. Default is enable.
  40. .TP
  41. .BR \-\-shell
  42. Open an interactive shell.
  43. .SH OPERATORS
  44. .nf
  45. + Mathematical addition
  46. - Mathematical subtraction
  47. * Mathematical multiplication
  48. / Mathematical division
  49. ^ Mathematical exponentiation
  50. = Assignment of variable values
  51. | Absolute value of number
  52. .fi
  53. .SH VARIABLES AND CONSTANT
  54. .nf
  55. pi Trigonometric constant
  56. e Euler's number
  57. i Imaginary unit
  58. ins Result of last calculation
  59. .fi
  60. .SH MISCELLANEOUS FUNCTIONS
  61. .nf
  62. abs Absolute value of number
  63. sgn Mathematical signum function
  64. round Round to nearest integer number
  65. trunc Discard fraction part of number
  66. floor Mathematical floor function
  67. ceil Mathematical ceiling function
  68. sqrt Square root function (exp 1/2)
  69. cbrt Cube root function (exp 1/3)
  70. lb Binary logarithm function (base 2)
  71. ln Natural logarithm function (base e)
  72. lg Common logarithm function (base 10)
  73. .fi
  74. .SH TRIGONOMETRIC FUNCTIONS
  75. .nf
  76. sin Trigonometric sine function
  77. cos Trigonometric cosine function
  78. tan Trigonometric tangent function
  79. cot Trigonometric cotangent function
  80. sec Trigonometric secant function
  81. csc Trigonometric cosecant function
  82. crd Trigonometric chord function
  83. exsec Trigonometric exsecant function
  84. excsc Trigonometric excosecant function
  85. arcsin Inverse trigonometric sine function
  86. arccos Inverse trigonometric cosine function
  87. arctan Inverse trigonometric tangent function
  88. arccot Inverse trigonometric cotangent function
  89. arcsec Inverse trigonometric secant function
  90. arccsc Inverse trigonometric cosecant function
  91. arccrd Inverse trigonometric chord function
  92. arcexsec Inverse trigonometric exsecant function
  93. arcexcsc Inverse trigonometric excosecant function
  94. .fi
  95. .SH HYPERBOLIC FUNCTIONS
  96. .nf
  97. sinh Hyperbolic sine function
  98. cosh Hyperbolic cosine function
  99. tanh Hyperbolic tangent function
  100. coth Hyperbolic cotangent function
  101. sech Hyperbolic secant function
  102. csch Hyperbolic cosecant function
  103. arcsinh Inverse hyperbolic sine function
  104. arccosh Inverse hyperbolic cosine function
  105. arctanh Inverse hyperbolic tangent function
  106. arccoth Inverse hyperbolic cotangent function
  107. arcsech Inverse hyperbolic secant function
  108. arccsch Inverse hyperbolic cosecant function
  109. .fi
  110. .SH EARLY TRIGONOMETRIC FUNCTIONS
  111. .nf
  112. ver Versed sine function
  113. vcs Versed cosine function
  114. cvs Coversed sine function
  115. cvc Coversed cosine function
  116. hv Haversed sine function
  117. hvc Haversed cosine function
  118. hcv Hacoversed sine function
  119. hcc Hacoversed cosine function
  120. arcver Inverse versed sine function
  121. arcvcs Inverse versed cosine function
  122. arccvs Inverse coversed sine function
  123. arccvc Inverse coversed cosine function
  124. archv Inverse haversed sine function
  125. archvc Inverse haversed cosine function
  126. archcv Inverse hacoversed sine function
  127. archcc Inverse hacoversed cosine function
  128. .fi
  129. .SH STATEMENTS
  130. .nf
  131. about Show about text
  132. clear Clear console window
  133. def Define function
  134. delete Delete variable or function
  135. digits Set number of significant digits
  136. eval Evaluate arithmetic expression
  137. execute Execute statements in a file
  138. functions Show list of user defined functions
  139. input Change numeral input system
  140. help Show basic help text
  141. output Change numeral output system
  142. list Show content of a directory
  143. show Show content of a file
  144. load Load variable and functions from file
  145. save Save variable and functions to file
  146. variables Show list of variables
  147. version Show version string
  148. license Show copyright and license texts
  149. memory Show internal memory usage
  150. exit Exit program
  151. .fi
  152. .SH EXIT STATUS
  153. \fBamath\fP exits 0 on success and >0 if an error occurs.
  154. .SH EXAMPLES
  155. Add two numbers:
  156. .RS
  157. $ amath 1.3 + 2.6
  158. .RE
  159. .PP
  160. Find cosine of pi/2:
  161. .RS
  162. $ amath "cos(pi/2)"
  163. .RE
  164. .PP
  165. Find square root of minus 25:
  166. .RS
  167. $ amath "sqrt(-25)"
  168. .RE
  169. .PP
  170. Show only 5 digits in the result of a division:
  171. .RS
  172. $ amath "digits 5;34/11"
  173. .RE
  174. .PP
  175. Script block with functions:
  176. .RS
  177. .nf
  178. round(1.5461);round(-1.5461);
  179. ceil(43.5461);ceil(-43.5461);
  180. floor(39.9531);floor(-39.9531);
  181. trunc(23.827);trunc(-23.827);
  182. sqrt(100);sqrt(52.23);
  183. .fi
  184. .RE
  185. .PP
  186. Script block with user defined functions:
  187. .RS
  188. .nf
  189. f(x)=x*2+1;
  190. g(y)=y^2+y*1.5+2;
  191. a=2;b=3;c=a+b;
  192. f(2.2);c+1.1;
  193. .fi
  194. .RE
  195. .SH BUGS
  196. .IP \[bu] 2
  197. If \fBamath\fP is linked with system libraries (-lm) sometimes the real part
  198. of a result of arccosh of a complex number, is negative instead of positive.
  199. .IP \[bu]
  200. coth() with complex numbers is inaccurate on the 14th digit.
  201. .sp
  202. Please report any other bugs that you encounter via:
  203. .br
  204. \fIhttps://gitlab.com/rnger/amath/issues\fR.
  205. .SH HOMEPAGE
  206. https://amath.innolan.net/
  207. .SH SEE ALSO
  208. amathc(3), amathr(3), amathi(3)
  209. .SH AUTHORS
  210. Written by Carsten Sonne Larsen <cs@innolan.net>. Floating point to string
  211. conversion is based on software written by Ryan Juckett. The code in complex
  212. calculations is derived from software written by Stephen L. Moshier. The code
  213. in MemSet and MemCopy is derived from software contributed to Berkeley by
  214. Mike Hibler and Chris Torek.