Add Constant - Maple Help
For the best experience, we recommend viewing online help using Google Chrome or Microsoft Edge.

Online Help

All Products    Maple    MapleSim


ScientificConstants

  

AddConstant

  

add a physical constant definition

 

Calling Sequence

Parameters

Description

Examples

Calling Sequence

AddConstant( full_name, value_eqn, opts )

AddConstant( full_name, derive_eqn, derive_opts )

Parameters

full_name

-

name; full name of the physical constant. It cannot match the name or symbol of a physical constant in the ScientificConstants package (unless the 'check=false' option is given)

value_eqn

-

equation of the form 'value'=value_obj that defines the value of the nonderived physical constant; value_obj must be of type constant or contain a Constant() object such that it evaluates to type constant

opts

-

(optional) equation(s) of the form option=value, where option is one of 'check', 'symbol',

derive_eqn

-

equation of the form 'derive'=derive_obj that defines the derived physical constant; derive_obj must be of type algebraic and contain at least one symbol or name of a physical constant

derive_opts

-

(optional) equation(s) of the form option=value, where option is one of 'check' or 'symbol'; specify the derived physical constant definition

Description

• 

The AddConstant( full_name, value_eqn, opts ) command adds a nonderived physical constant to the ScientificConstants package for the current session.

• 

The AddConstant( full_name, derive_eqn, derive_opts ) command adds a derived physical constant to the ScientificConstants package for the current session.

• 

To add a constant to all future Maple sessions, add the AddConstant command to your Maple initialization file. For more information, see Create Maple Initialization File.

• 

After the physical constant has been added, the full name or symbol can be used to access the constant.

• 

In the derive_eqn equation of the form 'derive'=derive_obj, the derive_obj expression is typically a product of rational powers of numerics, Maple constants, and physical constant identifiers (for example, symbols). Exceptions are the abs function, and a sum with dimensionally consistent summands.

• 

The opts and derive_opts arguments can contain one or more of the following equations that specify the physical constant.

  

 

  

'check' = true or false

  

When 'check'=true, AddConstant checks whether the given name or symbol matches names or symbols of physical constants in the package. If it does, an error is returned.  The default value of 'check' is true. When 'check'=false, AddConstant attempts to remove from the package any conflicting physical constants.  This is unsuccessful if any of the conflicting constants are currently used in the definition of any derived physical constants.

  

 

  

'symbol' = symbol

  

This option defines the symbol of the physical constant. It cannot match the name or symbol of a physical constant in the ScientificConstants package (unless the 'check=false' option is given, see below).

  

If a  physical constant definition does not include a 'symbol' equation, the full name is also assigned to the symbol.

  

 

• 

The opts argument can also contain one or more of the following equations that specify the nonderived physical constant.

  

 

  

'uncertainty' = uncertainty_obj

  

This option defines the precision to which the physical constant's value is known. The uncertainty_obj option must be of type constant (or be so after Constant() objects evaluate) or a list of the form uncer,uncertainty_opt where uncertainty_opt is 'relative' or 'uld' and uncer is of type constant (or is after Constant() objects evaluate).

  

If no uncertainty option uncertainty_opt is included, the value represents the absolute uncertainty of the physical constant. That is, the value is measured in units determined by the 'units' option.

  

If uncertainty_obj is of the form uncer,relative, uncer is the relative uncertainty in the physical constant's value.  The quantity uncer*value_obj is the absolute uncertainty of the physical constant.

  

If uncertainty_obj is of the form uncer,uld, uncer is the uncertainty in units in the least digit in the physical constant's value.  The quantity uncerSFloatExponentvalue_obj is the absolute uncertainty of the physical constant.  This form of uncertainty cannot be used with a non-float value_obj.

  

If the 'uncertainty' option is not specified, the uncertainty is undefined.

  

 

  

'units' = units_obj

  

This option defines the units in which the value, and possibly uncertainty, are measured. The units_obj option can be an expression that Units[Unit] interprets as a unit or a Unit() standard form. For more information, see Units.

  

If 'units'=units_obj is not specified, the units is unity, that is, one (1). This means that the physical constant is dimensionless.

Examples

withScientificConstants:

AddConstantHooke1,symbol=k1,value=2.3,uncertainty=0.1,relative,units=Nm

GetConstantk1

Hooke1,symbol=k1,value=2.3,uncertainty=0.23,units=Nm

(1)

AddConstantC,value=3.0

GetConstantC

C,symbol=C,value=3.0,uncertainty=undefined,units=1

(2)

AddConstantHooke2,symbol=k2,value=2Constantk1,uncertainty=2GetErrorConstantk1,units=GetUnitConstantk1

GetConstantk2

Hooke2,symbol=k2,value=4.6,uncertainty=0.46,units=kgs2

(3)

AddConstantHooke2d,symbol=k2d,derive=2k1

GetConstantk2d

Hooke2d,symbol=k2d,derive=2k1

(4)

Constantk2d

Constantk2d

(5)

GetValue,GetError,GetUnit

4.6,0.4600000000,kgs2

(6)

GetConstantsderivedfrom=k1

k2d

(7)

GetConstantℏ

Planck_constant_over_2pi,symbol=ℏ,derive=h2π

(8)

AddConstantelectron_proton_mass_ratio,symbol=`m[e]/m[p]`,derive=memp

Constant`m[e]/m[p]`

Constantm[e]/m[p]

(9)

GetValue

0.0005446170214

(10)

GetError

5.176301769×10−14

(11)

GetConstanttP

Planck_time,symbol=tP,derive=ℏGc5

(12)

See Also

Create Maple Initialization File

Details of Commands for Physical Constants

Initial Physical Constants

ScientificConstants

ScientificConstants[Constant]

ScientificConstants[GetConstant]

ScientificConstants[GetConstants]

ScientificConstants[GetError]

ScientificConstants[GetUnit]

ScientificConstants[ModifyConstant]

SFloatExponent

Units