constant - EranOfek/AstroPack GitHub Wiki
The constant is a static class that store physical and astronimcal constants. See also the convert static class. This file is accessible through the manual package (i.e. manual.constant).
If you are using this code or products in your scientific publication please give a reference to Ofek (2014; ascl.soft 07005).
Unless specified otherwise this code and products are released under the GNU general public license version 3.
To see a list of all methods available in the constant class, type "constant." followed by . Most of the methods are simply constant names, while there are a few special methods.
To obtain a list of all available constant:
Const=constant.all;
{Const.Name}
% to see the constants and their values:
[{A.Name}',{A.Const}']
To obtain the list of all constants in a structure:
[St,StUnits]=constant.all_st
% while loading all the constants to the session:
constant.all_var
% and clear all the constants from the session:
constant.all_var_clear
To obtain a specific constant in cgs units (default units) use:
% Gravitational constant
constant.G
% astronomical unit
constant.au
You can change the units to SI by using:
% Planck constant
constant.h('SI')
You can obtain additional information, like the units, errors and formula (for secondary constants):
% speed of light
[Const,Units,Error,Form]=constant.c