Ask Your Question

PaulEbert's profile - activity

2022-01-29 22:12:53 +0200 received badge  Notable Question (source)
2022-01-29 22:12:53 +0200 received badge  Popular Question (source)
2020-07-17 15:53:48 +0200 commented answer How to plot in seperate window using Jupyter notebook?

Thanks for your answer! Is there any way to make the axis labels more sharp? In my case they appear in very low resolution, while the plot itself doesn't. Another thing I noticed: For some reason no legend appears next to the plot, even though I tried coding it in.

2020-07-17 11:17:39 +0200 asked a question How to plot in seperate window using Jupyter notebook?

Hello Guys,

I spend quite some time approximating a 1-manifold via a list of points, that I now want to plot. Is there a way to have a nice big window showing the interactive plot, instead of the small image, which is shown inline per default?

I'm using something like

plot = list_plot(firstList, plotjoined=True, color = 'blue')
plot += list_plot(secondList, plotjoined=True, color = 'red')

to plot two components of the manifold in one image. Sorry, but I can't show an screenshot of the output, because I'm new here and missing points (<60) to upload :( Alternatively, I tried adjusting the figsize, but nothing changed that way.

Thank you for your help!

2020-04-06 20:11:44 +0200 commented answer Random errors when using Singular via Sage

Thank you for helping me out again! I tried giving the functions to solve() directly and never got an error, one can also see the behavior by printing out I.primdecGTZ(). You mentioned doing in the "Sage-way" with Singular only acting in the background. Do you know about runtime advantages of one over the other?

2020-04-06 19:04:50 +0200 commented question Random errors when using Singular via Sage

Thanks! I'll try doing in that way and report the result.

2020-04-06 18:12:00 +0200 received badge  Editor (source)
2020-04-06 18:07:09 +0200 asked a question Random errors when using Singular via Sage

Hello everyone,

I'd like to use Singulars capabilities in solving systems of polynomial equations, however I regularly obtain errors of Singular not recognizing the ring, that is created when executing the solve() command from the solve.lib Singular package. It seems somehow random to me, because the error only appears at about 30% of the time running to programm, so just giving it another try (without making any changes to the code) results in the desired result most of the time.

Here is my code:

C.<x, y> = PolynomialRing(QQ)
f = x^2 +y^2
epsilon = 1
# suggested by "rburing" to my question 'Passing functions to Singular'
# because I need to split f=f1+i*f2 in real and imaginary part
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))
g3 = singular.new('x_1^2 + x_2^2 +y_1^2+y_2^2 -' + str(epsilon) + '^2')
# creating the first ideal
I = singular.ideal(g1, g2, g3)
singular.lib("primdec.lib")
singular.lib("solve.lib")
# obtain the simplified components of the solution
components = I.primdecGTZ()
k1_1 = components[1][2][1]
k1_2 = components[1][2][2]
k1_3 = components[1][2][3]
singular.setring(R)
# creating a new ideal containing only the first component
H = singular.ideal(str(k1_1),str(k1_2),str(k1_3))
singular.setring(R)
# I now add another constraint to get two real solutions
# sphere around a point close to the solution
J = singular.ideal(H, '(x_1-0)^2 + (x_2+985/1393)^2 +(y_1-985/1393)^2+(y_2-0)^2 -1/10^2')
T = singular.solve(J)
singular.setring(T)
print(singular.eval('SOL'))

It might seem complicated to create that many Ideals but it is necessary because some of them are needed more often. Executing it 10 times results in 2 to 3 errors of the following kind:

SingularError                             Traceback (most recent call last)
<ipython-input-55-da8b511c4e72> in <module>()
    28 J = singular.ideal(H, '(x_1-0)^2 + (x_2+985/1393)^2 +(y_1-985/1393)^2+(y_2-0)^2 -1/10^2')
    29 T = singular.solve(J)
->  30 singular.setring(T)
    31 print(singular.eval('SOL'))

 /opt/sagemath-9.0/local/lib/python3.7/site-packages/sage/interfaces/singular.py in set_ring(self, R)
    1097         if not isinstance(R, SingularElement):
    1098             raise TypeError("R must be a singular ring")
->  1099         self.eval("setring %s; short=0"%R.name(), allow_semicolon=True)
    1100 
    1101     setring = set_ring

/opt/sagemath-9.0/local/lib/python3.7/site-packages/sage/interfaces/singular.py in eval(self, x, allow_semicolon,      strip, **kwds)
    657         # Singular actually does use that string
    658         if s.find("error occurred") != -1 or s.find("Segment fault") != -1:
 -> 659             raise SingularError('Singular error:\n%s'%s)
    660 
    661         if get_verbose() > 0:

SingularError: Singular error:
   ? sage2437 is no name of a ring/qring
   ? error occurred in or before STDIN line 746: `setring sage2437; short=0;

Thanks for your help! Greetings Paul

2020-04-02 14:37:07 +0200 received badge  Scholar (source)
2020-04-02 14:32:40 +0200 commented answer Passing Sage functions to Singular

Thanks for you fast response, your solution works perfectly.

2020-04-02 14:26:18 +0200 received badge  Supporter (source)
2020-04-02 14:20:07 +0200 received badge  Student (source)
2020-04-02 13:16:03 +0200 asked a question 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!