00001 00030 #ifndef TRIG_HYP_H 00031 #define TRIG_HYP_H 00032 00033 #ifndef _MSC_VER 00034 # include <itpp/config.h> 00035 #else 00036 # include <itpp/config_msvc.h> 00037 #endif 00038 00039 #include <itpp/base/help_functions.h> 00040 00041 00044 00045 #ifndef HAVE_ASINH 00047 inline double asinh(double x) 00048 { 00049 return ((x >= 0) ? log(x + sqrt(x * x + 1)) : -log( -x + sqrt(x * x + 1))); 00050 } 00051 #endif 00052 00053 #ifndef HAVE_ACOSH 00055 inline double acosh(double x) 00056 { 00057 it_error_if(x < 1, "acosh(): Argument must be greater then 1."); 00058 return log(x + sqrt(x * x - 1.0)); 00059 } 00060 #endif 00061 00062 #ifndef HAVE_ATANH 00064 inline double atanh(double x) 00065 { 00066 it_error_if(fabs(x) >= 1,"atanh(): Argument out of range."); 00067 return 0.5 * log((x + 1) / (x - 1)); 00068 } 00069 #endif 00070 00072 00073 00074 namespace itpp { 00075 00078 00080 inline double sinc(double x) 00081 { 00082 return ((x == 0) ? 1.0 : sin(itpp::pi * x) / itpp::pi / x); 00083 } 00084 00086 inline vec sin(const vec &x) { return apply_function<double>(std::sin, x); } 00088 inline mat sin(const mat &x) { return apply_function<double>(std::sin, x); } 00090 inline vec cos(const vec &x) { return apply_function<double>(std::cos, x); } 00092 inline mat cos(const mat &x) { return apply_function<double>(std::cos, x); } 00094 inline vec tan(const vec &x) { return apply_function<double>(std::tan, x); } 00096 inline mat tan(const mat &x) { return apply_function<double>(std::tan, x); } 00098 inline vec asin(const vec &x) { return apply_function<double>(std::asin, x); } 00100 inline mat asin(const mat &x) { return apply_function<double>(std::asin, x); } 00102 inline vec acos(const vec &x) { return apply_function<double>(std::acos, x); } 00104 inline mat acos(const mat &x) { return apply_function<double>(std::acos, x); } 00106 inline vec atan(const vec &x) { return apply_function<double>(std::atan, x); } 00108 inline mat atan(const mat &x) { return apply_function<double>(std::atan, x); } 00110 inline vec sinc(const vec &x) { return apply_function<double>(sinc, x); } 00112 inline mat sinc(const mat &x) { return apply_function<double>(sinc, x); } 00113 00115 00116 00119 00121 inline vec sinh(const vec &x) { return apply_function<double>(std::sinh, x); } 00123 inline mat sinh(const mat &x) { return apply_function<double>(std::sinh, x); } 00125 inline vec cosh(const vec &x) { return apply_function<double>(std::cosh, x); } 00127 inline mat cosh(const mat &x) { return apply_function<double>(std::cosh, x); } 00129 inline vec tanh(const vec &x) { return apply_function<double>(std::tanh, x); } 00131 inline mat tanh(const mat &x) { return apply_function<double>(std::tanh, x); } 00133 inline vec asinh(const vec &x) { return apply_function<double>(::asinh, x); } 00135 inline mat asinh(const mat &x) { return apply_function<double>(::asinh, x); } 00137 inline vec acosh(const vec &x) { return apply_function<double>(::acosh, x); } 00139 inline mat acosh(const mat &x) { return apply_function<double>(::acosh, x); } 00141 inline vec atanh(const vec &x) { return apply_function<double>(::atanh, x); } 00143 inline mat atanh(const mat &x) { return apply_function<double>(::atanh, x); } 00144 00146 00147 } // namespace itpp 00148 00149 #endif // #ifndef TRIG_HYP_H
Generated on Sat Apr 19 10:43:52 2008 for IT++ by Doxygen 1.5.5