Processing math: 100%

First time here? Check out the FAQ!

Ask Your Question
2

How to define group actions on sagemath?

asked 3 years ago

anonymous user

Anonymous

updated 3 years ago

slelievre gravatar image

Hello everyone, I hope you are well.

I have the following problem and I'm having difficulties to make this implementation in sage.

Problem:

Consider fR[x,y] and MM2(R).

How can I implement the Mf(x,y)=f(M1(x,y)) group action in Sage?

I took a look at the link:

but I couldn't understand much.

I thank you for your attention.

Preview: (hide)

2 Answers

Sort by » oldest newest most voted
2

answered 3 years ago

rburing gravatar image

Here's an Action class:

from sage.categories.action import Action
from sage.groups.matrix_gps.matrix_group import is_MatrixGroup
from sage.rings.polynomial.multi_polynomial_ring import is_MPolynomialRing

class InverseLinearMapSubstitutionAction(Action):
    def __init__(self, G, S):
        if not is_MatrixGroup(G):
            raise TypeError("Not a matrix group: %s" % G)
        if not is_MPolynomialRing(S):
            raise TypeError("Not a multivariate polynomial ring: %s" % S)
        if not G.degree() == S.ngens():
            raise ValueError("Degree of matrix group (%d) does not match number of generators of polynomial ring (%d)" % (G.degree(), S.ngens()))
        if not S.base_ring().has_coerce_map_from(G.base_ring()):
            raise ValueError("Base rings not compatible")
        super().__init__(G, S, is_left=True, op=operator.mul)

    def _act_(self, g, f):
        return f(*(g.inverse() * vector(self.domain(), self.domain().gens())))

    def _repr_name_(self):
        return "inverse linear map substitution action"

It works:

sage: R.<x,y> = PolynomialRing(QQ)
sage: G = GL(2, QQ)
sage: a = InverseLinearMapSubstitutionAction(G, R); a
Left inverse linear map substitution action by General Linear Group of degree 2 over Rational Field on Multivariate Polynomial Ring in x, y over Rational Field
sage: M = Matrix(QQ, [[0,-1],[1,0]])
sage: f = x + y
sage: a(M, f)
-x + y

The next step to get the notation M*f working would be to call register_action on R. However M*f is already defined to be a matrix over the polynomial ring, and I don't know how to undo or get around this.

Preview: (hide)
link

Comments

Thank you, this helps a lot.

rafael gravatar imagerafael ( 3 years ago )
1

answered 3 years ago

slelievre gravatar image

The link you provide explains how to allow using g * f to let g act on f.

Here is a way to define the action that does not use that.

It requires typing act(g, f) rather than g * f.

Define the action:

def act(g, f):
    r"""
    Act by this invertible matrix ``g`` on this polynomial ``f``
    by ``g⋅f(x) = f(h(x))`` where ``h`` is the inverse of ``g``.
    """
    M = f.parent()
    return f(*(g.inverse() * vector(M, M.gens())))

Use it:

sage: R.<x, y> = QQ['x, y']
sage: G = GL(2, QQ)
sage: act = GeneralLinearGroupAction(G, R)
sage: f = x + y
sage: g = G([1, 2, 3, 5])
sage: act(g, f)
-2*x + y

Hope someone can say more on registering the group action so that g * f returns the same as act(g, f).

Preview: (hide)
link

Comments

Thank you, this helps a lot.

rafael gravatar imagerafael ( 3 years ago )

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: 3 years ago

Seen: 721 times

Last updated: Feb 07 '22