
Vertica includes a ton of built-in mathematical functions to help you on your analytic journey, and creating new ones is quick and easy.
Let’s create the inverse hyperbolic functions:
-
ACOSH – To compute the inverse (arc) hyperbolic cosine of its argument.
ASINH – To compute the inverse (arc) hyperbolic sine of its argument.
ATANH – To compute the inverse (arc) hyperbolic tangent of its argument.
Example:
verticademos=> CREATE OR REPLACE FUNCTION acosh(x FLOAT) RETURN FLOAT
verticademos-> AS
verticademos-> BEGIN
verticademos-> RETURN ln(x + sqrt((x^2-1)));
verticademos->
verticademos-> END;
CREATE FUNCTION
verticademos=> SELECT acosh(2.352409615);
acosh
------------------
1.49999999988576
(1 row)
verticademos=> CREATE OR REPLACE FUNCTION asinh(x FLOAT) RETURN FLOAT
verticademos-> AS
verticademos-> BEGIN
verticademos-> RETURN ln(x + sqrt((x^2+1)));
verticademos->
verticademos-> END;
CREATE FUNCTION
verticademos=> SELECT asinh(2.129279455);
asinh
------------------
1.49999999995969
(1 row)
verticademos=> CREATE OR REPLACE FUNCTION atanh(x FLOAT) RETURN FLOAT
verticademos-> AS
verticademos-> BEGIN
verticademos-> RETURN (ln(((1 + x) / (1 - x)))) / 2;
verticademos->
verticademos-> END;
CREATE FUNCTION
verticademos=> SELECT atanh(0.9051482536);
atanh
------------------
1.49999999975172
(1 row)
Have fun!