[GiNaC-list] comparing symbols

Chris Bouchard cbouchrd at illinois.edu
Thu Jul 24 19:08:23 CEST 2008


>Is it this what you want:
>	symbol x;
>	ex e1 = beta(x, lst(0,1));
>	ex e2 = beta(x, lst(4,1));
>	if ( e1 == beta(x, lst(0,1)) ) cout << "e1 BINGO" << endl;
>	if ( e2 == beta(x, lst(0,1)) ) cout << "e2 BINGO" << endl;
>Otherwise I do not completely understand your problem yet. Could you 
>clarify it more, then?

The x-loops function I'm working with is r_sum.  It's
definition is (from r.cpp):

static ex r_sum(const ex& t, const lst& b, const lst& x, const ex& eps, int order)

and I'm trying to flag the occurrence of a certain set of
argument values.

The boolean operation "is_a<symbol>(x.op(i));" returns 1 for
i=0,1 so I think I'm working with a list of symbols, x.

Additionally, "cout << x;" yields {0,1} making me think that
the symbols have been assigned numerical value.

>That is what confuses me. One cannot assign numerical values to symbols 
>in GiNaC. One can replace symbols by numbers, of course.

Perhaps I'm not correctly using/interpreting is_a<class>(ex) and/or cout<<x?

Chris Bouchard

More information about the GiNaC-list mailing list