Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
RocketMaDev opened this issue Dec 10, 2024 · 4 comments
Open
Labels

Comments

@RocketMaDev
Copy link

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.

@cbm755 cbm755 added this to the 3.2.2 milestone Dec 14, 2024
@cbm755
Copy link
Collaborator

cbm755 commented Dec 14, 2024

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

@cbm755 cbm755 added the bug label Dec 14, 2024
@cbm755
Copy link
Collaborator

cbm755 commented Dec 14, 2024

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
Copy link
Collaborator

cbm755 commented Dec 14, 2024

@cbm755
Copy link
Collaborator

cbm755 commented Dec 14, 2024

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 cbm755 added upstream and removed bug labels Dec 14, 2024
@cbm755 cbm755 removed this from the 3.2.2 milestone Dec 14, 2024
@cbm755 cbm755 changed the title Can not ezplot (sym)0 Cannot ezplot a constant: XX(0): subscripts must be either integers Dec 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants