28 May
2007
28 May
'07
2:56 p.m.
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