Ask Your Question

Revision history [back]

You could do something like this:

C.<x, y> = PolynomialRing(QQ)
f = x^2 + y^2
S.<x_1,x_2,y_1,y_2,i> = PolynomialRing(QQ)
F = f.subs({x: x_1 + i*x_2, y: y_1 + i*y_2}).reduce([i^2+1])
f1, f2 = F.polynomial(i).coefficients()
R = singular.ring(0,'(x_1,x_2,y_1,y_2)', 'lp')
g1 = singular.new(str(f1))
g2 = singular.new(str(f2))
g1, g2

Output:

(x_1^2-x_2^2+y_1^2-y_2^2, 2*x_1*x_2+2*y_1*y_2)

You can also use R.fetch(g) to force Singular polynomials g into your particular Singular ring R.