Post Reply 
(PC-12xx~14xx) qthsh Tanh-Sinh quadrature
04-02-2021, 08:14 PM
Post: #15
RE: (PC-12xx~14xx) qthsh Tanh-Sinh quadrature
(04-02-2021 07:12 PM)Albert Chan Wrote:  
(03-29-2021 07:42 PM)robve Wrote:  sqrt(x / (1 - x * x))

This an example of an integral that has all its area close to a non-zero endpoint, the problem here is that the function being integrated returns "garbage" values for x very close to 1. We can easily fix this issue by passing a 2 argument functor to the integrator: the second argument gives the distance to the nearest endpoint, and we can use that information to return accurate values, and thus fix the integral calculation.

Can you explain what that meant ? Perhaps an example ?

What is meant is that when x is close to 1 so-called "catastrophic cancellation" occurs with loss of precision. Tanh-Sinh accumulates inaccurate values at this point.

I picked two Boost Math Tanh-Sinh points very close to 1 for this function to illustrate:

x=0.999999999999991 x^2=0.999999999999982 1-x^2=1.77635683940025e-14
x=0.999999999999999 x^2=0.999999999999999 1-x^2=1.33226762955019e-15

The first point for example has about 3~4 digits remaining in IEEE 754 double precision after subtraction 1-x2 with x2= 0.999999999999982, so roughly 1.77e-14 < 1-x^2 < 1.78e-14. This means that x/(1-x*x)) is accurate to 3~4 digits while being fairly large 5.6e13. This happens to a lot of points.

The "garbage" is not my wording, see Boost Tanh-Sinh. There could be a problem if the number of points integrated are mostly in the neighborhood of 1 for this function. Thinking that there are better examples to demonstrate this.

- Rob

"I count on old friends to remain rational"
Visit this user's website 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 - robve - 04-02-2021 08:14 PM



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