Here I am trying to make a substitution. For testing, the function "has" works as shown below. But the "subs" just does not implement the substitution. cout << has(temp, JF1(wild(1), GA(wild(5)), wild(2))*JF1(wild(3), GA(wild(5)), wild(4)) , has_options::algebraic ) << endl; cout << temp.subs( JF1(wild(1),GA(wild(5)),wild(2))*JF1(wild(3),GA(wild(5)),wild(4)) == 2, subs_options::algebraic ) << endl; The functions "JF1" and "GA" are both declared using DECLARE_FUNCTION and commutative. DECLARE_FUNCTION_1P( GA ); REGISTER_FUNCTION( GA, dummy() ); Best regards, Zhao Theory Division Institute of High Energy Physics Chinese Academy of Sciences
On 02/21/2013 04:42 AM, Zhao Li wrote:
Here I am trying to make a substitution. For testing, the function "has" works as shown below. But the "subs" just does not implement the substitution.
cout << has(temp, JF1(wild(1), GA(wild(5)), wild(2))*JF1(wild(3), GA(wild(5)), wild(4)) , has_options::algebraic ) << endl; cout << temp.subs( JF1(wild(1),GA(wild(5)),wild(2))*JF1(wild(3),GA(wild(5)),wild(4)) == 2, subs_options::algebraic ) << endl;
The functions "JF1" and "GA" are both declared using DECLARE_FUNCTION and commutative.
DECLARE_FUNCTION_1P( GA ); REGISTER_FUNCTION( GA, dummy() );
$ cat zhaoli.cc #include <iostream> #include <ginac/ginac.h> using namespace std; using namespace GiNaC; DECLARE_FUNCTION_1P( GA ); REGISTER_FUNCTION( GA, dummy() ); DECLARE_FUNCTION_3P( JF1 ); REGISTER_FUNCTION( JF1, dummy() ); int main() { symbol a("a"); symbol b("b"); symbol t("t"); symbol x("x"); symbol y("y"); ex temp = JF1(a, GA(t), b)*JF1(x, GA(t), y); cout << temp << endl; cout << temp.has( JF1(wild(1), GA(wild(5)), wild(2)) * JF1(wild(3), GA(wild(5)), wild(4)), has_options::algebraic ) << endl; cout << temp.subs(JF1(wild(1), GA(wild(5)), wild(2)) * JF1(wild(3), GA(wild(5)), wild(4)) == 2, subs_options::algebraic ) << endl; } $ g++ zhaoli.cc -lginac $./a.out JF1(a,GA(t),b)*JF1(x,GA(t),y) 1 2 Cheers -richy. -- Richard B. Kreckel
participants (2)
-
Richard B. Kreckel
-
Zhao Li