[sage-support] Re: groebner bases of polynomials with complex coefficients

2014-02-18 Thread sahin508
Thank you for the reply. I am now trying the computation with a somewhat 
more involved example and I am getting the error. The example I am trying 
to solve is below:

R = QQ[sqrt(-1)]
RI = R.gens()[0]
S.x1,x2,x3,x4,x5,x6,x7,x8 = PolynomialRing(R,order='lex')
SI = 
S.ideal(4*RI*x4+2*x1-2.52*x3-8*RI,3*x4+2*x1-3.5*x2-6,-4*RI*x8+2*x5-2.52*x7+8*RI,3*x8+2*x5-3.5*x6-6,x1*x5-1,x2*x6-1,x3*x7-1,x4*x8-1)

The last line ends up with an error:

TypeError: unsupported operand parent(s) for '*': 'Real Field with 53
bits of precision' and 'Multivariate Polynomial Ring in x1, x2, x3, x4,
x5, x6, x7, x8 over Number Field in I with defining polynomial x^2 + 1'

I tried the other two methods discussed in this thread and I am obtaining 
similar type errors. I am not sure why this example is causing this error. Is 
there any solution to this error? Any help is well appreciated.

Best Regards,


On Monday, February 17, 2014 3:47:24 PM UTC-5, john_perry_usm wrote:

 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.


Re: [sage-support] Re: groebner bases of polynomials with complex coefficients

2014-02-18 Thread Martin R. Albrecht


On 18/02/14 14:31, sahin...@gmail.com wrote:
 TypeError: unsupported operand parent(s) for '*': 'Real Field with
 53 bits of precision' and 'Multivariate Polynomial Ring in x1, x2,
 x3, x4, x5, x6, x7, x8 over Number Field in I with defining
 polynomial x^2 + 1'

This means that you are mixing elements from

 * the 'Real Field with 53 bits of precision' and
 * 'Multivariate Polynomial Ring in x1, x2, x3, x4, x5, x6, x7, x8 over
Number Field in I with defining polynomial x^2 + 1'

which you shouldn't do. In particular:

   3.5*x2

is your problem. Replace 3.5 by 7/2 and you are good to go.

Cheers,
Martin

PS: Those error messages are meant to be helpful regardless of how scary
they might look :) You can also try to reduce your input in order to
figure out which part exactly triggers the error.



signature.asc
Description: OpenPGP digital signature


Re: [sage-support] Re: groebner bases of polynomials with complex coefficients

2014-02-18 Thread sahin508
I changed the decimals into fractions and I confirm that I am now getting 
results. Thank you so much for your help. You saved me out of stress and 
depression.

Best Regards,

On Tuesday, February 18, 2014 11:23:37 AM UTC-5, Martin R. Albrecht wrote:



 On 18/02/14 14:31, sahi...@gmail.com javascript: wrote: 
  TypeError: unsupported operand parent(s) for '*': 'Real Field with 
  53 bits of precision' and 'Multivariate Polynomial Ring in x1, x2, 
  x3, x4, x5, x6, x7, x8 over Number Field in I with defining 
  polynomial x^2 + 1' 

 This means that you are mixing elements from 

  * the 'Real Field with 53 bits of precision' and 
  * 'Multivariate Polynomial Ring in x1, x2, x3, x4, x5, x6, x7, x8 over 
 Number Field in I with defining polynomial x^2 + 1' 

 which you shouldn't do. In particular: 

3.5*x2 

 is your problem. Replace 3.5 by 7/2 and you are good to go. 

 Cheers, 
 Martin 

 PS: Those error messages are meant to be helpful regardless of how scary 
 they might look :) You can also try to reduce your input in order to 
 figure out which part exactly triggers the error. 



-- 
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.


[sage-support] Re: groebner bases of polynomials with complex coefficients

2014-02-17 Thread john_perry_usm
Instead of CC, try using QQ[i]. That works for me, giving the basis

[x + 4/25, y - 24/25]

john perry

On Monday, February 17, 2014 10:37:30 AM UTC-6, sahi...@gmail.com wrote:

 Hi:

 I am trying to obtain solution of a system of polynomial equations with 
 complex coefficients without success. For example, when I try 

 S.x,y = PolynomialRing(CC,order='lex')
 I = ideal((1+i)*x+y,x+(1-i)*y-(1-i))
 G = I.groebner_basis()

 I see this error:

 AttributeError: 'Ideal_generic' object has no attribute 'groebner_basis'

 I tried another ideal and I am getting the same error. What am I doing wrong? 
 Any help would be well appreciated.

 Best Regards,




-- 
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.


[sage-support] Re: groebner bases of polynomials with complex coefficients

2014-02-17 Thread john_perry_usm
ACK! Make sure I=sqrt(-1) first!

john perry

On Monday, February 17, 2014 10:37:30 AM UTC-6, sahi...@gmail.com wrote:

 Hi:

 I am trying to obtain solution of a system of polynomial equations with 
 complex coefficients without success. For example, when I try 

 S.x,y = PolynomialRing(CC,order='lex')
 I = ideal((1+i)*x+y,x+(1-i)*y-(1-i))
 G = I.groebner_basis()

 I see this error:

 AttributeError: 'Ideal_generic' object has no attribute 'groebner_basis'

 I tried another ideal and I am getting the same error. What am I doing wrong? 
 Any help would be well appreciated.

 Best Regards,




-- 
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.


[sage-support] Re: groebner bases of polynomials with complex coefficients

2014-02-17 Thread sahin508
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?

Best Regards,


On Monday, February 17, 2014 12:14:25 PM UTC-5, john_perry_usm wrote:

 ACK! Make sure I=sqrt(-1) first!

 john perry

 On Monday, February 17, 2014 10:37:30 AM UTC-6, sahi...@gmail.com wrote:

 Hi:

 I am trying to obtain solution of a system of polynomial equations with 
 complex coefficients without success. For example, when I try 

 S.x,y = PolynomialRing(CC,order='lex')
 I = ideal((1+i)*x+y,x+(1-i)*y-(1-i))
 G = I.groebner_basis()

 I see this error:

 AttributeError: 'Ideal_generic' object has no attribute 'groebner_basis'

 I tried another ideal and I am getting the same error. What am I doing 
 wrong? 
 Any help would be well appreciated.

 Best Regards,


  

-- 
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.


[sage-support] Re: groebner bases of polynomials with complex coefficients

2014-02-17 Thread luisfe


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.


[sage-support] Re: groebner bases of polynomials with complex coefficients

2014-02-17 Thread sahin508
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.


[sage-support] Re: groebner bases of polynomials with complex coefficients

2014-02-17 Thread john_perry_usm
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.