[GiNaC-list] Relations using possymbol

Michael Boyer mwb7w at cs.virginia.edu
Wed Mar 23 15:39:32 CET 2011

On Wed, Mar 23, 2011 at 5:28 AM, Richard B. Kreckel <kreckel at ginac.de> wrote:
> Please check the tutorial, in particular the section "Ordering expressions".
> I hope this answers your question.


Thanks for the pointer. I had read that section before but had not
properly understood how it related to what I was doing.

Another somewhat related question. Consider the following program:

#include <ginac/ginac.h>
using namespace GiNaC;

int main() {
	possymbol x("x");
	ex a = x;

	if (a.info(info_flags::positive)) std::cout << a << " is positive\n";
	else                              std::cout << a << " is _not_ positive\n";

	a *= -1;
	if (a.info(info_flags::negative)) std::cout << a << " is negative\n";
	else                              std::cout << a << " is _not_ negative\n";

The output I see is:
x is positive
-x is _not_ negative

Any idea why it cannot determine that -x is in fact negative?

- Michael

More information about the GiNaC-list mailing list