Problem with different maxima versions

14 views
Skip to first unread message

Paulo César Pereira de Andrade

unread,
Sep 14, 2009, 6:42:05 PM9/14/09
to sage-...@googlegroups.com
Hi,

In maxima-5.16.3.p2 as distributed with sage 4.1.1 when doing the
maxima tutorial, all goes well, but in my rpm, due to using system's
maxima-5.19.1-2mdv2010.0 I get an error because when reaching the
cell:

A.eigenvectors()

maxima 5.16.3 returns:
[[[0,4],[3,1]],[1,0,0,-4],[0,1,0,-2],[0,0,1,-4/3],[1,2,3,4]]

while maxima 5.19.1 returns:
[[[0,4],[3,1]],[[[1,0,0,-4],[0,1,0,-2],[0,0,1,-4/3]],[[1,2,3,4]]]]

and then, in the next cell it gives a fatal error due to not being
able to convert a list to rational.

Do you have any idea as to what would be the proper way to correct
this issue? Preferably without needing to use an older maxima for the
sage package :-)
[ I understand this is my problem due to not "always" using the sage
spkgs, but I think this is also useful information for sage, and it
should at least help others in watching what not to do when adding
sagemath to theirs distro... ]

When using maxima-5.16.3, as in, cat ~/bin/maxima:
#!/bin/sh
cd /home/pcpa/sage-4.1.1/local/bin
LD_LIBRARY_PATH=/home/pcpa/sage-4.1.1/local/lib:$LD_LIBRARY_PATH ./maxima "$@"

and putting $HOME/bin as the first $PATH entry, it works with my rpm package.

Thanks,
Paulo

Jason Grout

unread,
Sep 14, 2009, 6:51:18 PM9/14/09
to sage-...@googlegroups.com
Paulo César Pereira de Andrade wrote:
> Hi,
>
> In maxima-5.16.3.p2 as distributed with sage 4.1.1 when doing the
> maxima tutorial, all goes well, but in my rpm, due to using system's
> maxima-5.19.1-2mdv2010.0 I get an error because when reaching the
> cell:
>
> A.eigenvectors()
>
> maxima 5.16.3 returns:
> [[[0,4],[3,1]],[1,0,0,-4],[0,1,0,-2],[0,0,1,-4/3],[1,2,3,4]]
>
> while maxima 5.19.1 returns:
> [[[0,4],[3,1]],[[[1,0,0,-4],[0,1,0,-2],[0,0,1,-4/3]],[[1,2,3,4]]]]
>
> and then, in the next cell it gives a fatal error due to not being
> able to convert a list to rational.
>
> Do you have any idea as to what would be the proper way to correct
> this issue? Preferably without needing to use an older maxima for the
> sage package :-)

This change was actually motived by a request from the Sage project :).
As such, I'm sure it will be supported in Sage as soon as Sage
upgrades to the newer version of maxima.

As for you for now, you'd need to change the eigenvectors() command in
the matrix code. If you wanted to do so and submit a patch, it would be
greatly appreciated!


Thanks,

Jason

--
Jason Grout

Paulo César Pereira de Andrade

unread,
Sep 14, 2009, 7:48:15 PM9/14/09
to sage-...@googlegroups.com
2009/9/14 Jason Grout <jason...@creativetrax.com>:

>
> Paulo César Pereira de Andrade wrote:
>>   Hi,
>>
>>   In maxima-5.16.3.p2 as distributed with sage 4.1.1 when doing the
>> maxima tutorial, all goes well, but in my rpm, due to using system's
>> maxima-5.19.1-2mdv2010.0 I get an error because when reaching the
>> cell:
>>
>> A.eigenvectors()
>>
>> maxima 5.16.3 returns:
>> [[[0,4],[3,1]],[1,0,0,-4],[0,1,0,-2],[0,0,1,-4/3],[1,2,3,4]]
>>
>> while maxima 5.19.1 returns:
>> [[[0,4],[3,1]],[[[1,0,0,-4],[0,1,0,-2],[0,0,1,-4/3]],[[1,2,3,4]]]]
>>
>> and then, in the next cell it gives a fatal error due to not being
>> able to convert a list to rational.
>>
>>   Do you have any idea as to what would be the proper way to correct
>> this issue? Preferably without needing to use an older maxima for the
>> sage package :-)
>
> This change was actually motived by a request from the Sage project :).
>  As such, I'm sure it will be supported in Sage as soon as Sage
> upgrades to the newer version of maxima.

