[ create a new paste ] login | about

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

bot42 - Python, pasted on Oct 21:
1
2
3
4
5
6
7
8
9
10
11
12
13
ctr=0
def computeRoot(poly, x_0, epsilon):
    ctr=0
    y=42
    while not(abs(y)<=abs(epsilon)):
        ctr=ctr+1
        y=0
        dy=0
        for thing in range(len(poly)):
            y+=poly[thing]*(x_0**thing)
            dy+=(thing-1)*poly[thing]*(x_0**(thing-1))
        x_0=x_0-(y/dy)
    return [x_0,ctr]  


Output:
No errors or program output.


Create a new paste based on this one


Comments: