Post Reply 
(PC-12xx~14xx) qthsh Tanh-Sinh quadrature
04-06-2021, 04:19 PM
Post: #27
RE: (PC-12xx~14xx) qthsh Tanh-Sinh quadrature
Hi, emece67

>>> f = atanh
>>> uf = lambda u: 6*u*(1-u) * f(u*u*(3-2*u))
>>> uuf = lambda u: 6*u*(1-u) * uf(u*u*(3-2*u))

>>> log(2) # expected, for ∫(f(x), x=0..1)
mpf('0.69314718055994529')

Default 0.0 + ArithmeticError + Inf/NaN test, we get this:

(mpf('0.69314718055994518'), mpf('2.7138055025410779e-8'), 47, 3, 0)       # uf
(mpf('0.69314718055994484'), mpf('4.525002594846228e-11'), 71, 4, 0)       # uuf

Previous Point + ArithmeticError + Inf/NaN test, we get this:

(mpf('0.69314718055995395'), mpf('2.713805868914676e-8'), 49, 3, 0)         # uf
(mpf('0.69314725666345778'), mpf('7.6148712890855563e-8'), 83, 4, 0)       # uuf

But, without Inf/NaN test, both get this:

(mpf('+inf'), mpf('nan'), 171, 5, 0)       # uf
(mpf('+inf'), mpf('nan'), 133, 5, 0)       # uuf

This is because atanh(1) does not raise an exception, just return +inf
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-06-2021 04:19 PM



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