acot.js 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. import { factory } from '../../utils/factory.js';
  2. import { acotNumber } from '../../plain/number/index.js';
  3. var name = 'acot';
  4. var dependencies = ['typed', 'BigNumber'];
  5. export var createAcot = /* #__PURE__ */factory(name, dependencies, _ref => {
  6. var {
  7. typed,
  8. BigNumber: _BigNumber
  9. } = _ref;
  10. /**
  11. * Calculate the inverse cotangent of a value, defined as `acot(x) = atan(1/x)`.
  12. *
  13. * To avoid confusion with the matrix arccotanget, this function does not
  14. * apply to matrices.
  15. *
  16. * Syntax:
  17. *
  18. * math.acot(x)
  19. *
  20. * Examples:
  21. *
  22. * math.acot(0.5) // returns number 1.1071487177940904
  23. * math.acot(2) // returns number 0.4636476090008061
  24. * math.acot(math.cot(1.5)) // returns number 1.5
  25. *
  26. * See also:
  27. *
  28. * cot, atan
  29. *
  30. * @param {number | BigNumber| Complex} x Function input
  31. * @return {number | BigNumber| Complex} The arc cotangent of x
  32. */
  33. return typed(name, {
  34. number: acotNumber,
  35. Complex: function Complex(x) {
  36. return x.acot();
  37. },
  38. BigNumber: function BigNumber(x) {
  39. return new _BigNumber(1).div(x).atan();
  40. }
  41. });
  42. });