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

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

[Octave-bug-tracker] [bug #48316] besselj gives NaN for moderately large


From: Colin Macdonald
Subject: [Octave-bug-tracker] [bug #48316] besselj gives NaN for moderately large inputs (1e10)
Date: Sun, 26 Jun 2016 05:55:21 +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/?48316>

                 Summary: besselj gives NaN for moderately large inputs (1e10)
                 Project: GNU Octave
            Submitted by: cbm
            Submitted on: Sun 26 Jun 2016 05:55:18 AM GMT
                Category: Octave Function
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Incorrect Result
                  Status: None
             Assigned to: None
         Originator Name: 
        Originator Email: 
             Open/Closed: Open
         Discussion Lock: Any
                 Release: dev
        Operating System: Other

    _______________________________________________________

Details:

Octave gives "besselj(1, 1e10)" as "NaN + NaNI".

Octave:

>> O = besselj(1, 10.^[5:12]')
O =
   0.00184675756288257 +                    0i
  -0.000725968356813763 +                    0i
  0.000236899240312058 +                    0i
  7.30639118155185e-05 +                    0i
  -5.21042264155388e-06 +                    0i
                 NaN +               NaNi
                 NaN +               NaNi
                 NaN +               NaNi


Symbolic pkg, converted to double:

>> S = double(besselj(1, sym(10).^[5:12]'))
S =
   0.00184675756288257
  -0.000725968356813763
  0.000236899240312058
  7.30639118155185e-05
  -5.21042264155388e-06
  -7.67650817568416e-06
  9.95266266795786e-07
  -7.91380268385044e-07


The relative accuracy is fine before blow-up:

>> abs(O-S)./abs(S)
ans =
  1.17416838493212e-16
  1.49345651543824e-16
  1.14415961302507e-16
                     0
  1.62565113336314e-16
                                NaN
                                NaN
                                NaN


(Ironically, I found this when I went looking for a function with good
relative error behaviour even though it decays to zero!  viz., #48307)





    _______________________________________________________

Reply to this item at:

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

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




reply via email to

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