comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Physical constants in IDL with !CONST
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Physical constants in IDL with !CONST [message #82525] Tue, 18 December 2012 14:34 Go to next message
chris_torrence@NOSPAM is currently offline  chris_torrence@NOSPAM
Messages: 528
Registered: March 2007
Senior Member
Hi all,

I'm adding a new system variable to IDL, called !CONST. So far, it's an IDL structure containing the following physical constants, in MKS units. All of these values (except for !const.pi, .e, .phi, and .R_earth) are taken from the "2010 CODATA Recommended Values," from NIST.

Name Description Value
alpha Fine structure constant 7.2973525698 x 10-3
c Speed of light in a vacuum 299792458 m/s
e Euler's number 2.7182818284590452
ev elementary charge e, 1 electron volt 1.602176565 x 10-19 C
eps0 electric vacuum permittivity 8.854187817 x 10-12 F/m
F Faraday constant NAe 96485.3365 C/mol
G Gravitation constant 6.67384 x 10-11 m3/kg/s2
gn Earth standard gravity 9.80665 m/s2
h Planck constant 6.62606957 x 10-34 J s
hbar h/(2pi) 1.054571726 x 10-34 J s
k Boltzmann constant R/NA 1.3806488 x 10-23 J/K
me electron mass 9.10938291 x 10-31 kg
mn neutron mass 1.674927351 x 10-27 kg
mp proton mass 1.672621777 x 10-27 kg
mu0 magnetic vacuum permeability 12.566370614 x 10-7 N/A2
Na Avogadro constant NA 6.02214129e23 mol-1
phi golden ratio 1.6180339887498948
pi Pi 3.1415926535897932
R molar gas constant 8.3144621 J/mol/K
R_earth Earth radius (spherical) 6370997.0 m
re classical electron radius 2.8179403267 x 10-15 m
rydberg Rydberg constant Rinf 10973731.568539 m-1
sigma Stefan-Boltzmann constant 5.670373 x 10-8 W/m2/K4
u unified atomic mass unit 1.660538921 x 10-27 kg

Here's my question: What am I missing? Are there any physical constants that most people would find useful for their day-to-day work. The key is "most" people - nothing too esoteric, or limited to a single scientific discipline, etc.

Thanks!

-Chris
ExelisVis
p.s. please limit your comments to !CONST. Our new widget system team is currently hard at work in a secret underground bunker, and cannot be disturbed.
Re: Physical constants in IDL with !CONST [message #82550 is a reply to message #82525] Sun, 23 December 2012 20:21 Go to previous messageGo to next message
Jeremy Bailin is currently offline  Jeremy Bailin
Messages: 618
Registered: April 2008
Senior Member
On 12/18/12 5:34 PM, Chris Torrence wrote:
> Hi all,
>
> I'm adding a new system variable to IDL, called !CONST. So far, it's an IDL structure containing the following physical constants, in MKS units. All of these values (except for !const.pi, .e, .phi, and .R_earth) are taken from the "2010 CODATA Recommended Values," from NIST.
>
> Name Description Value
> alpha Fine structure constant 7.2973525698 x 10-3
> c Speed of light in a vacuum 299792458 m/s
> e Euler's number 2.7182818284590452
> ev elementary charge e, 1 electron volt 1.602176565 x 10-19 C
> eps0 electric vacuum permittivity 8.854187817 x 10-12 F/m
> F Faraday constant NAe 96485.3365 C/mol
> G Gravitation constant 6.67384 x 10-11 m3/kg/s2
> gn Earth standard gravity 9.80665 m/s2
> h Planck constant 6.62606957 x 10-34 J s
> hbar h/(2pi) 1.054571726 x 10-34 J s
> k Boltzmann constant R/NA 1.3806488 x 10-23 J/K
> me electron mass 9.10938291 x 10-31 kg
> mn neutron mass 1.674927351 x 10-27 kg
> mp proton mass 1.672621777 x 10-27 kg
> mu0 magnetic vacuum permeability 12.566370614 x 10-7 N/A2
> Na Avogadro constant NA 6.02214129e23 mol-1
> phi golden ratio 1.6180339887498948
> pi Pi 3.1415926535897932
> R molar gas constant 8.3144621 J/mol/K
> R_earth Earth radius (spherical) 6370997.0 m
> re classical electron radius 2.8179403267 x 10-15 m
> rydberg Rydberg constant Rinf 10973731.568539 m-1
> sigma Stefan-Boltzmann constant 5.670373 x 10-8 W/m2/K4
> u unified atomic mass unit 1.660538921 x 10-27 kg
>
> Here's my question: What am I missing? Are there any physical constants that most people would find useful for their day-to-day work. The key is "most" people - nothing too esoteric, or limited to a single scientific discipline, etc.
>
> Thanks!
>
> -Chris
> ExelisVis
> p.s. please limit your comments to !CONST. Our new widget system team is currently hard at work in a secret underground bunker, and cannot be disturbed.
>

Just checking against astroconst (good lord, is it really over 10 years
since I updated the public version?????), all of the ones that aren't
there or haven't already been mentioned are probably too astronomy-specific.

I would much prefer !CONST over !C. I just grepped my code directories
and found one case of !C in there, from my first 2 months of using IDL.
Think of how many cases of () subscripts you see from time to time, and
take pity on people who have code still around from before they learned
to be half-decent IDL programmers!

-Jeremy.
Re: Physical constants in IDL with !CONST [message #82558 is a reply to message #82525] Fri, 21 December 2012 16:19 Go to previous messageGo to next message
chris_torrence@NOSPAM is currently offline  chris_torrence@NOSPAM
Messages: 528
Registered: March 2007
Senior Member
Hi all,

Here's the current list of constants:

IDL> help,!const,/full
** Structure !CONST, 33 tags, length=264, data length=264:
ALPHA DOUBLE 0.0072973525697999997
AU DOUBLE 149597870700.00000
C DOUBLE 299792458.00000000
DTOR DOUBLE 0.017453292519943299
E DOUBLE 1.6021765650000000e-019
EPS0 DOUBLE 8.8541878170000005e-012
EULER DOUBLE 2.7182818284590451
F DOUBLE 96485.336500000005
G DOUBLE 6.6742799999999995e-011
GN DOUBLE 9.8066499999999994
H DOUBLE 6.6260695699999996e-034
HBAR DOUBLE 1.0545717259999999e-034
K DOUBLE 1.3806488000000000e-023
M_EARTH DOUBLE 5.9721863899999997e+024
M_SUN DOUBLE 1.9884158605700001e+030
ME DOUBLE 9.1093829099999999e-031
MN DOUBLE 1.6749273509999999e-027
MP DOUBLE 1.6726217770000001e-027
MU0 DOUBLE 1.2566370613999999e-006
N0 DOUBLE 2.6867805000000001e+025
NA DOUBLE 6.0221412899999997e+023
P0 DOUBLE 101325.00000000000
PHI DOUBLE 1.6180339887498949
PI DOUBLE 3.1415926535897931
R DOUBLE 8.3144621000000001
R_EARTH DOUBLE 6378136.5999999996
RTOD DOUBLE 57.295779513082323
RE DOUBLE 2.8179403267000001e-015
RYDBERG DOUBLE 10973731.568538999
SIGMA DOUBLE 5.6703730000000003e-008
T0 DOUBLE 273.14999999999998
U DOUBLE 1.6605389209999998e-027
VM DOUBLE 0.022413967999999999

Comments or suggestions?

-Chris
p.s. some of the "9's" on the ends of the numbers are just due to the finite precision of double-precision numbers. For example, in the C code, T0 really is defined as 273.15.
p.p.s. Happy Holidays!
Re: Physical constants in IDL with !CONST [message #82575 is a reply to message #82525] Thu, 20 December 2012 12:59 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Paul van Delst writes:

> So if it's human readability you want, why not DEGREES_TO_RADIANS and
> RADIANS_TO_DEGREES?
>
> I realise just about everyone will disagree with me.

Not everyone! I'm a BIG fan of yours! ;-)

Cheers,

David


--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
Re: Physical constants in IDL with !CONST [message #82576 is a reply to message #82525] Thu, 20 December 2012 12:31 Go to previous messageGo to next message
Paul Van Delst[1] is currently offline  Paul Van Delst[1]
Messages: 1157
Registered: April 2002
Senior Member
Hello,

On 12/20/12 14:10, Chris Torrence wrote:
> On Thursday, December 20, 2012 10:36:21 AM UTC-7, Heinz Stege wrote:
>
> Hi Heinz,
>
> That's a really good point. I had the same dilemma about "eV" when I
> put it in. I like your idea of getting rid of "e".

For what it's worth, I agree with Heinz. But for a (slightly) different
reason.

The symbol for elementary charge on the NIST site is "e". Thus that
should be what is used in !C.

Consistent adherence to a convention (in this case: all this stuff comes
from the NIST/CODATA site) is A Good Thing (tm).

> Also, yes, I'll make the "DtoR" and "RtoD" consistent. Maybe "DegRad"
> and "RadDeg", so at least they are somewhat human-readable?

I prefer the former to the latter simply because of the preposition "to"
indicating a direction of conversion.

<aside mode="tangential">
I've never been a big fan of making constant names short because people
want to save some keystrokes. In fact, that violates most
advice/conventions on naming in the usual texts ("Code Complete", "Clean
Code", etc etc)

I'm a verbose sort so the following is what I use:

REAL(fp), PARAMETER :: PI = 3.141592653589793238462643383279_fp
REAL(fp), PARAMETER :: TWOPI = TWO * PI
REAL(fp), PARAMETER :: DEGREES_TO_RADIANS = PI / 180.0_fp
REAL(fp), PARAMETER :: RADIANS_TO_DEGREES = 180.0_fp / PI

(I have similar in IDL code so I'm sure of the precision)

So if it's human readability you want, why not DEGREES_TO_RADIANS and
RADIANS_TO_DEGREES?

I realise just about everyone will disagree with me.

And that's o.k. :o)
</aside>


cheers,

paulv
Re: Physical constants in IDL with !CONST [message #82580 is a reply to message #82525] Thu, 20 December 2012 11:10 Go to previous messageGo to next message
chris_torrence@NOSPAM is currently offline  chris_torrence@NOSPAM
Messages: 528
Registered: March 2007
Senior Member
On Thursday, December 20, 2012 10:36:21 AM UTC-7, Heinz Stege wrote:
> On Thu, 20 Dec 2012 06:24:31 -0800 (PST), wlandsman wrote:
>
>
>
>> I wonder if the constants should be !DtoR and !RtoD (or RADEG and DEGRA) to correct the earlier inconsistency in the ancient history of IDL. I'm not sure about this, though. --Wayne
>
>>
>
> A lot of discussions for a little thing, that everyone can do her or
>
> himself within a startup file.
>
>
>
> However, I think Wayne is absolutly right.
>
>
>
> A similar point is, that I wouldn't name the elementary charge "eV". I
>
> know, there is a name conflict with the Euler's number. However the
>
> Euler's number can simply be calculated by number=exp(1d). Therfore I
>
> suggest to simply remove it from the table.
>
>
>
> Please realize, that most of the "constants" are from physics and
>
> chemistry and the Euler's number is a mathematical number which never
>
> will change. (You may argue, that pi also is a mathematical constant,
>
> however it is needed [even though by definition] for the calculation
>
> of the magnetic constant mu0=4d*!dpi*1d-7)
>
>
>
> The name "ev" for the elementary charge is confusing, because the
>
> definition of the elementary charge constant has nothing to do with
>
> the energy unit "electron volt". The reason for 1 eV being 1.602...
>
> 10^-19 J only reflects, that changing the potential of a charge e
>
> about 1 V means an energy change of 1.602... 10^-19 J.
>
>
>
> Thats what I wanted to say.
>
>
>
> Cheers, Heinz

On Thursday, December 20, 2012 10:36:21 AM UTC-7, Heinz Stege wrote:
> On Thu, 20 Dec 2012 06:24:31 -0800 (PST), wlandsman wrote:
>
>
>
>> I wonder if the constants should be !DtoR and !RtoD (or RADEG and DEGRA) to correct the earlier inconsistency in the ancient history of IDL. I'm not sure about this, though. --Wayne
>
>>
>
> A lot of discussions for a little thing, that everyone can do her or
>
> himself within a startup file.
>
>
>
> However, I think Wayne is absolutly right.
>
>
>
> A similar point is, that I wouldn't name the elementary charge "eV". I
>
> know, there is a name conflict with the Euler's number. However the
>
> Euler's number can simply be calculated by number=exp(1d). Therfore I
>
> suggest to simply remove it from the table.
>
>
>
> Please realize, that most of the "constants" are from physics and
>
> chemistry and the Euler's number is a mathematical number which never
>
> will change. (You may argue, that pi also is a mathematical constant,
>
> however it is needed [even though by definition] for the calculation
>
> of the magnetic constant mu0=4d*!dpi*1d-7)
>
>
>
> The name "ev" for the elementary charge is confusing, because the
>
> definition of the elementary charge constant has nothing to do with
>
> the energy unit "electron volt". The reason for 1 eV being 1.602...
>
> 10^-19 J only reflects, that changing the potential of a charge e
>
> about 1 V means an energy change of 1.602... 10^-19 J.
>
>
>
> Thats what I wanted to say.
>
>
>
> Cheers, Heinz

Hi Heinz,

That's a really good point. I had the same dilemma about "eV" when I put it in. I like your idea of getting rid of "e".

Also, yes, I'll make the "DtoR" and "RtoD" consistent. Maybe "DegRad" and "RadDeg", so at least they are somewhat human-readable?

-Chris
Re: Physical constants in IDL with !CONST [message #82582 is a reply to message #82525] Thu, 20 December 2012 10:41 Go to previous messageGo to next message
PMan is currently offline  PMan
Messages: 61
Registered: January 2011
Member
On Tuesday, December 18, 2012 5:34:53 PM UTC-5, Chris Torrence wrote:
> Hi all,
>
>
>
> I'm adding a new system variable to IDL, called !CONST. So far, it's an IDL structure containing the following physical constants, in MKS units. All of these values (except for !const.pi, .e, .phi, and .R_earth) are taken from the "2010 CODATA Recommended Values," from NIST.
>
>
>
> Name Description Value
>
> alpha Fine structure constant 7.2973525698 x 10-3
>
> c Speed of light in a vacuum 299792458 m/s
>
> e Euler's number 2.7182818284590452
>
> ev elementary charge e, 1 electron volt 1.602176565 x 10-19 C
>
> eps0 electric vacuum permittivity 8.854187817 x 10-12 F/m
>
> F Faraday constant NAe 96485.3365 C/mol
>
> G Gravitation constant 6.67384 x 10-11 m3/kg/s2
>
> gn Earth standard gravity 9.80665 m/s2
>
> h Planck constant 6.62606957 x 10-34 J s
>
> hbar h/(2pi) 1.054571726 x 10-34 J s
>
> k Boltzmann constant R/NA 1.3806488 x 10-23 J/K
>
> me electron mass 9.10938291 x 10-31 kg
>
> mn neutron mass 1.674927351 x 10-27 kg
>
> mp proton mass 1.672621777 x 10-27 kg
>
> mu0 magnetic vacuum permeability 12.566370614 x 10-7 N/A2
>
> Na Avogadro constant NA 6.02214129e23 mol-1
>
> phi golden ratio 1.6180339887498948
>
> pi Pi 3.1415926535897932
>
> R molar gas constant 8.3144621 J/mol/K
>
> R_earth Earth radius (spherical) 6370997.0 m
>
> re classical electron radius 2.8179403267 x 10-15 m
>
> rydberg Rydberg constant Rinf 10973731.568539 m-1
>
> sigma Stefan-Boltzmann constant 5.670373 x 10-8 W/m2/K4
>
> u unified atomic mass unit 1.660538921 x 10-27 kg
>
>
>
> Here's my question: What am I missing? Are there any physical constants that most people would find useful for their day-to-day work. The key is "most" people - nothing too esoteric, or limited to a single scientific discipline, etc.
>
>
>
> Thanks!
>
>
>
> -Chris
>
> ExelisVis
>
> p.s. please limit your comments to !CONST. Our new widget system team is currently hard at work in a secret underground bunker, and cannot be disturbed.

Excellent - being in a bunker myself, I understand how sensitive bunkered people are :)
Re: Physical constants in IDL with !CONST [message #82584 is a reply to message #82525] Thu, 20 December 2012 09:36 Go to previous messageGo to next message
Heinz Stege is currently offline  Heinz Stege
Messages: 189
Registered: January 2003
Senior Member
On Thu, 20 Dec 2012 06:24:31 -0800 (PST), wlandsman wrote:

> I wonder if the constants should be !DtoR and !RtoD (or RADEG and DEGRA) to correct the earlier inconsistency in the ancient history of IDL. I'm not sure about this, though. --Wayne
>
A lot of discussions for a little thing, that everyone can do her or
himself within a startup file.

However, I think Wayne is absolutly right.

A similar point is, that I wouldn't name the elementary charge "eV". I
know, there is a name conflict with the Euler's number. However the
Euler's number can simply be calculated by number=exp(1d). Therfore I
suggest to simply remove it from the table.

Please realize, that most of the "constants" are from physics and
chemistry and the Euler's number is a mathematical number which never
will change. (You may argue, that pi also is a mathematical constant,
however it is needed [even though by definition] for the calculation
of the magnetic constant mu0=4d*!dpi*1d-7)

The name "ev" for the elementary charge is confusing, because the
definition of the elementary charge constant has nothing to do with
the energy unit "electron volt". The reason for 1 eV being 1.602...
10^-19 J only reflects, that changing the potential of a charge e
about 1 V means an energy change of 1.602... 10^-19 J.

Thats what I wanted to say.

Cheers, Heinz
Re: Physical constants in IDL with !CONST [message #82585 is a reply to message #82525] Thu, 20 December 2012 09:08 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Chris Torrence writes:

> Yes, using some sort of object is a possibility.
>
> But, not to throw out a bombshell, but... what if we were to change !C to be the constant? It's currently used for some very old (stupid) purpose like holding the min/max index from the last call to min/max.
>
> Does anyone have any code that relies on this?!

God help the boys at NASA who are still running IDL 1.0
on some of their machines! But, yes, I'm all in favor of
using !C as the constant system variable. :-)

Cheers,

David


--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
Re: Physical constants in IDL with !CONST [message #82586 is a reply to message #82525] Thu, 20 December 2012 09:02 Go to previous messageGo to next message
chris_torrence@NOSPAM is currently offline  chris_torrence@NOSPAM
Messages: 528
Registered: March 2007
Senior Member
Hi Ben,

Yes, using some sort of object is a possibility.

But, not to throw out a bombshell, but... what if we were to change !C to be the constant? It's currently used for some very old (stupid) purpose like holding the min/max index from the last call to min/max.

Does anyone have any code that relies on this?!

-Chris
Re: Physical constants in IDL with !CONST [message #82587 is a reply to message #82525] Thu, 20 December 2012 07:03 Go to previous messageGo to next message
ben.bighair is currently offline  ben.bighair
Messages: 221
Registered: April 2007
Senior Member
On Thursday, December 20, 2012 12:37:12 AM UTC-5, Chris Torrence wrote:
> On Wednesday, December 19, 2012 9:43:16 PM UTC-7, Craig Markwardt wrote:
>
>> On Wednesday, December 19, 2012 10:36:24 PM UTC-5, Jeff N. wrote:
>
>>
>
>>> Chris,
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>>
>
>>
>
>>> If you're going to put pi in there, which we already have in !pi, you might also consider putting !dtor and !radeg in as well, otherwise people might be wondering why !pi was put into !const but not the other two.
>
>>
>
>>
>
>>
>
>> But if you do, then put the double precision values! !DTOR is worse than useless for me because it's only single precision.
>
>>
>
>>
>
>>
>
>> Craig
>
>
>
> Hi all,
>
>
>
> These are great suggestions.
>
>
>
> Paul, I just added in all of your constants except "c1" and "c2". There seems to be a discrepancy with the definition of c1. NIST gives it as 2.pi.h.c^2, which is a factor of "pi" bigger than your constant. I don't want anyone to get confused and just use the constant blindly, perhaps including an unexpected extra factor of pi. Which one is in "standard" use?
>
>
>
> Craig, I'll add in the AU, and the mass of the Sun & Earth. And of course "dtor" and "radeg" (double precision!). But don't worry, the older system variables won't go away.
>
>
>
> Russell, great suggestion on including more info, like the "units". I'd love to do that, but I don't want to make the structure too complicated. What about having a second system variable, say something like !CONST_UNITS, which could contain additional information?

Hi,

Great idea1 Would it be a pain to call it something like !K instead of !CONST for all of the keyboard-bumblers out there (like me)? It might be nice to include the reference for each definition if they come from different standards.

Have you considered the possibility of using an object in the system variable?

mass = 12*!K->get("u", /value)
print, "mass = ", mass, !K->Get("u", /unit)

It might be nice if it were the possibile to support two kinds of constants - built-in and user defined. The built-in would be read only, but the user defined could be added/modified as the user sees fit at start-up or whenever. At least that would provide a unified interface.

Cheers,
Ben
Re: Physical constants in IDL with !CONST [message #82588 is a reply to message #82525] Thu, 20 December 2012 06:24 Go to previous messageGo to next message
wlandsman is currently offline  wlandsman
Messages: 743
Registered: June 2000
Senior Member
I wonder if the constants should be !DtoR and !RtoD (or RADEG and DEGRA) to correct the earlier inconsistency in the ancient history of IDL. I'm not sure about this, though. --Wayne

On Wednesday, December 19, 2012 10:36:24 PM UTC-5, Jeff N. wrote:
> Chris,
>
>
>
> If you're going to put pi in there, which we already have in !pi, you might also consider putting !dtor and !radeg in as well, otherwise people might be wondering why !pi was put into !const but not the other two.
>
>
>
> But don't remove the three existing system variables of course :)
>
>
>
> Jeff
Re: Physical constants in IDL with !CONST [message #82593 is a reply to message #82525] Wed, 19 December 2012 21:37 Go to previous messageGo to next message
chris_torrence@NOSPAM is currently offline  chris_torrence@NOSPAM
Messages: 528
Registered: March 2007
Senior Member
On Wednesday, December 19, 2012 9:43:16 PM UTC-7, Craig Markwardt wrote:
> On Wednesday, December 19, 2012 10:36:24 PM UTC-5, Jeff N. wrote:
>
>> Chris,
>
>>
>
>>
>
>>
>
>> If you're going to put pi in there, which we already have in !pi, you might also consider putting !dtor and !radeg in as well, otherwise people might be wondering why !pi was put into !const but not the other two.
>
>
>
> But if you do, then put the double precision values! !DTOR is worse than useless for me because it's only single precision.
>
>
>
> Craig

Hi all,

These are great suggestions.

Paul, I just added in all of your constants except "c1" and "c2". There seems to be a discrepancy with the definition of c1. NIST gives it as 2.pi.h.c^2, which is a factor of "pi" bigger than your constant. I don't want anyone to get confused and just use the constant blindly, perhaps including an unexpected extra factor of pi. Which one is in "standard" use?

Craig, I'll add in the AU, and the mass of the Sun & Earth. And of course "dtor" and "radeg" (double precision!). But don't worry, the older system variables won't go away.

Russell, great suggestion on including more info, like the "units". I'd love to do that, but I don't want to make the structure too complicated. What about having a second system variable, say something like !CONST_UNITS, which could contain additional information?

-Chris
Re: Physical constants in IDL with !CONST [message #82594 is a reply to message #82525] Wed, 19 December 2012 20:43 Go to previous messageGo to next message
Craig Markwardt is currently offline  Craig Markwardt
Messages: 1869
Registered: November 1996
Senior Member
On Wednesday, December 19, 2012 10:36:24 PM UTC-5, Jeff N. wrote:
> Chris,
>
>
>
> If you're going to put pi in there, which we already have in !pi, you might also consider putting !dtor and !radeg in as well, otherwise people might be wondering why !pi was put into !const but not the other two.

But if you do, then put the double precision values! !DTOR is worse than useless for me because it's only single precision.

Craig
Re: Physical constants in IDL with !CONST [message #82596 is a reply to message #82525] Wed, 19 December 2012 19:36 Go to previous messageGo to next message
jeffnettles4870 is currently offline  jeffnettles4870
Messages: 111
Registered: October 2006
Senior Member
Chris,

If you're going to put pi in there, which we already have in !pi, you might also consider putting !dtor and !radeg in as well, otherwise people might be wondering why !pi was put into !const but not the other two.

But don't remove the three existing system variables of course :)

Jeff
Re: Physical constants in IDL with !CONST [message #82597 is a reply to message #82525] Wed, 19 December 2012 19:07 Go to previous messageGo to next message
Russell Ryan is currently offline  Russell Ryan
Messages: 122
Registered: May 2012
Senior Member
Sounds cool and is a good idea. What if you have four tags:

name
description
value
unit

so you could have
!const={name:'c',description:'speed of light',value:2.99d10,unit:'cm/s'}

-Russell

On Tuesday, December 18, 2012 5:34:53 PM UTC-5, Chris Torrence wrote:
> Hi all,
>
>
>
> I'm adding a new system variable to IDL, called !CONST. So far, it's an IDL structure containing the following physical constants, in MKS units. All of these values (except for !const.pi, .e, .phi, and .R_earth) are taken from the "2010 CODATA Recommended Values," from NIST.
>
>
>
> Name Description Value
>
> alpha Fine structure constant 7.2973525698 x 10-3
>
> c Speed of light in a vacuum 299792458 m/s
>
> e Euler's number 2.7182818284590452
>
> ev elementary charge e, 1 electron volt 1.602176565 x 10-19 C
>
> eps0 electric vacuum permittivity 8.854187817 x 10-12 F/m
>
> F Faraday constant NAe 96485.3365 C/mol
>
> G Gravitation constant 6.67384 x 10-11 m3/kg/s2
>
> gn Earth standard gravity 9.80665 m/s2
>
> h Planck constant 6.62606957 x 10-34 J s
>
> hbar h/(2pi) 1.054571726 x 10-34 J s
>
> k Boltzmann constant R/NA 1.3806488 x 10-23 J/K
>
> me electron mass 9.10938291 x 10-31 kg
>
> mn neutron mass 1.674927351 x 10-27 kg
>
> mp proton mass 1.672621777 x 10-27 kg
>
> mu0 magnetic vacuum permeability 12.566370614 x 10-7 N/A2
>
> Na Avogadro constant NA 6.02214129e23 mol-1
>
> phi golden ratio 1.6180339887498948
>
> pi Pi 3.1415926535897932
>
> R molar gas constant 8.3144621 J/mol/K
>
> R_earth Earth radius (spherical) 6370997.0 m
>
> re classical electron radius 2.8179403267 x 10-15 m
>
> rydberg Rydberg constant Rinf 10973731.568539 m-1
>
> sigma Stefan-Boltzmann constant 5.670373 x 10-8 W/m2/K4
>
> u unified atomic mass unit 1.660538921 x 10-27 kg
>
>
>
> Here's my question: What am I missing? Are there any physical constants that most people would find useful for their day-to-day work. The key is "most" people - nothing too esoteric, or limited to a single scientific discipline, etc.
>
>
>
> Thanks!
>
>
>
> -Chris
>
> ExelisVis
>
> p.s. please limit your comments to !CONST. Our new widget system team is currently hard at work in a secret underground bunker, and cannot be disturbed.
Re: Physical constants in IDL with !CONST [message #82642 is a reply to message #82525] Wed, 26 December 2012 12:31 Go to previous message
vlk.astro is currently offline  vlk.astro
Messages: 11
Registered: March 2006
Junior Member
Here are some more (excluding the ones already in your list, and excluding some -- like Bode's distances -- which are clearly only of specialized interest) that I have found to be useful from time to time (I have been collecting them in http://hea-www.harvard.edu/PINTofALE/pro/util/inicon.pro ). Some of these are probably too esoteric still (e.g., not many people want to convert from Angstrom to keV), but who knows.


ESU 4.8030000e-10 electron charge [ESU]
KB 1.3806620e-16 Boltzmann's constant [erg/K]
A 7.5656559e-15 Radiation Pressure constant [erg/cm^3/deg^4]
WEIN 0.28978000 Wein Displacement Law constant [cm K]
ATM 1013250.0 1 Atmosphere [dynes/cm^2]
KEVANG 12.398521 keV*Ang (1e8*h*c/(e*1e10))
EVWAV 0.00012379700 1 eV in wave numbers [/cm]
DEGEV 8.6173468e-05 1 deg K in eV [eV] (K*degev/1e3->keV)
JOULEV 1.6021892e-19 1 eV in Joule = Coulomb*meter [J]
ERGEV 1.6021892e-12 1 eV in ergs [erg]
THOMPSON 6.65246e-25 Thompson cross-section for electron [cm^2]
COMPTON 0.024263026 Compton wavelength for electron, h/mc [Angstrom]
RADIAN 206264.81 1 radian [arcsec]
ARCSR 2.3504431e-11 1 arcsec^2 in steradians [sr]
PI 3.14159265358979323846 PI to 20 decimals
GAMMA 0.57721566 Euler's constant, gamma
RYD 13.577755 Rydberg Constant for H [eV]
RBOHR 5.2922910e-09 Bohr Radius [cm]
DAY 86636.6 mean solar day [sec]
YEAR 31643326. Equinoctial Year [sec]
YR 31644553. Sidereal Year [sec]
PC 3.0926963e+18 1 parsec [cm]
LY 9.4867984e+17 1 Light Year [cm]
AU 1.4959787e+13 Astronomical Unit [cm]
MSUN 1.9890000e+33 Mass of Sun [gm]
LSUN 3.8260000e+33 Luminosity of Sun [erg/s]
RSUN 6.96900e+10 Radius of Sun [cm]
TSUN 5770.00 Effective Temperature of Sun [K]
PSUN 25.3800 Rotational period of Sun [day]
MJUP 1.8986000e+30 Mass of Jupiter [gm]
RJUP 6.99110e+09 volumetric radius of Jupiter at 1 bar [cm]
MGEO 5.9720000e+27 Mass of Earth [gm]
MMOON 7.3429237e+25 Mass of Moon [gm]
RMOON 1737.90 Radius of Moon [km]
DMOON 384404. mean distance of Moon from Earth [km]

Cheers,
VLK

On Tuesday, December 18, 2012 5:34:53 PM UTC-5, Chris Torrence wrote:
> Hi all,
>
>
>
> I'm adding a new system variable to IDL, called !CONST. So far, it's an IDL structure containing the following physical constants, in MKS units. All of these values (except for !const.pi, .e, .phi, and .R_earth) are taken from the "2010 CODATA Recommended Values," from NIST.
>
>
>
> Name Description Value
>
> alpha Fine structure constant 7.2973525698 x 10-3
>
> c Speed of light in a vacuum 299792458 m/s
>
> e Euler's number 2.7182818284590452
>
> ev elementary charge e, 1 electron volt 1.602176565 x 10-19 C
>
> eps0 electric vacuum permittivity 8.854187817 x 10-12 F/m
>
> F Faraday constant NAe 96485.3365 C/mol
>
> G Gravitation constant 6.67384 x 10-11 m3/kg/s2
>
> gn Earth standard gravity 9.80665 m/s2
>
> h Planck constant 6.62606957 x 10-34 J s
>
> hbar h/(2pi) 1.054571726 x 10-34 J s
>
> k Boltzmann constant R/NA 1.3806488 x 10-23 J/K
>
> me electron mass 9.10938291 x 10-31 kg
>
> mn neutron mass 1.674927351 x 10-27 kg
>
> mp proton mass 1.672621777 x 10-27 kg
>
> mu0 magnetic vacuum permeability 12.566370614 x 10-7 N/A2
>
> Na Avogadro constant NA 6.02214129e23 mol-1
>
> phi golden ratio 1.6180339887498948
>
> pi Pi 3.1415926535897932
>
> R molar gas constant 8.3144621 J/mol/K
>
> R_earth Earth radius (spherical) 6370997.0 m
>
> re classical electron radius 2.8179403267 x 10-15 m
>
> rydberg Rydberg constant Rinf 10973731.568539 m-1
>
> sigma Stefan-Boltzmann constant 5.670373 x 10-8 W/m2/K4
>
> u unified atomic mass unit 1.660538921 x 10-27 kg
>
>
>
> Here's my question: What am I missing? Are there any physical constants that most people would find useful for their day-to-day work. The key is "most" people - nothing too esoteric, or limited to a single scientific discipline, etc.
>
>
>
> Thanks!
>
>
>
> -Chris
>
> ExelisVis
>
> p.s. please limit your comments to !CONST. Our new widget system team is currently hard at work in a secret underground bunker, and cannot be disturbed.
Re: Physical constants in IDL with !CONST [message #82648 is a reply to message #82525] Mon, 24 December 2012 01:37 Go to previous message
Mats Löfdahl is currently offline  Mats Löfdahl
Messages: 263
Registered: January 2012
Senior Member
Den tisdagen den 18:e december 2012 kl. 23:34:53 UTC+1 skrev Chris Torrence:
> Hi all,
>
>
>
> I'm adding a new system variable to IDL, called !CONST. So far, it's an IDL structure containing the following physical constants, in MKS units. All of these values (except for !const.pi, .e, .phi, and .R_earth) are taken from the "2010 CODATA Recommended Values," from NIST.
>
>
>
> Name Description Value
>
> alpha Fine structure constant 7.2973525698 x 10-3
>
> c Speed of light in a vacuum 299792458 m/s
>
> e Euler's number 2.7182818284590452
>
> ev elementary charge e, 1 electron volt 1.602176565 x 10-19 C
>
> eps0 electric vacuum permittivity 8.854187817 x 10-12 F/m
>
> F Faraday constant NAe 96485.3365 C/mol
>
> G Gravitation constant 6.67384 x 10-11 m3/kg/s2
>
> gn Earth standard gravity 9.80665 m/s2
>
> h Planck constant 6.62606957 x 10-34 J s
>
> hbar h/(2pi) 1.054571726 x 10-34 J s
>
> k Boltzmann constant R/NA 1.3806488 x 10-23 J/K
>
> me electron mass 9.10938291 x 10-31 kg
>
> mn neutron mass 1.674927351 x 10-27 kg
>
> mp proton mass 1.672621777 x 10-27 kg
>
> mu0 magnetic vacuum permeability 12.566370614 x 10-7 N/A2
>
> Na Avogadro constant NA 6.02214129e23 mol-1
>
> phi golden ratio 1.6180339887498948
>
> pi Pi 3.1415926535897932
>
> R molar gas constant 8.3144621 J/mol/K
>
> R_earth Earth radius (spherical) 6370997.0 m
>
> re classical electron radius 2.8179403267 x 10-15 m
>
> rydberg Rydberg constant Rinf 10973731.568539 m-1
>
> sigma Stefan-Boltzmann constant 5.670373 x 10-8 W/m2/K4
>
> u unified atomic mass unit 1.660538921 x 10-27 kg
>
>
>
> Here's my question: What am I missing? Are there any physical constants that most people would find useful for their day-to-day work. The key is "most" people - nothing too esoteric, or limited to a single scientific discipline, etc.
>
>
>
> Thanks!
>
>
>
> -Chris
>
> ExelisVis
>
> p.s. please limit your comments to !CONST. Our new widget system team is currently hard at work in a secret underground bunker, and cannot be disturbed.

I suggest !const.xmase=1224 and !const.xmasd=1225.
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: What are the rules for automatic removal of singleton dimensions, and can I have a way of disabling them, please?
Next Topic: day or night

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 11:42:08 PDT 2025

Total time taken to generate the page: 0.00550 seconds