tan.js 1.1 KB

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