Post Reply 
(PC-12xx~14xx) qthsh Tanh-Sinh quadrature
04-10-2021, 12:05 AM
Post: #45
RE: (PC-12xx~14xx) qthsh Tanh-Sinh quadrature
(04-08-2021 01:58 PM)Albert Chan Wrote:  
(04-08-2021 11:20 AM)emece67 Wrote:  integrals (1 - sqrt(2)*cosh(x)/sqrt(cosh(2*x)), from -inf to +inf) needed one more level.
This particular case worsened dramatically, from 13 correct digits with strength reduction to only 4 with these changes)

I believe there is nothing to worry about.
Integrand suffered from subtraction cancellations.

Amazingly, qthsh (I picked sqrt version, for speed), does not get garbage from this.

lua> f = function(x) n=n+1; return 1-sqrt(2)*cosh(x)/sqrt(cosh(2*x)) end
lua> f01 = function(t) local y=t*t-t; return f((2*t-1)/y) * (2*y+1)/(y*y) end

With default setting of n=6, eps=1e-9, we have:

lua> Q = require 'quad'
lua> n=0; print(Q.qthsh(f01, 0, 1, 1), n) -- Previous Point
-0.6931471805996943       80
lua> n=0; print(Q.qthsh(f01, 0, 1, 0), n) -- Default Zero
-0.6931471805582439       77

Showing running integral sum, for each level k (c=0, n=5, eps=0)

lua> n=0; Q.qthsh(f01, 0, 1, 0, 5, 0)
0       -1.6568543106755638
1       -0.8783982505319032
2       -0.7037071116271125
3       -0.693194301031653
4       -0.6931471818102728
5       -0.6931471805599556
lua> n, -log(2)
99     -0.6931471805599453
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-10-2021 12:05 AM



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