exp.js 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.createExp = void 0;
  6. var _factory = require("../../utils/factory.js");
  7. var _index = require("../../plain/number/index.js");
  8. var name = 'exp';
  9. var dependencies = ['typed'];
  10. var createExp = /* #__PURE__ */(0, _factory.factory)(name, dependencies, function (_ref) {
  11. var typed = _ref.typed;
  12. /**
  13. * Calculate the exponential of a value.
  14. * For matrices, if you want the matrix exponential of square matrix, use
  15. * the `expm` function; if you want to take the exponential of each element,
  16. * see the examples.
  17. *
  18. * Syntax:
  19. *
  20. * math.exp(x)
  21. *
  22. * Examples:
  23. *
  24. * math.exp(2) // returns number 7.3890560989306495
  25. * math.pow(math.e, 2) // returns number 7.3890560989306495
  26. * math.log(math.exp(2)) // returns number 2
  27. *
  28. * math.map([1, 2, 3], math.exp)
  29. * // returns Array [
  30. * // 2.718281828459045,
  31. * // 7.3890560989306495,
  32. * // 20.085536923187668
  33. * // ]
  34. *
  35. * See also:
  36. *
  37. * expm1, expm, log, pow
  38. *
  39. * @param {number | BigNumber | Complex} x A number to exponentiate
  40. * @return {number | BigNumber | Complex} Exponential of `x`
  41. */
  42. return typed(name, {
  43. number: _index.expNumber,
  44. Complex: function Complex(x) {
  45. return x.exp();
  46. },
  47. BigNumber: function BigNumber(x) {
  48. return x.exp();
  49. }
  50. });
  51. });
  52. exports.createExp = createExp;