HP71B Integral Questions
|
02-11-2020, 05:03 PM
(This post was last modified: 04-14-2021 12:58 AM by Albert Chan.)
Post: #28
|
|||
|
|||
RE: HP71B Integral Questions
Trapezoid and midpoint extrapolated numbers are using same points.
Doing both schemes together in parallel are very cheap. Code: -- integ.lua Note: midpoints "first" simpson numbers were a placeholder, to line-up the 2 sequences. (1 sample point cannot produce simpson number, which required 3+ points) lua> I = require'integ' lua> log1p = require'mathx'.log1p lua> function f(x) return x*log1p(x) end lua> s = I.simpson(I.u(f,-1,1),-1,1,0) lua> a = I.integ(s) 4 0.9275194244636257 1.7390989208692982 8 0.9780170697704409 1.0269366636614183 16 0.9945010276157439 1.0108562045403804 32 0.9986339047563956 1.002758709871382 64 0.9996599242359795 1.0006854427294893 128 0.9999151793902487 1.0001704033854413 256 0.9999788205588988 1.0000424597853743 512 0.9999947084064521 1.0000105961327912 1024 0.9999986775131146 1.000002646612206 We don't know the error ratios of 2 methods. But, we can apply Aitken's Extrapolation for the better convergence sequence. In other words, extrapolate along the romberg table diagonals. For u-transfomed f(x), trapezoid numbers is better. ("error" between iterations is smaller) Aitkens extrapolation of last 5 trapezoid numbers gives area = 1.00000 000003 Code: 64 0.99965992424 For comparison, INTEGRAL (with built-in u-transform), and maximum 65536 intervals. >INTEGRAL(-1,1,0,IVAR*LOGP1(IVAR)) .999999 999665 |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)