# [GiNaC-list] how to match symmetric function

Zhao Li zhaoli at ihep.ac.cn
Sat Feb 14 06:25:42 CET 2015

```We have a self defined function “LMT” by

DECLARE_FUNCTION_2P( LMT );
REGISTER_FUNCTION( LMT, set_symmetry(sy_symm(0,1)) );

Its two arguments are symmetric to each other. And we want to make the substitution in the expressions, LMT(mu1,mu2)*LMT(mu2,mu3) -> LMT(mu1,mu3). Therefore we made an exmap by

exmap replacement;
replacement.insert(ex2( LMT(wild(1),wild(2))*LMT(wild(2),wild(3)), LMT(wild(1),wild(3)) ));

However, it sometimes does not work for

ex testexpr = LMT(rho1,rho2)*LMT(rho2,rho3);
cout << “before subs, testexpr = “ << testexpr << endl;
testexpr = testexpr.subs( replacement, subs_options::algebraic );
cout << “after subs, testexpr = “ << testexpr << endl;

The subs here mostly fails. Then we realised GiNaC will change to the canonical form for LMT, so we insert all cases of combinations by

exmap replacement;
replacement.insert(ex2( LMT(wild(1),wild(2))*LMT(wild(2),wild(3)), LMT(wild(1),wild(3)) ));
replacement.insert(ex2( LMT(wild(2),wild(1))*LMT(wild(2),wild(3)), LMT(wild(1),wild(3)) ));
replacement.insert(ex2( LMT(wild(1),wild(2))*LMT(wild(3),wild(2)), LMT(wild(1),wild(3)) ));
replacement.insert(ex2( LMT(wild(2),wild(1))*LMT(wild(3),wild(2)), LMT(wild(1),wild(3)) ));

But this still does not work sometimes. Then we got that GiNaC may also change the form of matching expression of LMT(wild(1),wild(2)).

What we can have now is only turn off symmetry property for LMT function, but we worry it may generate difficulty in the future.

So is there some option or algorithm for the symmetric function matching?

Thanks.

Best Regards,
Zhao

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cebix.net/pipermail/ginac-list/attachments/20150214/0f78d278/attachment-0001.html>
```