getting expression as string
Chris Dams
chrisd at sci.kun.nl
Fri Feb 27 14:50:23 CET 2004
Hi!
On Fri, 27 Feb 2004, Kai Ludwig wrote:
> How can I get the string of a expression ?
> I saw a get_name() function for symbols but
> nothing similar for expressions.
#include<iostream>
#include<sstream>
#include<ginac/ginac.h>
using namespace std;
using namespace GiNaC;
int main()
{ symbol x("x");
symbol y("y");
ex f=x*y;
ostringstream o;
o << f;
string s=o.str();
cout << s << endl;
return 0;
}
Bye,
Chris Dams
More information about the GiNaC-list
mailing list