Variant of the Secant Method
|
12-11-2020, 04:46 PM
(This post was last modified: 02-07-2021 11:59 AM by Albert Chan.)
Post: #8
|
|||
|
|||
RE: Variant of the Secant Method
Let's compare inverse-interpolation vs improved-secant (code from previous post)
Code: function test(f, x0, x1, n) -- n = 1 (linear) to 3 (cubic) lua> function f(x) return x^3 - 8 end lua> test(f, 5, 4, 2) -- https://arxiv.org/pdf/2012.04248.pdf, Table 2 2 3.081967213114754 3.081967213114754 3 2.3945608933295457 2.2862188297178117 4 2.0980163342039635 2.010344209437878 5 2.0088865345029276 1.99979593345267 6 2.0001129292461193 2.0000000722313933 7 2.0000000388749792 2.000000000000015 8 2.0000000000000164 2 9 2 2 Last column is improved secant, fitting data up to quadratic (slope by linear interpolation) Middle column is inverse-interpolation for x, at y = 0, also fitting up to quadratic. Improved secant uses the last point as the "base", then does correction. Inverse-interpolation is not as good, probably due to putting equal weight to its points. Let's try again, but with up to cubic fit. lua> test(f, 5, 4, 3) 2 3.081967213114754 3.081967213114754 3 2.3945608933295457 2.2862188297178117 4 2.082744738020821 2.034337291023909 5 2.0058425366743506 2.000576313421517 6 2.0000383915262443 2.000000166004798 7 2.0000000023200664 2.0000000000000138 8 1.9999999999999998 2 9 2 2 Based on above, anything more than a cubic fit probably not worth the trouble. For example, lets see how Newton's method does (actual slope) lua> function df(x) return 3*x*x end lua> x = 4 lua> for i=2, 9 do x = x - f(x)/df(x); print(i, x) end 2 2.833333333333333 3 2.221068819684737 4 2.0212735368091126 5 2.0002231146078984 6 2.0000000248863623 7 2.0000000000000004 8 2 9 2 |
|||
« Next Oldest | Next Newest »
|
Messages In This Thread |
Variant of the Secant Method - ttw - 12-09-2020, 04:33 AM
RE: Variant of the Second Method - Valentin Albillo - 12-09-2020, 05:40 AM
RE: Variant of the Second Method - Albert Chan - 12-09-2020, 04:38 PM
RE: Variant of the Secant Method - Albert Chan - 12-09-2020, 11:51 PM
RE: Variant of the Secant Method - Namir - 12-10-2020, 01:54 PM
RE: Variant of the Secant Method - Namir - 12-10-2020, 02:56 PM
RE: Variant of the Secant Method - Albert Chan - 12-11-2020, 04:34 PM
RE: Variant of the Secant Method - Albert Chan - 12-11-2023, 03:25 PM
RE: Variant of the Secant Method - Albert Chan - 12-11-2020 04:46 PM
RE: Variant of the Secant Method - Namir - 12-12-2020, 04:22 AM
RE: Variant of the Secant Method - ttw - 12-12-2020, 02:41 PM
RE: Variant of the Secant Method - Albert Chan - 12-12-2020, 04:27 PM
RE: Variant of the Secant Method - Thomas Klemm - 12-16-2023, 08:11 PM
|
User(s) browsing this thread: 1 Guest(s)