3
$\begingroup$

I've been working on some optics problems and regularly need to use constants like the charge of an electron, vacuum permittivity, etc. I'd like to be able to call these constants in Mathematica as decimal values without having to go in and define them every time I start a new notebook. So far I've tried using Quantity and UnitConvert on constant names ported over from older versions of Mathematica, but thus far I have been unsuccessful in calling constants completely divorced from their units. Is there any way to do this without having to include a bunch of definitions at the top of the notebook?

$\endgroup$
2
  • 4
    $\begingroup$ Does QuantityMagnitude work for you? It accepts a unit-system as a second argument. E.g. QuantityMagnitude["ElementaryCharge", "SIBase"] // N $\endgroup$ Commented Jul 6, 2021 at 20:36
  • $\begingroup$ Welcome to Mathematica.SE! I hope you will become a regular contributor. To get started, 1) take the introductory tour now, 2) when you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge, 3) remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign, and 4) give help too, by answering questions in your areas of expertise. $\endgroup$
    – bbgodfrey
    Commented Jul 6, 2021 at 20:39

2 Answers 2

3
$\begingroup$
pl = QuantityMagnitude[Entity["PhysicalConstant", "PlanckLength"]["Value"]]

1.6163*10^-35

$\endgroup$
0
$\begingroup$

You just need to add this code at your note book: << PhysicalConstants` And then you can easily get numerical values for physical constants by calling them like this: e = ElectronCharge

$\endgroup$

Not the answer you're looking for? Browse other questions tagged or ask your own question.