GiNaC discussion list, I'd like to discern when arguments of a pre-defined function (from another library, xloops) attain a certain value. One of the arguments is type: lst x(symbol("a"), symbol("b")); cout << x yields {0,1} and these are the values I'm looking for. I'm unable to define a relational that accurately tests the values attained by a & b. I tried: if (a==0 && ...) if (a.is_equal(0) && ...) if (a.is_zero() && ...) if (match(a,0,lst placeholder) && ...) with no success. "Probably because a is type symbol", I reasoned. So I defined lst y(symbol("c"), symbol("d")); and used in-place modification y[0] = 0; y[1] = 1; to set symbols c and d to 0 and 1, resp. I then tried the conditionals if (x==y && ...) if (x.is_equal(y) && ...) if (match(x,y,lst placeholder) && ...) with no success. How does one set up a conditional for symbols that have been assigned numeric values? Any ideas? Thanks in advance! Sincerely, Chris Bouchard
Hi, Chris Bouchard schrieb:
I'd like to discern when arguments of a pre-defined function (from another library, xloops) attain a certain value. One of the arguments is type:
lst x(symbol("a"), symbol("b"));
cout << x yields {0,1} and these are the values I'm looking for. I'm unable to define a relational that accurately tests the values attained by a & b. I tried:
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?
with no success. How does one set up a conditional for symbols that have been assigned numeric values? Any ideas?
That is what confuses me. One cannot assign numerical values to symbols in GiNaC. One can replace symbols by numbers, of course. Regards, Jens
participants (2)
-
Chris Bouchard
-
Jens Vollinga