tan.js 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.createTan = void 0;
  6. var _factory = require("../../utils/factory.js");
  7. var _trigUnit = require("./trigUnit.js");
  8. var name = 'tan';
  9. var dependencies = ['typed'];
  10. var createTan = /* #__PURE__ */(0, _factory.factory)(name, dependencies, function (_ref) {
  11. var typed = _ref.typed;
  12. var trigUnit = (0, _trigUnit.createTrigUnit)({
  13. typed: typed
  14. });
  15. /**
  16. * Calculate the tangent of a value. `tan(x)` is equal to `sin(x) / cos(x)`.
  17. *
  18. * To avoid confusion with the matrix tangent, this function does not apply
  19. * to matrices.
  20. *
  21. * Syntax:
  22. *
  23. * math.tan(x)
  24. *
  25. * Examples:
  26. *
  27. * math.tan(0.5) // returns number 0.5463024898437905
  28. * math.sin(0.5) / math.cos(0.5) // returns number 0.5463024898437905
  29. * math.tan(math.pi / 4) // returns number 1
  30. * math.tan(math.unit(45, 'deg')) // returns number 1
  31. *
  32. * See also:
  33. *
  34. * atan, sin, cos
  35. *
  36. * @param {number | BigNumber | Complex | Unit} x Function input
  37. * @return {number | BigNumber | Complex} Tangent of x
  38. */
  39. return typed(name, {
  40. number: Math.tan,
  41. 'Complex | BigNumber': function ComplexBigNumber(x) {
  42. return x.tan();
  43. }
  44. }, trigUnit);
  45. });
  46. exports.createTan = createTan;