Many thanks for the fast reply!

> As for you for now, you'd need to change the eigenvectors() command in
> the matrix code.  If you wanted to do so and submit a patch, it would be
> greatly appreciated!

Hmm, with my limited python knowledge I don't think it is doable :-)
I can't find myself in sage/matrix code, and I fear those .pyx/.pxd files...

I think I will just point to this email if I receive bug reports
about this problem, and leave as is for now, as packaging a full
alternate maxima in the sagemath package is overkill...

> Thanks,
>
> Jason
>
>
>
> --
> Jason Grout

Thanks,
Paulo

kcrisman

unread,
Sep 14, 2009, 9:43:08 PM9/14/09
to sage-devel


On Sep 14, 6:51 pm, Jason Grout <jason-s...@creativetrax.com> wrote:
> Paulo César Pereira de Andrade wrote:
>
>
>
> > Hi,
>
> > In maxima-5.16.3.p2 as distributed with sage 4.1.1 when doing the
> > maxima tutorial, all goes well, but in my rpm, due to using system's
> > maxima-5.19.1-2mdv2010.0 I get an error because when reaching the
> > cell:
>
> > A.eigenvectors()
>
> > maxima 5.16.3 returns:
> > [[[0,4],[3,1]],[1,0,0,-4],[0,1,0,-2],[0,0,1,-4/3],[1,2,3,4]]
>
> > while maxima 5.19.1 returns:
> > [[[0,4],[3,1]],[[[1,0,0,-4],[0,1,0,-2],[0,0,1,-4/3]],[[1,2,3,4]]]]
>
> > and then, in the next cell it gives a fatal error due to not being
> > able to convert a list to rational.
>
> > Do you have any idea as to what would be the proper way to correct
> > this issue? Preferably without needing to use an older maxima for the
> > sage package :-)
>
> This change was actually motived by a request from the Sage project :).
> As such, I'm sure it will be supported in Sage as soon as Sage
> upgrades to the newer version of maxima.
>

Umm, I think that is already in the alphas... isn't it? Minh would
know.

- kcrisman

Jason Grout

unread,
Sep 14, 2009, 10:16:14 PM9/14/09
to sage-...@googlegroups.com
kcrisman wrote:
>
>
> On Sep 14, 6:51 pm, Jason Grout <jason-s...@creativetrax.com> wrote:
>> Paulo César Pereira de Andrade wrote:
>>
>>
>>
>>> Hi,
>>> In maxima-5.16.3.p2 as distributed with sage 4.1.1 when doing the
>>> maxima tutorial, all goes well, but in my rpm, due to using system's
>>> maxima-5.19.1-2mdv2010.0 I get an error because when reaching the
>>> cell:
>>> A.eigenvectors()
>>> maxima 5.16.3 returns:
>>> [[[0,4],[3,1]],[1,0,0,-4],[0,1,0,-2],[0,0,1,-4/3],[1,2,3,4]]
>>> while maxima 5.19.1 returns:
>>> [[[0,4],[3,1]],[[[1,0,0,-4],[0,1,0,-2],[0,0,1,-4/3]],[[1,2,3,4]]]]
>>> and then, in the next cell it gives a fatal error due to not being
>>> able to convert a list to rational.
>>> Do you have any idea as to what would be the proper way to correct
>>> this issue? Preferably without needing to use an older maxima for the
>>> sage package :-)
>> This change was actually motived by a request from the Sage project :).
>> As such, I'm sure it will be supported in Sage as soon as Sage
>> upgrades to the newer version of maxima.
>>
>
> Umm, I think that is already in the alphas... isn't it? Minh would
> know.
>

Then there might be a problem. From alpha.sagenb.org:

sage: A=matrix(SR,[[1,2,3],[4,5,6],[7,8,9]])
sage: A.eigenvectors_right()
Traceback (most recent call last):
...
TypeError: degree() takes exactly one argument (0 given)


Jason

--
Jason Grout

Dr. David Kirkby

unread,
Sep 15, 2009, 4:15:02 AM9/15/09
to sage-...@googlegroups.com

maxima-5.19.1 can be found in Sage sage-4.1.2.alpha1, but being an
alpha, it is likely to be less stable than a 'stable' release of Sage.
Note Sage 4.1.2 will be the first Sage to have a recent update of
Maxima. The previous version, 4.1.1, does not.

kcrisman

