x0=2 #initial value
var('k N') # k is the root and N is the constant
k=3 #finding 3rd root
N=8
h(x)=((k-1)*(x)+N/x**(k-1))/k #by the newton raphson method
h(x0)
for i in range (10):
    xn=h(x0)
    x0=xn
o=float(h(x0))  
print o 

SageDays/Kreyszig-17.2-11 (last edited 2010-08-15 09:27:52 by PraveenKumar)