[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: List of constants.
From: |
David Bateman |
Subject: |
Re: List of constants. |
Date: |
Sat, 10 Feb 2007 12:52:34 +0100 |
User-agent: |
Thunderbird 1.5.0.7 (X11/20060921) |
Muthiah Annamalai wrote:
>> Muthiah Annamalai wrote:
>>> Hello there,
>>>
>>> I was looking for some physical constant (Boltzmann Constant K),
>>> lately, and thought if we had some inbuilt thing in Octave
>>> (Octave-Forge) like the table from NIST, at
>>> http://www.physics.nist.gov/cuu/Constants/Table/allascii.txt
>>> it could be quite useful.
>>>
>
> On Fri, 2007-02-09 at 10:58 -0500, Tom Holroyd (NIH/NIMH) [E] wrote:
>> you could make a constant package.
>>
> I have uploaded a copy of physical-constants in the octave-forge/main/
> CVS. I think someone can have a look at it, and suggest improvements.
>
> A list of constants is at,
> http://octave.cvs.sourceforge.net/octave/octave-forge/main/
> physical-constants/test-consts.m?revision=1.1&view=markup
>
> A functions are at,
> http://octave.cvs.sourceforge.net/octave/octave-forge/main/
> physical-constants/inst/
>
> ~ Muthiah
Muthu,
I think it might be better to store the NIST data and a script to create
the functions. This might be in the sub-directory src/ with a script and
Makefile to built the functions. This allows new functions to be
automatically added by updating the database and repackaging.
Also I'm not sure its a great idea to have a function for each constant,
as you increase the chances of a collision with one of the users
functions. I think I'd prefer a function that took a string argument,
converted to lower case and found the minimum unique matching string and
returned the matching constant. That is
c = physical_constant("SpeedOf")
would match "speedoflight", but if both "speedoflight" and
"speedofunladenpigeon" were defined
c = physical_constant("SpeedOf")
should throw an error as an ambiguous request for a constant. In any
case this is just a preference of how I would implement this if I was
doing it..
D.