[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-gsl] Complex numbers - how?

From: Joakim Hove
Subject: Re: [Help-gsl] Complex numbers - how?
Date: Tue, 01 Mar 2005 15:36:54 +0100
User-agent: Gnus/5.1006 (Gnus v5.10.6) Emacs/21.2 (gnu/linux)

Anders Misfeldt <address@hidden> writes:

> GSL_SET_COMPLEX(&ztest, 3, 4);
> GSL_REAL(ztest);
> printf("%g",ztest);
> but I get the following error:
> error: request for member `dat' in something not a structure or union
> What am I doing wrong?

Several things I think:

 1. The macro GSL_REAL extracts/returns the real part of the variable
    ztest. It does *not* modify ztest in any way, which it seems you

 2. The error message indicates that your variable ztest is not of
    type gsl_complex?

 3. The ztest variable has (if it is of type gsl_complex, as it should
    be) two components, and can not be formattet with printf("%g",);

This little program works:

#include <gsl/gsl_complex.h>

int main (void) {
  gsl_complex Z;
  printf("Re(Z):%g  Im(Z):%g \n",GSL_REAL(Z),GSL_IMAG(Z));

[As for your "real question" I strongly believe you should proceed
 further with pen and paper before you start asking the computer.]

HTH - Joakim

Joakim Hove
hove AT ift uib no
Tlf: +47 (55 5)8 27 90 
Fax: +47 (55 5)8 94 40

reply via email to

[Prev in Thread] Current Thread [Next in Thread]