21 lines
471 B
Julia
21 lines
471 B
Julia
# \Phi(x)=2*(1-sqrt(1-x))/x
|
|
function Phi(x)
|
|
if abs(x)>1e-5
|
|
return 2*(1-sqrt(1-x))/x
|
|
else
|
|
return 1+x/4+x^2/8+5*x^3/64+7*x^4/128+21*x^5/512
|
|
end
|
|
end
|
|
# \partial\Phi
|
|
function dPhi(x)
|
|
#if abs(x-1)<1e-5
|
|
# @printf(stderr,"warning: dPhi is singular at 1, and evaluating it at (% .8e+i% .8e)\n",real(x),imag(x))
|
|
#end
|
|
if abs(x)>1e-5
|
|
return 1/(sqrt(1-x)*x)-2*(1-sqrt(1-x))/x^2
|
|
else
|
|
return 1/4+x/4+15*x^2/64+7*x^3/32+105*x^4/512+99*x^5/512
|
|
end
|
|
end
|
|
|