Re: [OLPC library] MATLAB for OLPC?
Ian Bicking wrote: I'm not sure his summary here is true. You can do efficient operations over sets of data in Python (actually due to some small tweaks to the language requested by NumPy/Numeric users back around the time of Python 2.1). So if you do something like array * 6, it actually does the multiplication of items in the array in C. They bend Python's magic methods quite a bit in NumPy, so things like array access, slicing, and multiplication all avoid actually iterating over the arrays or matrixes in Python. 1. Python's array handling is the subject of an excellent chapter in Beautiful Code. :) 2. I may be wrong, but IIRC NumPy is already installed on the XO by default! I forget what depends on it, but I think it's there as a dependency. ___ Devel mailing list Devel@lists.laptop.org http://lists.laptop.org/listinfo/devel
Re: [OLPC library] MATLAB for OLPC?
Speaking of the free alternatives (of which I only know a bit -- I don't actually do any of this kind of work), I haven't noticed anyone mention RPy (http://rpy.sourceforge.net/) which provides some integration between R and Python. It would probably be very helpful for porting R to the XO, as you could write Activity wrapper in Python, and/or hook into things like the Journal using the bindings. I don't really know what the difference is between RPy and R/SPlus, it's not immediately obvious. Matplotlib (http://matplotlib.sourceforge.net/) implements a lot of 2D graphing for Python. The graphs is creates can be quite nice, and the API is pretty simple. I'm not really sure what the end-user experience is that people are looking for. An interactive prompt to explore data? A full GUI for managing the data? A tool that can be used by other Activities that actually have the data? Mel Chua wrote: On the subject of transcribing MATLAB to numpy, aside from the aforementioned smattering of dependencies on MATLAB environmental features, I would say the answer to your question is: very hard. Not only are the numpy types not a one-to-one mapping with MATLAB types; MATLAB syntax is optimized around certain assumptions about matrix iteration at a deep level. I don't fully understand the inner workings, but my impression is it would require tweaks in the Python interpreter and stack to get it running MATLAB computations at a reasonable efficiency. I'm not sure his summary here is true. You can do efficient operations over sets of data in Python (actually due to some small tweaks to the language requested by NumPy/Numeric users back around the time of Python 2.1). So if you do something like array * 6, it actually does the multiplication of items in the array in C. They bend Python's magic methods quite a bit in NumPy, so things like array access, slicing, and multiplication all avoid actually iterating over the arrays or matrixes in Python. While I imagine Matlab has a greater number of routines and algorithms written in C or other efficient languages, from Python you can access similarly efficient algorithms (once they get written). Actually interpreting another language in Python, or translating a language to Python, is probably infeasible. I've never been a fan of attempts to do this that I've seen in the past. If you actually want the Matlab language then you probably need to start with that as a goal, as Octave seems to do. I'm not sure of what the goal of having a translation from Matlab would be. Lots of XO users already know Matlab? That seems unlikely. There are libraries implemented for Matlab that would be really hard to port/reimplement? Maybe. You want XO users to collaborate with scientists who are using Matlab? I suppose; except it's easy to transfer exact code, but hard to transfer familiarity, so while Octave builds on people's Matlab familiarity I'm not sure you can confidently transfer actual code from Matlab to Octave. Given a very specific goal, I am guessing that NumPy plus Matplotlib would probably be a good base for building an Activity. For generic goals -- analyzing data in novel ways -- straight Python may be too undirected, and writing a directed Activity would probably be a significant undertaking. Ian ___ Devel mailing list Devel@lists.laptop.org http://lists.laptop.org/listinfo/devel
Re: [OLPC library] MATLAB for OLPC?
I happened to mention this email thread to a friend who works at Mathworks on MATLAB and related code. The part of the conversation that contains some notes on MATLAB and the possibility of a port or a release of the earlier version follows. The short version is that port/earlier-version-release is probably not going to happen at this company from his impression of how the corporation runs, it would be very tough technically speaking to make MATLAB work on the XO, and we're probably better off using Octave or something similar since we'd end up rewriting pretty much all of MATLAB to port it to the XO anyway, but when we're working on a solution we should consider compatibility with existing similar tools of both open and closed source varieties (so kids can use existing libraries and datasets from a wider range of places). -Mel For starters, MATLAB software is programmed in three main languages. The core computing and numerical analysis routines are optimized in C/C++, probably hand tuned in assembler at a few crucial junctures but that's beside the point. The programming environment is built up largely in MATLAB code, which serves to implement high-level language features as well as the gazillion and one global functions. The GUI layer and, increasingly, things like XML parsing and file I/O, are handled by an internal Java VM controlled by the MATLAB interpreter. This blend of technologies is, of course, a design choice. But it's a very effective one. Command-line MATLAB does exist (on Linux at least), and it does not require Java nor quite as much of the foundation M-code. I'm not sure how much space that saves, but I'll grant that it significantly cuts down on the problems of code migration, many of which are GUI-related. I will caution that doing this not only removes some capabilities, but reduces the number of M-files from sites like MATLAB Central that work properly. Taking the GUI off the table entirely might seem like a reasonable way to get corporate to sign-off on open sourcing components, but is the wrong approach, for two reasons besides the above. First, this is still a very IP-conservative company, and my suspicion is that if they ever did come to the bargaining table it'd be after striking much of the remaining language features that separate the product from lookalikes. Secondly, the GUI is important. We get away with charging $2000 a seat because most scientists aren't really programmers, and of those who are, 90% hate emacs-style development and will take every convenience feature they can get. On the subject of transcribing MATLAB to numpy, aside from the aforementioned smattering of dependencies on MATLAB environmental features, I would say the answer to your question is: very hard. Not only are the numpy types not a one-to-one mapping with MATLAB types; MATLAB syntax is optimized around certain assumptions about matrix iteration at a deep level. I don't fully understand the inner workings, but my impression is it would require tweaks in the Python interpreter and stack to get it running MATLAB computations at a reasonable efficiency. If your grand plan for this M-to-Python interpreter is to bring in utilities that help make up for what they don't give us, I'd say take another look at Octave. I believe they are doing this the right way--they recognize that, besides being a language and a software product, MATLAB is also an architecture. Even an M-interpreter and runtime with incomplete compatibility is probably better than attempting source translation. And they do make compatibility a goal. I don't know if you remember, but when I did a project in college I was able to tweak my original M-code (which used the DSP toolbox) to also run on Octave with the Octave-Forge library. As I understand it, this next release of Octave is another step in that direction, especially in the area of graphics. One minor caveat to all of this is that unless you're handed a working implementation of the language layer of R2008a, you won't get the newly introduced classdef syntax. Mostly irrelevant, since it won't be in widespread use for some time. I just happen to find it pretty spiffy :-) ___ Devel mailing list Devel@lists.laptop.org http://lists.laptop.org/listinfo/devel
Re: [OLPC library] MATLAB for OLPC?
On Jan 28, 2008, at 8:04 PM, Cleve Moler wrote: (I doubt that MATLAB runs in the OLPC, but I'm not sure.) According to the system requirements[0] for MATLAB 7.5, it won't run on the XO laptop due to insufficient RAM (256MB present, 512MB required). In a perfect world, that would mean you'd pick an older version that runs on our hardware and consider open sourcing it, like EA did with the tremendously popular SimCity[1]. The latter made gamers around the world rejoice -- perhaps MathWorks could do the same for us math-heads; getting some real numerical analysis tools into the kids' hands would be awfully exciting. Cheers, Ivan. [0] http://www.mathworks.com/support/sysreq/current_release/linux.html [1] http://arstechnica.com/news.ars/post/20071110-original-sim-city-donated-to-one-laptop-per-child-project.html -- Ivan Krstić [EMAIL PROTECTED] | http://radian.org ___ Devel mailing list Devel@lists.laptop.org http://lists.laptop.org/listinfo/devel
Re: [OLPC library] MATLAB for OLPC?
On Jan 28, 2008 5:24 PM, Ivan Krstić [EMAIL PROTECTED] wrote: On Jan 28, 2008, at 8:04 PM, Cleve Moler wrote: (I doubt that MATLAB runs in the OLPC, but I'm not sure.) There are a number of open-source replacements for MATLAB, including GNU Octave ( http://www.gnu.org/software/octave/ ) and Maxima ( http://maxima.sourceforge.net/ ). --scott -- ( http://cscott.net/ ) ___ Devel mailing list Devel@lists.laptop.org http://lists.laptop.org/listinfo/devel
Re: [OLPC library] MATLAB for OLPC?
On Mon, 28 Jan 2008, Marcus Leech wrote: I was just about to say the same thing. There's also R (The open-source replacement for 'S'). I know someone who would be more than happy to help bring R and OLPC together. /me looks meaningfully at Mr. Michael Tiemann... --g -- Greg DeKoenigsberg Community Development Manager Red Hat, Inc. :: 1-919-754-4255 To whomsoever much hath been given... ...from him much shall be asked ___ Devel mailing list Devel@lists.laptop.org http://lists.laptop.org/listinfo/devel
Re: [OLPC library] MATLAB for OLPC?
C. Scott Ananian wrote: On Jan 28, 2008 5:24 PM, Ivan Krstić [EMAIL PROTECTED] wrote: On Jan 28, 2008, at 8:04 PM, Cleve Moler wrote: (I doubt that MATLAB runs in the OLPC, but I'm not sure.) There are a number of open-source replacements for MATLAB, including GNU Octave ( http://www.gnu.org/software/octave/ ) and Maxima ( http://maxima.sourceforge.net/ ). --scott I was just about to say the same thing. There's also R (The open-source replacement for 'S'). When my daughter was taking introductory algebra, I showed here the algebraic solver in xMaxima. She said that's cheating :-) ex ___ Devel mailing list Devel@lists.laptop.org http://lists.laptop.org/listinfo/devel
Re: [OLPC library] MATLAB for OLPC?
2008/1/28 C. Scott Ananian [EMAIL PROTECTED]: On Jan 28, 2008 5:24 PM, Ivan Krstić [EMAIL PROTECTED] wrote: On Jan 28, 2008, at 8:04 PM, Cleve Moler wrote: (I doubt that MATLAB runs in the OLPC, but I'm not sure.) There are a number of open-source replacements for MATLAB, including GNU Octave ( http://www.gnu.org/software/octave/ ) and Maxima ( http://maxima.sourceforge.net/ ). --scott -- Another interesting open source math project also pointed as a replacement of matlab is Sage * http://www.sagemath.org/** * -- Rafael Enrique Ortiz Guerrero One Laptop Per Child [EMAIL PROTECTED] ___ Devel mailing list Devel@lists.laptop.org http://lists.laptop.org/listinfo/devel
Re: [OLPC library] MATLAB for OLPC?
Rafael Enrique Ortiz Guerrero wrote: 2008/1/28 C. Scott Ananian [EMAIL PROTECTED] mailto:[EMAIL PROTECTED]: On Jan 28, 2008 5:24 PM, Ivan Krstić [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: On Jan 28, 2008, at 8:04 PM, Cleve Moler wrote: (I doubt that MATLAB runs in the OLPC, but I'm not sure.) There are a number of open-source replacements for MATLAB, including GNU Octave ( http://www.gnu.org/software/octave/ ) and Maxima ( http://maxima.sourceforge.net/ ). --scott -- Another interesting open source math project also pointed as a replacement of matlab is Sage * http://www.sagemath.org/** * My turn: 1. Both Maxima/XMaxima/wxMaxima and R run on my XO out of the box courtesy of yum. With the Maximae, you get your choice of Lisp run times. I've successfully used both the clisp and SBCL runtimes. They do have a lot of dependencies, however, so watch your flash space. 2. Maxima is a Computer Algebra System and R is a graphical and statistical/numeric package. Both will do number crunching, but they're two different beasts, and both fundamentally different beasts from Matlab. 3. There are two and a half free Matlab clones. Someone mentioned Octave, but there is also Freemat, and a half-free package called SciLab. I call SciLab half-free because I don't know its exact license. You can download it freely, but I'm not sure all of the GPL freedoms are in place on it. I have used exactly none of these -- I learned R and don't see the need for another number cruncher. 4. On to Sage -- Sage is a wonderful package. It is written in Python and wraps many specialized and more general math packages. Its goal is to replace Mathematica, Maple, and some other less-well-known math packages. However -- it's huge. And it installs everything independently of whether you have the same package already as part of your distro. I loaded it once, but there were only two or three rather specialized packages in Sage that weren't in my Gentoo repositories already. I think it's modular -- you don't have to load the whole enchilada. I might load the base on my virtual XO just to see how much space the core takes, because it's really an excellent collection. If you can only load *one* math package, I highly recommend wxMaxima with the clisp run time. That's going to give you the most bang for your flash space. You don't really need XMaxima -- wxMaxima is a much better UI. By the way, wxMaxima also runs on Windows!! Well ... so does R. In fact, the Windows UI for R is better than the core Linux UI. :) ___ Devel mailing list Devel@lists.laptop.org http://lists.laptop.org/listinfo/devel