ggggggggg / Physical.jl

Units, physical constants, error propagation.
MIT License
7 stars 5 forks source link

asbase is inconsistent with prefixed base units #7

Open ggggggggg opened 9 years ago

ggggggggg commented 9 years ago
julia> asbase(Gram)
0.001 kg 

julia> asbase(Newton)
1000.0 g s⁻²m

These should both go to kg.

ggggggggg commented 9 years ago

Simpler case

julia> KiloGram*KiloGram
1.0e6 g²

It has to do with remove_prefix not knowing about prefixed base units.

gr225607 commented 8 years ago

For: E=2.409866751432028e-24 g⁻¹J²s²m⁻² E1=as(E,eV) equals E1=1.504120584507506e-8 eV This is wrong!

Should be 0.0150412053 eV

I think in has to do with the g unit

I think in has to do with default, const KiloGram = BaseUnit("g", prefix=3) Why is this not in kg?

Update: Yes this worked. Change the a_si_plus.jl file to reflect the above [KiloGram = BaseUnit("kg")]. I'm new to github, so not sure how to change/ or if possible to change the master. Also, this change may affect others...

Rant: Was so close to going back to maple... but I must say, it is very nice to be able to update the source file, the potential is limitless :) Thanks for the package

ggggggggg commented 8 years ago

The base unit is prefixed g instead of kg, because it's easier to support prefixes other than k. If I used kg without a prefix, then a gram would be mkg (milli kg). At least the way I programmed it. Prefixed base units turned out to be way trickier than I expected. I'll take another look at it.

ggggggggg commented 8 years ago

I fixed your example. I'm leaving the issue open because it was actually a different (but more serious) issue than the original. The original is just a cosmetic issue.

c8266e34c588dcd32da92e437609457fcb838b0b