Skip to content
Harold edited this page Nov 24, 2013 · 10 revisions

This page aims to discuss open questions on unit systems (sympy.physics.unitsystems) in Sympy as well as possible improvements that can be made. You can propose your ideas and if you need help you can send me a message.

For some historical discussions you can take a look at:

Some articles speaking about the mathematical formulation of unit/dimension systems:

Open questions

The module can already be used in daily life, but it will need some polishing in order to be fully convenient to use. In this section I suggest several points that could be improved.

Various points:

  • Verify that function arg are dimensionless (there is care to take with angles, cf the papers above).

Operations with units and numbers

This is the big question: currently operations with units return either a unit or an instance Add/Mul/Pow. The main problem is for add/sub: we can get units with negative scale, which has no sense with regard to the way we defined them. The solution could be that every operation implying a unit return a quantity. For example 10*m return the quantity Quantity(10, m); similarly Unit(length, 10) - Unit(length, 20) returns Quantity(-10, m).

Conversions

A lot of work is needed to tie better units and unit systems. For example if one wants to define a quantity with Quantity("10 m"), we have somehow to say what is the current system. One could define a gloval variable SYSTEM which says in which system one wants to work, and then add some function in units to take this into account (but some people don't like global variables).

We can also add a method to print quantities in term of the unit that makes its factor the closest of 1. For example 1.7e6 eV will be written 1.7 MeV.

Improvements

New unit systems

Several systems have to be defined:

  • SI
  • Planck system
  • computer science system
  • astronomical (with ua, earth mass, solar radius, etc.)

Dimensional analysis

A lot of things can be done with dimensional analysis.

  • Parse equations to check dimensions (there is already a function for this, but its very rough).
  • Implement Buckingham Π theorem: find all adimensional quantities with n quantities and N base units.

New objects

Several kinds of new objects can be implemented:

  • Units with offset (like °C).
  • Logarithmic units (dB, pH, bytes, etc.) : one has to take care to allow log in different basis (cf [deBoer1979]).
  • Quantities with uncertainties.

Misc

  • Define sympy printing for the different objects (use the package siunitx for LaTeX).
  • Allow for time system? (like hour/minutes/seconds) calendars?
Clone this wiki locally