[GiNaC-list] real and imaginary parts of an expression
Martin DRUON
martin.druon at wanadoo.fr
Mon May 28 14:56:48 CEST 2007
hello,
I would like to know how I can get the real part and the imaginary part of an expression (GiNaC::ex)...
for example :
#include <iostream>
#include <ginac/ginac.h>
using namespace GiNaC;
int main(int argc, char **argv)
{
symbol x("x"), y("y"); // My complex number : x + iy
symbol Q("Q"), a("a"); // Parameters
// My expression
ex f = (Q / 2 * Pi) * log(((x + I * y) - a) / ((x + I * y) + a));
std::cout << f << std::endl;
// f.real() -> How I can get real part ???
// f.imag() -> How I can get imaginary part ???
return EXIT_SUCCESS;
}
Is it possible easily ?
Thanks
Martin
More information about the GiNaC-list
mailing list