# Revision history [back]

You can do it like this (also simplifying the notation a bit):

sage: R.<x> = PolynomialRing(GF(3))
sage: S.<t> = R.quotient(x^2 + 1)
sage: sum(p^2 for p in S)
0


You can do it like this (also simplifying the notation a bit):

sage: R.<x> = PolynomialRing(GF(3))
sage: S.<t> S.<i> = R.quotient(x^2 + 1)
sage: sum(p^2 for p in S)
0


We can explain the result (for this choice of $f$) as follows: $p(i) = a+bi$ implies $p(i)^2 = a^2 - b^2 + 2abi$ and the sum runs over all $a$ and $b$, so the "real part" of the sum is $$\sum_{a,b} a^2 - b^2 = \sum_a a^2 - \sum_b b^2 = 0,$$ and the "imaginary part" is $$\sum_{a,b} 2ab = \sum_{a,b} ab + \sum_{a,b} ab = \sum_{a,b} ab + \sum_{a,b} (-a)b = \sum_{a,b} ab - ab = 0.$$