Ask Your Question
1

Passing Sage functions to Singular

asked 2020-04-02 12:26:07 +0100

PaulEbert gravatar image

Hello Everyone,

given a polynomial $f\colon \mathbb{C}^2 \to \mathbb{C}$ 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)\in \mathbb{C}^2: f(x,y)=0$ that intersect a small sphere ${S_\epsilon}^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\colon \mathbb{R}^4 \to \mathbb{R}^2$ and to easily write the second condition in terms of $$ x_1^2 + x_2 ^2 +y_1^2 + y_2 ^2 - \epsilon^2 =0, \qquad x=x_1 + i~x_2, ~~y=y_1 + i~y_2.$$

I know that the solution is homeomorphic to $S^1 \cup S^1$, that's why I want to pass $f$ splitted in real and imaginary part as functions of $(x_1, x_2, y_1, y_2)$ 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 $(x_1, x_2, y_1, y_2)$?

Thanks you very much!

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2020-04-02 14:16:03 +0100

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.

edit flag offensive delete link more

Comments

Thanks for you fast response, your solution works perfectly.

PaulEbert gravatar imagePaulEbert ( 2020-04-02 14:32:40 +0100 )edit

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: 2020-04-02 12:26:07 +0100

Seen: 629 times

Last updated: Apr 02 '20