Maurizio wrote:
> Hi
> 
> can anyone give an advice on how to adapt Quantities to let it be
> compatible with SAGE? I don't know how SAGE modifies the way to
> represent numbers, and why it does not comply with Quantities.
> 
> For example, how does SAGE generate an instance of
> "sage.rings.integer.Integer"? I hope this can help me. Actually, I
> wasn't able to understand how Quantities deals with numbers, because
> it basically transform any python int or float multiplied by a
> physical unit, into a numpy array (either a single element or a
> vector) with unit "dimensionless". I think there would be nothing
> wrong with continue using normal sage integers or float as
> dimensionless, even though I don't know how could we manage an object
> given by the multiplication of an integer and a physical unit: would
> this become a "quantity" instance? This would be fast to implement,
> because that's the way it is now. Nonetheless, this is not the way I
> would like it to do, because it would cause the necessity to add in
> quantity the way to deal with all the possible types in SAGE (also
> symbolics, in future?).

Not necessarily.  As I understand it, quantities are just numpy arrays, 
basically.  Those numpy arrays should be able to contain and deal with 
any type (sage or python or whatever).

I tracked down where the error was in what you posted before.  I think 
if we could get the following two expressions to return the same thing, 
we may be good to go.  Does anyone know what is going on here?


sage: import quantities as pq
sage: other_sage=numpy.asarray(10).view(pq.Quantity)
sage: import numpy
sage: numpy.ndarray.__mul__(numpy.array(float(1.0)),other_sage)
NotImplemented
sage: numpy.ndarray.__mul__(numpy.array(float(1.0)),other_sage.astype(int))
array(10.0)*dimensionless


Thanks,

Jason


--~--~---------~--~----~------------~-------~--~----~
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