Built in Functions » Histórico » Revisión 2
Revisión 1 (Federico Vera, 2018-06-09 23:54) → Revisión 2/10 (Federico Vera, 2018-06-09 23:55)
# Built in Functions
There are a number of built-in functions, that usually just map with the corresponding [`java.util.Math`](https://docs.oracle.com/javase/8/docs/api/java/lang/Math.html) 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 of `x`
* `log1p(x)`: Base 10 logarithm of `(x + 1)`
* `log10(x)`: Base 10 logarithm of `x`
* `log2(x)`: Base 2 logarithm of `x`
## Misc
* `pow(b, e)`: `b` to the power of `e`
* `sqrt(x)`: Square root of `x`
* `cbrt(x)`: Cube root of `x`
* `exp(x)`: `e` to the power of `x`
* `expm1(x)`: `e` to the power of `x` minus 1 (`e^x - 1`)
* `signum(x)`<sup>1</sup>: Signum of `x` (`-1, 0, 1` for `< 0`, `= 0` and `> 0` respectively)
* `abs(x)`: Absolute value of `x`
* `ceil(x)`: First integer closest to negative infinity greater than or equal `x`
* `floor(x)`: First integer closest to positive infinity less than or equal `x`
## Constants
* `pi()`: Ratio of the circumference of a circle to its diameter `3.14159265358979323846`
* `e()`: Base of the natural logarithm `2.7182818284590452354`
## Disabling built-in functions
Since version `0.6-riddler` ([commit](https://gitlab.com/riddler_arg/exp4j/commit/28c731ea9a6140871a2ee2e0373cd13751d2e494)) you can disable all built-in functions like this:
~~~Java
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](https://gitlab.com/riddler_arg/exp4j/blob/master/src/main/java/net/objecthunter/exp4j/function/Functions.java).
##
<sup>1</sup> This is the only method not implemented using it's corresponding `java.util.Math` method.
Volver al inicio