bugGNU Octave - Bugs: bug #44867, Bessel functions scaled even if...

 
 

bug #44867: Bessel functions scaled even if opt=0

Submitter:  None
Submitted:  Fri 17 Apr 2015 05:34:55 PM UTC
   
 
Category:  Octave Function Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Feature Request
Status:  Fixed Assigned to:  None
Originator Name:  Byron Boulton Originator Email:  -email is unavailable-
Open/Closed:  * Closed Release:  * 3.8.2
Operating System:  * GNU/Linux Fixed Release:  None
Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Mon 20 Apr 2015 12:23:35 PM UTC, comment #6: 

Thank you for such a quick response to this!

Byron Boulton <bkboulton>
Fri 17 Apr 2015 10:04:08 PM UTC, comment #5: 

I checked in a changeset here that uses stricter input validation of the OPT argument (http://hg.savannah.gnu.org/hgweb/octave/rev/93b3757a9623).  It also updates the documentation.  This will be a part of the 4.0 release coming out shortly.

Rik <rik5>
Group administrator
Fri 17 Apr 2015 08:05:32 PM UTC, comment #4: 

+verbose+

>> besselj (1, i, 3.0)

Error using besselj
SCALE must be 0 or 1.
-verbose-

Thanks for your fast response. This change will also necessitate a documentation update for the bessel functions. Should I open a separate issue for that?

Byron Boulton <bkboulton>
Fri 17 Apr 2015 07:52:26 PM UTC, comment #3: 

One final test I need data on.


besselj (1, i, 3.0)


I've got a changeset that works for this.

Rik <rik5>
Group administrator
Fri 17 Apr 2015 06:59:52 PM UTC, comment #2: 


>> besselj (1, i)

ans =

   0.0000 + 0.5652i

>> besselj (1, i, 0.0)

ans =

   0.0000 + 0.5652i

>> besselj (1, i, 1.0)

ans =

   0.0000 + 0.2079i

>> besselj (1, i, zeros(1))

ans =

   0.0000 + 0.5652i

>> besselj (1, i, zeros(2))
Error using besselj
SCALE must be 0 or 1.

>> besselj (1, i, zeros(2,2))
Error using besselj
SCALE must be 0 or 1.

>> besselj (1, i, zeros(2,2,2))
Error using besselj
SCALE must be 0 or 1.

>> besselj (1, i, ones(2,2,2))
Error using besselj
SCALE must be 0 or 1.

>> besselj (1, i, eye(1))

ans =

   0.0000 + 0.2079i

>> besselj (1, i, eye(3,3))
Error using besselj
SCALE must be 0 or 1.

>> besselj (1, i, 'abc')
Error using besselj
Inputs must be single or double.

>> besselj (1, i, char(0.0))
Error using besselj
Inputs must be single or double.


Byron Boulton <bkboulton>
Fri 17 Apr 2015 06:40:50 PM UTC, comment #1: 

Do you have access to Matlab?  I'd like to know how much input validation they are really doing.

Example Code to Run:


besselj (1, i)
besselj (1, i, 0.0)
besselj (1, i, 1.0)
besselj (1, i, zeros (2,2,2))
besselj (1, i, ones (2,2,2))
besselj (1, i, eye (3,3))
besselj (1, i, 'abc');
besselj (1, i, char (0.0));


Post the results back to this bug report and I'll have a go at changing Octave.

Rik <rik5>
Group administrator
Fri 17 Apr 2015 05:34:55 PM UTC, original submission:  

besselj, bessely, besseli, besselk, and besselh all have an "opt" parameter, which if present causes the bessel* functions to return a scaled value. This is true whether "opt" has the value 0, 1, 'hokuspokus', or anything.

Attached is a small script which demonstrates besselj getting scaled by providing "opt" values of 0, 1, and 'hokuspokus'.

It would make more sense for this to be implemented the way it is in MATLAB so that "opt" must be a 0 or a 1. If 0, don't scale; if 1, scale.

Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #33705:  scale_besselj.m added by None (130B - text/x-objcsrc - Script demonstrating odd scaling behavior of bessel* functions.)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by bkboulton (Posted a comment)
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by None (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2015-04-17 rik5 StatusNeed Info Fixed
        Open/ClosedOpen Closed
    2015-04-17 rik5 StatusNone Need Info
    2015-04-17 None Attached File- Added scale_besselj.m, #33705

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code