Ian Jauslin
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'figs/numerical.fig/simpleq/tools.jl')
-rw-r--r--figs/numerical.fig/simpleq/tools.jl20
1 files changed, 20 insertions, 0 deletions
diff --git a/figs/numerical.fig/simpleq/tools.jl b/figs/numerical.fig/simpleq/tools.jl
new file mode 100644
index 0000000..1635a14
--- /dev/null
+++ b/figs/numerical.fig/simpleq/tools.jl
@@ -0,0 +1,20 @@
+# \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
+