epsilon_0 simplifies incorrectly

Bug #495181 reported by Ryan James
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
python-quantities
Fix Released
Critical
Darren Dale

Bug Description

quantities.epsilon_0 and quantities.constants.epsilon_0 behave differently:

In [17]: epsilon_0.simplified
Out[17]: array(8.8541878176203908e-12) * s**4*A**2/(kg*m**3) # correct
In [18]: constants.epsilon_0.simplified
Out[18]: array(8.5429932106168411e-07) * s*A/m # incorrect

In [24]: constants.epsilon_0
Out[24]: UnitConstant('electric_constant', 8.854187817e-12 * F/m, 'epsilon_0') # correct
In [25]: F.simplified
Out[25]: array(1.0) * s**4*A**2/(kg*m**2) # also correct...
In [26]: x = 1*F/m
In [27]: x
Out[27]: array(1.0) * F/m
In [28]: x.simplified
Out[28]: array(1.0) * s**4*A**2/(kg*m**3) # all good here

so i have no idea why it can simplify farads correctly, and farads per meter, but not when it's constants.epsilon_0

and on a side note, the ascii symbol for quantities.mu_0 reads "epsilon_0" while quantities.constants.mu_0 is correct:

In [20]: mu_0
Out[20]: UnitQuantity('magnetic_constant', 1.25663706144e-06 * N/A**2, 'epsilon_0')
In [21]: constants.mu_0
Out[21]: UnitConstant('magnetic_constant', 1.2566370614e-06 * N/A**2, 'mu_0')

Related branches

Revision history for this message
Darren Dale (dsdale24) wrote :

Thank you for catching this. The symbol F is commonly used for both the Farad and the Faraday constant, and the Faraday constant was registering itself as F and overwriting the farad. This can't be allowed to happen, so I added a check to make sure that previously registered units can not be overwritten. It's fixed in the trunk.

I'll try to get a new release out as soon as possible.

Changed in python-quantities:
assignee: nobody → Darren Dale (dsdale24)
importance: Undecided → Critical
milestone: none → 0.7.0
status: New → In Progress
Darren Dale (dsdale24)
Changed in python-quantities:
status: In Progress → Fix Committed
Darren Dale (dsdale24)
Changed in python-quantities:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.