unread,
Sep 15, 2009, 9:28:33 AM9/15/09
to sage-devel
> > As for you for now, you'd need to change the eigenvectors() command in
> > the matrix code.  If you wanted to do so and submit a patch, it would be
> > greatly appreciated!
>

But all doctests pass for me in alpha1:

./sage -t "devel/sage/sage/matrix/"
All tests passed!
Total time for all tests: 177.1 seconds


>
> maxima-5.19.1 can be found in Sage sage-4.1.2.alpha1, but being an
> alpha, it is likely to be less stable than a 'stable' release of Sage.
> Note Sage 4.1.2 will be the first Sage to have a recent update of
> Maxima. The previous version, 4.1.1, does not.

That's #6699 where the change went in. Note that the patch there
fixes similar eigenvector problems in doc/en/constructions/
linear_algebra.rst and doc/en/tutorial/interfaces.rst, and, for that
matter, sage/interfaces/maxima.py

But actually, the problem is already in 4.1.1, with the previous
Maxima:

----------------------------------------------------------------------
| Sage Version 4.1.1, Release Date: 2009-08-14 |
| Type notebook() for the GUI, and license() for information. |
----------------------------------------------------------------------
sage: A = matrix(SR, [[1,2,3],[4,5,6],[7,8,9]])
sage: A.eigenvectors_right()
UserWarning: Using generic algorithm for an inexact ring, which may
result in garbage from numerical precision issues.
# -*- coding: utf-8 -*-
UserWarning: Using generic algorithm for an inexact ring, which will
probably give incorrect results due to numerical precision issues.
# -*- coding: utf-8 -*-
TypeError: degree() takes exactly one argument (0 given)
sage: maxima_console()
Maxima 5.16.3 http://maxima.sourceforge.net

For some reason SR eigenvectors were never actually tested, I think -
because they inherit directly from matrix2.pyx! In fact, the error
comes from eigenspaces_left in that file, where G = self.fcp() calls
degree of a symbolic expression, which now requires an argument ! The
symbolic upgrade strikes again... I'll try to have a patch for this
soon.

- kcrisman

kcrisman

unread,
Sep 15, 2009, 9:34:12 AM9/15/09
to sage-devel

kcrisman

unread,
Sep 15, 2009, 9:47:06 AM9/15/09
to sage-devel

> For some reason SR eigenvectors were never actually tested, I think -
> because they inherit directly from matrix2.pyx!  In fact, the error
> comes from eigenspaces_left in that file, where G = self.fcp() calls
> degree of a symbolic expression, which now requires an argument ! The
> symbolic upgrade strikes again...  I'll try to have a patch for this
> soon.

As it turns out, there is actually a lot of stuff which now does not
work with symbolic matrices, because we only tested the things which
were actually implemented for them. See http://trac.sagemath.org/sage_trac/ticket/6934,
which I've labeled critical. Suggestions for how to approach the
fix?

- kcrisman

Jason Grout

unread,
Sep 15, 2009, 11:01:41 AM9/15/09
to sage-...@googlegroups.com


Wow. It seems like Nicolas had a patch once that made it easy to test
functions that a type inherited from its parents. That would have been
useful here.

Jason


--
Jason Grout

Paulo César Pereira de Andrade

unread,
Sep 15, 2009, 3:10:46 PM9/15/09
to sage-...@googlegroups.com
2009/9/15 kcrisman <kcri...@gmail.com>:

>
>> > As for you for now, you'd need to change the eigenvectors() command in
>> > the matrix code.  If you wanted to do so and submit a patch, it would be
>> > greatly appreciated!
>>
>
> But all doctests pass for me in alpha1:
>
> ./sage -t "devel/sage/sage/matrix/"
> All tests passed!
> Total time for all tests: 177.1 seconds

I get slightly different results, with two known (hopefully :-)
"minor" problems:
% sage -t "devel/sage/sage/matrix/"
...
sage -t "devel/sage/sage/matrix/matrix_double_dense.pyx"
**********************************************************************
File "/usr/share/sage/devel/sage/sage/matrix/matrix_double_dense.pyx", line 996:
sage: V
Expected:
[-0.392540507864 0.824163383692 0.408248290464]
[-0.560772154092 0.137360563949 -0.816496580928]
[ -0.72900380032 -0.549442255795 0.408248290464]
Got:
[-0.392540507864 0.824163383692 -0.408248290464]
[-0.560772154092 0.137360563949 0.816496580928]
[ -0.72900380032 -0.549442255795 -0.408248290464]
**********************************************************************
1 items had failures:
1 of 27 in __main__.example_28
***Test Failed*** 1 failures.
...
sage -t "devel/sage/sage/matrix/constructor.py"
**********************************************************************
File "/usr/share/sage/devel/sage/sage/matrix/constructor.py", line 155:
sage: g = graphs.PetersenGraph()
Expected nothing
Got:
doctest:16: DeprecationWarning: the sets module is deprecated
doctest:18: DeprecationWarning:
**********************************************************
matplotlib.numerix and all its subpackages are deprecated.
They will be removed soon. Please use numpy instead.
**********************************************************
<BLANKLINE>
**********************************************************************
1 items had failures:
1 of 94 in __main__.example_1
***Test Failed*** 1 failures.
...

