Operator

Given any ring R, the ring of the Integer linear operators over R is called Operator(R). To create an operator over R, first create a basic operator using the operation operator, and then convert it to Operator(R) for the R you want. We choose R to be the two by two matrices over the integers.
Create the operator tilde on R
Since Operator is unexposed we must either package-call operations from it, or expose it explicitly. For convenience we will do the latter.
To attach an evaluation function (from R to R) to an operator over R, use evaluate(op,f) where op is an operator over R and f is a function R->R. This needs to be done only once when the operator is defined. Note that f must be Integer linear (that is,
```  f(ax+y) = a f(x) + f(y)
```
for any integer a and any x and y in R). We now attach the transpose map to the above operator t.
Operators can be manipulated formally as in any ring: + is the pointwise addition and * is composition. Any element x of R can be converted to an operator op_x over R, and the evaluation function of op_x is left-multiplication by x. Multiplying on the left by this matrix swaps the two rows.
Can you guess what is the action of the following operator?
Hint: applying rho four times gives the identity, so rho^4-1 should return 0 when applied to any two by two matrix.
Now check with this matrix
As you have probably guessed by now, rho acts on matrices by rotating the elements clockwise.
Do the swapping of rows and transposition commute? We can check by computing their bracket.
Now apply it to m.
Next we demonstrate how to define a differential operator on a polynomial ring. This is the recursive definition of the nth Legendre polynomial.
Create the differential operator d/dx on polynomials in x over the rational numbers.
Now attach a map to it.
This is the differential equation satisfied by the nth Legendre polynomial.
Now we verify this for n=15. Here is the polynomial.
Here is the operator.
Here is the evaluation.