[Top][All Lists]

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

[Octave-bug-tracker] [bug #62682] ezplot() gets different results betwee

From: Glite
Subject: [Octave-bug-tracker] [bug #62682] ezplot() gets different results between inline function and anonymous function
Date: Wed, 29 Jun 2022 13:00:34 -0400 (EDT)

Follow-up Comment #6, bug #62682 (project octave):

In common anonymous functions, _x^2+y^2_ is equivalent to _x.^2+y.^2_, even
without ezplot().
Here is the code:
>> a=@(x,y)x^2+y^2;
>> b=@(x,y)x.^2+y.^2;
>> a(1,2)
ans = 5
>> b(1,2)
ans = 5

That's because Octave can't do A ^ B for A and B both matrices.
Here is the code:
>> [1 2]^[3 4]
error: can't do A ^ B for A and B both matrices

So I guess ezplot() makes some different operation to parse anonymous
functions, and it leads to an incorrect result.
If ezplot() can parse anonymous functions regularly, the result won't be

[comment #5 comment #5:]
> I guess what Dmitri is referring to is this part in Matlab's documentation:
> > When specifying the function as a character vector or string scalar, array
multiplication, division, and exponentiation are always implied. For example,
x^2 is interpreted as x.^2.
> In general the operators `^` (matrix exponentiation) and `.^` (element-wise
exponentiation) are not the same.
> Octave documentation of `ezplot` could be clearer about the "special"
meaning of (matrix) operators in its string input form.


Reply to this item at:


Message sent via Savannah

reply via email to

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