Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: Exact square root.
PostPosted: Fri May 18, 2018 10:15 am 
I have done this before but forgotten it now. How do you work in a ring of characteristic 0 where the square root of 2 is symbolic rather than a number? Thank you very much. Best regards.


Report this post
Top
  
Reply with quote  
 Post subject: Re: Exact square root.
PostPosted: Fri May 18, 2018 2:53 pm 

Joined: Wed Mar 03, 2010 5:08 pm
Posts: 108
Location: Germany, Münster
Work with an algebraic extension of the rationals numbers by definining a minimal polynomial.
Code:
> ring ra = (0,a),(x,y),dp;
> minpoly = a^2-2;
> a^2;
2
> poly f = ax2-1;
> f^2;
2*x4+(-2a)*x2+1
> basering;
// coefficients: QQ[a]/(a2-2)
// number of vars : 2
//        block   1 : ordering dp
//                  : names    x y
//        block   2 : ordering C


Report this post
Top
 Profile  
Reply with quote  
 Post subject: Re: Exact square root.
PostPosted: Sat Jun 09, 2018 11:56 pm 
Thank you very much, that worked like a charm. What if I want to involve other things, like Sqrt[3]? Or what if I want to work with square roots and parameters at the same time? The following won't work.

> ring ra = (0, a, L), (x, y), dp;
> minpoly = a^2 - 2;


Best regards.


Report this post
Top
  
Reply with quote  
 Post subject: Re: Exact square root.
PostPosted: Mon Jun 11, 2018 4:29 pm 

Joined: Wed Mar 03, 2010 5:08 pm
Posts: 108
Location: Germany, Münster
At present, the syntax of Singular allows only to define algebraic extensions of numbers as Q, and Z_p.

If you want to work over the field Q(a,b) with say a:=sqrt{2} and b:=sqrt{3} then you have to calculate first
a primitive element c(this exists in characteristic 0), such that Q(c) = Q(a,b) and express a and b by c.
In practice a generic lineare combination of the algebraic elements a and b is primitive
element c. The library primitive.lib http://www.singular.uni-kl.de/Manual/latest/sing_1320.htm#SEC1396 does this task.
(But there are two drawbacks: 1. IMO, the docmention is difficult to understand
2. the (random) delivered minimal polynomials have in general large coefficients which slows down a computation.
The returned minimal polynomial should be further simplified e.g. by using a the LLL-algorithm.)

To your example: The minimal polynomial for a+b is c4-10c2+1=0.
You will find it by squaring a+b, using a2=2, b2=3, and squaring c2-5=2ab again.

With Singular it can be done quickly as follows:
Code:
// find a primitive element
> ring rabc = 0,(a,b,c),dp;
> ideal I = a2-2,b2-3,c-a-b;
> eliminate (I,ab);
_[1]=c4-10c2+1

Check that this polynomial is irreducible over the rationals:
Code:
> ring rc =0,c,dp;
> factorize(c4-10c2+1);
[1]:
   _[1]=1
   _[2]=c4-10c2+1
[2]:
   1,1

Now find how to express a and b by c (it also shows what -a and -b is; you only need one of them):
Code:
> ring rcab = (0,c),(a,b),dp; minpoly = c4-10c2+1;
> factorize (a2-2);
[1]:
   _[1]=1
   _[2]=a+(-1/2c3+9/2c)
   _[3]=a+(1/2c3-9/2c)
[2]:
   1,1,1
> factorize (b2-3);
[1]:
   _[1]=1
   _[2]=b+(1/2c3-11/2c)
   _[3]=b+(-1/2c3+11/2c)
[2]:
   1,1,1

Remark: The programm pari/gp https://pari.math.u-bordeaux.fr/ tells us that also c^4 - 4*c^2 + 1 =0 defines the same number field.

As an alternative approach,
which also addresses to your second question for rings with parameters and algebraic extensions simultaneously,
you can mimic the (double) algebraic extension as follows.

Instead of the parameter a and minpoly = ... define the variables a,b and take
the defining relations a2-2,b2-3 into your ideal. Then compute a (reduced) Groebner basis.
In this way you can also use additional parameters in the coefficent field:
Code:
> ring rt = (0,t),(x,y,a,b),dp;
> // option(redSB);
> ideal I = ....;
> I = I,a2-2,b2-3;
> ideal I = std(I);

To display the result with a and b as parameters switch to another ring:
Code:
> ring rtab = (0,a,b,t),(x,y),dp;
> ideal Istd = imap(rt,Istd);
> Istd;


Report this post
Top
 Profile  
Reply with quote  
 Post subject: Re: Exact square root.
PostPosted: Thu Aug 02, 2018 5:30 am 
Now (sometime back) I figured out, and it is really easy. You can have as many as you want of these things, while staying in Q. Just add variables d1, d2, d3... in the end of all variables, and add the equations, for example,
d1^2-2,
d2^3-5,
d3^2-7
.......................

Ilia Toli


Report this post
Top
  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

It is currently Fri May 13, 2022 11:00 am
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group