Main Thread

When executing NR.py from lecture 12:

"ImportError: No module named rationals"

Am I supposed to download this module from somewhere?

Can I use other value than the default epsilon? I want to change it to epsilon=100**(-8), so I will get a more precise solution

No, the question specifically says you need to use the default values from class.

The idea in this question is not to get the most precise result, but to understand what happens in each case.

do i need to use diff or should i derive on my own?

you may use diff and any other code from the lectures.

when using diff, the results differ rather then using the "real" derivative [-x*exp(-x)]

for instance, using the above derivative result in a "no derivative" in case x0=0.

I realize both cases describe the same general idea, but what should I use in the answer ?

Go with diff that you saw in the lectures. The idea is to understand the behaviour of NR in the general case where you do not have the symbolic derivative, but only an approximation of it.

but can I use the symbolic derivative nevertheless? the input of NR using diff indeed merges (more or less) in cases of x0=-2,1 with the input of NR using the symbolic derivative, but not in case of x0=0 ( diff:0 convergence in 1 iterations 2001.33.., symbolic: zero derivative). In my opinion, if we use diff we may find the cases of x0=0,1 very similar, in comparison to three distinct cases we should get using the symbolic derivative.

OK, We'll accept both ways.

What should I explain about a case where the method NR() just works? :)

explain why it works. also, i'm not sure it works perfectly fine in any of the cases. calculate using pen and paper what are the roots of f(x) and compare to your results from NR.

that's weird, I haven't done the pen-and-paper thing, but I double checked the function and it's parameters, and can tell it gives the correct root.

Are you confidence with what you're statement?

When we get an x that makes f(x) close "epsilon" to 0, should we consider it as a root? or as a failure of NR?

If NR finds an approximation for the root, it is a success, not a failure.

I guess the actual question was this:

If a function converges (quickly) to 0 as x reaches infinity, so for example f(2000) = 10^(-10), but there's no x in

that area (or anywhere, for that matter) that actually maintains f(x) = 0, then officially I believe 2000 is not an approximation of a root, as there's no real root in its area.

Is this correct? Would you describe this as a failure?

I agree with you that it's appropriate to classify this as failure. But it's not so important how you call it, as long as you understand what's going on.

אם הפעולה עובדת ומוצאת את השורש, מה צריך ליהיות ההסבר לכך?

להראות את התכנסות הסדרה, להראות שמתקיימים התנאים של שיטת ניוטון רפסון, או להסביר באופן כללי?

can we explain our answers in english in the pdf file ?

I just realized I accidently took the NR code from the lecture's pdf itself instead of the added python file, and I saw there are some differences between the codes, is it ok to leave my answers based on the code from the pdf file? or should I edit them according to the added NR code?