Perl Tutorial Perl References

Perl Math - asinh() Function



The Perl Math asinh() function returns inverse hyperbolic sine of a value. The inverse hyperbolic sine of x is defined as:

asinh

In special cases it returns the following:

  • If the argument is NaN, then the result is NaN.

Syntax

asinh(x)

Parameters

x Specify the value.

Return Value

Returns the inverse hyperbolic sine of a value.

Example:

In the example below, asinh() function is used to find out the inverse hyperbolic sine of a value.

use Math::Trig;

print("asinh(-2) = ".asinh(-2)."\n");
print("asinh(-1) = ".asinh(-1)."\n");
print("asinh(0) = ".asinh(0)."\n");
print("asinh(1) = ".asinh(1)."\n");
print("asinh(2) = ".asinh(2)."\n");
print("asinh(Inf) = ".asinh(Inf)."\n");
print("asinh(-Inf) = ".asinh(-Inf)."\n");
print("asinh(NaN) = ".asinh(NaN)."\n");

The output of the above code will be:

asinh(-2) = -1.44363547517881
asinh(-1) = -0.881373587019543
asinh(0) = 0
asinh(1) = 0.881373587019543
asinh(2) = 1.44363547517881
asinh(Inf) = Inf
asinh(-Inf) = NaN
asinh(NaN) = NaN

This function can also be used to calculate complex inverse hyperbolic sine of a complex number z. It is a function on complex plane, and has two branch cuts:

  • Extends from 1i along the imaginary axis to ∞i, continuous from the right.
  • Extends from -1i along the imaginary axis to -∞i, continuous from the left.

Mathematically, it can be expressed as:

complex asinh

Example:

In the example below, asinh() function is used to find out the complex inverse hyperbolic sine of a given complex number.

use Math::Complex;

$z1 = 2 + 2*i;
$z2 = 2;
$z3 = 2*i;
print("asinh($z1) = ".asinh($z1)."\n");
print("asinh($z2) = ".asinh($z2)."\n");
print("asinh($z3) = ".asinh($z3)."\n");

The output of the above code will be:

asinh(2+2i) = 1.73432452148797+0.754249144698046i
asinh(2) = 1.44363547517881
asinh(2i) = 1.31695789692482+1.5707963267949i

❮ Perl Math Functions