csch function

dynamic csch(
  1. dynamic x
)

Returns the hyperbolic cosecant of a number.

Example 1:

print(csch(1)); // Output: 0.8509181282393215

Example 2:

print(csch(Complex(1, 2))); // Output: -0.22150093085050945 - 0.6354937992539i

Example 3:

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

Implementation

dynamic csch(dynamic x) {
  if (x is num || x is Complex) {
    return Complex(1, 0) / sinh(x);
  } else if (x is Matrix) {
    return MatrixFunctions(x).csch();
  } else {
    throw ArgumentError('Input should be either num or Complex');
  }
}