00001 /* 00002 ------------------------------------------------------------------- 00003 00004 Copyright (C) 2006, 2007, Andrew W. Steiner 00005 00006 This file is part of O2scl. 00007 00008 O2scl is free software; you can redistribute it and/or modify 00009 it under the terms of the GNU General Public License as published by 00010 the Free Software Foundation; either version 3 of the License, or 00011 (at your option) any later version. 00012 00013 O2scl is distributed in the hope that it will be useful, 00014 but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00016 GNU General Public License for more details. 00017 00018 You should have received a copy of the GNU General Public License 00019 along with O2scl. If not, see <http://www.gnu.org/licenses/>. 00020 00021 ------------------------------------------------------------------- 00022 */ 00023 #ifndef O2SCL_CX_ARITH_H 00024 #define O2SCL_CX_ARITH_H 00025 /** \file cx_arith.h 00026 \brief Complex arithmetic 00027 00028 \todo Define operators with assignment for complex + double 00029 \todo Ensure all the trig functions are tested 00030 */ 00031 00032 #include <iostream> 00033 #include <complex> 00034 #include <cmath> 00035 #include <gsl/gsl_complex.h> 00036 #include <gsl/gsl_complex_math.h> 00037 00038 /** 00039 \brief A namespace for arithmetic on complex numbers and vectors 00040 */ 00041 namespace o2scl_arith { 00042 00043 /// \name Binary operators for two complex numbers 00044 //@{ 00045 /// Add two complex numbers 00046 gsl_complex operator+(gsl_complex x, gsl_complex y); 00047 00048 /// Subtract two complex numbers 00049 gsl_complex operator-(gsl_complex x, gsl_complex y); 00050 00051 /// Multiply two complex numbers 00052 gsl_complex operator*(gsl_complex x, gsl_complex y); 00053 00054 /// Divide two complex numbers 00055 gsl_complex operator/(gsl_complex x, gsl_complex y); 00056 //@} 00057 00058 /// \name Binary operators with assignment for two complex numbers 00059 //@{ 00060 /// Add a complex number 00061 gsl_complex operator+=(gsl_complex &x, gsl_complex y); 00062 00063 /// Subtract a complex number 00064 gsl_complex operator-=(gsl_complex &x, gsl_complex y); 00065 00066 /// Multiply a complex number 00067 gsl_complex operator*=(gsl_complex &x, gsl_complex y); 00068 00069 /// Divide a complex number 00070 gsl_complex operator/=(gsl_complex &x, gsl_complex y); 00071 //@} 00072 00073 /// \name Binary operators with assignment for a complex and real 00074 //@{ 00075 /// Add a complex and real number 00076 gsl_complex operator+(gsl_complex x, double y); 00077 00078 /// Add a complex and real number 00079 gsl_complex operator+(double y, gsl_complex x); 00080 00081 /// Subtract a complex and real number 00082 gsl_complex operator-(gsl_complex x, double y); 00083 00084 /// Subtract a complex and real number 00085 gsl_complex operator-(double y, gsl_complex x); 00086 00087 /// Multiply a complex and real number 00088 gsl_complex operator*(gsl_complex x, double y); 00089 00090 /// Multiply a complex and real number 00091 gsl_complex operator*(double y, gsl_complex x); 00092 00093 /// Divide a complex and real number 00094 gsl_complex operator/(gsl_complex x, double y); 00095 //@} 00096 00097 /// \name Miscellaneous functions 00098 //@{ 00099 double arg(gsl_complex x); 00100 double abs(gsl_complex x); 00101 double abs2(gsl_complex z); 00102 gsl_complex conjugate(gsl_complex a); 00103 //@} 00104 00105 /// \name Square root and exponent functions 00106 //@{ 00107 gsl_complex sqrt(gsl_complex a); 00108 gsl_complex sqrt_real(double x); 00109 gsl_complex pow(gsl_complex a, gsl_complex b); 00110 gsl_complex pow_real(gsl_complex a, double b); 00111 //@} 00112 00113 /// \name Logarithmic and exponential functions 00114 //@{ 00115 double logabs(gsl_complex z); 00116 gsl_complex exp(gsl_complex a); 00117 gsl_complex log(gsl_complex a); 00118 gsl_complex log10(gsl_complex a); 00119 gsl_complex log_b(gsl_complex a, gsl_complex b); 00120 //@} 00121 00122 /// \name Trigonometric functions 00123 //@{ 00124 gsl_complex sin(gsl_complex a); 00125 gsl_complex cos(gsl_complex a); 00126 gsl_complex tan(gsl_complex a); 00127 gsl_complex sec(gsl_complex a); 00128 gsl_complex csc(gsl_complex a); 00129 gsl_complex cot(gsl_complex a); 00130 gsl_complex asin(gsl_complex a); 00131 gsl_complex asin_real(double a); 00132 gsl_complex acos(gsl_complex a); 00133 gsl_complex acos_real(double a); 00134 gsl_complex atan(gsl_complex a); 00135 gsl_complex asec(gsl_complex a); 00136 gsl_complex asec_real(double a); 00137 gsl_complex acsc(gsl_complex a); 00138 gsl_complex acsc_real(double a); 00139 gsl_complex acot(gsl_complex a); 00140 //@} 00141 00142 /// \name Hyperbolic trigonometric functions 00143 //@{ 00144 gsl_complex sinh(gsl_complex a); 00145 gsl_complex cosh(gsl_complex a); 00146 gsl_complex tanh(gsl_complex a); 00147 gsl_complex sech(gsl_complex a); 00148 gsl_complex csch(gsl_complex a); 00149 gsl_complex coth(gsl_complex a); 00150 gsl_complex asinh(gsl_complex a); 00151 gsl_complex acosh(gsl_complex a); 00152 gsl_complex acosh_real(double a); 00153 gsl_complex atanh(gsl_complex a); 00154 gsl_complex atanh_real(double a); 00155 gsl_complex asech(gsl_complex a); 00156 gsl_complex acsch(gsl_complex a); 00157 gsl_complex acoth(gsl_complex a); 00158 //@} 00159 00160 } 00161 00162 #endif
Documentation generated with Doxygen and provided under the GNU Free Documentation License. See License Information for details.
Project hosting provided by
,
O2scl Sourceforge Project Page