Evaluate polynomials with imaginary numbers

Viewed 27

I'm trying to calculate 19v^2 + 49v + 8 to the 67th power over the finite field Z/67Z using Sage where v = sqrt(-2).

Here's what I have so far (using t instead of v):

R.<t> = PolynomialRing(GF(67))
poly = (19 * (t^2) + 49*t + 8)
poly^67

This works fine. But now, I want to evaluate the resulting polynomial with the value sqrt(-2).

I'm not sure how to proceed. Any ideas?

1 Answers

Computing with a square root of -2 amounts to working modulo the polynomial t^2 + 2.

The function power_mod can be used for that.

Instead of first powering and then reducing modulo t^2 + 2, which would be wasteful, it performs the whole powering process modulo t^2 + 2, which is a lot more efficient.

Here are two ways to write the (same) computation.

sage: t = polygen(GF(67))
sage: p = 19 * t^2 + 49 * t + 8
sage: power_mod(p, 67, t^2 + 2)
sage: R.<t> = GF(67)[]
sage: p = R([8, 49, 19])
sage: power_mod(p, 67, R([2, 0, 1]))
Related