[sage-support] Re: problem running combinatorial functions

2009-01-07 Thread mabshoff



On Jan 7, 3:38 pm, davidp  wrote:

Hi Dave,

> Oops.  I take back my last post.  Running Sage 3.2.2, I got the
> following:
>
> sage: combinations([1,2,3,4],2)
> 
>    File "", line 1
>      [ [ 1, 2 ], [ 1, 3 ], [ 1, 4 ], [ 2, 3 ], [ 2, 4 ], [ 3, 4 ] ]
> gap>

I tried in Sage 3.2, 3.2.1, 3.2.2 and 3.2.3 and it always worked for
me.
                                                                    ^
> 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 "", 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 "", line 1
>      [ [ 1, 2 ], [ 1, 3 ], [ 1, 4 ], [ 2, 3 ], [ 2, 4 ], [ 3, 4 ] ]
> gap>
>                                                                    ^
> SyntaxError: invalid syntax
>
> Thanks for any suggestions.

Hmm, this looks like some escape characters from the shell. What shell
are you using? . What platform is this on? Did you build this Sage
yourself or is it a binary? Did you upgrade it from a previous release
of Sage?

 Do you have any gap config file around? This problem sounds familiar,
but I cannot put my finger on it.

> Dave

One last think: Do you have a patch for the laplacian_matrix()
problem, i.e. http://trac.sagemath.org/sage_trac/ticket/4888 or do you
want someone from our end to make a patch? Robert Miller looked at the
suggested fix and he agrees that it is the right way to go.

Cheers,

Michael
--~--~-~--~~~---~--~~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Re: problem running combinatorial functions

2009-01-07 Thread davidp

Oops.  I take back my last post.  Running Sage 3.2.2, I got the
following:

sage: combinations([1,2,3,4],2)

   File "", 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:

1579ans=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 "", 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 "", 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  wrote:
> Thanks.  By problem went away with Sage 3.2.2.
>
> Dave
>
> On Dec 27 2008, 10:55 am, mabshoff 
> dortmund.de> wrote:
> > On Dec 27, 9:11 am,DavidPerkinson wrote:
>
> > Hi Dave,
>
> > > Here is a typical error when I try to run a combinatorial function:
>
> > > sage: combinations([1,2],3)
> > > 
> > >    File "", 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 sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Re: Interpolation

2009-01-07 Thread William Stein

On Wed, Jan 7, 2009 at 9:16 AM, Santanu Sarkar
 wrote:
> Let f(x,y,z) is polynomial in x,y,z with degree 4. But we don't know
> the coefficient of the monomials of f. And we know  f(x0,y0,z0)  for
> different x0,y0,z0  which are known to us.  Can we find the coefficient
> of the monomials of f  using SAGE easily?

For every value f(x0,y0,z0) you get a single linear constraint on the
coefficients of f(x,y,z).  If you have enough such constraints, then
all coefficients will be uniquely determined, and finding them is
straightforward linear algebra that Sage could certainly do
efficiently.

If you need more details, please respond.

William

--~--~-~--~~~---~--~~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Interpolation

2009-01-07 Thread Santanu Sarkar
Let f(x,y,z) is polynomial in x,y,z with degree 4. But we don't know
the coefficient of the monomials of f. And we know  f(x0,y0,z0)  for
different x0,y0,z0  which are known to us.  Can we find the coefficient
of the monomials of f  using SAGE easily?

--~--~-~--~~~---~--~~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Re: Worsening of @interact auto-evaluate problems in 3.2.2?

2009-01-07 Thread William Stein

