The actual computation I had in mind requires a somewhat more convoluted: sage: R = QQ[sqrt(-1)] sage: RI = R.gens()[0] # necessary, since Sage's I is symbolic, and causes issues sage: S.<x,y> = PolynomialRing(R,order='lex') sage: SI = S.ideal((1+RI)*x+y,x+(1-RI)*y-(1-RI)) sage: SI.groebner_basis() [x + (-I + 1), y - 2]
Sorry for my earlier imprecision: when I did it the first time, I didn't realize that "I" was defined as something other than sqrt(-1) in my current session. is the variable x in the first line a dummy one, i.e. has nothing to do > with the > x in the second line? > I wouldn't say it's a dummy; it's used to define the number field. But, it is unrelated to the second x. I don't use CC much myself, but it certainly has its uses (e.g., approximation). john perry On Monday, February 17, 2014 12:39:46 PM UTC-6, sahi...@gmail.com wrote: > > Thank you, I get the solution by using > > N.<i> = NumberField(x^2+1) > S.<x,y> = PolynomialRing(QQ,order='lex') > > is the variable x in the first line a dummy one, i.e. has nothing to do > with the > x in the second line? Sorry, I am new to Sage and sometimes I get confused. > > If CC is not appropriate for this kind of problems we are discussing, for > what > computational reason can CC be used in sage or any other computer algebra > system? > > Best Regards, > > On Monday, February 17, 2014 1:08:30 PM UTC-5, luisfe wrote: >> >> >> >> On Monday, February 17, 2014 6:39:38 PM UTC+1, sahi...@gmail.com wrote: >>> >>> OK, I tried the following: >>> >>> S.<i,x,y> = PolynomialRing(QQ,order='lex') >>> I = ideal(i^2+1,(1+i)*x+y,x+(1-i)*y-(1-i)) >>> G = I.groebner_basis() >>> G >>> >>> would give me >>> >>> [i - x - 1, x^2 + 2*x + 2, y - 2] >>> >>> which are the results. But I am confused; why I can't get the result when I >>> try >>> to get a polynomial ring in the field of complex numbers implemented by >>> sage? Also, >>> does adding i**2+1=0 really extend the rational numbers to complex number >>> field? >>> >>> >> The problem with CC is that it is an *inexact field. *If you do >> computations with coefficients in CC, you will end up with roundup errors. >> For instance, buchberger algorithm to compute Grobner basis would yield the >> ideal (1) with high probability. >> >> In the case, you are not computing on the complex numbers, only on the >> gaussian rationals. Essentially, you are working on QQ[i] without naming >> it. In this case your solutions live on QQ[i] so it is not a problem. >> >> Consider the following example: >> >> system x^2+i+y^3, y^4-x >> >> sage: S.<i,x,y>=PolynomialRing(QQ,order='lex') >> sage: I=Ideal(x^2+i+y^3, y^4-x) >> sage: I.groebner_basis() >> [i + y^8 + y^3, x - y^4] >> >> Then, y is any of the 8 roots of the polynomial *'i + y^8 + y^3*', and >> for each one of these roots, *x=y^4*. So you get 8 pairs (x,y) of >> solutions. >> >> By the way, the suggestion given by John Perry is to do: >> >> sage: N.<i> = NumberField(x^2+1) >> sage: S.<x,y>=PolynomialRing(QQ,order='lex') >> >> if you do this, then >> >> sage: i^2 >> -1 >> >> you are really working on QQ[i] >> > -- You received this message because you are subscribed to the Google Groups "sage-support" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-support+unsubscr...@googlegroups.com. To post to this group, send email to sage-support@googlegroups.com. Visit this group at http://groups.google.com/group/sage-support. For more options, visit https://groups.google.com/groups/opt_out.