Processing math: 100%

First time here? Check out the FAQ!

Ask Your Question
1

Passing Sage functions to Singular

asked 5 years ago

PaulEbert gravatar image

Hello Everyone,

given a polynomial f:C2C in two complex variables x,y together with a singular isolated point (0,0) of f, I try to extract information about the set of points (x,y)C2:f(x,y)=0 that intersect a small sphere Sϵ3(z) centered at the origin. In order to obtain points (x,y) satisfying both conditions, I wanted to split my two complex variables (x,y) in their real and imaginary part to obtain a polynomial f:R4R2 and to easily write the second condition in terms of x21+x22+y21+y22ϵ2=0,x=x1+i x2,  y=y1+i y2.

I know that the solution is homeomorphic to S1S1, that's why I want to pass f splitted in real and imaginary part as functions of (x1,x2,y1,y2) to Singular together with the equation above, to get the two components of the solution. Everything works perfectly so far (giving the equations to Singular directly), except that I can't manage to pass the functions from Sage to singular (via the built-in Interface).

I tried something like:

C.<x, y> = PolynomialRing(CC)
f = x^2 +y^2
f1 = real_part(f)
f2 = imag_part(f); f2
# The output for f2 is: 
# 2.00000000000000*imag_part(x)*real_part(x) + 2.00000000000000*imag_part(y)*real_part(y)

I know how to define new functions in Singular via

R = singular.ring(0, '(x_1,x_2,y_1,y_2)', 'lp')
g = singular.new('2*x_1*x_2 + 2*y_1*y_2')

but how can I pass f1 and f2 to Singular and tell Singular to treat them as functions of (x1,x2,y1,y2)?

Thanks you very much!

Preview: (hide)

1 Answer

Sort by » oldest newest most voted
2

answered 5 years ago

rburing gravatar image

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.

Preview: (hide)
link

Comments

Thanks for you fast response, your solution works perfectly.

PaulEbert gravatar imagePaulEbert ( 5 years ago )

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 5 years ago

Seen: 807 times

Last updated: Apr 02 '20