octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #48307] sinc loses precision for large argumen


From: Colin Macdonald
Subject: [Octave-bug-tracker] [bug #48307] sinc loses precision for large arguments
Date: Fri, 24 Jun 2016 17:49:35 +0000 (UTC)
User-agent: Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:47.0) Gecko/20100101 Firefox/47.0

URL:
  <http://savannah.gnu.org/bugs/?48307>

                 Summary: sinc loses precision for large arguments
                 Project: GNU Octave
            Submitted by: cbm
            Submitted on: Fri 24 Jun 2016 05:49:33 PM GMT
                Category: Octave Function
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Inaccurate Result
                  Status: None
             Assigned to: None
         Originator Name: 
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
                 Release: dev
        Operating System: Any

    _______________________________________________________

Details:

For large arguments, the relative error in "sinc" gets progressively worse.


>> x = sym(10000001)/3
x = (sym) 10000001/3
>> d = double(x)              % large non-integer
d =    3.3333e+06
>> P1 = double(sin(pi*x) / (pi*x))
P1 =   -8.2699e-08
>> P2 = double(sinc(x))
P2 =   -8.2699e-08

>> Q = sinc(d)             % this is the value we're checking
Q =   -8.2699e-08

>> (P1-Q)/P1               % relative errors
ans =   -6.3216e-10
>> (P2-Q)/P2
ans =   -6.3222e-10

I'd rather see e.g., 3*eps.

That's all on the real line where the behaviour is decay.  I haven't looked
very carefully in the complex plane; here's one example:

>> x = sym(10+20i); d = double(x)
d =  10 + 20i
>> Q = sinc(d)
Q =  1.2343e+25 + 6.1713e+24i
>> P2 = double(sinc(x))
P2 =  1.2343e+25 + 6.1713e+24i
>> abs((Q - P2)/P2)        % 12*eps, this is not too bad.
ans =    2.6456e-15


The implementation is from the definition: sin(pi*x)/(pi*x).  I don't know
enough if there is an asymptotic series, or some other tool from approx theory
that would do better.

#GSoC2017: fix our special functions?





    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?48307>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]