wraithx on Mon, 02 Jan 2023 23:43:33 +0100


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

Re: Question on using eval...


On 1/2/2023 4:09 PM, Bill Allombert wrote:
On Mon, Jan 02, 2023 at 03:31:00PM -0600, wraithx@morpheus.net wrote:
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!

Dear David,

The eval function does not work like in Maple.
Writing
? eval("something")
has the same effect as
? something.
so it is not useful with string constants.

gp > a
%1 = a
gp > b
%2 = b
gp > c
%3 = c
gp > eval("(a/b)+c == (a-b)+c")

  gp> (a/b)+c == (a-b)+c
  would do the same thing faster.

I did see that I could just write the expression on the gp command line, but unfortunately, I am using code to generate these expressions and so I only have them available as strings.

Do you know of a way to compare two expressions in pari/gp (checking for equality) when each expression is stored in a string? Hopefully a way that includes the exponent operator?

-David C.