Post Reply 
(12C Platinum) Zero of Function
02-04-2019, 05:19 PM (This post was last modified: 02-04-2019 05:24 PM by Dieter.)
Post: #5
RE: (12C Platinum) Zero of Function
(02-04-2019 01:00 AM)Gamo Wrote:  Dieter program suggestion is more refine and more clear.

The clarity essentially is in the formatting.
Use line numbers, one command per line, and you will also detect possible errors.
For instance that f(x) does not start on line 022 (which is GTO 000) but line 023.

(02-04-2019 01:00 AM)Gamo Wrote:  First Guess: 6 [R/S] display 65
Second Guess: 4 [R/S] display 4.5555

As already explained, the two inputs are not two guesses for the root. Only the second value (I called it "b") is an estimate, while the first one (I called it "a") is not.

Still not convinced? Then try this:
f(x) = 1000·x – 2000 = 0

There obviously is a root at x=2. If you think that the two input values are two guesses, try 3 and 1. Result: this will not converge, the iteration finally oscillates between plus and minus infinity.

Then try 3000 (!) and 1. This will eventually converge to the correct result x=2.
Try 1000 and 1, 100, 4711 or whatever, and the root is instantly found in the first iteration.

The first input "a" is not a guess for the root. It is a slope (!) that determines how fast the iteration converges – if at all. In the above example f'(x) = 1000 (constant), so the iteration directly returns the root.

To be honest, I don't think that this method is a good one for solving functions. Its essential advantage is its simplicity that requires just one function call – which is nice for calculators without subroutines.

If one wants to try this approach it is recommended to choose the first input close to the function's derivative at the root, and the second input (the guess) should be close to root itself.

Consider your last example: f(x) = x · ln(x) – ln(1000)

Let's start with a quite rough guess: the solution is somewhere between 1 and 10. The derivative for these values falls between 1 and ~3,3. So let's choose 2 as the first input. The second input, i.e. the initial guess, may be any positive value up to about 12, and the iteration will converge to the true root. It doesn't matter whether you enter 0,001 or 2 or 4,5 or 8 or 12 here. All these initial guesses will equally converge within roughly twenty iterations.

(02-04-2019 01:00 AM)Gamo Wrote:  Not bad for when using a good guess.

As shown, the initial guess is not that crucial; it's the first input, the slope, that decides whether the whole thing will work or not. If you choose 2,5 here (which is f'(4,55) it only takes a few iterations until the root is found – for any positive guess up to about 17.

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


Messages In This Thread
(12C Platinum) Zero of Function - Gamo - 02-03-2019, 10:34 AM
RE: (12C Platinum) Secant Method - Dieter - 02-03-2019, 05:57 PM
RE: (12C Platinum) Secant Method - Gamo - 02-04-2019, 01:00 AM
RE: (12C Platinum) Zero of Function - Dieter - 02-04-2019 05:19 PM



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