On Wed, Jan 7, 2009 at 8:44 AM, kcrisman  wrote:
>
> Dear Support,
>
> I built 3.2.2 and seem to have a worsening of the auto-evaluation of
> @interact worksheets.  Up to 3.2.1 the worksheets only autoevaluate
> interacts if I actually open them (the worksheets) up.  In 3.2.2 today
> they auto-evaluated for ALL my worksheets with @interact in them
> without opening (that is, the list of worksheets had all such sheets
> saying "running" for some reason).  That would be a lot of things to
> open just to interrupt them...
>
> This was a little unfortunate, because it meant rlmiller had to do his
> presentation for the MAA Panel session in reverse order while we
> switched computers.
>
> I don't know if this is reproducible - it may have been a once-off
> problem, something I somehow inadvertently broke (though I'm not sure
> what), or just my old OSX.4 PPC.  But I thought I would report it.
>
> The wifi here is spotty, so I don't have time to try it on sagenb or
> something, but if someone could check this out in 3.2.2 and/or 3.2.3
> on a few platforms I would appreciate it; if it's reproducible there I
> suggest this be logged as a blocker; it is a huge memory waste and
> time drain.

I tried to replicate this on my OS X laptop and couldn't, but then I
tried on sagenb.org after upgrading, and yes, I *could* replicate it.
This is obviously very very bad.

This was already reported here: http://trac.sagemath.org/sage_trac/ticket/4947


 -- William

--~--~-~--~~~---~--~~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Worsening of @interact auto-evaluate problems in 3.2.2?

2009-01-07 Thread kcrisman

Dear Support,

I built 3.2.2 and seem to have a worsening of the auto-evaluation of
@interact worksheets.  Up to 3.2.1 the worksheets only autoevaluate
interacts if I actually open them (the worksheets) up.  In 3.2.2 today
they auto-evaluated for ALL my worksheets with @interact in them
without opening (that is, the list of worksheets had all such sheets
saying "running" for some reason).  That would be a lot of things to
open just to interrupt them...

This was a little unfortunate, because it meant rlmiller had to do his
presentation for the MAA Panel session in reverse order while we
switched computers.

I don't know if this is reproducible - it may have been a once-off
problem, something I somehow inadvertently broke (though I'm not sure
what), or just my old OSX.4 PPC.  But I thought I would report it.

The wifi here is spotty, so I don't have time to try it on sagenb or
something, but if someone could check this out in 3.2.2 and/or 3.2.3
on a few platforms I would appreciate it; if it's reproducible there I
suggest this be logged as a blocker; it is a huge memory waste and
time drain.

Thanks,
- kcrisman
--~--~-~--~~~---~--~~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Re: Importing lists from mathematica

2009-01-07 Thread William Stein

On Wed, Jan 7, 2009 at 6:52 AM, Jason Grout  wrote:
>
> thelamecamel wrote:
>> Thanks all for speedy help!
>>
>> On Jan 7, 4:25 pm, Jason Grout  wrote:
>>> These are not the right way to do this, but they seem to give results
>>> for right now, at least until someone fixes this:
>>>
>>> sage: a=mathematica([1,2,3])
>>> sage: [a[i] for i in range(1,a.Length()+1)]
>>> [1, 2, 3]
>>>
>>> Or
>>>
>>> sage: a=mathematica(slist)
>>> sage: a._Expect__sage_list
>>> [1, 2, 3]
>>
>> I think I can get a variant of the first tactic working in my program
>> - I've actually dealing with non-rectangular multidimensional
>> mathematica lists, e.g. {1, {2, 3}}, which are not handled by either
>> approach.  By explicitly coding for the structure of my lists I think
>> I can get it working in my case; but it would be great if sage could
>> handle nested lists such as this - it looks like a case of just
>> replacing curly brackets by square ones.
>
>
> Yes, you can get the above to work with nested lists using recursion.
> Your other idea is good too (well, again, not the "right" way to do it,
> but until someone fixes it).

If all the entries in the list were integers or rationals, then doing
what you suggest below would be the right way, and would be the
fastest way to convert from mathematica back to sage.   The technique
below is a problem if the entries in the list of lists are funny
mathematica objects that can't be eval'd in sage.

> Note that there are security implications
> in the code below since we call eval.
>
> sage: a=mathematica([1,2,[3,4]])
> sage: sage_eval(repr(a).replace('{','[').replace('}',']'))
> [1, 2, [3, 4]]
>
> Jason
>
>
>
>
>
>
>>
>> Thanks again,
>> Felix
>> >
>>
>
>
> >
>



