How to transpose two variables of an expression
Hello, I am using Sagemath version 10.3 I want to work with Double Affine Hecke Algebra (DAHA) generators, which are operators from Q(q,t)[x1,…,xm]→Q(q,t)[x1,…,xm] Ti(f)=tf+txi−xi+1xi−xi+1(Ki,i+1f−f) Where Ki,i+1f(x1,…,xi,xi+1,…xm)=f(x1,…,xi+1,xi,…xm), is the action which interchanges the two variables xi and xi+1. I tried to write it down but I don't know how to do this on expressions, I didn't found the Ki,i+1 so I wrote it using functions for m=3.
I wrote this:
t = PolynomialRing(RationalField(), 't,z_0,z_1,z_2').gen()
def T1(f):
expr=t*f(z_0,z_1,z_2)+(t*z_0-z_1)*(f(z_1,z_0,z_2)-f(z_0,z_1,z_2))/(z_0-z_1)
out=expr.simplify_full()
return out
def T2(f):
expr=t*f(z_0,z_1,z_2)+(t*z_1-z_2)*(f(z_0,z_2,z_1)-f(z_0,z_1,z_2))/(z_1-z_2)
out=expr.simplify_full()
return out
My problem with this approach is that I cannot use T2(T1(f)), I have to do
a(z_0,z_1,z_2)=T1(f)
T2(a)
And with bigger m it becomes more cumbersome.
Any advice?