getting expression as string

Chris Dams chrisd at
Fri Feb 27 14:50:23 CET 2004


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.


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;

Chris Dams

More information about the GiNaC-list mailing list