Singular
https://www.singular.uni-kl.de/forum/

squareroots of numbers
https://www.singular.uni-kl.de/forum/viewtopic.php?f=10&t=1410
Page 1 of 1

Author:  Dominik Wagenfuehr [ Thu Aug 11, 2005 5:32 pm ]
Post subject:  squareroots of numbers

Hello!

I think the answers to my questions are really simple but I don't find them anywhere. (Maybe they are to stupid...)

1. How do I could define the polynom ring Q(sqrt(2))[x1,...,xn] ?

2. And how can I describe a squareroot, e.g. sqrt(2) or 2^(1/2) in Singular? sqrt(2) gives an error and 2^(1/2), too.

Thanks a lot,
Dominik Wagenfuehr


email: dominik.wagenfuehr@math.uni-giessen.de
Posted in old Singular Forum on: 2004-11-02 09:32:51+01

Author:  levandov [ Thu Aug 11, 2005 8:14 pm ]
Post subject: 

Both questions are related to each other.
Declaring the ring over a ground field of char 0 in Singular with the command

ring R = 0,(x),dp;

implies that you'll work with coefficients from Q (rationals).
In order to have sqrt(2), you have to pass to the algebraic extension of Q, Q' = Q(sqrt(2)).
Since a polynomial x^2-2 is irreducible over Q, let us denote the sqrt(2) by q. Then, the following code

ring R = (0,q),(x),dp;
minpoly = q^2-2;

creates a polynomial ring in x over Q(sqrt(2)).
For example, computing (1+q)^4 gives you

(12q+17)

For further details please consult with the documentation,
available at http://www.singular.uni-kl.de/Manual/2-0-5/index.htm
or, more recently, at http://www.singular.uni-kl.de/Manual/3-0-0/index.htm

Best regards,

Author:  Dominik Wagenfuehr [ Tue Sep 20, 2005 4:13 pm ]
Post subject: 

Thanks Viktor Levandovskyy for your fast reply! Smile

So the roots for the minimal polynom are always positive?

At this time I got the ring R = 0,(x,q),dp; and declare a poly s1=q^2-2; which I put into my ideal I. If I now want to use sqrt(2), I declare a poly s2=q*x+3;.
But solving this ideal I=s1,s2; will lead to two solutions because the solution of q is +-sqrt(2). So it's important that I only have a positive solution. Unfortunately I'm not at work right now to test it...

Background: I want to use Singular to compute a Groebner-Basis which I want to use in another CAS after calculation.

Best greetings,
Dominik Wagenfuehr

> Hello Dominik Wagenfuehr,
>
> > Hello!
> >
> > I think the answers to my questions are really simple but I don't find them anywhere. (Maybe they are to stupid...)
> >
> > 1. How do I could define the polynom ring Q(sqrt(2))[x1,...,xn] ?
> >
> > 2. And how can I describe a squareroot, e.g. sqrt(2) or 2^(1/2) in Singular? sqrt(2) gives an error and 2^(1/2), too.
> >
>
> Both questions are related to each other.
> Declaring the ring over a ground field of char 0
> in Singular with the command
> ring R = 0,(x),dp;
> implies that you'll work with coefficients from Q (rationals).
> In order to have sqrt(2), you have to pass to
> the algebraic extension of Q, Q' = Q(sqrt(2)). Since
> a polynomial x^2-2 is irreducible over Q, let us
> denote the sqrt(2) by q. Then, the following code
>
> ring R = (0,q),(x),dp;
> minpoly = q^2-2;
>
> creates a polynomial ring in x over Q(sqrt(2)).
> For example, computing (1+q)^4 gives you
>
> (12q+17)
>
> For further details please consult with the documentation,
> available at http://www.singular.uni-kl.de/Manual/2-0-5/index.htm
>
>
> > Thanks a lot,
> > Dominik Wagenfuehr
> >
>
> Best regards,
>
> Viktor Levandovskyy, SINGULAR Team

