Post Reply 
(PC-12xx~14xx) qthsh Tanh-Sinh quadrature
04-02-2021, 03:16 PM
Post: #10
RE: (PC-12xx~14xx) qthsh Tanh-Sinh quadrature
https://www.genivia.com/files/qthsh.pdf, page 10 Wrote:mpmath: mp.dps=15, points=53, est.err=1e-14 (incorrect, actual is about 1e-9)

I was unable to produce above result, for ∫(x**3 - 2x*x + x, x = 0 .. 1)

>>> def f(x): f.n += 1; return x*x*x-2*x*x+x
...
>>> f.n = 0
>>> quadts(f, [0,1], error=True), f.n
((mpf('0.083333333333333329'), mpf('1.0e-22')), 53)

Integral look too simple to trip Tanh-Sinh quadrature.
With Gauss-Legendre quadrature, it took even less points.

>>> f.n = 0
>>> quadgl(f, [0,1], error=True), f.n
((mpf('0.083333333333333329'), mpf('9.26442286059391e-23')), 9)

Both algorithms return correct quadrature, 1/4 - 2/3 + 1/2 = 1/12
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: (PC-12xx~14xx) qthsh Tanh-Sinh quadrature - Albert Chan - 04-02-2021 03:16 PM



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