This is the mail archive of the
gsl-discuss@sources.redhat.com
mailing list for the GSL project.
RE: AW: hypergeometric function
- From: "J.J. Gomez Cadenas" <gomez at ific dot uv dot es>
- To: "Brian Gough" <bjg at network-theory dot co dot uk>, "J.J. Gomez Cadenas" <gomez at hal dot ific dot uv dot es>
- Cc: <gsl-discuss at sources dot redhat dot com>
- Date: Wed, 12 Dec 2001 18:39:07 +0100
- Subject: RE: AW: hypergeometric function
This is the test program.
#include "GslPP/DataTypes/Complex.h"
#include <iostream>
#include <fstream>
int main() {
double re,im;
cout << " Enter the real and imaginary part of a complex number\n";
cout << " >>enter real part "; cin >> re;
cout << " >>enter imaginary part "; cin >> im;
cout.width(10);
cout.precision(12);
Complex z1 = Complex (re, im);
cout << " z1 = " << z1 << endl
<< " real part = " << z1.real ()
<< " imag part = " << z1.imag ()
<< " arg = " << z1.arg ()
<< " abs = " << z1.abs ()
<< endl
<< " z**2 = " << z1.abs2 ()
<< " log |z| = " << z1.logAbs ()
<< endl;
double r, theta;
cout << " Enter a complex number in polar coordinates\n";
cout << " >>enter radius "; cin >> r;
cout << " >>enter polar angle "; cin >> theta;
Complex z2 = Complex ();
z2.setPolar (r, theta);
cout << " z2 = " << z2 << endl
<< " real part = " << z2.real ()
<< " imag part = " << z2.imag ()
<< " arg = " << z2.arg ()
<< " abs = " << z2.abs ()
<< endl
<< " z**2 = " << z2.abs2 ()
<< " log |z| = " << z2.logAbs ()
<< endl;
/* Assignement operators */
Complex z3 = z1; //Complex& operator = (const Complex& z);
Complex z4;
z4= 10.0; //Complex& operator = (double d);
cout << " z3 must be = z1, z3 = " << z3 << endl;
cout << " z4 must be = (10,0), z4 = " << z4 << endl;
// Complex& operator += (const Complex& z);
z1 += z2;
cout << " z1 += z2 = " << z1 << endl;
z1 = z3;
// Complex& operator -= (const Complex& z);
z1 -= z2;
cout << " z1 -= z2 = " << z1 << endl;
z1 = z3;
// Complex& operator *= (const Complex& z);
z1 *= z2;
cout << " z1 *= z2 = " << z1 << endl;
z1 = z3;
// Complex& operator *= (double d);
z1 *= 10.;
cout << " z1 *= 10. = " << z1 << endl;
z1 = z3;
// Complex& operator /= (const Complex& z);
z1 /= z2;
cout << " z1 /= z2 = " << z1 << endl;
z1 = z3;
// Complex& operator /= (double d);
z1 /= 10.;
cout << " z1 /= 10. = " << z1 << endl;
z1 = z3;
/*
* Operations with complex numbers
*/
// friend Complex operator - (const Complex& z);
//Complex operator + (const Complex& z1, const Complex& z2);
cout << " z1 + z2 = " << z1 + z2 << endl;
z1 = z3;
// Complex operator - (const Complex& z1, const Complex& z2);
cout << " z1 - z2 = " << z1 - z2 << endl;
z1 = z3;
//Complex operator * (const Complex& z1, const Complex& z2);
cout << " z1 * z2 = " << z1 * z2 << endl;
z1 = z3;
// Complex operator / (const Complex& z1, const Complex& z2);
cout << " z1 / z2 = " << z1 / z2 << endl;
z1 = z3;
/*
Complex operator + (double a, const Complex& z);
Complex operator - (double a, const Complex& z);
Complex operator * (double a, const Complex& z);
Complex operator / (double a, const Complex& z);
*/
cout << " 10 + z1 = " << 10. + z1 << endl;
z1 = z3;
cout << " 10 - z1 = " << 10. - z1 << endl;
z1 = z3;
cout << " 10 * z2 = " << 10. * z1 << endl;
z1 = z3;
cout << " 10 / z1 = " << 10. / z1 << endl;
z1 = z3;
/*
Complex operator + (const Complex& z, double a);
Complex operator - (const Complex& z, double a);
Complex operator * (const Complex& z, double a);
Complex operator / (const Complex& z, double a);
*/
cout << " z1 + 10 = " << z1 + 10. << endl;
z1 = z3;
cout << " z1 - 10 = " << z1 - 10. << endl;
z1 = z3;
cout << " z1 * 10 = " << z1 * 10. << endl;
z1 = z3;
cout << " z1/10 = " << z1/10. << endl;
z1 = z3;
/*
* Complex functions.
*/
cout << " Elementary functions "
<< endl
<< " abs (z1) = " <<abs (z1)
<<endl
<< " conj (z1) = " <<conj (z1)
<<endl
<< " inverse (z1) = " <<inverse (z1)
<<endl
<< " sqrt (z1) = " <<sqrt (z1)
<<endl
<< " Csqrt (10.) = " <<Csqrt (10.)
<<endl
<< " pow (z1,z2) = " <<pow(z1,z2)
<<endl
<< " pow (z1,10.) = " <<pow(z1,10.)
<<endl
<< " exp (z1) = " <<exp(z1)
<<endl
<< " log (z1) = " <<log(z1)
<<endl
<< " log10 (z1) = " <<log10(z1)
<<endl;
cout << " Trigonometric functions "
<< endl
<< " sin (z1) = " <<sin (z1)
<<endl
<< " cos (z1) = " <<cos (z1)
<<endl
<< " tan (z1) = " <<tan (z1)
<<endl
<< " sec (z1) = " <<sec (z1)
<<endl
<< " csc (z1) = " <<csc (z1)
<<endl
<< " cot (z1) = " <<cot (z1)
<<endl;
cout << " Inverse Trigonometric functions "
<< endl
<< " asin (z1) = " <<asin (z1)
<<endl
<< " acos (z1) = " <<acos (z1)
<<endl
<< " atan (z1) = " <<atan (z1)
<<endl
<< " asec (z1) = " <<asec (z1)
<<endl
<< " acsc (z1) = " <<acsc (z1)
<<endl
<< " acot (z1) = " <<acot (z1)
<<endl;
cout << " Hyperbolic functions "
<< endl
<< " sinh (z1) = " <<sinh (z1)
<<endl
<< " cosh (z1) = " <<cosh (z1)
<<endl
<< " tanh (z1) = " <<tanh (z1)
<<endl
<< " sech (z1) = " <<sech (z1)
<<endl
<< " csch (z1) = " <<csch (z1)
<<endl
<< " coth (z1) = " <<coth (z1)
<<endl;
cout << " Inverse hyperbolic functions "
<< endl
<< " asinh (z1) = " <<asinh (z1)
<<endl
<< " acosh (z1) = " <<acosh (z1)
<<endl
<< " atanh (z1) = " <<atanh (z1)
<<endl
<< " asech (z1) = " <<asech (z1)
<<endl
<< " acsch (z1) = " <<acsch (z1)
<<endl
<< " acoth (z1) = " <<acoth (z1)
<<endl;
return 0;
}
This is the header Complex.h
/* -*- mode: c++ -*- */
/*
* Complex.h
* This is a wrapper around the complex type defined in the GSL
*
* This code is part of the
* Gsl++library, a C++ wrapper around the GNU Scientific Library (GNU)
*
* Copyright for this wrapper (C) 2001,2002
* J. Burguet, J.J. Gomez-Cadenas, J.A. Hernando
*
* For the GSL library
* Copyright (C) 1996, 1997, 1998, 1999, 2000 Brian Gough and others,
* see documentation of the GSL library
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef _COMPLEX_
#define _COMPLEX_
#include <iostream> // to overload ostream& <<
#include <gsl/gsl_complex.h>
#include <gsl/gsl_complex_math.h>
using namespace std; //needed by gcc 3.2 and MVC++
/**
* Complex numbers
*
* This is a wrapper class around the complex numbers defined by the GSL
*
* A gsl complex is a structure defined as:
*
* typedef struct
* {
* double dat[2]
* } gsl_complex;
*
* See gsl manual chapter 5
*/
class Complex;
Complex operator - (const Complex& z);
Complex operator + (const Complex& z1, const Complex& z2); ///< z1+z2
Complex operator - (const Complex& z1, const Complex& z2); ///< z1-z2
Complex operator * (const Complex& z1, const Complex& z2); ///< z1*z2
Complex operator / (const Complex& z1, const Complex& z2); ///< z1/z2
Complex operator + (double a, const Complex& z); ///< a + z
Complex operator - (double a, const Complex& z); ///< a - z
Complex operator * (double a, const Complex& z); ///< a * z
Complex operator / (double a, const Complex& z); ///< a / z
Complex operator + (const Complex& z, double a); ///< z + a
Complex operator - (const Complex& z, double a); ///< z - a
Complex operator * (const Complex& z, double a); ///< z * a
Complex operator / (const Complex& z, double a); ///< z / ac
/*
* Complex functions.
*/
// Elementary functions
double fabs(const Complex& z); ///< absolute value, |z|
double abs(const Complex& z); ///< absolute value, |z|
Complex conj(const Complex& z); ///< complex conjugate
Complex inverse(const Complex& z); ///< 1/z
Complex sqrt(const Complex& z); ///< complex square root
Complex Csqrt(double a); ///< complex sqrt of a real
Complex pow(const Complex& z1, const Complex& z2); ///< z1**z2
Complex pow(const Complex& z, double a); ///< z**a
Complex exp(const Complex& z); ///< exponential function, exp(z)
Complex log(const Complex& z); ///< natural logarithm, log(z)
Complex log10(const Complex& z); ///< logarithm in base 10, log10(z)
// Trigonometric
Complex sin(const Complex& z); ///< sinus, sin(z)
Complex cos(const Complex& z); ///< cosinus, cos(z)
Complex tan(const Complex& z); ///< tangent, tan(z)
Complex sec(const Complex& z); ///< secant, sec(z) = 1/cos(z)
Complex csc(const Complex& z); ///< cosecant, cosec(z) = 1/sin(z)
Complex cot(const Complex& z); ///< cotangent, cotan(z) = 1/cot(z)
// Inverse trigonometric
Complex asin(const Complex& z); ///< arcsin(z)
Complex acos(const Complex& z); ///< arccos(z)
Complex atan(const Complex& z); ///< arctan(z)
Complex asec(const Complex& z); ///< arcsec(z)
Complex acsc(const Complex& z); ///< arccosec(z)
Complex acot(const Complex& z); ///< arccotg(z)
// Hyperbolic
Complex sinh(const Complex& z); ///< sinh(z)
Complex cosh(const Complex& z); ///< cosh(z)
Complex tanh(const Complex& z); ///< tanh(z)
Complex sech(const Complex& z); ///< sech(z) = 1/cosh(z)
Complex csch(const Complex& z); ///< cosech(z) = 1/sinh(z)
Complex coth(const Complex& z); ///< cotanh(z) = 1/coth(z)
// Inverse hyperbolic
Complex asinh(const Complex& z); ///< arcsinh(z)
Complex acosh(const Complex& z); ///< arccosh(z)
Complex atanh(const Complex& z); ///< arctan(z)
Complex asech(const Complex& z); ///< arcsec(z)
Complex acsch(const Complex& z); ///< arccosec(z)
Complex acoth(const Complex& z); ///< arccotg(z)
class Complex {
private:
gsl_complex m_gslComplex; ///< a gsl complex number
public:
Complex();
Complex(double x, double y);
Complex(const Complex& z);
~Complex();
/* Reading functions */
double real() const; ///< real part, Re(z)
double imag() const; ///< imaginary part, Im(z)
double arg() const; ///< argument, -pi < arg(z) < pi
double abs() const; ///< absolute value, |z|
double abs2() const; ///< squared absolute value, |z|**2
double logAbs() const; ///< log|z|. It allows accurate evaluation near
|z|=1
/* Setting functions */
void setRectangular(double x, double y);
void setPolar(double r, double theta);
/* Assignement operators */
Complex& operator = (const Complex& z);
Complex& operator = (double d);
Complex& operator += (const Complex& z);
Complex& operator -= (const Complex& z);
Complex& operator *= (const Complex& z);
Complex& operator *= (double d);
Complex& operator /= (const Complex& z);
Complex& operator /= (double d);
/*
* Friend functions
*/
/*
* Operations with complex numbers
*/
friend Complex operator - (const Complex& z);
friend Complex operator + (const Complex& z1, const Complex& z2); ///<
z1+z2
friend Complex operator - (const Complex& z1, const Complex& z2); ///<
z1-z2
friend Complex operator * (const Complex& z1, const Complex& z2); ///<
z1*z2
friend Complex operator / (const Complex& z1, const Complex& z2); ///<
z1/z2
friend Complex operator + (double a, const Complex& z); ///< a + z
friend Complex operator - (double a, const Complex& z); ///< a - z
friend Complex operator * (double a, const Complex& z); ///< a * z
friend Complex operator / (double a, const Complex& z); ///< a / z
friend Complex operator + (const Complex& z, double a); ///< z + a
friend Complex operator - (const Complex& z, double a); ///< z - a
friend Complex operator * (const Complex& z, double a); ///< z * a
friend Complex operator / (const Complex& z, double a); ///< z / ac
/*
* Complex functions.
*/
// Elementary functions
friend double fabs(const Complex& z); ///< absolute value, |z|
friend double abs(const Complex& z); ///< absolute value, |z|
friend Complex conj(const Complex& z); ///< complex conjugate
friend Complex inverse(const Complex& z); ///< 1/z
friend Complex sqrt(const Complex& z); ///< complex square root
friend Complex Csqrt(double a); ///< complex sqrt of a real
friend Complex pow(const Complex& z1, const Complex& z2); ///< z1**z2
friend Complex pow(const Complex& z, double a); ///< z**a
friend Complex exp(const Complex& z); ///< exponential function,
exp(z)
friend Complex log(const Complex& z); ///< natural logarithm, log(z)
friend Complex log10(const Complex& z); ///< logarithm in base 10,
log10(z)
// Trigonometric
friend Complex sin(const Complex& z); ///< sinus, sin(z)
friend Complex cos(const Complex& z); ///< cosinus, cos(z)
friend Complex tan(const Complex& z); ///< tangent, tan(z)
friend Complex sec(const Complex& z); ///< secant, sec(z) = 1/cos(z)
friend Complex csc(const Complex& z); ///< cosecant, cosec(z) =
1/sin(z)
friend Complex cot(const Complex& z); ///< cotangent, cotan(z) =
1/cot(z)
// Inverse trigonometric
friend Complex asin(const Complex& z); ///< arcsin(z)
friend Complex acos(const Complex& z); ///< arccos(z)
friend Complex atan(const Complex& z); ///< arctan(z)
friend Complex asec(const Complex& z); ///< arcsec(z)
friend Complex acsc(const Complex& z); ///< arccosec(z)
friend Complex acot(const Complex& z); ///< arccotg(z)
// Hyperbolic
friend Complex sinh(const Complex& z); ///< sinh(z)
friend Complex cosh(const Complex& z); ///< cosh(z)
friend Complex tanh(const Complex& z); ///< tanh(z)
friend Complex sech(const Complex& z); ///< sech(z) = 1/cosh(z)
friend Complex csch(const Complex& z); ///< cosech(z) = 1/sinh(z)
friend Complex coth(const Complex& z); ///< cotanh(z) = 1/coth(z)
// Inverse hyperbolic
friend Complex asinh(const Complex& z); ///< arcsinh(z)
friend Complex acosh(const Complex& z); ///< arccosh(z)
friend Complex atanh(const Complex& z); ///< arctan(z)
friend Complex asech(const Complex& z); ///< arcsec(z)
friend Complex acsch(const Complex& z); ///< arccosec(z)
friend Complex acoth(const Complex& z); ///< arccotg(z)
};
ostream& operator << (ostream& s, const Complex& z);
#endif /* _COMPLEX_ */
And this is the .cpp, all straight forward!
**
* Complex numbers and complex functions.
*
* The class Complex is a wrapper around gsl_complex.
*
* @version v1
* @author JJ Gomez Cadenas, JBC
* @date 17/08/2001
*/
#include <gsl/gsl_errno.h>
#include "GslPP/DataTypes/Complex.h"
/**
* Default constructor, z = 0.
*/
Complex::Complex() {
m_gslComplex = gsl_complex_rect(0.0, 0.0);
}
/**
* Create a complex number z = x + iy
*/
Complex::Complex(double x, double y) {
m_gslComplex = gsl_complex_rect(x, y);
}
/**
* Copy constructor
*/
Complex::Complex(const Complex& z) {
m_gslComplex = gsl_complex_rect(z.real(), z.imag());
}
/**
* Destructor
*/
Complex::~Complex() {
}
/*
* Reading functions.
*/
/// Real part
double Complex::real() const {
return GSL_REAL(m_gslComplex);
}
/// Imaginary part
double Complex::imag() const {
return GSL_IMAG(m_gslComplex);
}
/// Argument, -pi < arg < pi
double Complex::arg() const {
return gsl_complex_arg(m_gslComplex);
}
/// Modulus
double Complex::abs() const {
return gsl_complex_abs(m_gslComplex);
}
/// Modulus squared
double Complex::abs2() const {
return gsl_complex_abs2(m_gslComplex);
}
double Complex::logAbs() const {
return gsl_complex_logabs(m_gslComplex);
}
/*
* Setting functions
*/
void Complex::setRectangular(double x, double y) {
m_gslComplex = gsl_complex_rect(x, y);
}
void Complex::setPolar(double r, double theta) {
m_gslComplex = gsl_complex_polar(r, theta);
}
/*
* Assignement operators.
*/
Complex& Complex::operator = (const Complex& z) {
m_gslComplex = gsl_complex_rect(z.real(), z.imag());
return *this;
}
Complex& Complex::operator = (double d) {
m_gslComplex = gsl_complex_rect(d, 0.0);
return *this;
}
Complex& Complex::operator += (const Complex& z)
m_gslComplex = gsl_complex_add(m_gslComplex, z.m_gslComplex);
return *this;
}
Complex& Complex::operator -= (const Complex& z) {
m_gslComplex = gsl_complex_sub(m_gslComplex, z.m_gslComplex);
return *this;
}
Complex& Complex::operator *= (const Complex& z) {
m_gslComplex = gsl_complex_mul(m_gslComplex, z.m_gslComplex);
return *this;
}
Complex& Complex::operator *= (double a) {
m_gslComplex = gsl_complex_mul_real(m_gslComplex, a);
return *this;
}
Complex& Complex::operator /= (const Complex& z) {
m_gslComplex = gsl_complex_div(z.m_gslComplex, m_gslComplex);
return *this;
}
Complex& Complex::operator /= (double a) {
m_gslComplex = gsl_complex_div_real(m_gslComplex, a);
return *this;
}
/*
* Operations with complex numbers.
*/
Complex operator - (const Complex& z) {
return Complex(-GSL_REAL(z.m_gslComplex), -GSL_IMAG(z.m_gslComplex));
}
Complex operator + (const Complex& z1, const Complex& z2) {
gsl_complex gz = gsl_complex_add(z1.m_gslComplex, z2.m_gslComplex);
return Complex(GSL_REAL(gz), GSL_IMAG(gz));
}
Complex operator - (const Complex& z1, const Complex& z2) {
gsl_complex gz = gsl_complex_sub(z1.m_gslComplex, z2.m_gslComplex);
return Complex(GSL_REAL(gz), GSL_IMAG(gz));
}
Complex operator * (const Complex& z1, const Complex& z2) {
gsl_complex gz = gsl_complex_mul(z1.m_gslComplex, z2.m_gslComplex);
return Complex(GSL_REAL(gz), GSL_IMAG(gz));
}
Complex operator / (const Complex& z1, const Complex& z2) {
gsl_complex gz = gsl_complex_div(z1.m_gslComplex, z2.m_gslComplex);
return Complex(GSL_REAL(gz), GSL_IMAG(gz));
}
Complex operator + (double a, const Complex& z) {
gsl_complex gz = gsl_complex_add_real(z.m_gslComplex, a);
return Complex(GSL_REAL(gz), GSL_IMAG(gz));
}
Complex operator - (double a, const Complex& z) {
gsl_complex gz = gsl_complex_sub_real(z.m_gslComplex, a);
return Complex(-GSL_REAL(gz), -GSL_IMAG(gz));
}
Complex operator * (double a, const Complex& z) {
gsl_complex gz = gsl_complex_mul_real(z.m_gslComplex, a);
return Complex(GSL_REAL(gz), GSL_IMAG(gz));
}
Complex operator / (double a, const Complex& z) {
gsl_complex ac = gsl_complex_rect(a, 0); // complexization of a
gsl_complex gz = gsl_complex_div(ac, z.m_gslComplex);
return Complex(GSL_REAL(gz), GSL_IMAG(gz));
}
Complex operator + (const Complex& z, double a) {
gsl_complex gz = gsl_complex_add_real(z.m_gslComplex, a);
return Complex(GSL_REAL(gz), GSL_IMAG(gz));
}
Complex operator - (const Complex& z, double a) {
gsl_complex gz = gsl_complex_sub_real(z.m_gslComplex, a);
return Complex(GSL_REAL(gz), GSL_IMAG(gz));
}
Complex operator * (const Complex& z, double a) {
gsl_complex gz = gsl_complex_mul_real(z.m_gslComplex, a);
return Complex(GSL_REAL(gz), GSL_IMAG(gz));
}
Complex operator / (const Complex& z, double a) {
gsl_complex gz = gsl_complex_div_real(z.m_gslComplex, a);
return Complex(GSL_REAL(gz), GSL_IMAG(gz));
}
/*
* Complex functions.
*/
// Elementary functions
double fabs(const Complex& z) {
return gsl_complex_abs(z.m_gslComplex);
}
double abs(const Complex& z) {
return gsl_complex_abs(z.m_gslComplex);
}
Complex conj(const Complex& z) {
gsl_complex gz = gsl_complex_conjugate(z.m_gslComplex);
return Complex(GSL_REAL(gz), GSL_IMAG(gz));
}
Complex inverse(const Complex& z) {
gsl_complex gz = gsl_complex_inverse(z.m_gslComplex);
return Complex(GSL_REAL(gz), GSL_IMAG(gz));
}
Complex sqrt(const Complex& z) {
gsl_complex gz = gsl_complex_sqrt(z.m_gslComplex);
return Complex(GSL_REAL(gz), GSL_IMAG(gz));
}
Complex Csqrt(double a) {
gsl_complex gz = gsl_complex_sqrt_real(a);
return Complex(GSL_REAL(gz), GSL_IMAG(gz));
}
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));
}
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));
}
Complex exp(const Complex& z) {
gsl_complex gz = gsl_complex_exp(z.m_gslComplex);
return Complex(GSL_REAL(gz), GSL_IMAG(gz));
}
Complex log(const Complex& z) {
gsl_complex gz = gsl_complex_log(z.m_gslComplex);
return Complex(GSL_REAL(gz), GSL_IMAG(gz));
}
Complex log10(const Complex& z) {
gsl_complex gz = gsl_complex_log10(z.m_gslComplex);
return Complex(GSL_REAL(gz), GSL_IMAG(gz));
}
// Trigonometric
Complex sin(const Complex& z) {
gsl_complex gz = gsl_complex_sin(z.m_gslComplex);
return Complex(GSL_REAL(gz), GSL_IMAG(gz));
}
Complex cos(const Complex& z) {
gsl_complex gz = gsl_complex_cos(z.m_gslComplex);
return Complex(GSL_REAL(gz), GSL_IMAG(gz));
}
Complex tan(const Complex& z) {
gsl_complex gz = gsl_complex_tan(z.m_gslComplex);
return Complex(GSL_REAL(gz), GSL_IMAG(gz));
}
Complex sec(const Complex& z) {
gsl_complex gz = gsl_complex_sec(z.m_gslComplex);
return Complex(GSL_REAL(gz), GSL_IMAG(gz));
}
Complex csc(const Complex& z) {
gsl_complex gz = gsl_complex_csc(z.m_gslComplex);
return Complex(GSL_REAL(gz), GSL_IMAG(gz));
}
Complex cot(const Complex& z) {
gsl_complex gz = gsl_complex_cot(z.m_gslComplex);
return Complex(GSL_REAL(gz), GSL_IMAG(gz));
}
// Inverse trigonometric
Complex asin(const Complex& z) {
gsl_complex gz = gsl_complex_arcsin(z.m_gslComplex);
return Complex(GSL_REAL(gz), GSL_IMAG(gz));
}
Complex acos(const Complex& z) {
gsl_complex gz = gsl_complex_arccos(z.m_gslComplex);
return Complex(GSL_REAL(gz), GSL_IMAG(gz));
}
Complex atan(const Complex& z) {
gsl_complex gz = gsl_complex_arctan(z.m_gslComplex);
return Complex(GSL_REAL(gz), GSL_IMAG(gz));
}
Complex asec(const Complex& z) {
gsl_complex gz = gsl_complex_arcsec(z.m_gslComplex);
return Complex(GSL_REAL(gz), GSL_IMAG(gz));
}
Complex acsc(const Complex& z) {
gsl_complex gz = gsl_complex_arccsc(z.m_gslComplex);
return Complex(GSL_REAL(gz), GSL_IMAG(gz));
}
Complex acot(const Complex& z) {
gsl_complex gz = gsl_complex_arccot(z.m_gslComplex);
return Complex(GSL_REAL(gz), GSL_IMAG(gz));
}
// Hyperbolic
Complex sinh(const Complex& z) {
gsl_complex gz = gsl_complex_sinh(z.m_gslComplex);
return Complex(GSL_REAL(gz), GSL_IMAG(gz));
}
Complex cosh(const Complex& z) {
gsl_complex gz = gsl_complex_cosh(z.m_gslComplex);
return Complex(GSL_REAL(gz), GSL_IMAG(gz));
}
Complex tanh(const Complex& z) {
gsl_complex gz = gsl_complex_tanh(z.m_gslComplex);
return Complex(GSL_REAL(gz), GSL_IMAG(gz));
}
Complex sech(const Complex& z) {
gsl_complex gz = gsl_complex_sech(z.m_gslComplex);
return Complex(GSL_REAL(gz), GSL_IMAG(gz));
}
Complex csch(const Complex& z) {
gsl_complex gz = gsl_complex_csch(z.m_gslComplex);
return Complex(GSL_REAL(gz), GSL_IMAG(gz));
}
Complex coth(const Complex& z) {
gsl_complex gz = gsl_complex_coth(z.m_gslComplex);
return Complex(GSL_REAL(gz), GSL_IMAG(gz));
}
// Inverse hyperbolic
Complex asinh(const Complex& z) {
gsl_complex gz = gsl_complex_arcsinh(z.m_gslComplex);
return Complex(GSL_REAL(gz), GSL_IMAG(gz));
}
Complex acosh(const Complex& z) {
gsl_complex gz = gsl_complex_arccosh(z.m_gslComplex);
return Complex(GSL_REAL(gz), GSL_IMAG(gz));
}
Complex atanh(const Complex& z) {
gsl_complex gz = gsl_complex_arctanh(z.m_gslComplex);
return Complex(GSL_REAL(gz), GSL_IMAG(gz));
}
Complex asech(const Complex& z) {
gsl_complex gz = gsl_complex_arcsech(z.m_gslComplex);
return Complex(GSL_REAL(gz), GSL_IMAG(gz));
}
Complex acsch(const Complex& z) {
gsl_complex gz = gsl_complex_arccsch(z.m_gslComplex);
return Complex(GSL_REAL(gz), GSL_IMAG(gz));
}
Complex acoth(const Complex& z) {
gsl_complex gz = gsl_complex_arccoth(z.m_gslComplex);
return Complex(GSL_REAL(gz), GSL_IMAG(gz));
}
/**
* Write complex number to a stream (for visual output)
*/
ostream& operator << (ostream& s, const Complex& z) {
s << "( " << z.real() << ", " << z.imag() << " )";
return s;
}
Finally, this is the error
Linking...
Searching Libraries
Searching C:\Archivos de programa\Microsoft Visual
Studio\VC98\LIB\kernel32.lib:
Searching C:\Archivos de programa\Microsoft Visual
Studio\VC98\LIB\ws2_32.lib:
Searching C:\Archivos de programa\Microsoft Visual
Studio\VC98\LIB\advapi32.lib:
Searching C:\Archivos de programa\Microsoft Visual
Studio\VC98\LIB\msvcrt.lib:
Searching C:\Archivos de programa\Microsoft Visual
Studio\VC98\LIB\msvcprt.lib:
Searching C:\Archivos de programa\Microsoft Visual
Studio\VC98\LIB\msvcirt.lib:
Searching C:\Archivos de programa\Microsoft Visual
Studio\VC98\LIB\oldnames.lib:
Searching C:\cygwin\jj\GSL++\GslPP\v0r1\Win32Debug\libGslPP.lib:
Searching C:\ARCHIV~1\GSL\lib\libgsld.lib:
Searching C:\ARCHIV~1\GSL\lib\libgslcblasd.lib:
Searching C:\Archivos de programa\Microsoft Visual
Studio\VC98\LIB\kernel32.lib:
Searching C:\Archivos de programa\Microsoft Visual
Studio\VC98\LIB\ws2_32.lib:
Searching C:\Archivos de programa\Microsoft Visual
Studio\VC98\LIB\advapi32.lib:
Searching C:\Archivos de programa\Microsoft Visual
Studio\VC98\LIB\msvcrt.lib:
Searching C:\Archivos de programa\Microsoft Visual
Studio\VC98\LIB\msvcprt.lib:
Searching C:\Archivos de programa\Microsoft Visual
Studio\VC98\LIB\msvcirt.lib:
Searching C:\Archivos de programa\Microsoft Visual
Studio\VC98\LIB\oldnames.lib:
Searching C:\cygwin\jj\GSL++\GslPP\v0r1\Win32Debug\libGslPP.lib:
Searching C:\ARCHIV~1\GSL\lib\libgsld.lib:
Searching C:\ARCHIV~1\GSL\lib\libgslcblasd.lib:
Searching C:\Archivos de programa\Microsoft Visual
Studio\VC98\LIB\kernel32.lib:
Searching C:\Archivos de programa\Microsoft Visual
Studio\VC98\LIB\ws2_32.lib:
Searching C:\Archivos de programa\Microsoft Visual
Studio\VC98\LIB\advapi32.lib:
Done Searching Libraries
libgsld.lib(invhyp.obj) : error LNK2001: unresolved external symbol __HUGE
../Win32Debug/test_complex.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.
test_complex.exe - 2 error(s), 0 warning(s)
Notice that the missing symbol is in a module of libgsld.lib. I downloaded
v1 only a few days ago
Incidentally, I also use cygwin in windows. I compiled the library without
problems and the test example runs flawlessly. It also runs in Linux.
jj