# How can I perform matrix operations in a transcendental extension of Q?

I have three variables $p_w, p_i, p_f$. I want to construct a matrix whose entries are members are rational polynomials in these variables and perform computations with this matrix (ultimately diagonalize it and obtain a general formula for its $n$-th power). But I want to do this computation symbolically, treating the three variables as transcendental elements adjoined to $\mathbb Q$. How an I do this?

You can define a matrix over a fraction field of a polynomial ring (just define the polynomial ring, and define the matrix by its entries which are fractions). Obtaining the eigenvalues could be tricky, likely requiring a field extension. If you want more precise help, you should add the matrix to your question.