This is the mail archive of the
gsl-discuss@sources.redhat.com
mailing list for the GSL project.
Possible errors in Complex functions,
- From: "JJ Gomez-Cadenas" <gomez at ific dot uv dot es>
- To: "Brian Gough" <bjg at network-theory dot co dot uk>
- Cc: <gsl-discuss at sources dot redhat dot com>
- Date: Tue, 26 Feb 2002 17:48:14 +0100
- Subject: Possible errors in Complex functions,
Hi,
We believe there may be an error in the function gsl_complex_pow, testing
code follows:
1). Complex pow(const Complex& z1, const Complex& z2)
Complex pow(const Complex& z1, const Complex& z2) {
gsl_complex gz = gsl_complex_pow(z1.m_gslComplex,
z2.m_gslComplex);
return Complex(GSL_REAL(gz), GSL_IMAG(gz));
}
z1 = Complex(0.37082,-1.14127)
z2 = Complex(0.965809,-2.19709)
Testing pow (z1,z2).This function gives z1**z2
Expect pow (z1,z2) = Complex(-0.4342397,-0.090085)
Obtain pow (z1,z2) = ( -0.00327587, -0.0753357 )
2). Complex pow(const Complex& z, double a):
Complex pow(const Complex& z, double a) {
gsl_complex gz =
gsl_complex_pow_real(z.m_gslComplex, a);
return Complex(GSL_REAL(gz), GSL_IMAG(gz));
}
Testing pow (z,10.).This function gives z**10
z = Complex(0.37082,-1.14127)
a = 10.
Expect pow (z,10) = Complex(6.19173,-0.00007834)
Obtain pow (z,10) = ( 6.19184, -5.40649e-05 )
Same for complex asec:
3). Complex asec(const Complex& z) :
Complex asec(const Complex& z) {
gsl_complex gz =
gsl_complex_arcsec(z.m_gslComplex);
return Complex(GSL_REAL(gz), GSL_IMAG(gz));
}
Testing asec (z):
z = Complex(0.37082,-1.14127)
Expect asec (z) = Complex(-1.369225 ,0.739622)
Obtain asec (z) = ( 1.36922, -0.739622 )
Regards,
JJ Gomez and Ana Tornero