HP 42S Integration
|
11-10-2021, 11:12 PM
Post: #8
|
|||
|
|||
RE: HP 42S Integration
(11-09-2021 06:27 PM)lrdheat Wrote: Thanks, Albert…I wonder how the Free42 integration implementation differs. Free42 integration routine use Romberg's method, with u-transformed integrand. (11-10-2021 02:34 PM)lrdheat Wrote: I should be clear in stating that I did simply integrated x^1/3 from 3 to 0 to get a negative area under the curve Complex numbers had little to do with the trouble of integrating it. cbrt(x) = sign(x) * abs(x)^(1/3) will suffer just as badly, integrating from -3 to 1. By examining trapezoid numbers, we can deduce effectiveness of Romberg's method. Note: Q.tm returns trapezoids and squares area (mid-point as height, not used here) lua> Q = require 'quad' lua> t0, i0 = Q.tm(Q.u(cbrt,-3,0),-1,1), -3^(4/3) * 3/4 lua> t1, i1 = Q.tm(Q.u(cbrt,-3,1),-1,1), i0 + 3/4 lua> e0, e1 = {}, {} lua> for i=1,9 do e0[i] = i0-t0(); e1[i] = i1-t1() end lua> for i=2,9 do print(i, e0[i-1]/e0[i], e1[i-1]/e1[i]) end -- ratio of errors Code: 2 4.406348748051959 -1.6536329825683571 For ∫(cbrt(x), x=-3..0), doubling trapezoids improve accuracy, about 4 times. I = T1 + O(h^2) I = T2 + O((h^2)/4 Assume both O(h^2) are close, we can extrapolate, and remove them. 4*I = 4*T2 + O(h^2) ≈ 4*T2 + (I-T1) 3*I ≈ 3*T2 + (T2-T1) I = T2 + (T2-T1)/3 + O(h^4) Rinse and repeat, we can remove O(h^4), O(h^6), O(h^8), ... This is essentially what Romberg's method does. For ∫(cbrt(x), x=-3..1), error ratios are all over the place, sometimes even wrong signs ! With false assumption, extrapolation make it worse. |
|||
« Next Oldest | Next Newest »
|
Messages In This Thread |
HP 42S Integration - lrdheat - 11-09-2021, 03:23 PM
RE: HP 42S Integration - Werner - 11-09-2021, 04:18 PM
RE: HP 42S Integration - Albert Chan - 11-09-2021, 05:06 PM
RE: HP 42S Integration - lrdheat - 11-09-2021, 06:27 PM
RE: HP 42S Integration - Albert Chan - 11-10-2021 11:12 PM
RE: HP 42S Integration - lrdheat - 11-09-2021, 06:48 PM
RE: HP 42S Integration - lrdheat - 11-09-2021, 06:55 PM
RE: HP 42S Integration - lrdheat - 11-10-2021, 02:34 PM
RE: HP 42S Integration - lrdheat - 11-10-2021, 11:53 PM
|
User(s) browsing this thread: 1 Guest(s)