sagemath / sage

Main repository of SageMath
https://www.sagemath.org
Other
1.44k stars 480 forks source link

bug in units conversion #19093

Open 94a1bc6f-6005-414c-9598-64422d48cc95 opened 9 years ago

94a1bc6f-6005-414c-9598-64422d48cc95 commented 9 years ago

The .convert() function converts units to their base units, e.g.

sage: (units.energy.joule).convert()                            
kilogram*meter^2/second^2

The units of heat capacity are joule/kelvin/kilogram and since joule is not a base unit, it should be possible to convert them to base units. However, this throws an error:

sage: (units.energy.joule/units.temperature.kelvin/units.mass.kilogram).convert()
Traceback (click to the left of this block for traceback)
...
ValueError: Cannot convert

This seems to be the case whenever something is divided by temperature.

Component: symbolics

Keywords: units

Issue created by migration from https://trac.sagemath.org/ticket/19093

94a1bc6f-6005-414c-9598-64422d48cc95 commented 9 years ago
comment:1

Goodness, did I really create this ticket only 3 weeks ago? Just googled it again and found the same issue asked by myself 2 years ago with a proposed workaround by Eviatar Bach: http://ask.sagemath.org/question/10260/convert-derived-si-units-to-base-units/