-- 
William Stein
Associate Professor of Mathematics
University of Washington
http://wstein.org

--~--~-~--~~~---~--~~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Re: doc for sage, ifpdf

2009-01-07 Thread William Stein

On Wed, Jan 7, 2009 at 4:39 AM, Guilhem Bourrié  wrote:
>
> hello,
>
> I installed sage version 3.2.2 compiled from the source, by make. No problem.
>
> I am working with OSX 10.5, and with LaTeX from the TeXLive 2008, and Emacs
> (Aquamacs).
>
> In the directory /devel/doc, in a Terminal window (tcsh), I typed:
>
> make pdf
>
> I obtain the following error message:
> "
> ...
> (/usr/local/texlive/2008/texmf-dist/tex/generic/oberdiek/ifpdf.sty
>
> ! Package ifpdf Error: Name clash, \ifpdf is already defined.
>
> See the ifpdf package documentation for explanation.
> Type  H   for immediate help.
>  ...
>
> l.142 }
>   %
> ?
> ! Emergency stop.
>  ...
>
> l.142 }
>   %
> !  ==> Fatal error occurred, no output PDF file produced!
> "
> There seems to be an unconsistency with definition of \ifpdf
>
> Any idea about it ?

Thanks.   However, we're currently switching sage very soon from using
latex for the documentation to using Sphinx
(http://sphinx.pocoo.org/), so trying to fix bugs or issues with the
current documentation system on some platform is doesn't really make
sense.

William

--~--~-~--~~~---~--~~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Re: Importing lists from mathematica

2009-01-07 Thread Jason Grout

thelamecamel wrote:
> Thanks all for speedy help!
> 
> On Jan 7, 4:25 pm, Jason Grout  wrote:
>> These are not the right way to do this, but they seem to give results
>> for right now, at least until someone fixes this:
>>
>> sage: a=mathematica([1,2,3])
>> sage: [a[i] for i in range(1,a.Length()+1)]
>> [1, 2, 3]
>>
>> Or
>>
>> sage: a=mathematica(slist)
>> sage: a._Expect__sage_list
>> [1, 2, 3]
> 
> I think I can get a variant of the first tactic working in my program
> - I've actually dealing with non-rectangular multidimensional
> mathematica lists, e.g. {1, {2, 3}}, which are not handled by either
> approach.  By explicitly coding for the structure of my lists I think
> I can get it working in my case; but it would be great if sage could
> handle nested lists such as this - it looks like a case of just
> replacing curly brackets by square ones.


Yes, you can get the above to work with nested lists using recursion. 
Your other idea is good too (well, again, not the "right" way to do it, 
but until someone fixes it).  Note that there are security implications 
in the code below since we call eval.

sage: a=mathematica([1,2,[3,4]])
sage: sage_eval(repr(a).replace('{','[').replace('}',']'))
[1, 2, [3, 4]]

Jason






> 
> Thanks again,
> Felix
> > 
> 


--~--~-~--~~~---~--~~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Re: doc for sage, ifpdf

2009-01-07 Thread Guilhem Bourrié

hello,

I installed sage version 3.2.2 compiled from the source, by make. No problem.

I am working with OSX 10.5, and with LaTeX from the TeXLive 2008, and Emacs
(Aquamacs).

In the directory /devel/doc, in a Terminal window (tcsh), I typed:

make pdf

I obtain the following error message:
"
...
(/usr/local/texlive/2008/texmf-dist/tex/generic/oberdiek/ifpdf.sty

! Package ifpdf Error: Name clash, \ifpdf is already defined.

See the ifpdf package documentation for explanation.
Type  H   for immediate help.
 ...

l.142 }
   %
?
! Emergency stop.
 ...

l.142 }
   %
!  ==> Fatal error occurred, no output PDF file produced!
"
There seems to be an unconsistency with definition of \ifpdf

Any idea about it ?


Guilhem Bourrié

--~--~-~--~~~---~--~~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support-unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---