cosh.js 901 B

1234567891011121314151617181920212223242526272829303132333435
  1. import { factory } from '../../utils/factory.js';
  2. import { cosh as coshNumber } from '../../utils/number.js';
  3. var name = 'cosh';
  4. var dependencies = ['typed'];
  5. export var createCosh = /* #__PURE__ */factory(name, dependencies, _ref => {
  6. var {
  7. typed
  8. } = _ref;
  9. /**
  10. * Calculate the hyperbolic cosine of a value,
  11. * defined as `cosh(x) = 1/2 * (exp(x) + exp(-x))`.
  12. *
  13. * To avoid confusion with the matrix hyperbolic cosine, this function does
  14. * not apply to matrices.
  15. *
  16. * Syntax:
  17. *
  18. * math.cosh(x)
  19. *
  20. * Examples:
  21. *
  22. * math.cosh(0.5) // returns number 1.1276259652063807
  23. *
  24. * See also:
  25. *
  26. * sinh, tanh
  27. *
  28. * @param {number | BigNumber | Complex} x Function input
  29. * @return {number | BigNumber | Complex} Hyperbolic cosine of x
  30. */
  31. return typed(name, {
  32. number: coshNumber,
  33. 'Complex | BigNumber': x => x.cosh()
  34. });
  35. });