bugGNU Octave - Bugs: bug #35236, Inline does not recognise...

 
 

bug #35236: Inline does not recognise "e" as a built-in variable

Submitter:  None
Submitted:  Wed 04 Jan 2012 01:51:56 PM UTC
   
 
Category:  Plotting Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Other
Status:  Fixed Assigned to:  jordigh
Originator Name:  Anders Andersson Originator Email:  -email is unavailable-
Open/Closed:  * Closed Release:  * dev
Operating System:  * GNU/Linux Fixed Release:  None
Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Wed 04 Jan 2012 03:56:52 PM UTC, comment #2: 

First, there are no "built-in variables" in Octave now.  Symbols like "pi" and "NaN" that are given special treatment by the inline function are functions, not variables.

The confusing error message about 'x' undefined happens because by default, inline functions use 'x' as their argument when no other variables are discovered in the expression.  That is somewhat strange, but compatible with Matlab.

Matlab's inline function does not give 'e' or 'NA' special treatment.

So now I suppose that we will see bug reports about how


inline ('some-expression-involving-e')


is not compatible with Matlab (Matlab will include 'e' in the list of arguments and Octave will not do that now).

To be fair, this problem already existed for 'NA', but just came to my attention because of this report.

Unfortunately, I don't think the list of symbols that are handled specially by Matlab's inline function are documented. 

It looks like we only document 'i' and 'j' and the wording could be better.

John W. Eaton <jwe>
Group administrator
Wed 04 Jan 2012 03:17:16 PM UTC, comment #1: 

Thanks, 'twas a slight oversight. Fixed:

http://hg.savannah.gnu.org/hgweb/octave/rev/5a25a51146a1

This should be part of the stable release scheduled for this week.

Jordi GutiƩrrez Hermoso <jordigh>
Group Member
Wed 04 Jan 2012 01:51:56 PM UTC, original submission:  

The mathematical constants e and pi are both pre-defined in Octave. However, not to an equal degree. Compare for example


f=inline('e^x')


which defines f as a function of two variables, e and x, with


f=inline('sin(pi*x)')


which defines f as a function of only one variable, x.

Furthermore, while


fplot('sin(pi*x)',[0,1])


works as expected,


fplot('e^x',[0,1])


gives the confusing and incorrect error message


error: `x' undefined near line XX column XX



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 jwe (Posted a comment)
  • -email is unavailable- added by jordigh (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 5 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2012-01-04 jordigh StatusNone Fixed
        Assigned toNone jordigh
        Open/ClosedOpen Closed
        Release3.2.4 dev
        SummaryIncorrect error message when using mathematical constant e in fplot Inline does not recognise "e" as a built-in variable

    Back to the top

    Powered by Savane 3.13-caa5.
    Corresponding source code