bugGNU Octave - Bugs: bug #36889, inline with too many parentheses...

 
 

bug #36889: inline with too many parentheses fails to identify X variable

Submitter:  Rik <rik5>
Submitted:  Thu 19 Jul 2012 07:39:59 PM UTC
   
 
Category:  Interpreter Severity:  3 - Normal
Priority:  5 - Normal Item Group:  None
Status:  Wont Fix Assigned to:  None
Originator Name:  Open/Closed:  * Closed
Release:  * dev Operating System:  * GNU/Linux
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Tue 30 Oct 2012 01:37:33 PM UTC, comment #1: 

I suspect Octave current behavior is correct and this can not be fixed. Consider something like


f = inline ('a.^2 + b - cos (theta)')


where both matlab and octave respond with


f(a, b, theta) = a.^2 + b - cos (theta)


as you would expect. Note however that "cos" was not treated as a variable as you seem to expect it should be given this bug report. When I implemented the inline function as a special type of anonymous function I explictedly excluded variables and functin calls being treated as arguments as that is what matlab did at the time.

Though I don't have access to matlab to confirm it but given the bug report

http://www.mathworks.com/matlabcentral/newsreader/view_thread/321077

I suspect matlab still behaves in the same manner. So I'm marking this bug as "Won't fix" but leaving it open to allow someone to check if Matlab treats this example in the same manner as Octave.



David Bateman <dbateman>
Group Member
Thu 19 Jul 2012 07:39:59 PM UTC, original submission:  

Sample code:


fn = inline(' (x(1) - 5).^2')
fn = f() =  (x(1) - 5).^2
octave:8> fn(5)
error: `x' undefined near line 7 column 7
error: called from:
error:    at line -1, column -1


The problem can be corrected by forcing recognition of the variable 'x'.


fn = inline(' (x(1) - 5).^2', 'x')
fn = f(x) =  (x(1) - 5).^2
fn(5)
ans = 0



Rik <rik5>
Group administrator

 

(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 dbateman (Posted a comment)
  • -email is unavailable- added by rik5 (Submitted the item)
  • -email is unavailable- added by rik5 (I added you to the CC list so you can follow the 'inline' bug)
  •  

    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 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2012-12-10 rik5 Open/ClosedOpen Closed
    2012-10-30 dbateman StatusNone Wont Fix
    2012-07-19 rik5 Carbon-Copy- Added -email is unavailable-

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code