Open chongchonghe opened 4 years ago
Sounds good, thanks for your suggestions ChongChong.
@ericman314 what do you think?
Sounds good to me too, but I wonder if an alternative could be to have a generically named function like .toSystem(string)
which converts to any named system?
That's a good idea 👍 , would be nice to see whether it is doable to implement a more generic solution. What do you think @chongchonghe?
Is there any other unit system other than SI, CGS, and US?
We can simply link .toSystem('SI') to .toSI() and .toSystem('cgs') to .toCGS(). The first step is to complete the CGS system. I'll be working on that soon and make pull requests once finished.
I don't think there are any other systems. Some day when I finish UnitMath I'll add your toSystem
function too, so we should make sure that we can accommodate custom unit systems if the user has defined any.
Some day when I finish UnitMath
Still looking forward to that day 😎 👍
Hi, thank you for your awesome math library!
I am thinking about taking advantage of this library and build a calculator for physicists and astronomers. Since cgs unit system is still widely used in the astronomy community, I'd like to help to add a cgs unit system to this library.
I found
UNIT_SYSTEMS.cgs
but didn't find a.toCGS()
function. Here's what I plan to do:UNIT_SYSTEMS.cgs
: add a missing basic unit 'Ba = g/(cm⋅s2)'; implement the ESU units system for Electromagnetics.Unit.prototype.toCGS
: copyUnit.prototype.toSI
and change every instance ofUNIT_SYSTEMS.si
toUNIT_SYSTEMS.cgs
.Please let me know what do you think, or what is already in math.js that I missed.