Ok, let me add another long post to this conversation... hopefully you
have enough patience!! This is probably known stuff for some of you,
but I'm sure some others will learn something! I kindly ask you to try
to go through all this post, I think it will be worthwile.

Short and not so important things first: why can't I get method
suggested by Jason to get Python integers in SAGE work from the
notebook? I mean:

import quantities as pq
res = 10r*pq.ohm

works in sage (run from the command line), but not from the notebook!
I get the same error, and I also get

value = 10
type(value)
<type 'sage.rings.integer.Integer'>
value = 10r
type(value)
<type 'sage.rings.integer.Integer'>

But from sage command line I correctly get type(10r) = python integer!
Why is that?

Let's go to the units package discussion. I had a look at this (not so
new) discussion in the enthought mailing list:
https://mail.enthought.com/pipermail/enthought-dev/2007-September/009125.html

Let's consider the "units" package in enthought the equivalent of the
"father" of "quantities", hoping that I understood everything
correctly. Let me cite the author of "quantities":

<Citation>
I've been working on an ndarray subclass which could unify these two
packages. Unit conversion is handled by UDUnits, which is compatible
with the terms of the BSD. I've done some preliminary unittesting and
things look good on both windows and linux. I'm waiting for numpy-1.2
to be released so I can use the incorporated nose-based unit-testing
framework to continue writing unittests.

The package is available at http://dale.chess.cornell.edu/chess-wiki/Quantities
. The package only depends on numpy, and does not require Traits, so I
was thinking it might be better to continue development as a scikit
and decide later where and how to incorporate it into enhought, scipy,
numpy, or none of the above.
</Citation>

In the enthought mailing list, they claim that: "The units package is
very stable, but perhaps lacking in documentation.". Which is pretty
good. Then, another person in that thread states:
"Have you guys look at scientificPython's units ? I use them through
ipython shorthands and they are pretty good. It won't run on your
system
because you don't have the required modules (well, I could make it
run,
but it's not worth it), and it needs to be ran through ipython, with
the
"physcis" profile".
So I discovered this (reference:
http://modular.math.washington.edu/home/jvoight/sage-2.10.2/local/share/doc/ipython-0.8.1/manual.pdf
):
"The module PhysicalQInput allows a simplified form of input for
physical quantities with
units. This file is meant to be used in conjunction with the
PhysicalQInteractive module
(in the same directory) and Physics.PhysicalQuantities from Konrad
Hinsen’s ScientificPython
(http://dirac.cnrs-orleans.fr/ScientificPython/)."
So, it seems that PhysicalQuantities (together with the "physics"
profile of iPython, which could be maybe used in SAGE, if needed??),
is pretty much a standard thing for Python (which seems VERY good!),
so let me investigate why these enthought guys needed something
different (reference: reply in the same previous mailing list):
"enthought.units provides a similar mechanism, if thats the route you
want to go. The reason we don't typically use the package that way is
because unit conversions because if forces explicit unit conversion.
Say
we were to send a probe to mars, and somewhere in our code we used
metric, and other places we used imperial, we would have to know at
what
points the two unit systems required conversion. Otherwise, the probe
burns up in the atmosphere... Some of our apps have data in multiple
unit systems, so having the automatic conversion is a big plus, but
this
may not be true for every app."
I have to admit I totally agree with this guy, so I am basically going
for enthought's approach! But, wait a minute, what if I install
SciMath (the enthought package) I downloaded last night?

Well, the result is not that good, because you basically need a lot of
other enthought stuff to let enthought.units work:

from enthought import units

Traceback (click to the left for traceback)
...
ImportError: No module named util.resource

The problem is that you have to modify "units" from SciMath to let it
work without the enthought util environment. I'm not that into doing
this.

To summarize stuff:
1) the Python standard seems to be iPython + "physics" profile +
Scientific Python
2) the Enthought suite uses two different packages, but it "seems"
that the most used is "units", and one big plus is the ability to mix
together (as they say, I was not able to verify it) different units of
the same physical quantity and let the "decorator" do the translation
job to some preassigned standard for that quantity
3) the Quantities package has been developed as a refactoring and
joining of the two Enthought package, although this units mixing
(claimed as possible in Enthought) seems not natively supported (if I
try to add 10 inches and 10 meters I get an error... I can't even add
meters and centimeters!) which is not good. A good plus about
"quantities" is that it seems actively developed, as I can see from
their active mailing list:
https://lists.launchpad.net/python-quantities-developers/threads.html

I can see that in the middle of January they were thinking about their
timeline, since they presented something to the SciPy community
recently, and had some good feedback.
They are currently discussing about being almost ready to present
something to the numpy community, so they seems satisfied with what
they have now:
https://lists.launchpad.net/python-quantities-developers/msg00057.html

Don't you think it would be REALLY useful for us to try to discuss
with them (I'm sure some of you guys, can represent this SAGE
community much better than I do), and to ask them if they are willing
to work with us on making quantities compatible with one of our
symbolic packages? They seem pretty experienced about this package,
seem willing to improve their work, and this is (in my opinion) going
to be a VERY BIG PLUS for SAGE!!

I mean, I don't think anything out there is actually able to manage
symbolics and units at the same time, do you?

I'm very eager to see your comments, hoping that you get my passion
and enthusiasm!

Best regards

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

Reply via email to