00001
00005
00006
00007
00008
00009 #include "specfun.h"
00010 #include <stdio.h>
00011 #include "prototypes2.h"
00012
00013 NAMESPACE_TBCI
00014
00015 cplx<double> HypergeometricU(const cplx<double>& a, const cplx<double>& b,
00016 const cplx<double>& z)
00017 {
00018 printf ("????\n");
00019 doublecomplex sin_erg;
00020 doublecomplex pow_erg;
00021 doublecomplex temp;
00022 cplx<double> res;
00023
00024 temp.r = pi*b.real(); temp.i = pi*b.imag();
00025 z_sin(&sin_erg, &temp);
00026
00027 temp.r = -b.real() + 1.0; temp.i = -b.imag();
00028 pow_zz(&pow_erg, (doublecomplex*)(&z), &temp);
00029
00030 res = pi/cplx<double>(sin_erg.r, sin_erg.i)
00031 *(HypergeometricM(a,b,z)/(gamma(a-b+1)*gamma(b))
00032 -cplx<double>(pow_erg.r, pow_erg.i)
00033 *HypergeometricM(a-b+1,-b+2,z)/(gamma(a)*gamma(-b+2))
00034 );
00035 return res;
00036 }
00037
00038
00039 cplx<double> gamma(const cplx<double>& z)
00040 {
00041 floatcomplex arg = {(float)z.real(), (float)z.imag()};
00042 floatcomplex erg;
00043 cgamma_(&erg, &arg);
00044
00045 return cplx<double>(erg.r, erg.i);
00046 }
00047
00048
00049 cplx<double> HypergeometricM(const cplx<double>& a, const cplx<double>& b,
00050 const cplx<double>& z)
00051 {
00052 doublecomplex erg = {0, 0};
00053 static const LONG_ int lnchf = 0;
00054 static const LONG_ int ip = 10;
00055
00056 conhyp_(&erg, (doublecomplex*)&a, (doublecomplex*)&b,
00057 (doublecomplex*)&z, &lnchf, &ip);
00058
00059 return cplx<double>(erg.r, erg.i);
00060 }
00061
00062 cplx<double> besselh1(double order, const cplx<double>& z)
00063 {
00064 double zr, zi, fnu;
00065 LONG_ int kode, m, n;
00066 double cyr[1], cyi[1];
00067 LONG_ int nz, ierr;
00068
00069 zr = z.real(); zi = z.imag();
00070
00071 kode = 1;
00072 m = 1;
00073 n = 1;
00074 fnu = MATH__ fabs(order);
00075 zbesh_(&zr, &zi, &fnu, &kode, &m, &n, cyr, cyi, &nz, &ierr);
00076 if (ierr || nz)
00077 fprintf (stderr, "Error computing Hankel function\n");
00078 if (order >= 0.0)
00079 return cplx<double> (cyr[0], cyi[0]);
00080
00081 static const cplx<double> I(0,1);
00082 return cplx<double>(cyr[0], cyi[0])* MATH__ exp(pi*fnu*I);
00083 }
00084
00085
00086 cplx<double> besselh2(double order, const cplx<double>& z)
00087 {
00088 double zr, zi, fnu;
00089 LONG_ int kode, m, n;
00090 double cyr[1], cyi[1];
00091 LONG_ int nz, ierr;
00092
00093 zr = z.real(); zi = z.imag();
00094
00095 kode = 1;
00096 m = 2;
00097 n = 1;
00098 fnu = MATH__ fabs(order);
00099 zbesh_(&zr, &zi, &fnu, &kode, &m, &n, cyr, cyi, &nz, &ierr);
00100 if (ierr || nz)
00101 fprintf (stderr, "Error computing Hankel function\n");
00102 if (order >= 0.0)
00103 return cplx<double> (cyr[0], cyi[0]);
00104
00105 static const cplx<double> I(0,1);
00106 return cplx<double> (cyr[0], cyi[0]) * MATH__ exp(-pi*fnu*I);
00107 }
00108
00109
00110 cplx<double> besselj(double order, const cplx<double>& z)
00111 {
00112 double zr, zi, fnu;
00113 LONG_ int kode, n;
00114 double cyr[1], cyi[1];
00115 LONG_ int nz, ierr;
00116
00117 zr = z.real(); zi = z.imag();
00118
00119 kode = 1;
00120 n = 1;
00121 fnu = MATH__ fabs(order);
00122 zbesj_(&zr, &zi, &fnu, &kode, &n, cyr, cyi, &nz, &ierr);
00123 if (ierr || nz)
00124 fprintf (stderr, "Error computing Hankel function\n");
00125 if (order >= 0.0)
00126 return cplx<double> (cyr[0], cyi[0]);
00127
00128
00129 return cplx<double>(cyr[0], cyi[0]) * MATH__ cos(pi*fnu)
00130 - bessely(fnu, z)* MATH__ sin(pi*fnu);
00131 }
00132
00133
00134
00135 cplx<double> besseli(double order, const cplx<double>& z)
00136 {
00137 double zr, zi, fnu;
00138 LONG_ int kode, n;
00139 double cyr[1], cyi[1];
00140 LONG_ int nz, ierr;
00141
00142 zr = z.real(); zi = z.imag();
00143
00144 kode = 1;
00145 n = 1;
00146 fnu = MATH__ fabs(order);
00147 zbesi_(&zr, &zi, &fnu, &kode, &n, cyr, cyi, &nz, &ierr);
00148 if (ierr || nz)
00149 fprintf (stderr, "Error computing Hankel function\n");
00150 if (order >= 0.0)
00151 return cplx<double> (cyr[0], cyi[0]);
00152
00153
00154 return cplx<double> (cyr[0], cyi[0])
00155 + 2.0/pi*MATH__ sin(pi*fnu)*besselk(fnu,z);
00156 }
00157
00158
00159
00160 cplx<double> besselk(double order, const cplx<double>& z)
00161 {
00162 double zr, zi, fnu;
00163 LONG_ int kode, n;
00164 double cyr[1], cyi[1];
00165 LONG_ int nz, ierr;
00166
00167 zr = z.real(); zi = z.imag();
00168
00169 kode = 1;
00170 n = 1;
00171 fnu = MATH__ fabs(order);
00172 zbesk_(&zr, &zi, &fnu, &kode, &n, cyr, cyi, &nz, &ierr);
00173 if (ierr || nz)
00174 fprintf (stderr, "Error computing Hankel function\n");
00175 if (order >= 0.0)
00176 return cplx<double> (cyr[0], cyi[0]);
00177
00178
00179 return cplx<double> (cyr[0], cyi[0]);
00180 }
00181
00182
00183 cplx<double> bessely(double order, const cplx<double>& z)
00184 {
00185 double zr, zi, fnu;
00186 LONG_ int kode, n;
00187 double cyr[1], cyi[1];
00188 double wcyr[1], wcyi[1];
00189 LONG_ int nz, ierr;
00190
00191 zr = z.real(); zi = z.imag();
00192
00193 kode = 1;
00194 n = 1;
00195 fnu = MATH__ fabs(order);
00196 zbesy_(&zr, &zi, &fnu, &kode, &n, cyr, cyi, &nz, wcyr, wcyi, &ierr);
00197 if (ierr || nz)
00198 fprintf (stderr, "Error computing Hankel function\n");
00199 if (order >= 0.0)
00200 return cplx<double> (cyr[0], cyi[0]);
00201
00202
00203 return cplx<double> (cyr[0], cyi[0])*MATH__ cos(pi*fnu)
00204 + besselj(fnu,z)*MATH__ sin(pi*fnu);
00205 }
00206
00207 NAMESPACE_END