#9763: Metrology module (a different implementation of the units module)
-----------------------------+----------------------------------------------
Reporter: cousteau | Owner: burcin
Type: enhancement | Status: needs_work
Priority: minor | Milestone: sage-feature
Component: symbolics | Keywords: units, SI, metrology
Work_issues: | Upstream: N/A
Reviewer: Burcin Erocal | Author: Javier Mora
Merged: | Dependencies:
-----------------------------+----------------------------------------------
Comment(by cousteau):
As burcin said, the idea was to have this as a replacement for the current
units module, without removing the old one. (Another idea was to call it
units2, but that looked kind of ugly)
Making `Units` derive from `SageObject` might be a good idea; however I
didn't know much about Sage (nor do I now, actually) so I didn't consider
this possibility. Maybe a Units ring could be made too.
The `U()` function was called this way so one could create units
conveniently, like
{{{
#!python
from metrology import U
length = U("1 m")
}}}
However, it's not necessary to have this function on the top level
namespace, and Python guidelines usually suggest something like
{{{
#!python
import metrology
length = metrology.U("1 m")
}}}
As for advantages/disadvantages, well, I don't remember them all, but
here's a rough list:
=== Pros ===
* Create units from a text string, including multiples and fractions.
* !LaTeX representation of units.
* Abstraction of units, as (value, unit !SI value, unit dimmensions),
which allows to know the mass-length-time decomposition of the magnitude.
* `0 * 1m = 0 m`, not just `0`. Also, it's possible to convert from 0
degrees Celsius to Fahrenheit, which is impossible with the current
`units` module.
=== Cons ===
* `Units` is a class written from scratch, with all operations
(`__add__()`, `__mul__()`...) coded explicitly.
* Interoperability with other data types (for example, a matrix of units)
might be messy.
* The `units` module has a pretty nice documentation for each unit, not
present in this module.
* It's very incomplete, missing a lot of units.
--
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/9763#comment:4>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica,
and MATLAB
--
You received this message because you are subscribed to the Google Groups
"sage-trac" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sage-trac?hl=en.