acoth.js 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.createAcoth = void 0;
  6. var _factory = require("../../utils/factory.js");
  7. var _index = require("../../plain/number/index.js");
  8. var name = 'acoth';
  9. var dependencies = ['typed', 'config', 'Complex', 'BigNumber'];
  10. var createAcoth = /* #__PURE__ */(0, _factory.factory)(name, dependencies, function (_ref) {
  11. var typed = _ref.typed,
  12. config = _ref.config,
  13. Complex = _ref.Complex,
  14. _BigNumber = _ref.BigNumber;
  15. /**
  16. * Calculate the hyperbolic arccotangent of a value,
  17. * defined as `acoth(x) = atanh(1/x) = (ln((x+1)/x) + ln(x/(x-1))) / 2`.
  18. *
  19. * To avoid confusion with the matrix hyperbolic arccotangent, this
  20. * function does not apply to matrices.
  21. *
  22. * Syntax:
  23. *
  24. * math.acoth(x)
  25. *
  26. * Examples:
  27. *
  28. * math.acoth(0.5) // returns 0.8047189562170503
  29. *
  30. * See also:
  31. *
  32. * acsch, asech
  33. *
  34. * @param {number | BigNumber | Complex} x Function input
  35. * @return {number | BigNumber | Complex} Hyperbolic arccotangent of x
  36. */
  37. return typed(name, {
  38. number: function number(x) {
  39. if (x >= 1 || x <= -1 || config.predictable) {
  40. return (0, _index.acothNumber)(x);
  41. }
  42. return new Complex(x, 0).acoth();
  43. },
  44. Complex: function Complex(x) {
  45. return x.acoth();
  46. },
  47. BigNumber: function BigNumber(x) {
  48. return new _BigNumber(1).div(x).atanh();
  49. }
  50. });
  51. });
  52. exports.createAcoth = createAcoth;