Skip to content

plasmapy.formulary.quantum.chemical_potential bug with powers #726

@StanczakDominik

Description

@StanczakDominik

The current doctest error for plasmapy.formulary.quantum.chemical_formula() is a result of a floating point arithmetic error...

image

There is a large difference in n_e when we convert from cm ** -3 to m ** -3...

>>> (1.e27*u.m**-3) - (1.e21*u.cm**-3).to(u.m**-3)
<Quantity 1.37438953e+11 1 / m3>

Thus, even though the inputs are essentially identical, the following yields...

>>> chemical_potential(1.e27 ** u.m ** -3, 11000 * u.K)
<Quantity 2.00039985e-12>

>>> chemical_potential(1.e21 ** u.cm ** -3, 11000 * u.K)
<Quantity 5.1487703e-12>

@namurphy @StanczakDominik Thoughts??? If we can't figure out a quick fix, then I feel like we should exclude this code from the source until we determine a solution.

Originally posted by @rocco8773 in #722 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIssues describing unexpected behavior or defects. Remember: a bug is a sign of a missing test!plasmapy.formulary.quantumRelated to the plasmapy.formulary.quantum module

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions