HP Forums

Full Version: Constants aren't so constant [SOLVED]
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
The physical constants that can be accessed in the Prime, fall mainly into two categories: constants with an exact value (like "c" - the speed oh light), and constants whose values depend on the current state of the art measurements (like "G" - the gravitation constant).

The internationally recommended values are recorded by CODATA (Committee on Data for Science and Technology). These constants can also be browsed at NIST (National Institute of Standards and Technology).

As long as I've seen, the values stored in the Prime agree exactly with the values given in 2010 by CODATA (for example, G=6.67384E-11).

Today these values are dated, because a new set of values was stablished in 2014 (for example, te current value for G is: 6.67408E-11).

Given the above, I propose to HP considering the update of these values in a future firmware release.
(12-03-2016 04:14 PM)JMB Wrote: [ -> ]Today these values are dated, because a new set of values was stablished in 2014 (for example, te current value for G is: 6.67408E-11).

I'd be happy to do so, but it is a pretty low priority item at this point. The thing that takes the longest is simply going through the table and finiding which did or didn't change. If you wanted to point those out, I'd be much more likely to be able to resolve sooner rather then later. Thanks!

Here's the actual code table:

Code:
  /// These values come from the NIST 2010 published values
  static struct { u32 StringId; wchar_t symbol[5]; HP_Real value; wchar_t unit[15]; } const constants[]={
    { SIDConstant_NA    ,L"NA"             ,HPREAL(+,602214129,23)      ,L"(1/mol)"      },
    { SIDConstant_k     ,L"k"              ,HPREAL(+,13806488,-23)      ,L"(J/K)"       },
    { SIDConstant_Vm    ,L"Vm"             ,HPREAL(+,22413968,1)        ,L"(l/mol)"      },
    { SIDConstant_R     ,L"R"              ,HPREAL(+,83144621,0)        ,L"(J/(mol*K))"    },
    { SIDConstant_StdT  ,L"StdT"           ,HPREAL(+,27315,2)           ,L"K"          },
    { SIDConstant_StdP  ,L"StdP"           ,HPREAL(+,101325,2)          ,L"kPa"        },

    { SIDConstant_Sigma ,L"\u03C3"         ,HPREAL(+,5670373,-8)        ,L"(W/(m^2*K^4))"    },
    { SIDConstant_c     ,L"c"              ,HPREAL(+,299792458,8)       ,L"(m/s)"        },
    { SIDConstant_e0    ,L"\u03B5\u2080"   ,HPREAL(+,885418781762,-12)  ,L"(F/m)"        },
    { SIDConstant_m0    ,L"\u03BC\u2080"   ,HPREAL(+,125663706144,-6)  ,L"(H/m)"        },
    { SIDConstant_g     ,L"g"              ,HPREAL(+,980665,0)          ,L"(m/(s^2))"       },
    { SIDConstant_G     ,L"G"              ,HPREAL(+,667384,-11)        ,L"(m^3/(s^2*kg))"   },

    { SIDConstant_h     ,L"h"              ,HPREAL(+,662606957,-34)     ,L"(J*s)"        },
    { SIDConstant_hBar  ,L"\u0127"           ,HPREAL(+,1054571726,-34)    ,L"(J*s)"        },
    { SIDConstant_q     ,L"q"              ,HPREAL(+,1602176565,-19)    ,L"C"          },
    { SIDConstant_me    ,L"me"             ,HPREAL(+,910938291,-31)     ,L"kg"         },
    { SIDConstant_qme   ,L"qme"            ,HPREAL(+,1758820088,11)     ,L"(C/kg)"       },
    { SIDConstant_mp    ,L"mp"             ,HPREAL(+,1672621777,-27)    ,L"kg"         },
    { SIDConstant_mpme  ,L"mpme"           ,HPREAL(+,183615267245,3)    ,NULL           },
    { SIDConstant_alpha ,L"\u03B1"         ,HPREAL(+,72973525698,-3)    ,NULL           },
    { SIDConstant_phi   ,L"\u03C6\u2080"   ,HPREAL(+,2067833758,-15)    ,L"Wb"         },
    { SIDConstant_F     ,L"F"              ,HPREAL(+,964853365,4)       ,L"(C/mol)"      },
    { SIDConstant_Rinf  ,L"R\u221E"        ,HPREAL(+,109737315685,7)   ,L"(1/m)"        },
    { SIDConstant_a0    ,L"a\u2080"        ,HPREAL(+,52917721092,-11)   ,L"m"         },
    { SIDConstant_mB    ,L"\u03BCB"        ,HPREAL(+,927400968,-24)     ,L"(J/T)"        },
    { SIDConstant_mN    ,L"\u03BCN"        ,HPREAL(+,505078353,-27)     ,L"(J/T)"        },
    { SIDConstant_l0    ,L"\u03BB\u2080"   ,HPREAL(+,123984192920,-6)   ,L"m"         },
    { SIDConstant_f0    ,L"f\u2080"        ,HPREAL(+,241798934961,14)   ,L"Hz"         },
    { SIDConstant_lc    ,L"\u03BBc"        ,HPREAL(+,24263102389,-12)   ,L"m"         } };
I used the 2014 CODATA values in http://physics.nist.gov/cuu/Constants/Ta...lascii.txt
In cases where there were a different number of digits in the NIST vs. existing HP code, I used NIST values.

Also, one small error noted in the pdf manual on the HP support site (2nd edition, Sept 2016, DPN 813269-002):
Under the list on constants on page 499, in the chemistry section, the manual says "Boltmann, k" as one of the constants. Should be 'Boltzmann' (z is missing).

