wraithx on Mon, 02 Jan 2023 22:32:14 +0100


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

Question on using eval...


Hello,

I've run into an issue using the "eval" function. I'm trying to check two expressions for symbolic equality. But, I run into a problem when I use the exponent operator. Is this a valid use for the eval function? Is there another way to check if two expressions are equal? Thank you for any help you can provide!

gp > a
%1 = a
gp > b
%2 = b
gp > c
%3 = c
gp > eval("(a/b)+c == (a-b)+c")
%4 = 0
gp > eval("(c-b)+a == (a-b)+c")
%5 = 1
gp > eval("(a^b)+c == (a-b)+c")
  ***   at top-level: eval("(a^b)+c == (a-b)+c")
  ***                 ^--------------------------
  ***   in function eval: (a^b)+c==(a-b)+c
  ***                       ^--------------
  *** _^_: domain error in gpow [irrational exponent]: valuation != 0

-David C.