When executing NR.py from lecture 12:
"ImportError: No module named rationals"
Am I supposed to download this module from somewhere?
There are other methods in the file that deals with rationals, you don't need them so you can delete the "import rationals" line from the beginning of the file.
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
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.
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 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?