email: dominik.wagenfuehr@math.uni-giessen.de
Posted in old Singular Forum on: 2004-11-02 17:29:15+01

Author:  Dominik Wagenfuehr [ Tue Sep 20, 2005 4:14 pm ]
Post subject: 

Edit: I tested the Groebner-Basis calculation now with your hint below. After 9 hours of computing (I think this is very long!) I get the ideal J=[1] as Groebner Basis. If I use my method with w as unknown and w^2-3 as new polynom the calculation of the G-Basis takes only a few seconds and has 104 polynoms in it.
J=[1] must be wrong, because I have a solution for the variety of the ideal...

For better understanding I present my input:
ring R=(0,w),(x1,y1,z1,x2,y2,z2,x3,y3,z3,l,d,xs,ys,zs,x,y,z), Dp;
minpoly=w^2-3;
poly s1=x1^2+y1^2+(2-z1)^2-9;
poly s2=(-w-x2)^2+y2^2+(-1-z2)^2-9;
poly s3=(w-x3)^2+y3^2+(-1-z3)^2-9;
poly s4=(x-x1)*x+(y-y1)*y+(z-z1)*z;
poly s5=(x-x2)*x+(y-y2)*y+(z-z2)*z;
poly s6=(x-x3)*x+(y-y3)*y+(z-z3)*z;
poly s7=(x1-x2)^2+(y1-y2)^2+(z1-z2)^2-12;
poly s8=(x3-x2)^2+(y3-y2)^2+(z3-z2)^2-12;
poly s9=(x1-x3)^2+(y1-y3)^2+(z1-z3)^2-12;
poly s10=(x1+x2+x3)-3*x;
poly s11=(y1+y2+y3)-3*y;
poly s12=(z1+z2+z3)-3*z;
poly s13=x^2-xs^2;
poly s14=y^2-ys^2;
poly s15=z^2-zs^2;
poly s16=x^2+y^2+z^2-l^2;
poly s17=y^2+z^2-d^2;
poly s18=x-x1;
poly s19=-3*d*ys-zs*6-3*d*y1;
poly s20=-3*d*zs+ys*6-3*d*z1;
poly s21=-2*l*xs+d*2*w+2*l*x2;
poly s22=-6*ys*xs*w-6*d*l*ys+6*zs*l-6*d*l*y2;
poly s23=-6*zs*xs*w-6*zs*d*l-6*ys*l-6*d*l*z2;
poly s24=2*w*d+2*xs*l-2*l*x3;
poly s25=6*w*ys*xs-6*ys*d*l+6*zs*l-6*d*l*y3;
poly s26=6*w*zs*xs-6*zs*d*l-6*ys*l-6*d*l*z3;
ideal I=s1,s2,s3,s4,s5,s6,s7,s8,s9,s10,s11,s12,s13,s14,s15,s16,s17,s18,s19,s20,s21,s22,s23,s24,s25,s26;
ideal J=groebner(I);
J;

One solution is {x=0, y=-3, z=0, x1=0, y1=-3, z1=2, x2=-sqrt(3), y2=-3, z2=-1, x3=sqrt(3), y3=-3, z3=-1,
l=3, d=3, xs=0, ys=3, zs=0}.

My method was
ring R=(0),(w,x1,y1,z1,x2,y2,z2,x3,y3,z3,l,d,xs,ys,zs,x,y,z), Dp;
poly s1=...
...
poly s26=...
poly s27=w^2-3;
I=s1,s2,s3,s4,s5,s6,s7,s8,s9,s10,s11,s12,s13,s14,s15,s16,s17,s18,s19,s20,s21,s22,s23,s24,s25,s26,s27;
ideal J=groebner(I);
J;

I hope you can help me understand where the problem is.

Best greetings,
Dominik Wagenfuehr

