ASKSAGE: Sage Q&A Forum - Individual question feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Fri, 13 Sep 2019 05:33:21 -0500More physics constants in Sagemathhttps://ask.sagemath.org/question/47878/more-physics-constants-in-sagemath/I can you following command to load physics constants h and c:
from scipy.constants import h, c
h, c # show value of h and c
But, how can I load more physics constants such as Bohr magneton?
Following command doesn't work,
from scipy.constants import Bohr magneton
Bohr magneton # to show Bohr magneton
I load physics constant from https://docs.scipy.org/doc/scipy/reference/constants.html
Thanks for help.Fri, 13 Sep 2019 04:31:37 -0500https://ask.sagemath.org/question/47878/more-physics-constants-in-sagemath/Answer by tmonteil for <p>I can you following command to load physics constants h and c:</p>
<pre><code> from scipy.constants import h, c
h, c # show value of h and c
</code></pre>
<p>But, how can I load more physics constants such as Bohr magneton?
Following command doesn't work,</p>
<pre><code> from scipy.constants import Bohr magneton
Bohr magneton # to show Bohr magneton
</code></pre>
<p>I load physics constant from <a href="https://docs.scipy.org/doc/scipy/reference/constants.html">https://docs.scipy.org/doc/scipy/refe...</a></p>
<p>Thanks for help.</p>
https://ask.sagemath.org/question/47878/more-physics-constants-in-sagemath/?answer=47879#post-id-47879As explained in the doc you provided, this constant appears in the constant database, so you can do:
sage: from scipy.constants import physical_constants
sage: physical_constants["Bohr magneton"]
(9.274009994e-24, 'J T^-1', 5.7e-32)
So you can do something like:
sage: Bohr = physical_constants["Bohr magneton"][0]
sage: Bohr
9.274009994e-24
Fri, 13 Sep 2019 05:33:21 -0500https://ask.sagemath.org/question/47878/more-physics-constants-in-sagemath/?answer=47879#post-id-47879