mathjs icon indicating copy to clipboard operation
mathjs copied to clipboard

Add the Universal Gravitational Constant

Open thonkinator opened this issue 3 years ago • 6 comments

It would be nice if mathjs had the Universal Gravitational Constant (G) as one of it's constants. I would think that it would be an uppercase G, as it's referred to normally, although depending on how other constants are defined it could also be lowercase. Because it's so hard to measure with accuracy though, there are many different values of G, but the one that seems to be most commonly used in code is 6.67430e-11.

thonkinator avatar Apr 17 '22 13:04 thonkinator

Thanks for your suggestion. Would be nice to add this constant. I think it makes sense to name it G indeed.

Anyone interested in creating a PR with this new unit?

josdejong avatar Apr 19 '22 11:04 josdejong

Impulsively committed. please ignore

dextel2 avatar Apr 19 '22 12:04 dextel2

This is the very first physical constant defined in this library. It would be nice to define more of them (e.g. Planck's constant, speed of light, electron's charge, Boltzmann constant, fine-structure constant, etc.) and classify them into separate categories. Additionally, defining some of them (eight will be enough to define time, meter, kilogram, ampere, kelvin, mole, and candela) and deriving the others from the basic and unitless constants is recommended. Despite the precision error, the value will likely always be in line with one another.

HanchaiN avatar May 24 '22 08:05 HanchaiN

Actually there are quite some physical constants defined already, see /src/type/unit/physicalConstants.js

josdejong avatar May 24 '22 08:05 josdejong

But aren't the gravitational constant already defined there? Are we adding some alias for this constant?

HanchaiN avatar May 25 '22 01:05 HanchaiN

o wow you're right, I hadn't realized that.

@thonkinator does the gravitationConstant solve your problem? I think if you want you can always define G=gravitationConstant to have a shorter name.

josdejong avatar May 25 '22 15:05 josdejong

As it appears the feature desired is already present in mathjs (albeit under a different name), closing.

gwhitney avatar Oct 03 '23 02:10 gwhitney