MatPy question
Huaiyu Zhu
huaiyu at gauss.almadan.ibm.com
Wed Nov 21 13:48:22 EST 2001
More information about the Python-list mailing list
Wed Nov 21 13:48:22 EST 2001
- Previous message (by thread): MatPy question
- Next message (by thread): MatPy question
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Wed, 21 Nov 2001 19:25:01 -0800, Glenn R Fulford <glennfulford at bigpond.com> wrote: >On the other hand, most work with matricies has indexing starting from 1. That's just because it does not matter. Since people normally count things from one, that's the convention they use. >Noone uses matrix indices (0,0). Note that MatLab does it's indexing from 1, >and I thought that nupy is thought of as a replacement for matlab? The whole >idea of using software to do mathematics is to have a language which feels >natural to translate the maths into the program. I don't think Numpy was originally intended as a Matlab replacement. It's more like a way to give numerical capability to people already using Python. In contrast, I wrote MatPy for the express purpose of making the interface more like Matlab, as I had used Matlab for years and liked it a lot. But I find matching indexing conventions between two languages of minimal interest - the purpose of these objects is to hide them. On the other hand, if you are ever going to tranform arrays between numerical and non-numerical types within the same language, Python, you really want to match the indexing convention between them. In fact, changing the indexing in MatPy itself is not difficult at all - you can do it within half an hour (the first version of MatPy was done in an afternoon). Look for __getitem__ and friends in the Matrix module. The code is GPLed so you can do almost anything with it. But be warned: the difficulty only comes when you are using such a scheme. If you are really more interested in an outright replacement of Matlab (for licensing issues, for example) instead of having both numerical and Python capabilities in one language, you'd be better off trying Octave. It is excellent and it is GPLed. >> . I initially learned >> programming in Fortran, but when I learned C later it felt much more >> natural. I guess some other people might feel the same way too. > Not me! Glenn. If you have tried to solve differential equations with a difference method in Fortran you'd have felt the pain of indexing from one. More specifically, if you divide an interval into n, the nodes would be most naturally labelled [0, 1, ..., n]. There are many other situations, but I won't repeat them. Huaiyu
- Previous message (by thread): MatPy question
- Next message (by thread): MatPy question
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list