Post Reply 
(PC-12xx~14xx) qthsh Tanh-Sinh quadrature
04-12-2021, 12:20 PM (This post was last modified: 04-12-2021 01:08 PM by Albert Chan.)
Post: #49
RE: (PC-12xx~14xx) qthsh Tanh-Sinh quadrature
I thought this might be interesting to others, so I am responding PM as a post

robve Wrote:I now see what the difference is between qthsh and quad, it's quite simple: qthsh uses f(a+x) while quad uses f(c-x). When a=0, the check a+x>a always succeeds for nonzero positive x, but c-x>a fails due to cancellation with c=(a+b)/2.

This means that qthsh approaches the zero point aggressively, something we already saw before. It also means that qthsh is not "symmetric" in the bounds, something we also saw before. This could be desirable actually, when functions exhibit interesting behavior close to x=0.

Yes, it is more accurate interpolate from the closest edge.
https://www.hpmuseum.org/forum/thread-16...#pid140084

Even if interpolate closed to center !
(c=(a+b)/2 might have rounding errors; a, b are user inputs, thus can considered exact)

That's why qthsh lua implementation removed a ≤ b limitation.

And, accuracy affect both edges, not just the "zero" side.
Example, (code snippet from previous post)

Code:
      else {                // Exp-Sinh
        x = c + d/r;
        if (x > a) {
          y = f(x);
          if (isfinite(y))  // if f(x) is finite, add to local sum
            q += y/w;
        }
      }

Note that x is interpolated from the finite edge (c), so is very accurate.
With r = exp(sinh(j*h)) > 1, this x is approaching the finite edge, so it is better to test x ≠ c.

If x=c, we throwaway the point. It does not meant we assume f(c)=0.
Instead, we are assuming f(c) * weight = 0, since weight at the edge is miniscule.

This is what "default 0.0" meant.

(04-10-2021 01:45 PM)Albert Chan Wrote:  With limits of ±∞, even slight noise will make it hard to converge. (*)

To reduce noise, we should quit summing, if we actually hit the finite edge.
So this is the proposed patch:

Code:
      else {                // Exp-Sinh
        x = c + d/r;
        if (x == c) break;  // x hit finite edge
        y = f(x);
        if (isfinite(y)) q += y/w;
      }
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-12-2021 12:20 PM



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