Built in Functions¶
- Índice de contenidos
- Built in Functions
There are a number of built-in functions, that usually just map with the corresponding java.util.Math
methods (so all of the same restrictions apply), this functions are:
Trigonometric Functions:¶
-
sin(x)
: Sine of an angle expressed in radians -
cos(x)
: Cosine of an angle expressed in radians -
tan(x)
: Tangent of an angle expressed in radians
Inverse Trigonometric:¶
-
asin(x)
: Arc sine in the range [-π/2, π/2) -
acos(x)
: Arc cosine in the range [0, π) -
atan(x)
: Arc tangent in the range [-π/2, π/2)
Hyperbolic Functions:¶
-
sinh(x)
: Hyperbolic sine(e^x - e^(-x)) / 2
-
cosh(x)
: Hyperbolic cosine(e^x + e^(-x)) / 2
-
tanh(x)
: Hyperbolic tangent(e^x - e^(-x)) / (e^x + e^(-x))
Logarithms¶
-
log(x)
: Base 10 logarithm ofx
-
log1p(x)
: Base 10 logarithm of(x + 1)
-
log10(x)
: Base 10 logarithm ofx
-
log2(x)
: Base 2 logarithm ofx
Misc¶
-
pow(b, e)
:b
to the power ofe
-
sqrt(x)
: Square root ofx
-
cbrt(x)
: Cube root ofx
-
exp(x)
:e
to the power ofx
-
expm1(x)
:e
to the power ofx
minus 1 (e^x - 1
) -
signum(x)
:Note Signum ofx
(-1, 0, 1
for< 0
,= 0
and> 0
respectively) -
abs(x)
: Absolute value ofx
-
ceil(x)
: First integer closest to negative infinity greater than or equalx
-
floor(x)
: First integer closest to positive infinity less than or equalx
Constants¶
-
pi()
: Ratio of the circumference of a circle to its diameter3.14159265358979323846
-
e()
: Base of the natural logarithm2.7182818284590452354
Disabling built-in functions¶
Since version 0.6-riddler
(28c731ea) you can disable all built-in functions like this:
Expression e = new ExpressionBuilder("x + 3")
.disableBuiltInFunctions() //<--
.variable("x")
.build();
Remember that since constants are also defined as functions this will also disable them.
Code¶
The code for the functions is here.
Actualizado por Federico Vera hace más de 6 años · 10 revisiones
Volver al inicio