Post Reply 
(12C) Newton's Method
03-30-2018, 02:00 PM (This post was last modified: 03-30-2018 02:54 PM by Dieter.)
Post: #11
RE: (12C) Newton's Method
(03-30-2018 01:15 PM)Gamo Wrote:  5 > R/S > 2.236067978
4 > R/S > 2.236067978
3 > R/S > 2.236067977
2 > R/S > 2.236067977
1 > R/S > 2.236067978

Answer is 2.236067977

The true result is right in the middle. Even with 13-digit precision the answer is 2,236067977500. See below.

(03-30-2018 01:15 PM)Gamo Wrote:  Can I check for accuracy on Register 2

In a way, yes. But let's be precise for a moment now. What is accuracy? How do you define it? The term may relate to two different things.

On the one hand you may refer to the difference between the returned result and the actual true answer. For instance, if the true result is 2 and the program returns 1,999999999 this is accurate to 9 places, or it has an error of 1 ULP.

On the other hand you may take a look at f(x) for the returned value. Does it return exactly zero, or 0,000000001 or something else?

Both definitions may come to different conclusions. For instance, there are cases where a whole range of results yields f(x) = exactly 0. Remember the 3^x–x^3 case? Here anything between 2,478052679 and 2,478052683 will return exactly zero on a correctly working 10-digit calculator. The true result is 2,4780526802883...

On the other hand even a function result that is not zero does not mean that the result has a slight error. It may be exact to all 10 digits. Consider the function x^2–2=0. The exact 10-digit result here is 1,414213562, but f(1,414213562) yields –0,000000001. The next higher answer 1,414213563 returns +0,000000002. So there simply is no 10-digit result that returns exactly 0.

You can also check by how much the final value of x has been corrected. This can be a measure for its accuracy. But again, even if the last two approximations agree and the correction term is zero, this does not neccessarily mean that the result is dead on.

Back to the programs now. You said that in the original version of the program (cf. your initial post) RCL 4 could be used to check the accuracy of the result. In fact this is not possible. The original version calculates f(x) and stores this in R4. But then a "better x" is calculated and finally displayed. So R4 holds the function value of the second-to-last x, and not that of the finally returned x (!).

In the last version of my program you may recall R2 to see the last correction term. If R2 is zero, f(x) returns zero as well. Nonzero values mean that f(x) of the previous (!) approximatino was not zero, but x should be at least as accurate as this. So if x is for example 3,5 and RCL 2 returns 3E–9 you know that the final correction was 3 units in the last digit. The program terminates if this update only affected the last one or two digits. In most cases this means that the new result is as good as it gets with 10-digit precision. Due to the quadratic convergence of Newton's method, in a perfect world even 15 digits should be fine.

There is an easy way to get another impression of the accuracy: press [R/S] again for an update of x. In some cases this may show how x oscillates between two values. Remember the example where the last two digits changed between ...80 and ...86? Here the calculator simply cannot do better, for instance because of limited accuracy in the function itself, and the last digit remains uncertain.

He is an example for the polynomial in your last post.

5 [R/S] => 2,236067978
RCL 2 => 4,938E–10

So f(x) is not exactly zero, but the last correction was less than 5 units in the 11th digit, thus not affecting the 10-digit result. In fact the true result is right in the middle between 2,236067977 and ...78. The program tried to correct it to 2,2360679775 but due to 10-digit precision it could not do so.

Dieter
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
(12C) Newton's Method - Gamo - 03-24-2018, 01:10 PM
RE: (12C) Newton's Method - Dieter - 03-24-2018, 01:31 PM
RE: (12C) Newton's Method - Dieter - 03-27-2018, 06:08 PM
RE: (12C) Newton's Method - Gamo - 03-25-2018, 03:05 AM
RE: (12C) Newton's Method - Dieter - 03-25-2018, 06:26 PM
RE: (12C) Newton's Method - Gamo - 03-28-2018, 04:23 AM
RE: (12C) Newton's Method - Carsen - 03-29-2018, 05:11 AM
RE: (12C) Newton's Method - Dieter - 03-29-2018, 05:04 PM
RE: (12C) Newton's Method - Gene - 03-29-2018, 05:23 PM
RE: (12C) Newton's Method - Gamo - 03-30-2018, 01:15 PM
RE: (12C) Newton's Method - Dieter - 03-30-2018 02:00 PM
RE: (12C) Newton's Method - Gamo - 03-31-2018, 01:15 PM
RE: (12C) Newton's Method - Dieter - 03-31-2018, 05:27 PM



User(s) browsing this thread: 1 Guest(s)