|
•
|
To access or represent the value of a physical constant, use the Constant constructor. For example, the velocity of light (usually represented by the symbol c):
|
>
|
with(ScientificConstants):
|
•
|
To obtain the value of a ScientificConstants object, use the evalf command with a physical constant object.
|
>
|
evalf( Constant( c ) );
|
|
The preceding physical constant object was constructed without any reference to a system of units. Thus, when evaluated, it returns the physical constant value in the current system of units. For more information about checking the current system of units, see Units[UsingSystem]. To evaluate it in a different system, first change the system of units with Units[UseSystem].
|
>
|
Units:-UseSystem( CGS );
|
>
|
evalf( Constant( c ) );
|
•
|
To obtain a unit object that contains the units of a ScientificConstants object, use the GetUnit command. For more information about unit objects, see Units[Unit].
|
>
|
GetUnit( Constant( c ) );
|
>
|
Units:-UseSystem( SI );
|
>
|
GetUnit( Constant( c ) );
|
|
Again, the preceding physical constant object is constructed without any reference to a system of units. Thus, it returns its units in the current system of units.
|
•
|
To construct a physical constant object that always evaluates in a particular system of units, use the 'system' option.
|
>
|
Constant( c, system=FPS );
|
>
|
evalf( (7) ), GetUnit( (7) );
|
|
Notice that the preceding physical constant object has the system of units in which it evaluates displayed in index notation.
|
•
|
By using the 'units' option, the physical constant object is multiplied by the appropriate unit object. This is intended for use in the Standard Units environment.
|
>
|
Constant( c, system=FPS, units );
|
|
If the 'units' option is specified and the 'system' option is not specified, the current system is used.
|
•
|
Unlike c, which is exact, most physical constants have an associated uncertainty or error, which is a measure of the precision to which their values have been measured experimentally. For example, the gravitational constant (usually represented by G):
|
>
|
GetError( Constant( G ) );
|
|
The error returned for a ScientificConstants object is of constant type and in absolute (not relative) form. That is, the magnitude depends on the system of units. For more information about uncertainties, see GetError.
|
|
Some physical constants return an error of undefined, which indicates the error is implicit in the figures of the central value.
|
•
|
Because the objects in ScientificConstants have central values with associated uncertainties, they are also recognized by the ScientificErrorAnalysis package.
|
•
|
To view information for a physical constant in the ScientificConstants package, use the GetConstant command.
|
| (13) |
|
Note that a physical constant can be identified by its full name (the first item in the sequence) or symbol. The name can be used in the Constant constructor, but is most useful as a brief description of the constant.
|
•
|
To list the physical constants in the ScientificConstants package, use the GetConstants command.
|
| (14) |
>
|
GetConstants( names )[1..5];
|
| (15) |
•
|
To check the existence of a physical constant in the ScientificConstants package, use the HasConstant command.
|
>
|
HasConstant( Moon_mass);
|
•
|
Physical constants that are not in the package can be added by using the AddConstant command. For example, add the mass of the Moon.
|
>
|
AddConstant( Moon_mass, symbol=M[Moon], value=7.35e22, units=kg );
|
>
|
HasConstant( Moon_mass );
|
>
|
evalf( Constant( M[Moon] ) );
|
>
|
evalf( Constant( M[Moon], system=FPS ) );
|
•
|
To modify the information for a physical constant, for example, to change its symbol, use the ModifyConstant command.
|
>
|
ModifyConstant( Moon_mass, symbol=M[M] );
|
|
Add an error to the Moon mass physical constant.
|
>
|
ModifyConstant( M[M], value=7.35e22, uncertainty=0.005e22 );
|
| (21) |
•
|
Derived physical constants are defined in terms of other physical constants, for example:
|
| (22) |
| (23) |
|
Derived physical constants are constructed and queried in the usual way.
|
>
|
evalf( (24) ), GetError( (24) ), GetUnit( (24) );
|
| (25) |
|
ScientificConstants uses the ScientificErrorAnalysis package to calculate the error of a derived physical constant.
|
•
|
Some physical constants have their values determined to more than 10 significant figures. Hence, access of these values at the default setting of Digits may result in a loss of precision. For more precision, set Digits to a higher value, for example, 15.
|
|