サブ xxp.js Last modified: Mar 25, 2004
// defined gxp
function xxp(x, is)
{
var pi2, w, t, i
pi2 = 0.398942280401432677940
if (x == 0.0) {
return 1
}
else if (is == 1) {
return gxp(Math.sqrt(x))*2.0
}
else if (is == 2) {
return Math.exp(-x/2.0)
}
else if ((is%2) == 0) {
w = t = 1.0
for (i = 2; i <= is-2; i += 2) {
t *= x/i
w += t
}
return Math.exp(Math.log(w) - x*0.5)
}
else {
t = w = Math.sqrt(x)
for (i = 3; i <= is-2; i += 2) {
t *= x/i
w += t
}
return 2.0*(gxp(Math.sqrt(x))+pi2*Math.exp(Math.log(w)-x*0.5))
}
}
直前のページへ戻る E-mail to Shigenobu AOKI