Hope these quick changes are useful.

Code:
  /// These values come from the NIST 2014 published values
  static struct { u32 StringId; wchar_t symbol[5]; HP_Real value; wchar_t unit[15]; } const constants[]={
    { SIDConstant_NA    ,L"NA"             ,HPREAL(+,6022140857,23)     ,L"(1/mol)"      },
    { SIDConstant_k     ,L"k"              ,HPREAL(+,138064852,-23)     ,L"(J/K)"       },
    { SIDConstant_Vm    ,L"Vm"             ,HPREAL(+,22413962,1)        ,L"(l/mol)"      },
    { SIDConstant_R     ,L"R"              ,HPREAL(+,83144598,0)        ,L"(J/(mol*K))"    },
    { SIDConstant_StdT  ,L"StdT"           ,HPREAL(+,27315,2)           ,L"K"          },
    { SIDConstant_StdP  ,L"StdP"           ,HPREAL(+,101325,2)          ,L"kPa"        },

    { SIDConstant_Sigma ,L"\u03C3"         ,HPREAL(+,5670367,-8)        ,L"(W/(m^2*K^4))"    },
    { SIDConstant_c     ,L"c"              ,HPREAL(+,299792458,8)       ,L"(m/s)"        },
    { SIDConstant_e0    ,L"\u03B5\u2080"   ,HPREAL(+,8854187817,-12)    ,L"(F/m)"        },
    { SIDConstant_m0    ,L"\u03BC\u2080"   ,HPREAL(+,12566370614,-6)    ,L"(H/m)"        },
    { SIDConstant_g     ,L"g"              ,HPREAL(+,980665,0)          ,L"(m/(s^2))"       },
    { SIDConstant_G     ,L"G"              ,HPREAL(+,667408,-11)        ,L"(m^3/(s^2*kg))"   },

    { SIDConstant_h     ,L"h"              ,HPREAL(+,6626070040,-34)    ,L"(J*s)"        },
    { SIDConstant_hBar  ,L"\u0127"         ,HPREAL(+,1054571800,-34)    ,L"(J*s)"        },
    { SIDConstant_q     ,L"q"              ,HPREAL(+,16021766208,-19)   ,L"C"          },
    { SIDConstant_me    ,L"me"             ,HPREAL(+,910938356,-31)     ,L"kg"         },
    { SIDConstant_qme   ,L"qme"            ,HPREAL(+,1758820024,11)     ,L"(C/kg)"       },
    { SIDConstant_mp    ,L"mp"             ,HPREAL(+,1672621898,-27)    ,L"kg"         },
    { SIDConstant_mpme  ,L"mpme"           ,HPREAL(+,183615267389,3)    ,NULL           },
    { SIDConstant_alpha ,L"\u03B1"         ,HPREAL(+,72973525664,-3)    ,NULL           },
    { SIDConstant_phi   ,L"\u03C6\u2080"   ,HPREAL(+,2067833831,-15)    ,L"Wb"         },
    { SIDConstant_F     ,L"F"              ,HPREAL(+,9648533289,4)      ,L"(C/mol)"      },
    { SIDConstant_Rinf  ,L"R\u221E"        ,HPREAL(+,10973731568508,7)  ,L"(1/m)"        },
    { SIDConstant_a0    ,L"a\u2080"        ,HPREAL(+,52917721067,-11)   ,L"m"         },
    { SIDConstant_mB    ,L"\u03BCB"        ,HPREAL(+,9274009994,-24)    ,L"(J/T)"        },
    { SIDConstant_mN    ,L"\u03BCN"        ,HPREAL(+,5050783699,-27)    ,L"(J/T)"        },
    { SIDConstant_l0    ,L"\u03BB\u2080"   ,HPREAL(+,12398419739,-6)    ,L"m"         },
    { SIDConstant_f0    ,L"f\u2080"        ,HPREAL(+,2417989262,14)     ,L"Hz"         },
    { SIDConstant_lc    ,L"\u03BBc"        ,HPREAL(+,24263102367,-12)   ,L"m"         } };
Definitely, I can do a text compare and cross check much easier. Much appreciated!
I agree with the new values listed by sat1410.

Thanks to everyone.
I would also suggest adding NIST_Year or something, to identify in one place which version of all the variables you have - to be accessible from a user program along with the other variables, so that a program can add "as at 2016" or whatever to the small print..

Everyone is bound to have their own additions they would like to sneak in, but I usually end up defining my own, if only whilst compatability testing.
The last FW beta v3 (13217) still has the old values. Is there any possibility to see the new values for the constants in the final version?
A Murphy's law corollary states that "Constants aren't, and variables won't." Such is the dichotomy between nature and frustrated programmers....
(01-15-2018 04:12 AM)JimP Wrote: [ -> ]A Murphy's law corollary states that "Constants aren't, and variables won't." Such is the dichotomy between nature and frustrated programmers....

Nice.
(12-03-2016 04:14 PM)JMB Wrote: [ -> ]The physical constants that can be accessed in the Prime, fall mainly into two categories: constants with an exact value (like "c" - the speed oh light), and constants whose values depend on the current state of the art measurements (like "G" - the gravitation constant).

But even constant speed of light isn't as constant since it depends on the medium it travels.
In water (I suppose 20° celsius) it's 225 e6 m/s, in glass it's 160 e6 m/s.
Just note that Rinf will be "109737315685" since we are limited to 12 digits of precision here. Anyway...
Understood Tim, thanks.
Corrected in firmware 13333.

Thanks to the HP Prime Team!
Reference URL's