Post Reply 
(12C Platinum) Zero of Function
02-03-2019, 05:57 PM (This post was last modified: 02-03-2019 06:31 PM by Dieter.)
Post: #3
RE: (12C Platinum) Secant Method
(02-03-2019 01:31 PM)Albert Chan Wrote:  I thought Secant's method required 2 points, thus 4 variables: (x0, f0), (x1,f1)
Interpolate the line to (x2, 0):

Take a look at the code and see what it does:
  1. This is not some kind of Secant method
  2. For inputs a and b the suggested method calculates b := b – f(b)/a
  3. This looks similar to Newton's method where f'(b) is replaced by a constant.
  4. Only b is an estimate for the root, while a is not.

The choice of a is crucial as it decides whether the iteration will converge at all. It doesn't matter if a is greater or less than b (which can be shown easily). The iteration may converge, diverge or oscillate between different values.

As a rough rule the value of a should be close to the slope (!) of the function near the root, and b should be close to the root itself. Again: only b is a guess for the root, but a isn't.

Consider the first example x³+x²+x–2 = 0. There is a root at ≈0,81. At this root the slope (derivative) is ≈4,6. At the initial guess b=1 the derivative is 6. So values for a in this range, say 4...6, will make the iteration converge well, similar to Newton's method.

Now try a=2 and b=1. The iteration does not converge and will finally oscillate between approx. 0,3 and 1,09.

Then try a=–1 and b=1. The iteration will diverge towards infinity (eventually causing an overflow error).

So this method only works under some exactly defined conditions.

Or, as Gamo put it:
(02-03-2019 10:34 AM)Gamo Wrote:  This is not a perfect program, use at your own risk.

;-)

Edit: here is another version of Gamo's program that might be more clear:

Code:
001 STO 0
002 R/S
003 STO 1
004 6
005 5
006 STO 2
007 GTO 020
008 ÷
009 RCL 0
010 =
011 STO-1
012 1
013 STO-2
014 RCL 2
015 1
016 x≤y
017 GTO 020
018 RCL 1
019 GTO 000
020 (place your f(x) here, where x = RCL 1)
... GTO 008

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



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