Oops. I take back my last post. Running Sage 3.2.2, I got the
following:
sage: combinations([1,2,3,4],2)
------------------------------------------------------------
File "<string>", line 1
[ [ 1, 2 ], [ 1, 3 ], [ 1, 4 ], [ 2, 3 ], [ 2, 4 ], [ 3, 4 ] ]
gap>
^
SyntaxError: invalid syntax
The problem seems to occur on line 1580 of combinat.py:
1579 ans=gap.eval("Combinations(%s,%s)"%(mset,ZZ(k))).replace
("\n","")
1580 return eval(ans)
For the example above:
sage: gap.eval("Combinations([1,2,3,4],2)")
'[ [ 1, 2 ], [ 1, 3 ], [ 1, 4 ], [ 2, 3 ], [ 2, 4 ], [ 3, 4 ] ]\n\x1b
[1m\x1b[34mgap> \x1b[0m'
sage: eval(gap.eval("Combinations([1,2,3,4],2)").replace("\n",""))
------------------------------------------------------------
File "<string>", line 1
[ [ 1, 2 ], [ 1, 3 ], [ 1, 4 ], [ 2, 3 ], [ 2, 4 ], [ 3, 4 ] ]
gap>
^
SyntaxError: invalid syntax
sage: eval(gap.eval("Combinations([1,2,3,4],2)").replace("\n",""))
------------------------------------------------------------
File "<string>", line 1
[ [ 1, 2 ], [ 1, 3 ], [ 1, 4 ], [ 2, 3 ], [ 2, 4 ], [ 3, 4 ] ]
gap>
^
SyntaxError: invalid syntax
Thanks for any suggestions.
Dave
On Jan 4, 10:44 am, davidp <[email protected]> wrote:
> Thanks. By problem went away with Sage 3.2.2.
>
> Dave
>
> On Dec 27 2008, 10:55 am, mabshoff <[email protected]
>
> dortmund.de> wrote:
> > On Dec 27, 9:11 am,DavidPerkinson<[email protected]> wrote:
>
> > Hi Dave,
>
> > > Here is a typical error when I try to run a combinatorial function:
>
> > > sage: combinations([1,2],3)
> > > ------------------------------------------------------------
> > > File "<string>", line 1
> > > [ ]gap>
> > > ^
> > > SyntaxError: invalid syntax
>
> > > Linux Fedora 9, 2.6.27.7-53.fc9.i686 on a Thinkpad
> > > SAGE Version 3.1.4, Release Date: 2008-10-16
> > > installed from a binary
>
> > > Thanks for any suggestions.
>
> > > Dave
>
> > This works for me in Sage 3.2.2:
>
> > sage: combinations([1,2],1)
> > [[1], [2]]
> > sage: combinations([1,2],2)
> > [[1, 2]]
> > sage: combinations([1,2],3)
> > []
>
> > Note that this code was recently (In Sage 3.2.0 or so IIRC) fixed.
>
> > Cheers,
>
> > Michael
--~--~---------~--~----~------------~-------~--~----~
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
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---