MainNews › Vertica. Quick Tip: Create inverse hyperbolic functions

Vertica. Quick Tip: Create inverse hyperbolic functions

Vertica. Quick Tip: Create inverse hyperbolic functions

Vertica includes a variety of built-in math features to help you on your analytical journey, but also to create new ones – quickly and easily!

Let’s create inverse hyperbolic functions:
ACOSH – to calculate the inverse (arch) hyperbolic cosine of its argument.
ASINH – to calculate the inverse (arsh) hyperbolic sine of its argument.
ATANH – to calculate the inverse (arth) 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)

Want to know more? If you have any questions, please contact software@erc.ua
More tips here http://bit.ly/vertica_blog




Share