Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

First off, the code appears to be incomplete as neither R nor x is defined. Per textual description, the set-up should be

P.<t2,t3,t4,t5> = PolynomialRing(QQ)
S.<q> = PowerSeriesRing(P, default_prec=2)
R.<x> = PolynomialRing(S)

Next, the discriminant can be computed directly as p.discriminant().

Finally, there seems to be a misunderstanding of what default precision is. Per documentation:

default_prec – the default precision used if an exact object must be changed to an approximate object in order to do an arithmetic operation. [...] The default precision is specified at construction, but does not bound the precision of created elements.

In your code, the coefficients of p are specified as exact and thus have infinite precision. Hence, the discriminant is not computed modulo q^2 but exactly, In order to perform computation modulo q^2, the precision of the coefficients has to be changed to 2 first:

p.map_coefficients(lambda t: t.add_bigoh(2)).discriminant()

which instantly returns O(q^10).