Opened 6 years ago

Last modified 6 years ago

#20411 new enhancement

Injecting shorthands for the most usual units

Reported by: nthiery Owned by:
Priority: major Milestone: sage-7.2
Component: symbolics Keywords:
Cc: Merged in:
Authors: Reviewers:
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Status badges


Implement inject_shorthands that would inject into the global name space shorthands for the most usual units::

    sage: units.inject_shorthands()
    sage: 3 * kg * m / s^2

This can be implemented easily as in e.g. sage.combinat.sf.sf.SymmetricFunctions?.inject_shorthands, together with a dictionary mapping shorthands to the corresponding units.

The main difficulty is to agree on a list of shorthands :-)

Let's start a list: s, mm, cm, m, km, g, kg, ...; Maybe l, W, J, ...; Maybe long names for the less usual units: ton, watt, ...

Or have something like:

    sage: sage.units.mass.inject_shorthands(all=True)

that injects all the units with their long names.

Change History (1)

comment:1 Changed 6 years ago by mcognetta

I think the easiest thing we could agree on is using the SI unit abbreviations. For non SI units, maybe use the long name to avoid ambiguity.

Note: See TracTickets for help on using tickets.