Loading [MathJax]/jax/output/HTML-CSS/jax.js
Ask Your Question
0

How to transpose two variables of an expression

asked 0 years ago

updated 0 years ago

vdelecroix gravatar image

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+txixi+1xixi+1(Ki,i+1ff) 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?

Preview: (hide)

1 Answer

Sort by » oldest newest most voted
0

answered 0 years ago

vdelecroix gravatar image

I think that you first want to define the base ring Q(t) and get its generators as

A = ZZ['t'].fraction_field()
t = A.gens()

Assuming that you will work over this base ring, then you can program a function T1 generic enough that works for any n

def T1(f):
    B = f.parent()
    x = list(B.gens())
    A = B.base_ring()
    t = A.gen()
    ff = t * f
    for i in range(len(x) - 1):
        xx = x[:]
        xx[i], xx[i+1], = xx[i+1], xx[i]
        g = f(*xx) - f(x)
        quo, rem = g.quo_rem(x[i] - x[i+1])
        assert rem.is_zero()
        ff += (t * x[i] - x[i+1]) * g
    return ff

For example

B = A['z0, z1, z2, z3']
z0, z1, z2 ,z3 = B.gens()
f = (1-t)*z0 + (1+t)*z1 + z2 - t*z3
print(T1(f))

gives me

2*t^2*z0^2 + (-2*t^2 - 2*t)*z0*z1 + (-t^2 + 2*t)*z1^2 + (t^2 + t)*z1*z2 +
(-t^2 - 2*t)*z2^2 + (t^2 + 2*t + 1)*z2*z3 + (-t - 1)*z3^2 + (-t^2 + t)*z0 +
(t^2 + t)*z1 + t*z2 + (-t^2)*z3
Preview: (hide)
link

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 0 years ago

Seen: 142 times

Last updated: Jul 04 '24