(PC-12xx~14xx) qthsh Tanh-Sinh quadrature
|
04-17-2021, 01:14 PM
Post: #60
|
|||
|
|||
RE: (PC-12xx~14xx) qthsh Tanh-Sinh quadrature
Revisiting original quad(), where we interpolate from the center, we may be able to improve it.
double_exponential.py is doing the same way, so the patch might be useful. This was the snippet from before, started with r = w = exp(t-.25/t); // = exp(sinh(j*h)) For tanh-sinh, r ← (r-1/r) / (r+1/r), which may suffer rounding errors > 1/2 ulp (04-11-2021 03:05 AM)robve Wrote: Instead, we calculate from the edge: r ← (r-1/r) / (r+1/r) = 1 - 2/(1+r*r) This is the proposed patch, where updated r should be much more accurate, at the edges. Code: if (mode == 0) { // if Tanh-Sinh (04-12-2021 01:50 PM)Albert Chan Wrote: lua> Q = require 'quad' This is still not as good as interpolate from the edge, but it improved a lot. Redoing the above example, with the proposed patch. lua> O = require 'quad0' -- original quad(), interpolate from center, but more accurate r lua> O.quad(O.count(f), -1, 1), O.n 3.1415926448906006 59 |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 6 Guest(s)