(For the next two commands see the installation page.)
libname := libname, FileTools:-JoinPath(["maple","lib","dcfun.mla"],base=homedir):
with(dcfun):
Mahler's operator, which we usually refer to as $M$, is the substitution operator which replaces the variable, say $x$, with the power $x^b$. Here, $b$ is an integer greater than $1$, which we call the radix, because certain aspects of the domain are linked to the $b$-ary expansions of integers.
More generally, a linear Mahler operator is an element of the algebra ${\mathbb F}(x)\langle M\rangle$, where $\mathbb F$ is the ground field, with the commutation rule $Mx = x^bM$. Concretely, we deal with polynomials in $M$ whose coefficients are rational functions in $x$. The coefficients are often polynomials, as it is always possible to return to this case when looking for solutions to homogeneous equations. A monomial in $x$ and $M$ is understood to have a power of $M$ to the right of a power of $x$, even if written in reverse order. In other words, $x^j M^k$ and $M^k x^j$ are both understood as $x^j M^k$.
Let us define a linear Mahler operator $L$. First we choose a radix $b$, next we consider a polynomial $L$ in the variable $M$.
b := 3;
$$3$$
L1 := (x^72 + x^63 + x^54 + x^45 + x^36 + x^27 + x^18 + x^9 + 1)*M^4 + (-x^54 - x^50 - x^46 - x^42 - x^38 - x^34 - x^30 - x^26 - x^22 - x^18)*M^2 + x^48 - x^47 + x^44 - x^43 + x^40 - x^38 + x^36 - x^34 + x^32 - x^29 + x^28 - x^25 + x^24;
$$\left(x^{72}+x^{63}+x^{54}+x^{45}+x^{36}+x^{27}+x^{18}+x^{9}+1\right) M^{4}+\left(-x^{54}-x^{50}-x^{46}-x^{42}-x^{38}-x^{34}-x^{30}-x^{26}-x^{22}-x^{18}\right) M^{2}+x^{48}-x^{47}+x^{44}-x^{43}+x^{40}-x^{38}+x^{36}-x^{34}+x^{32}-x^{29}+x^{28}-x^{25}+x^{24}$$
It has order $r_1 = 4$ and degree $d_1 = 72$.
r1, d1 := degree(L1, M), degree(L1, x);
$$4, 72$$
Besides we consider the following ramified rational function $f$.
f := x^(1/4)/(1 + x^(1/2));
$$\frac{x^{\frac{1}{4}}}{1+\sqrt{x}}$$
The operator $L_1$ annihilates $f$.
LMOpEval(L1, f, x, M, b);
$$0$$
However, $L_1$ is not the minimal operator annihilating $f$.
L2 := RamRatPolyToLMOp(f, x, M, b);
$$\left(-x^{6}-x^{3}-1\right) M^{2}+\left(x^{4}+x^{2}\right) M +x^{4}-x^{3}+x^{2}$$
r2, d2 := degree(L2, M), degree(L2, x);
$$2, 6$$
LMOpEval(L2, f, x, M, b);
$$0$$
$L_2$ is the minimal operator annihilating $f$ and it has order $r = 2$ and degree $d = 6$.
Let us verify that $L_2$ divides $L_1$ on the right.
Q, R := LMOpRightEuclideanDivision(L1, L2, x, M, b);
$$\left(-x^{18}-x^{9}-1\right) M^{2}+\left(-x^{36}-x^{18}\right) M +x^{44}-x^{42}-x^{41}+x^{40}+x^{39}-x^{37}+x^{35}-x^{33}+x^{31}-x^{29}+x^{27}+x^{26}-x^{25}-x^{24}+x^{22}, 0$$
R;
$$0$$
Conversely, we can check that the product $Q L_2$ is indeed $L_1$.
QL2 := LMOpMul(Q, L2, x, M, b);
$$\left(x^{22}-x^{20}-x^{19}+x^{18}+x^{17}-x^{15}+x^{13}-x^{11}+x^{9}-x^{7}+x^{5}+x^{4}-x^{3}-x^{2}+1\right) x^{24} \left(x^{2}-x +1\right)+\left(-x^{54}-x^{50}-x^{46}-x^{42}-x^{38}-x^{34}-x^{30}-x^{26}-x^{22}-x^{18}\right) M^{2}+\left(x^{18}+x^{9}+1\right) \left(x^{54}+x^{27}+1\right) M^{4}$$
collect(L1 - QL2, M, expand);
$$0$$