[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-gsl] Complex numbers - how?
From: |
Federico Zenith |
Subject: |
Re: [Help-gsl] Complex numbers - how? |
Date: |
Tue, 1 Mar 2005 15:37:13 +0100 |
User-agent: |
KMail/1.7.2 |
Alle 15:12, martedì 01 marzo 2005, Anders Misfeldt ha scritto:
> Hi,
>
> I have a program where I calculate an ugle integral. In the integral I'm
> having
>
> (1/(x^2-1))^{3/2}
>
> and my x is lower than 1! But since it's taking to the power of 3/2 I
> should still get a real number.
Hm, last time I checked i³ = -i. So you should indeed get an imaginary number
as long as x² < 1. Unless I'm missing something or my coffee was not strong
enough.
> 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?
Well, I suppose you did:
gsl_complex ztest ;
Other than that, you must consider that GSL_REAL (and GSL_IMAG too) is a macro
that _returns_ a value, not one that messes up its argument. So, to sum it
up,
gsl_complex ztest ;
GSL_SET_COMPLEX( &ztest, 3, 4 ) ;
printf( "%g", GSL_REAL(ztest) ) ;
Cheers,
-Federico
pgpbPyMavjQTq.pgp
Description: PGP signature