include/GMath.hpp

Go to the documentation of this file.
00001 /***************************************************************************
00002  *                     GMath.hpp - Mathematical functions                  *
00003  * ----------------------------------------------------------------------- *
00004  *  copyright (C) 2012-2015 by Juergen Knoedlseder                         *
00005  * ----------------------------------------------------------------------- *
00006  *                                                                         *
00007  *  This program is free software: you can redistribute it and/or modify   *
00008  *  it under the terms of the GNU General Public License as published by   *
00009  *  the Free Software Foundation, either version 3 of the License, or      *
00010  *  (at your option) any later version.                                    *
00011  *                                                                         *
00012  *  This program is distributed in the hope that it will be useful,        *
00013  *  but WITHOUT ANY WARRANTY; without even the implied warranty of         *
00014  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the          *
00015  *  GNU General Public License for more details.                           *
00016  *                                                                         *
00017  *  You should have received a copy of the GNU General Public License      *
00018  *  along with this program.  If not, see <http://www.gnu.org/licenses/>.  *
00019  *                                                                         *
00020  ***************************************************************************/
00021 /**
00022  * @file GMath.hpp
00023  * @brief Mathematical function definitions
00024  * @author Juergen Knoedlseder
00025  */
00026 
00027 #ifndef GMATH_HPP
00028 #define GMATH_HPP
00029 
00030 /* __ Includes ___________________________________________________________ */
00031 #include <cmath>
00032 
00033 /* __ Constants __________________________________________________________ */
00034 namespace gammalib {
00035     const double pi           =  3.141592653589793238462643383279502884197;
00036     const double twopi        =  6.283185307179586476925286766559005768394;
00037     const double fourpi       = 12.56637061435917295385057353311801153679;
00038     const double pihalf       =  1.570796326794896619231321691639751442099;
00039     const double inv_pihalf   =  0.6366197723675813430755350534900574;
00040     const double inv_sqrt4pi  =  0.2820947917738781434740397257803862929220;
00041     const double inv_sqrt2pi  =  0.3989422804014327028632180827116826549172;
00042     const double pi2          = pi*pi;
00043     const double deg2rad      =  0.0174532925199432954743717;
00044     const double rad2deg      = 57.295779513082322864647722;
00045     const double ln2          =  0.6931471805599453094172321214581766;
00046     const double ln10         =  2.3025850929940456840179914546843642;
00047     const double inv_ln2      =  1.4426950408889634073599246810018921;
00048     const double onethird     =  1.0/3.0;
00049     const double twothird     =  2.0/3.0;
00050     const double fourthird    =  4.0/3.0;
00051     const double sqrt_onehalf = std::sqrt(1.0/2.0);
00052     const double sqrt_pihalf  = std::sqrt(pihalf);
00053     const double sqrt_two     = std::sqrt(2.0);
00054     const double inv_ln10     =  1.0/ln10;
00055 }
00056 
00057 /* __ Prototypes _________________________________________________________ */
00058 namespace gammalib {
00059 
00060     // Trigonometric functions
00061     double acos(const double& arg);
00062     double cosd(const double& angle);
00063     double sind(const double& angle);
00064     double tand(const double& angle);
00065     double asind(const double& value);
00066     double acosd(const double& value);
00067     double atand(const double& value);
00068     double atan2d(const double& y, const double& x);
00069     void   sincosd(const double& angle, double *s, double *c);
00070 
00071     // Other functions
00072     double gammln(const double& arg);
00073     double erfcc(const double& arg);
00074     double erfinv(const double& arg);
00075     double modulo(const double& v1, const double& v2);
00076 }
00077 
00078 #endif /* GMATH_HPP */

Generated on Tue Jan 24 12:37:17 2017 for GammaLib by  doxygen 1.4.7