Ok! I find it!
It is a brutal method but works!!:
singular.lib('decodegb')
singular.lib('matrix.lib')
singular.eval('ring r=11,(x(1..17)),dp;')
singular.eval('list pointok;')
lung=len(provv[1])
for a in provv:
tmp=''
tmp2=''
for j in range(0,lung):
if(j!=0):
tmp=tmp+','+repr(a[j])
else:
tmp=tmp+repr(a[j])
tmp2='matrix m[17][1]='+tmp+';'
singular.eval(tmp2);
singular.eval('pointok=insert(pointok,m);')
singular.eval('option(redSB);')
tmp=singular.eval('ideal id=vanishId(pointok);')
tmp1=singular.eval('ideal jd=ideal([x(1)^11-x(1),x(2)^11-x(2),x(3)^11-
x(3),x(4)^11-x(4),x(5)^11-x(5),x(6)^11-x(6),x(7)^11-x(7),x(8)^11-
x(8),x(9)^11-x(9),x(10)^11-x(11),x(12)^11-x(12),x(13)^11-
x(13),x(14)^11-x(14),x(15)^11-x(15),x(16)^11-x(16),x(17)^11-x(17)]);')
a=singular.eval('jd+id;')
I have to create the column vectors, and i create it like a string:-))
unhappy but works!
Then I have to create a lis of lists from a and then:
lung=len(a);
k=0;
lista= list();
for i in range(0,lung-2):
w=a[i];
if((i>k)and (w=='x')):
tmp='x';
for j in range (i+1,lung):
if(a[j]!='\n'):
tmp+=a[j];
else:
k=j;
lista.append(tmp);
break;
Finally for the sage notation i have to remove '(' and ')'
Re.<x1,x2,x3,x4,x5,x6,x7,x8,x9,x10,x11,x12,x13,x14,x15,x16,x17> =
PolynomialRing(GF(11),17)
R = singular.ring(11, '(x(1..17))','lp')
tot=list();
for w in lista:
a=w
test=a.replace ( '(', '' )
test=test.replace ( ')', '' )
tot.append(test);
ide=Re.ideal(tot)
ide.groebner_basis()
Thanks a lot for all your suggestion!
Bye!!
On 27 Apr, 10:37, Andrea Gobbi <[email protected]> wrote:
> Hi!
> I try, and I can call vanishid...but there is an other problem..i have
> a list of lists (provv), in sage, and i have to conver it into a list
> of column vector (for vanishId function).
> I try with this code but doesn't work:
>
> singular.lib('decodegb')
> singular.lib('matrix.lib')
> singular.eval('ring r=11,(x(1..17)),dp;')
> persing=list();
>
> for i in range (0,len(provv)):
> b=matrix(17,1,provv[i]);
> persing.append(b);
> id=singular.vanishId(persing);
> id
>
> But if i call:
>
> id=singular.vanishId(b);
> id
>
> It works...( and so I think that b=matrix(17,1,provv[i]) works).
> I try also with
>
> b=vector(provv[i])
>
> and the results is the same...
>
> Some can help me please?
> Thanks!!!
>
> On 27 Apr, 08:41, Andrea Gobbi <[email protected]> wrote:
>
>
>
> > Thanks to everybody!
> > I can't write it in singular (i wrote it in singular but in the end i
> > have to call GrobnerFan and it is a sage function...and so i'm
> > rewriting all...).
> > Maybe i make a little confusion in the ways i can call singular...i'm
> > trying what you suggest to me.
> > Thanks!
> > Andrea
>
> > On 26 Apr, 17:36, Martin Albrecht <[email protected]>
> > wrote:
>
> > > Alright, here's the pure pexpect based version for the Singular example:
>
> > > sage: singular.lib('decodegb')
>
> > > # as mentioned before x(1)...x(3) is really bad notation for Sage.
>
> > > sage: r = singular.ring(3,'x(1..3)','dp')
> > > ---------------------------------------------------------------------------
> > > Traceback (most recent call last)
> > > ...
> > > RuntimeError: Singular error:
> > > ? error occurred in STDIN line 27: `if(defined((1..3)>0){kill (1..3;};`
> > > ? last reserved name was `defined`
> > > skipping text from `;`
> > > sage: r = singular.ring(3,'x(1),x(2),x(3)','dp')
> > > ---------------------------------------------------------------------------
> > > RuntimeError Traceback (most recent call
> > > last)
>
> > > # Thus we have use a 'trick'
>
> > > sage: singular.eval('ring r=3,(x(1..3)),dp;')
> > > 'ring r=3,(x(1..3)),dp;'
>
> > > sage: points = singular.pointsGen(3,1);
> > > sage: points2 = singular.convPoints(points);
> > > sage: p = singular.graspList(points2,1,11);
> > > sage: p
> > > [1]:
> > > _[1,1]=0
> > > _[2,1]=0
> > > _[3,1]=0
> > > [2]:
> > > _[1,1]=0
> > > _[2,1]=0
> > > _[3,1]=1
> > > [3]:
> > > _[1,1]=0
> > > _[2,1]=0
> > > _[3,1]=-1
> > > [4]:
> > > _[1,1]=0
> > > _[2,1]=1
> > > _[3,1]=0
> > > [5]:
> > > _[1,1]=0
> > > _[2,1]=1
> > > _[3,1]=1
> > > [6]:
> > > _[1,1]=0
> > > _[2,1]=1
> > > _[3,1]=-1
> > > [7]:
> > > _[1,1]=0
> > > _[2,1]=-1
> > > _[3,1]=0
> > > [8]:
> > > _[1,1]=0
> > > _[2,1]=-1
> > > _[3,1]=1
> > > [9]:
> > > _[1,1]=0
> > > _[2,1]=-1
> > > _[3,1]=-1
> > > [10]:
> > > _[1,1]=1
> > > _[2,1]=0
> > > _[3,1]=0
> > > [11]:
> > > _[1,1]=1
> > > _[2,1]=0
> > > _[3,1]=1
> > > sage: id = singular.vanishId(p);
> > > sage: id
> > > x(1)*x(2),
> > > x(1)^2-x(1),
> > > x(3)^3-x(3),
> > > x(1)*x(3)^2-x(1)*x(3),
> > > x(2)^3-x(2)
>
> > > --
> > > name: Martin Albrecht
> > > _pgp:http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x8EF0DC99
> > > _otr: 47F43D1A 5D68C36F 468BAEBA 640E8856 D7951CCF
> > > _www:http://www.informatik.uni-bremen.de/~malb
> > > _jab: [email protected]
>
> > > --
> > > To post to this group, send email to [email protected]
> > > To unsubscribe from this group, send email to
> > > [email protected]
> > > For more options, visit this group
> > > athttp://groups.google.com/group/sage-support
> > > URL:http://www.sagemath.org
>
> > --
> > To post to this group, send email to [email protected]
> > To unsubscribe from this group, send email to
> > [email protected]
> > For more options, visit this group
> > athttp://groups.google.com/group/sage-support
> > URL:http://www.sagemath.org
>
> --
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group
> athttp://groups.google.com/group/sage-support
> URL:http://www.sagemath.org
--
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org