acsch function

dynamic acsch(
  1. dynamic x
)

Returns the inverse hyperbolic cosecant (acsch) of x.

Example 1:

print(acsch(1)); // prints: 0.881373587019543

Example 2:

print(acsch(Complex(1, 2))); // Output: 0.21798993831344444 - 0.4522784461536737i

Example 3:

print(acsch(Matrix.identity(2))); // Output: [[1.0, 0.0], [0.0, 1.0]]

Implementation

dynamic acsch(dynamic x) {
  if (x is num) {
    return math.log(1 / x + math.sqrt(1 / (x * x) + 1));
  } else if (x is Complex) {
    return asinh(Complex(1, 0) / x);
  } else if (x is Matrix) {
    return MatrixFunctions(x).acsch();
  } else {
    throw ArgumentError('Input should be either num or Complex');
  }
}