> Thanks Viktor Levandovskyy for your fast reply! Smile
>
> So the roots for the minimal polynom are always positive?
>
> At this time I got the ring R = 0,(x,q),dp; and declare a poly s1=q^2-2; which I put into my ideal I. If I now want to use sqrt(2), I declare a poly s2=q*x+3;.
> But solving this ideal I=s1,s2; will lead to two solutions because the solution of q is +-sqrt(2). So it's important that I only have a positive solution. Unfortunately I'm not at work right now to test it...
>
> Background: I want to use Singular to compute a Groebner-Basis which I want to use in another CAS after calculation.
>
> Best greetings,
> Dominik Wagenfuehr
>
> > Hello Dominik Wagenfuehr,
> >
> > > Hello!
> > >
> > > I think the answers to my questions are really simple but I don't find them anywhere. (Maybe they are to stupid...)
> > >
> > > 1. How do I could define the polynom ring Q(sqrt(2))[x1,...,xn] ?
> > >
> > > 2. And how can I describe a squareroot, e.g. sqrt(2) or 2^(1/2) in Singular? sqrt(2) gives an error and 2^(1/2), too.
> > >
> >
> > Both questions are related to each other.
> > Declaring the ring over a ground field of char 0
> > in Singular with the command
> > ring R = 0,(x),dp;
> > implies that you'll work with coefficients from Q (rationals).
> > In order to have sqrt(2), you have to pass to
> > the algebraic extension of Q, Q' = Q(sqrt(2)). Since
> > a polynomial x^2-2 is irreducible over Q, let us
> > denote the sqrt(2) by q. Then, the following code
> >
> > ring R = (0,q),(x),dp;
> > minpoly = q^2-2;
> >
> > creates a polynomial ring in x over Q(sqrt(2)).
> > For example, computing (1+q)^4 gives you
> >
> > (12q+17)
> >
> > For further details please consult with the documentation,
> > available at http://www.singular.uni-kl.de/Manual/2-0-5/index.htm
> >
> >
> > > Thanks a lot,
> > > Dominik Wagenfuehr
> > >
> >
> > Best regards,
> >
> > Viktor Levandovskyy, SINGULAR Team

email: dominik.wagenfuehr@math.uni-giessen.de
Posted in old Singular Forum on: 2004-11-03 17:26:59+01

Author:  Dominik Wagenfuehr [ Tue Sep 20, 2005 4:15 pm ]
Post subject: 

More information:
I changed the ideal slighty but the output is confusing:

LIB "poly.lib";
ring R=(0,w),(x1,y1,z1,x2,y2,z2,x3,y3,z3,l,d,x,y,z), Dp;
minpoly=w^2-3;
poly s1=x1^2+y1^2+(2-z1)^2-9;
poly s2=(-w-x2)^2+y2^2+(-1-z2)^2-9;
poly s3=(w-x3)^2+y3^2+(-1-z3)^2-9;
poly s4=(x-x1)*x+(y-y1)*y+(z-z1)*z;
poly s5=(x-x2)*x+(y-y2)*y+(z-z2)*z;
poly s6=(x-x3)*x+(y-y3)*y+(z-z3)*z;
poly s7=(x1-x2)^2+(y1-y2)^2+(z1-z2)^2-12;
poly s8=(x3-x2)^2+(y3-y2)^2+(z3-z2)^2-12;
poly s9=(x1-x3)^2+(y1-y3)^2+(z1-z3)^2-12;
poly s10=(x1+x2+x3)-3*x;
poly s11=(y1+y2+y3)-3*y;
poly s12=(z1+z2+z3)-3*z;
poly s13=w*d*l*(x-x1)-2*w*x*z;
poly s14=w*d*l*(y-y1)-2*w*y*z;
poly s15=w*l*(z-z1)+2*w*d;
poly s16=w*l*2*w*y+2*w*d*l*(x-x2)+2*w*x*z;
poly s17=-w*l*2*w*x+2*w*d*l*(y-y2)+2*w*y*z;
poly s18=2*w*l*(z-z2)-2*w*d;
poly s19=-w*l*2*w*y+2*w*d*l*(x-x3)+2*w*x*z;
poly s20=w*l*2*w*x+2*w*d*l*(y-y3)+2*w*y*z;
poly s21=2*w*l*(z-z3)-2*w*d;
poly s22=x^2+y^2-d^2;
poly s23=x^2+y^2+z^2-l^2;
ideal I=s1,s2,s3,s4,s5,s6,s7,s8,s9,s10,s11,s12,s13,s14,s15,s16,s17,s18,s19,s20,s21,s22,s23;
ideal J=groebner(I);

