Names:::分段直接取值,x if ( x > 1 ) 6 * x - 5.9; else if ( x == 1) 38; else Math.pow(x, 2) + 2.7;
1.2.9.2 定义函数
Names:::分段函数取值,x function f1(x) { var multiply = 1; for (var i = 1; i <= Math.abs(x); i++) { multiply = multiply * i; } return multiply ; } function f2(x) { var sum = 0; for (var i = 1; i > x; i--) { sum += f1(i); } return sum; } if ( x > 1 ) f1(x); else if ( x == 1) 38; else f2(x);
Names:::一元正态分布概率密度函数,x var mean = 1; var stdDeviation = 2; var dx = x - mean; var expP = - dx * dx / ( 2 * stdDeviation * stdDeviation ); var div = Math.sqrt(2 * Math.PI) * stdDeviation; Math.exp(expP) / div
1.2.10.2 一元标准正态分布概率密度函数
Names:::一元标准正态分布概率密度函数,x Math.exp(- x * x / 2) / Math.sqrt(2 * Math.PI)
1.2.10.3 sigmoid
Names:::sigmoid,x 1 / (1 + Math.exp(-x))
1.2.10.4 sigmoid的导数
Names:::sigmoid的导数,x var s = 1 / (1 + Math.exp(-x)); s * (1 - s);
Names:::二元正态分布概率密度函数,x,y var xMean = 1; var xStd = 2; var yMean = 2; var yStd = 1; var coefficient = 0.2; var dx = x - xMean; var dy = y - yMean; var xyStd = xStd * yStd; var dco = 1 - coefficient * coefficient; var px = dx * dx / ( xStd * xStd ); var py = dy * dy / ( yStd * yStd ); var pxy = 2 * coefficient * dx * dy / xyStd; var expP = - (px + py - pxy) / ( 2 * dco) var div = 2 * Math.PI * xyStd * Math.sqrt(dco); Math.exp(expP) / div
1.3.7.2 二元标准正态分布概率密度函数
Names:::二元标准正态分布概率密度函数,x,y var xMean = 1; var xStd = 2; var yMean = 2; var yStd = 1; var dx = x - xMean; var dy = y - yMean; var xyStd = xStd * yStd; var px = dx * dx / ( xStd * xStd ); var py = dy * dy / ( yStd * yStd ); var expP = - (px + py) / 2 var div = 2 * Math.PI * xyStd; Math.exp(expP) / div