symbolic icon indicating copy to clipboard operation
symbolic copied to clipboard

Cannot `ezplot` a constant: XX(0): subscripts must be either integers

Open RocketMaDev opened this issue 1 year ago • 4 comments

I'm using GNU Octave to do some Signals and Systems experiments. In my textbook, ezplot is used to draw symbols like exp(2 * abs(t)). And to prove some properties, we need to substract two symbols and draw it to see if the difference is 0.

A quick poc:

pkg load symbolic;
syms a;
ezplot(a + a); % (sym)2a, success
ezplot(a - a); % (sym)0, failed

which throws:

error: XX(0): subscripts must be either integers 1 to (2^63)-1 or logicals
error: called from
    __ezplot__>find_valid_domain at line 508 column 12
    __ezplot__ at line 396 column 18
    ezplot at line 84 column 21
    ezplot at line 127 column 5

However, I expect it could draw a straight horizontal line to indicate the result is 0.

RocketMaDev avatar Dec 10 '24 08:12 RocketMaDev

Confirmed, I get the same with ezplot(sym(2)) so probably this is something about determining the default symbol to plot against...

cbm755 avatar Dec 14 '24 18:12 cbm755

It appears to be an Octave bug:

f = @(t) 2*t + 3
g = @(t) 2


ezplot(f)   %  ok
ezplot(g)  % error

error: XX(0): subscripts must be either integers 1 to (2^63)-1 or logicals
error: called from
    __ezplot__>find_valid_domain at line 508 column 12
    __ezplot__ at line 396 column 18
    ezplot at line 84 column 21

cbm755 avatar Dec 14 '24 18:12 cbm755

https://savannah.gnu.org/bugs/?func=detailitem&item_id=49766

cbm755 avatar Dec 14 '24 18:12 cbm755

So it seems this was found years ago but we only fixed half of the bug! Thanks for uncovering this (again!)

I've filed a new upstream issue, you can track the progress there; once fixed, this should "just work" in Symbolic.

https://savannah.gnu.org/bugs/index.php?66563

cbm755 avatar Dec 14 '24 18:12 cbm755