The problem using newton's method to determine the root of a poly has a quirk--it doesn't always converge. Using the example given in the problem set, my program returns the correct answer using the same number of loops, but if you use poly tuple (1,2,3) for example, you will get a noncovergent loop.
MIT 6.00 Intro Computer Science (OCW)
I got my questions answered at brainly.com in under 10 minutes. Go to brainly.com now for free help!
At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga.
Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus.
Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.
I had to program the same method to draw an implicit curve ... welcome to hell... however a hell with a solution.
f(x,y) = 0 <=> y^2 + x^2 - c^2 = 0 (the circle as an example)
with h a value like 1/10 of the interval you are interpolating roots
dfx(x,y) = (f(x + h, y) - f(x,y)) / h (x variable, y fixed)
dfy(x,y) = (f(x, + h) - f(x,y)) / h (x variable, y fixed)
w_n+1 = w_n - f(x,y) / f'(x,y) (w because it can either be estimated in y or x)
you stop if
-a w_n+1 is outside the interval you are considering (not converging)
-the value of the absolute value of the funtion for the new value w_n+1 < tol or|w_n - w_n+1| < tol
- you try this for some iterations because newtons method converges fast as hell if the root is in the interval bur otherwise it does weird stuff.
tolerance = 10^-3 or 10^-5 or 10^-7
Hope it helps
Maybe bisection then newton's would be simpler? One nice thing about programs for engineering is that we can throw a million darts and one of them will hit, rather than figuring out how to actually throw darts.