help-octave
[Top][All Lists]
Advanced

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

sqrt(1:4)(1:2:4) -> 1.0000 1.4142 1.7321 2.0000


From: Etienne Grossmann
Subject: sqrt(1:4)(1:2:4) -> 1.0000 1.4142 1.7321 2.0000
Date: Fri, 29 Oct 2004 15:59:36 -0400
User-agent: Mutt/1.4.2.1i

  Hi all,

I'm using 2.1.57. Is this the usual/desired behavior? I have the
feeling that it used to be that lines 17, 19 and 20 below would all
give the same result, that of line 20.

  Cheers,

  Etienne

octave:17> sqrt(1:4)(1:2:4)
ans =
 
  1.0000  1.4142  1.7321  2.0000
 
octave:18> 1:2:4
ans =
 
  1  3
 
octave:19> (sqrt(1:4))(1:2:4)
ans =
 
  1.0000  1.4142  1.7321  2.0000
 
octave:20> [sqrt(1:4)](1:2:4)
ans =
 
  1.0000  1.7321


PS : Please please octave don't imitate matlab's braindead behavior in
     this case

    >> sqrt(1:4)(1:2:4)
    ??? Error: () Indexing must appear last in an index expression.

    >> (sqrt(1:4))(1:2:4)
    ??? (sqrt(1:4))(1:2:4)
    |
    Error: Missing operator, comma, or semicolon.

    >> [sqrt(1:4)](1:2:4)
    ??? [sqrt(1:4)](1:2:4)
    |
    Error: Missing operator, comma, or semicolon.
  
 
-- 
Etienne Grossmann ------ http://www.cs.uky.edu/~etienne



-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.octave.org
How to fund new projects:  http://www.octave.org/funding.html
Subscription information:  http://www.octave.org/archive.html
-------------------------------------------------------------



reply via email to

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