substitute(I, x,0, y,-3, z,0,x1,0, y1,-3, z1,2,x2,-w, y2,-3, z2,-1,x3,w, y3,-3, z3,-1,l,3,d,3);

shows that all polynoms equals zero, but

substitute(J, x,0, y,-3, z,0,x1,0, y1,-3, z1,2,x2,-w, y2,-3, z2,-1,x3,w, y3,-3, z3,-1,l,3,d,3);

shows that some polynoms aren't zero. (They are -27 and -81.)

This should not happen because if X is a solution of I then it should be a solution of the J and vice versa. Anything other would doubt the meaning of Groebner Bases.

Funny remark: If I change the ring order from "Dp" to "dp" all polynoms of J are zero after substitution.

Maybe someone can help me. (What would really be great!)

Dominik Wagenfuehr


> Edit: I tested the Groebner-Basis calculation now with your hint below. After 9 hours of computing (I think this is very long!) I get the ideal J=[1] as Groebner Basis. If I use my method with w as unknown and w^2-3 as new polynom the calculation of the G-Basis takes only a few seconds and has 104 polynoms in it.
> J=[1] must be wrong, because I have a solution for the variety of the ideal...
>
> For better understanding I present my input:
> ring R=(0,w),(x1,y1,z1,x2,y2,z2,x3,y3,z3,l,d,xs,ys,zs,x,y,z), Dp;
> minpoly=w^2-3;
> poly s1=x1^2+y1^2+(2-z1)^2-9;
> poly s2=(-w-x2)^2+y2^2+(-1-z2)^2-9;
> poly s3=(w-x3)^2+y3^2+(-1-z3)^2-9;
> poly s4=(x-x1)*x+(y-y1)*y+(z-z1)*z;
> poly s5=(x-x2)*x+(y-y2)*y+(z-z2)*z;
> poly s6=(x-x3)*x+(y-y3)*y+(z-z3)*z;
> poly s7=(x1-x2)^2+(y1-y2)^2+(z1-z2)^2-12;
> poly s8=(x3-x2)^2+(y3-y2)^2+(z3-z2)^2-12;
> poly s9=(x1-x3)^2+(y1-y3)^2+(z1-z3)^2-12;
> poly s10=(x1+x2+x3)-3*x;
> poly s11=(y1+y2+y3)-3*y;
> poly s12=(z1+z2+z3)-3*z;
> poly s13=x^2-xs^2;
> poly s14=y^2-ys^2;
> poly s15=z^2-zs^2;
> poly s16=x^2+y^2+z^2-l^2;
> poly s17=y^2+z^2-d^2;
> poly s18=x-x1;
> poly s19=-3*d*ys-zs*6-3*d*y1;
> poly s20=-3*d*zs+ys*6-3*d*z1;
> poly s21=-2*l*xs+d*2*w+2*l*x2;
> poly s22=-6*ys*xs*w-6*d*l*ys+6*zs*l-6*d*l*y2;
> poly s23=-6*zs*xs*w-6*zs*d*l-6*ys*l-6*d*l*z2;
> poly s24=2*w*d+2*xs*l-2*l*x3;
> poly s25=6*w*ys*xs-6*ys*d*l+6*zs*l-6*d*l*y3;
> poly s26=6*w*zs*xs-6*zs*d*l-6*ys*l-6*d*l*z3;
> ideal I=s1,s2,s3,s4,s5,s6,s7,s8,s9,s10,s11,s12,s13,s14,s15,s16,s17,s18,s19,s20,s21,s22,s23,s24,s25,s26;
> ideal J=groebner(I);
> J;
>
> One solution is {x=0, y=-3, z=0, x1=0, y1=-3, z1=2, x2=-sqrt(3), y2=-3, z2=-1, x3=sqrt(3), y3=-3, z3=-1,
> l=3, d=3, xs=0, ys=3, zs=0}.
>
> My method was
> ring R=(0),(w,x1,y1,z1,x2,y2,z2,x3,y3,z3,l,d,xs,ys,zs,x,y,z), Dp;
> poly s1=...
> ...
> poly s26=...
> poly s27=w^2-3;
> I=s1,s2,s3,s4,s5,s6,s7,s8,s9,s10,s11,s12,s13,s14,s15,s16,s17,s18,s19,s20,s21,s22,s23,s24,s25,s26,s27;
> ideal J=groebner(I);
> J;
>
> I hope you can help me understand where the problem is.
>
> Best greetings,
> Dominik Wagenfuehr
>
> > Thanks Viktor Levandovskyy for your fast reply! Smile
> >
> > So the roots for the minimal polynom are always positive?
> >
> > At this time I got the ring R = 0,(x,q),dp; and declare a poly s1=q^2-2; which I put into my ideal I. If I now want to use sqrt(2), I declare a poly s2=q*x+3;.
> > But solving this ideal I=s1,s2; will lead to two solutions because the solution of q is +-sqrt(2). So it's important that I only have a positive solution. Unfortunately I'm not at work right now to test it...
> >
> > Background: I want to use Singular to compute a Groebner-Basis which I want to use in another CAS after calculation.
> >
> > Best greetings,
> > Dominik Wagenfuehr
> >
> > > Hello Dominik Wagenfuehr,
> > >
> > > > Hello!
> > > >
> > > > I think the answers to my questions are really simple but I don't find them anywhere. (Maybe they are to stupid...)
> > > >
> > > > 1. How do I could define the polynom ring Q(sqrt(2))[x1,...,xn] ?
> > > >
> > > > 2. And how can I describe a squareroot, e.g. sqrt(2) or 2^(1/2) in Singular? sqrt(2) gives an error and 2^(1/2), too.
> > > >
> > >
> > > Both questions are related to each other.
> > > Declaring the ring over a ground field of char 0
> > > in Singular with the command
> > > ring R = 0,(x),dp;
> > > implies that you'll work with coefficients from Q (rationals).
> > > In order to have sqrt(2), you have to pass to
> > > the algebraic extension of Q, Q' = Q(sqrt(2)). Since
> > > a polynomial x^2-2 is irreducible over Q, let us
> > > denote the sqrt(2) by q. Then, the following code
> > >
> > > ring R = (0,q),(x),dp;
> > > minpoly = q^2-2;
> > >
> > > creates a polynomial ring in x over Q(sqrt(2)).
> > > For example, computing (1+q)^4 gives you
> > >
> > > (12q+17)
> > >
> > > For further details please consult with the documentation,
> > > available at http://www.singular.uni-kl.de/Manual/2-0-5/index.htm
> > >
> > >
> > > > Thanks a lot,
> > > > Dominik Wagenfuehr
> > > >
> > >
> > > Best regards,
> > >
> > > Viktor Levandovskyy, SINGULAR Team

email: dominik.wagenfuehr@math.uni-giessen.de
Posted in old Singular Forum on: 2004-11-09 15:17:12+01

Author:  lossen [ Wed Sep 21, 2005 3:35 pm ]
Post subject: 

Dear Dominik,

the strange behavior was indeed a bug in groebner (standard.lib) . It will be repaired in future versions of Singular (>=3.0.1). Your example is one of the examples where the Hilbert driven Buchberger algorithm (called by groebner when applied in a ring with ordering Dp) is significantly slower than std (which always gave the correct answer in <10 seconds). The repaired version of groebner gives the same result after ~1-2 minutes.

Best regards,

Christoph Lossen
(Singular Team)

Page 1 of 1 All times are UTC + 1 hour [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/