Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Passing Sage functions to Singular

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!