On Thu, May 20, 2010 at 11:37 AM, Mike Hansen <[email protected]> wrote: > On Thu, May 20, 2010 at 11:33 AM, Nathann Cohen <[email protected]> > wrote: >> Hello ! >> >>> * As a language, Python is vastly superior to R. Python has good >>> support for object oriented programming, a very wide selection of >>> existing programs and libraries, and supports threads for handling >>> realtime data. I recently read a paper about massive contortions >>> somebody went through in trying to be build some system in R to model >>> and respond to realtime data -- this was really hard in R, since R >>> evidently doesn't have good support for threads. But of course, R + >>> Sage (via rpy2) would make it easy to combine the modeling power of R >>> with the asynchronous capabilities of Python. >> >> Just a few words on that one... I have had to stand statistics for one >> year at the university, and I really ate R from morning till >> evening... Even though I have forgotten almost all of it, there are >> still two things for which R is vastly superior to python : matrices >> and plots. This does not make it a better language than python, that's >> perfectly True, but to anyone who would like to rewrite in Sage some >> code written in R, this would mean a HUGE amount of work. The >> manipulation of matrices in R is just amazing. If you want to strip >> all the negative values contained in a matrix M, you but have to write >> M * (M > 0). How easier can it et ? There is a thousand tricks like >> that available in R that I noticed nowhere else. And the same goes for >> plottings using R. I mean that on these two points, the R language is >> much more expressive than any other I know. > > You can do this with numpy arrays: > > In [6]: import numpy as np > > In [7]: a = np.array([[1,-2],[-2,3]]); a > Out[7]: > array([[ 1, -2], > [-2, 3]]) > > In [8]: a*(a>0) > Out[8]: > array([[1, 0], > [0, 3]]) > > --Mike
Nice! The Python language is much more expressive than any other I know. william -- William Stein Professor of Mathematics University of Washington http://wstein.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
