Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

If you matrices have polynomial entries, a possible approach is to define a polynomial ring in all variables but p, and the power series ring in p over that ring like:

R.<a11,a12,a13> = PolynomialRing(QQ)
P.<p> = PowerSeriesRing(R,default_prec=2)

Then to ignore the powers p^2 and higher, one can add O(p^2} and convert the result to polynomial if needed:

f = a11 + a12*p + a13*p^2
f += O(p^2)