>> maxima-5.19.1 can be found in Sage sage-4.1.2.alpha1, but being an
>> alpha, it is likely to be less stable than a 'stable' release of Sage.
>> Note Sage 4.1.2 will be the first Sage to have a recent update of
>> Maxima. The previous version, 4.1.1, does not.
>
> That's #6699 where the change went in.  Note that the patch there
> fixes similar eigenvector problems in doc/en/constructions/
> linear_algebra.rst and doc/en/tutorial/interfaces.rst, and, for that
> matter, sage/interfaces/maxima.py

Many Thanks!! I just made a local build with
http://trac.sagemath.org/sage_trac/attachment/ticket/6699/maxima_doctests.patch
applied, and now the maxima tutorial works correctly.

> But actually, the problem is already in 4.1.1, with the previous
> Maxima:
>
> ----------------------------------------------------------------------
> | Sage Version 4.1.1, Release Date: 2009-08-14                       |
> | Type notebook() for the GUI, and license() for information.        |
> ----------------------------------------------------------------------
> sage: A = matrix(SR, [[1,2,3],[4,5,6],[7,8,9]])
> sage: A.eigenvectors_right()
> UserWarning: Using generic algorithm for an inexact ring, which may
> result in garbage from numerical precision issues.
>  # -*- coding: utf-8 -*-
>  UserWarning: Using generic algorithm for an inexact ring, which will
> probably give incorrect results due to numerical precision issues.
>  # -*- coding: utf-8 -*-
> TypeError: degree() takes exactly one argument (0 given)
> sage: maxima_console()
> Maxima 5.16.3 http://maxima.sourceforge.net
>
> For some reason SR eigenvectors were never actually tested, I think -
> because they inherit directly from matrix2.pyx!  In fact, the error
> comes from eigenspaces_left in that file, where G = self.fcp() calls
> degree of a symbolic expression, which now requires an argument ! The
> symbolic upgrade strikes again...  I'll try to have a patch for this
> soon.
>
> - kcrisman

Paulo

Jason Grout

unread,
Sep 15, 2009, 3:16:56 PM9/15/09
to sage-...@googlegroups.com
Paulo César Pereira de Andrade wrote:


Just a sign issue on the last eigenvector, it looks like, which is not a
problem mathematically. The doctest should probably just check to see
that the vector is really an eigenvector, rather than check the actual
output.


> sage -t "devel/sage/sage/matrix/constructor.py"
> **********************************************************************
> File "/usr/share/sage/devel/sage/sage/matrix/constructor.py", line 155:
> sage: g = graphs.PetersenGraph()
> Expected nothing
> Got:
> doctest:16: DeprecationWarning: the sets module is deprecated
> doctest:18: DeprecationWarning:
> **********************************************************
> matplotlib.numerix and all its subpackages are deprecated.
> They will be removed soon. Please use numpy instead.
> **********************************************************
> <BLANKLINE>
> **********************************************************************
> 1 items had failures:
> 1 of 94 in __main__.example_1
> ***Test Failed*** 1 failures.
> ...
>

The numerix issue should be fixed in #5448, IIRC.


--
Jason Grout

Paulo César Pereira de Andrade

unread,
Sep 15, 2009, 8:34:39 PM9/15/09
to sage-...@googlegroups.com
2009/9/15 Jason Grout <jason...@creativetrax.com>:

