Is this correct?
def computeRoot(poly, x_0, epsilon):
i=0
if len(poly)==1:
root=0
elif len(poly)>1:
root=x_0
while evaluatePoly(poly,root)
what error does the grader give you? or it wont work even on your machine?
It doesn't give any error, but it's not give me perfect answer....
ive sent u some notes about it!:)
I suppose evaluatePoly is another function?
yes. it's another function which compute a polynomial function with a value is given by argument as 'root'.
the 1st thing i see: you control if len(poly)==1or>1 no need as computeDeriv does that for you! then: while evaluatePoly(poly,root)<abs(epsilon): epsilon is always the same....i mean it wont change inside your code.you have to use abs with your root that could be negative. and one other thing...does ur poly change everytime you get its derivative ?..i mean ,on every iteration u have to have the derivative of the derivative....etc
Join our real-time social learning platform and learn together with your friends!