bugGNU Octave - Bugs: bug #54767, Function interpreter creates comma...

 
 

bug #54767: Function interpreter creates comma (",") where there shouldn'd be one

Submitter:  None
Submitted:  Tue 02 Oct 2018 01:03:07 PM UTC
   
 
Category:  Octave Function Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Unexpected Error or Warning
Status:  Invalid / Not an Octave Bug Assigned to:  None
Originator Name:  Jo Mayer Originator Email:  -email is unavailable-
Open/Closed:  * Closed Release:  * 4.2.0
Operating System:  * Microsoft Windows Fixed Release:  None
Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Tue 02 Oct 2018 02:59:06 PM UTC, comment #2: 

Thank you for your bug report. This is not a bug but a feature of the Octave programming language. This is very similar to the recently filed bug #54765.

If you look in the Octave user manual section on matrix bracket syntax, you will see explanations of how whitespace is significant between square brackets: http://octave.org/doc/interpreter/Matrices.html. You will even see an example explaining how '[ a - b ]' is parsed differently from '[ a -b ]', which is the case this report falls into. This is a necessary difference for compatibility with the Matlab language.

Mike Miller <mtmiller>
Group Member
Tue 02 Oct 2018 01:26:53 PM UTC, comment #1: 

te problem is related to -x(4) but if you write  - x(4) then it works. Notice the extra space between - and x(4).


Doug Stewart <dastew>
Tue 02 Oct 2018 01:03:07 PM UTC, original submission:  

enterin the following function definition to command line (i.e. by c'n'p):

funV = @(x,I)  [ x(1) .* sin(I(:,1)) - x(3) .* sin(I(:,1)) .* sin(I(:,2)) -x(4) .* cos(I(:,1)) + x(4) - (-x(1) - x(2)) .* sin(I(:,1)) .* cos(I(:,2)) - (x(1) + x(2)) .* sin(I(:,1)) + (x(3) + x(6)) .* sin(I(:,1)) .* sin(I(:,2)) + (x(4) + x(7)) .* cos(I(:,1)) - (x(1) + x(2) + x(5)) .* sin(I(:,1)) .* cos(I(:,2)) ]


yields a "," where there shouldn'd be one: (please search for the String: "(:, 2)), -x(4)" in the output below to find the wrong ","

funV =

@(x, I) [x(1) .* sin(I (:, 1)) - x(3) .* sin(I (:, 1)) .* sin(I (:, 2)), -x(4) .* cos(I (:, 1)) + x(4) - (-x(1) - x(2)) .* sin(I (:, 1)) .* cos(I (:, 2)) - (x(1) + x(2)) .* sin(I (:, 1)) + (x(3) + x(6)) .* sin(I (:,
 1)) .* sin(I (:, 2)) + (x(4) + x(7)) .* cos(I (:, 1)) - (x(1) + x(2) + x(5)) .* sin(I (:, 1)) .* cos(I (:, 2))]

Note: if the corner bracket "[ ]" around the function definition is removed, result is fine.



Anonymous

 

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

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by dastew (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 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2018-10-02 mtmiller StatusNone Invalid / Not an Octave Bug
        Open/ClosedOpen Closed

    Back to the top

    Powered by Savane 3.13-caa5.
    Corresponding source code