サブ pxx.js   Last modified: Mar 25, 2004
// defined pxg
// defined xxp

function pxx(p0, idf)
{
  var ok, xl, xr, xm, temp, u, df9
  ok = 0
  xl = 0.0
  xr = 10.0
  while (xr < 1e30) {
    temp = xxp(xr, idf)
    if (temp == p0) {
      return xr
    }
    else if (temp < p0) {
      ok = 1
      break
    }
    xl = xr
    xr *= 10.0
  }

  if (ok == 0) {
    u = pxg(p0)
    df9 = 2.0/(9*idf)
    temp = 1.0-df9+u*Math.sqrt(df9)
    return idf*temp*temp*temp
  }
  else {
    for (;;) {
      xm = (xl+xr)*0.5
      temp = xxp(xm, idf)
      if (temp > p0) {
        xl = xm
      }
      else {
        xr = xm
      }
      if (Math.abs(xr-xl)/xm < 1e-10) break
    }
    return xm
  }
}


・ 直前のページへ戻る  ・ E-mail to Shigenobu AOKI

Made with Macintosh