[ create a new paste ] login | about

Link: http://codepad.org/gwMWniZB    [ raw code | fork ]

Plain Text, pasted on Feb 22:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# generalized, refactored Halley's
x=((n-2)*x+(4*v*x)/(v+x**n))/n

# cube root, n=3
x=(x+(4*v*x)/(v+x*x*x))/3
x*=(1+(4*v)/(v+x*x*x))/3
x*=(1+4/(1+x*x*x/v))/3

# covergence lost
x*=(1+2/(x*x*x/v))/3
x*=(1+2*v/(x*x*x))/3

# more convergence lost
x*=(1+v/(x*x*x))/2
x=(x+v/(x*x))/2
x=(x+v/x/x)/2


Create a new paste based on this one


Comments: