Ask Your Question
0

How to transpose two variables of an expression

asked 2024-07-04 16:07:04 +0100

updated 2024-07-04 16:46:08 +0100

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 $\mathbb{Q} (q,t) [x_{1}, \dots , x_{m} ] \rightarrow \mathbb{Q} (q,t) [x_{1}, \dots , x_{m} ]$ $$ T_{i} (f) = tf + \dfrac{tx_{i} - x_{i+1} }{ x_{i} - x_{i+1} } (K_{i,i+1}f -f) $$ Where $K_{i,i+1} f(x_{1}, \ldots , x_{i}, x_{i+1}, \ldots x_{m} ) = f(x_{1}, \ldots , x_{i+1}, x_{i}, \ldots x_{m} )$, is the action which interchanges the two variables $x_{i}$ and $x_{i+1}$. I tried to write it down but I don't know how to do this on expressions, I didn't found the $K_{i,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?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2024-07-04 18:27:06 +0100

vdelecroix gravatar image

I think that you first want to define the base ring $\mathbb{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
edit flag offensive delete link more

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: 2024-07-04 16:07:04 +0100

Seen: 120 times

Last updated: Jul 04