Ask your own question, for FREE!
MIT 6.00 Intro Computer Science (OCW) 8 Online
OpenStudy (anonymous):

I am struggling on ps2 with Newton's method. I really just need to understand the concept of how it works. I have little to no understanding of calculus. If you could point me to a source that would help i'd appreciate it. Got the first two parts correct (derivatives and polynomials)

OpenStudy (anonymous):

ps2?

OpenStudy (anonymous):

problem set 2 of course 6.00ocw

OpenStudy (anonymous):

So using Newton's method in general, or for a certain function?

OpenStudy (anonymous):

it's down a little bit. The third part to the problem. I just do not know where to start. what variables to use. Where I should loop, if i should loop

OpenStudy (anonymous):

So you are able to compute the derivative and evaluate a polynomial?

OpenStudy (anonymous):

Yes

OpenStudy (anonymous):

Okay, we start out with \(x_n=x_0\). We want to do \(x_{n+1} = x_n - f(x_n)/f'(x_n)\).

OpenStudy (anonymous):

How would you calculate \(f(x_n)\) in your code?

OpenStudy (anonymous):

so xn would be the root that we are trying to find?

OpenStudy (anonymous):

What \(x_n\) is some number which is close to our root, and \(x_{n+1}\) is supposed to be a bit closer.

OpenStudy (anonymous):

Regardless, do you understand how to implement this programmatically?

OpenStudy (anonymous):

You should realize that \(f(x_n)\) → `evaluate_poly(poly, x_n)`

OpenStudy (anonymous):

these are the arguments allowed: def compute_root(poly, x_0, epsilon): So x_0 is a random guess, that we make up. epsilon is the accuracy and poly is the polynomial. Would I be using the derivatives from the code I have already done

OpenStudy (anonymous):

Okay I see what your saying

OpenStudy (anonymous):

You can calculate the derivative just once and save it. `dpoly = compute_derivative(poly)`

OpenStudy (anonymous):

yes

OpenStudy (anonymous):

You can let \(x_n=x_0\) at the beginning.

OpenStudy (anonymous):

Ok it's clicked with me now. Thanks for your help. I will be right from here :)

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!