CLI Calculator
calc <expression>
> calc "5+5*5"
30
> calc "(5+5)*5"
50
> calc "asin(1)+sin^-1(1)"
3.141592653589793
> calc "log_3^-1(9)"
0.5
> calc "log_3(9)^-1"
-2
- the two last examples have different results because
^
has larger precedence thanlog
solog_3^-1(9)
is the same as(log_3(9))^-1
, howeverlog_3(9)^-1
is the same aslog_3(9^-1)
- brackets in the last three examples are optional so
asin1+sin^-1 1
,log_3^-1 9
andlog_3 9^-1
have the same meaning
_
after operator name means that it supports lower index^
after operator name means that it supports upper index
- use brackets (
(
and)
) to guide the parser or to create combinations ((a b)
) - use
[
and]
for absolute value and to guide the parser
pi
- 3.141592653589793e
- 2.718281828459045
-
- negationabs
- absolute valuesin^
- sinuscos^
- cosinustan^
- tangensacos^
- inverse cosinusasin^
- inverse sinusatan^
- inverse tangenssqrt
- square rootlog_^
- logarithm (base 10 with no lower index)ln^
- natural logarithmlb^
- binary logarithmsum^_
- sum
+
- addition-
- subtraction*
- multiplication*-
- multiplication by negation/
- divisionrt
- root (2 rt a
=sqrt(a)
)^
- powerC
- combinationsP
- variations
!
- factorial
^
- upper index_
- lower index
- upper limit of the sum (if not present,
1000
is default) - must be number or not present
log
,ln
,lg
fun^1(a)
=fun(a)
fun^b(a)
=(fun(a))^b
sin
,cos
,tan
,asin
,acos
,atan
fun^1(a)
=fun(a)
fun^b(a)
=(fun(a))^b
fun^-1(a)
=afun(a)
afun^-1(a)
=fun(a)
- lower limit of the sum (if not present,
i=1
is default)
a=b
- b is number, a is name of variable to change in the suma
- a is variable to change in the sum, lower limit is 1b
- b is number, the default variable name is i
log_10(a)
=log(a)
log_e(a)
=ln(a)
log_2(a)
=lb(a)
log_b(a)
= logarithm of base b of a
- names that shouldn't be used as variable names, because in the future they may have different meaning
A, D, E, H, I, N, Q, R, Z, d, i, j, inf, nan, int, print