>> sage -t  "devel/sage/sage/matrix/constructor.py"
>> **********************************************************************
>> File "/usr/share/sage/devel/sage/sage/matrix/constructor.py", line 155:
>>     sage: g = graphs.PetersenGraph()
>> Expected nothing
>> Got:
>>     doctest:16: DeprecationWarning: the sets module is deprecated
>>     doctest:18: DeprecationWarning:
>>     **********************************************************
>>     matplotlib.numerix and all its subpackages are deprecated.
>>     They will be removed soon.  Please use numpy instead.
>>     **********************************************************
>>     <BLANKLINE>
>> **********************************************************************
>> 1 items had failures:
>>    1 of  94 in __main__.example_1
>> ***Test Failed*** 1 failures.
>> ...
>>
>
> The numerix issue should be fixed in #5448, IIRC.

Thanks again!! I used the patch in the spkg at
http://trac.sagemath.org/sage_trac/ticket/5448#comment:37
and that cleaned up most of the remaining noise in "sage -testall"

I am using sage's networkx spkg, because, as expected, upstream networkx 0.99
doesn't work correctly with sage, and is the package in the standard distro.
So far, the only python-* packages that I use from sage are
pexepect, networkx and sqlachemy. (sqlalchemy afaik only required for
dsage, to pass all it's tests).

> --
> Jason Grout

Paulo

Jason Grout

unread,
Sep 15, 2009, 8:52:21 PM9/15/09
to sage-...@googlegroups.com
Paulo César Pereira de Andrade wrote:


I think networkx 0.99 will require some nontrivial work in Sage, since
they changed a lot of things.


Jason


--
Jason Grout

Minh Nguyen

unread,
Sep 16, 2009, 12:49:03 AM9/16/09
to sage-...@googlegroups.com
On Wed, Sep 16, 2009 at 10:52 AM, Jason Grout
<jason...@creativetrax.com> wrote:

<SNIP>

> I think networkx 0.99 will require some nontrivial work in Sage, since
> they changed a lot of things.

NetworkX 1.0 should be out soon under the BSD license. Previous
versions were under LGPL.

--
Regards
Minh Van Nguyen

Paulo César Pereira de Andrade

unread,
Sep 16, 2009, 3:03:34 PM9/16/09
to sage-...@googlegroups.com
2009/9/16 Minh Nguyen <nguye...@gmail.com>:

>
> On Wed, Sep 16, 2009 at 10:52 AM, Jason Grout
> <jason...@creativetrax.com> wrote:
>
> <SNIP>
>
>> I think networkx 0.99 will require some nontrivial work in Sage, since
>> they changed a lot of things.

I forgot to say about another package, but at least for now, they
don't "cascade" on several other doctest failures, so I am keeping
sage using the distro cvxopt for now:

sage -t "devel/doc/en/numerical_sage/cvxopt.rst"
ESC[?1034h**********************************************************************
File "/usr/share/sage/devel/doc/en/numerical_sage/cvxopt.rst", line 57:
sage: print(A)
Expected:
SIZE: (5,5)
(0, 0) 2.0000e+00
(1, 0) 3.0000e+00
(0, 1) 3.0000e+00
(2, 1) -1.0000e+00
(4, 1) 4.0000e+00
(1, 2) 4.0000e+00
(2, 2) -3.0000e+00
(3, 2) 1.0000e+00
(4, 2) 2.0000e+00
(2, 3) 2.0000e+00
(1, 4) 6.0000e+00
(4, 4) 1.0000e+00
Got:
[ 2.00e+00 3.00e+00 0 0 0 ]
[ 3.00e+00 0 4.00e+00 0 6.00e+00]
[ 0 -1.00e+00 -3.00e+00 2.00e+00 0 ]
[ 0 0 1.00e+00 0 0 ]
[ 0 4.00e+00 2.00e+00 0 1.00e+00]
<BLANKLINE>
**********************************************************************
File "/usr/share/sage/devel/doc/en/numerical_sage/cvxopt.rst", line 73:
sage: print(C)
Expected:
5.7895e-01
-5.2632e-02
1.0000e+00
1.9737e+00
-7.8947e-01
Got:
[ 5.79e-01]
[-5.26e-02]
[ 1.00e+00]
[ 1.97e+00]
[-7.89e-01]
<BLANKLINE>
**********************************************************************
File "/usr/share/sage/devel/doc/en/numerical_sage/cvxopt.rst", line 97:
sage: print(P)
Expected:
1
0
2
3
Got:
[ 1]
[ 0]
[ 2]
[ 3]
<BLANKLINE>
**********************************************************************


> NetworkX 1.0 should be out soon under the BSD license. Previous
> versions were under LGPL.
>
> --
> Regards
> Minh Van Nguyen

Paulo

Reply all
Reply to author
Forward
0 new messages