How to use the exp function from mathjs
Find comprehensive JavaScript mathjs.exp code examples handpicked from public code repositorys.
50 51 52 53 54 55 56 57 58 59
artanh: math.atanh, arsech: math.asech, arcsch: math.acsch, arcoth: math.acoth, cis: z => math.exp(math.multiply(z, I)), gamma, beta, binom, eta, zeta,
+ 6 other calls in file
7 8 9 10 11 12 13 14 15 16
const cdiv = math.divide; const cmul = math.multiply; const cmul_i = z => math.multiply(z, I); const creciprocal = z => math.divide(1, z); const csin = math.sin; const cexp = math.exp; const clog = math.log; const csqrt = math.sqrt; const cpow = math.pow; const csquare = z => cmul(z, z);
+ 15 other calls in file
GitHub: asilvas/salient-maps
![asilvas profile picture](/asilvas.png?size=40)
168 169 170 171 172 173 174 175 176 177
const colorDifferenceMatrix = uniquePixelsPow.map(row => row.map(col => math.sum(col))); this.colorDistanceMatrix = math.sqrt(colorDifferenceMatrix); this.exponentialColorDistanceMatrix = math.exp(math.multiply(math.divide(colorDifferenceMatrix, (2 * sigmac * sigmac)), -1)); } bilateralFiltering() { const histVal = math.flatten(this.histogram).filter(v => v > 0);
GitHub: brin-eris/basic-bots
![brin-eris profile picture](/brin-eris.png?size=40)
170 171 172 173 174 175 176 177 178 179
let sqrRoot = function (x){ let result = Mathjs.sqrt(x); return isNaN(result) ? 1.0 : result; } let exp = function(x){ let result = Mathjs.exp(x); return isNaN(result) ? 1.0 : result; } let log = function(x){ let result = Mathjs.log(x);
+ 39 other calls in file
GitHub: kengz/Risk-game
![kengz profile picture](/kengz.png?size=40)
95 96 97 98 99 100 101 102 103 104
// if -ve: 1-Exp[x]/2; else Exp[-x]/2 Survival: function(v) { var xscale = 2; function trans(x) { return xscale*x - 5; } function f(x) { if (trans(x) < 0) { return 1 - m.exp(trans(x))/2; } else { return m.exp(-trans(x))/2; } } return fn.renorm( _.map(v, f)
+ 7 other calls in file
GitHub: jly36963/notes
![jly36963 profile picture](/jly36963.png?size=40)
35 36 37 38 39 40 41 42 43 44
// arithmetic math.add(a, b); // add math.cube(a); // cube math.cbrt(8); // cube root math.divide(a, b); // divide math.exp(8) // exponent (e ** x) math.log(a) // ln math.log(a, 2) // log base 2 math.mod(a, b) // modulus (remainder) math.multiply(a, b) // multiply
+ 2 other calls in file
66 67 68 69 70 71 72 73 74 75
var qp1s = maths.subtract(maths.dotMultiply(q, this.mr1), p1); var p1p2a = maths.add(maths.dotMultiply(p1, this.mr1), maths.dotMultiply(p2, this.mr1)); var p1p2s = maths.subtract(maths.dotMultiply(p1, this.mr1), maths.dotMultiply(p2, this.mr1)); var ep1d = maths.exp(maths.dotMultiply(p1, this.d*-2)); var refl_temp1 = qp1s.map((val, index) => val.mul(p1p2a[index])); var refl_temp2 = qp1a.map((val, index) => (val.mul(p1p2s[index].mul(ep1d[index])))); var refl_temp3 = qp1a.map((val, index) => val.mul(p1p2a[index]));
20 21 22 23 24 25 26 27 28 29
}; /** * sigmoid function * @param {number} x value */ var sigmoid = (x) => (1 / (1 + math.exp(-x)));//math.tanh(x); // var sigmoid = (x) => math.tanh(x); /** * derivative of sigmoid function * @param {number} y value
mathjs.evaluate is the most popular function in mathjs (87200 examples)