Chris,

On Wednesday, 17 August 2011 11:37:02 UTC+8, Chris Godsil wrote:
[...]

> One big advantage of sage is that one can do numerical calculations 
> along with 
> computations in algebra or number theory or graph theory... 
> For my own work I find myself wanting to do numerical computations on 
> adjacency matrices 
> of graphs. For this matlab is not very useful because it is awkward to 
> generate the graphs 
> or read them in from a unix pipe. And if I wanted to compute an 
> automorphism group, I am 
> entirely lost. So I have been using sage for numerical computations. 
> The good news is that it works. 
>
> The bad news is that it is a very frustrating experience. To 
> illustrate with an example, 
> I wanted to compute spectral decompositions of symmetric real 
> matrices. This means I need 
>

actually, did you try the built-in functionality for graph eigenvalues? I 
imagine it would alleviate some of your complaints. E.g.

sage: g=graphs.OctahedralGraph()  
sage: g.eigenspaces()
[
(4, Vector space of degree 6 and dimension 1 over Rational Field
User basis matrix:
[1 1 1 1 1 1]),
(-2, Vector space of degree 6 and dimension 2 over Rational Field
User basis matrix:
[ 1  0 -1 -1  0  1]
[ 0  1 -1 -1  1  0]),
(0, Vector space of degree 6 and dimension 3 over Rational Field
User basis matrix:
[ 1  0  0  0  0 -1]
[ 0  1  0  0 -1  0]
[ 0  0  1 -1  0  0])
]

 

> the eigenvalues and an orthogonal basis for each eigenspace. I must 
> use scipy/numpy, 
> because sage does not recognise that eigenvalues of symmetric matrices 
> are real. 
> Now the fun starts. The sort 
> of incantations needed to load stuff from numpy and scipy are 
> difficult to sort out. Basically 
> you make some semi-random trials until the output seems plausible, and 
> then hope everything 
> is working. The fact that the syntax for scipy and numpy differs from 
> that of sage is just 
> one more nuisance. For documentation, sage punts to the documentation 
> for scipy and numpy, 
> which is poor (and does not seem to be written by people who 
> understand numerical computation). 
>
> A more general issue is that, once I decide I want to work in floating 
> point, I want to stay 
> in floating point. I do not really want to deal with stuff like: 
>
> > sage: sin(2.0*pi) 
> > sin(2.00000000000000*pi) 
>
> And I'd love to see an engineer's face when s/he enters A.kernel() and 
> gets 
> back a message about free modules. 
>
> I agree strongly with comments of Pedro and Simon that editor+shell is 
> superior to the notebook 
> for this sort of work. 
>
> To finish, a few key points: 
> 1. When I am doing numerical linear algebra, I'd like code to return 
> scalars, vectors, matrices. 
> So A.kernel() should just return either a basis or a matrix, for 
> example. The default routines 
> should call LAPACK or an equivalent, and we should have access to as 
> many of these as possible. 
> (All actual code should have been written by a professional numerical 
> analyst.) 
>
> 2. Any computation which contains a floating point number or variable 
> should return 
> a floating point variable. 
>
> 3. The syntax and behaviour should be consistent, whether I am doing 
> numerical linear algebra, 
> linear programming, semidefinite optimization, numerical 
> integration,... 
>
>
> On Aug 15, 3:58 pm, William Stein <wst...@gmail.com> wrote: 
> > Hi, 
> > 
> > If somebody walked up to *you* and asked: "Is Sage now a viable 
> > alternative to MATLAB?" what would you say? 
> > I'm especially interested in what people who do numerical/applied 
> > computation think. 
> > 
> > My answer: "It's very difficult for *me* to answer this question 
> > myself, because MATLAB is useless for most of my own 
> > teaching/research/work, but I realize it is very widely used in 
> > applied mathematics.   Based on going to Scipy and the resources I've 
> > seen online, it appears that the Numpy/Scipy stack is extremely useful 
> > to actual people doing numerical computation.      Maybe I'll try 
> > asking on sage-devel." 
> > 
> > [NOTE:  I am interested in people's answers, rather than somebody 
> > hijacking this thread to try to define "viable alternative" or say 
> > this isn't a scientific survey or something.  Please try not to hijack 
> > this thread.  Thanks!] 
> > 
> >  -- William 
> > 
> > -- 
> > William Stein 
> > Professor of Mathematics 
> > University of Washingtonhttp://wstein.org

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

Reply via email to