I am used to responding to engineering colleagues in terms of Python
vs Matlab, but this particular person uses Mathematica almost
exclusively. So, he wanted to know if Python could be used like
Mathematica in terms of writing rule and procedure based programs. I
don't know how difficult this would be.
I don't do this kind of work and think of Mathematica primarily as a
symbolic algebra language, so that Python could not easily replace it.
Does anyone have experience of coming from Mathematica to Python and
whether or not I should try and convince this person to pursue Python?
Thanks,
Ryan
_______________________________________________
SciPy-user mailing list
SciPy...@scipy.org
http://projects.scipy.org/mailman/listinfo/scipy-user
Your friend can have both worlds and choose as needed:
http://library.wolfram.com/infocenter/MathSource/585/
http://library.wolfram.com/infocenter/MathSource/6622/
Cheers,
Alan Isaac
I think I understand what he means. Python can almost be used like this,
but there is the UI missing. Ipython is currently working on a "notebook"
UI that would address this problem. I have developped my own workflow
using a home made script ("pyreport"
http://gael-varoquaux.info/computers/pyreport/ ) to approach this
workflow. Ultimately I want to merge this with ipython's effort in order
to get nice notebook functionnality with html and pdf output, but
xurrently I don't have time for this.
I am attaching a file that shows how I use Python with Pyreport (Python
file attached, pdf file on http://gael-varoquaux.info/FORT_MOT.pdf ). The file
also shows the limits of the approach, and for larger project I use more
modular programming. This example is a bit frightening because it has
really grown longer than a Mathematica script and is a bit too complex to
have in such a monolythic code, but it is the only thing I have around.
There are also some very simple examples on pyreport's page.
So I think the answer is that it is possible with Python, but the tools
are not very developped and only slow progress is made.
My 2 cents,
Gaėl
Cheers,
You better make time soon. Min has already written a plaintext dump
format for the notebook, you'll be getting an email about that in a
minute. We need you :)
But back to the OP, I think the issue Ryan's colleague has isn't
addressed by a notebook interface, nor by SAGE (as great as SAGE is).
Mathematica's programming model/language can be very tricky to wrap
your head around, but it allows you to do *phenomenal* things in very
concise way, that would be extremely clunky in Python or any other
language I can think of.
Mathematica is very lisp-ish in its model, and its syntax for building
complex programs can be quirky, and its encapsulation model is rather
poor. But for rule-based programming it's hard to beat, it exposes
every object it has in a completely uniform way so that you can do
abstract manipulations on them, and it has very rich transformation
facilities. Doing things like "take an arbitrarily nested object,
traverse it and replace every instance of '(x-y)^4' by a polynomial
over z^2" are one-liners in Mathematica.
Honestly I'd say that if Ryan's colleague has a lot of code like that,
Python is NOT the answer for him. Rather, he should learn to use
Python because it *complements* Mathematica very well. Python is
good, easy to use and convenient to work with precisely at many of the
things that Mathematica is clunky for. They obviously have a lot of
overlap, and I personally use Python where they overlap simply because
I'm more proficient in Python these days. I'm sure he could go for
Mathematica in that region for the same reasons.
But there is definitely a domain where Mathematica is simply
unbeatable, and that goes beyond the obvious triad of (notebook,
symbolics, easy-to-control pervasive arbitrary precision).
These days my working toolbox is more or less just Python+Mathematica,
for these very reasons (and Python obviously includes C/C++/Fortran as
needed for low-level/speed work).
HTH.
Cheers,
f
No I have a dumb question: what is the easiest way to get him a link
to these responses, since he obviously doesn't subscribe to this list.
Does it take a few days to get into Gmane? Can he see the whole
thread there easily? Is there a better way?
http://comments.gmane.org/gmane.comp.python.scientific.user/12812
Thanks again.