UNPKG

ubique

Version:

A mathematical and quantitative library for Javascript and Node.js

34 lines (33 loc) 698 B
/** * Exponents and Logarithms */ module.exports = function($u) { /** * @method exp * @summary Exponential value * @description Exponential value * * @param {number|array|matrix} x element * @return {number|array|matrix} * * @example * ubique.exp(6); * // 403.429 * * ubique.exp([5,6,3]); * // [148.413, 403.429, 20.0855] * * ubqie.exp([[5,6,5],[7,8,-1]]); * // [[148.413, 403.429, 148.413], [1096.63, 2980.96, 0.367879]] */ $u.exp = function(x) { if (arguments.length === 0) { throw new Error('not enough input arguments'); } var fun = Math.exp; if ($u.isnumber(x)) { return fun(x); } return $u.arrayfun(x,fun) } }