[GiNaC-list] problem with function pow

Saurav Pathak saurav at sas.upenn.edu
Tue Jan 31 01:31:20 CET 2006


hi,

i am having trouble turning a string with function "pow" into an
expression.  an example of the code is given below along with the 
output.  i cannot figure out what i am doing wrong.

thanks for your help in advance.
--------
#include <iostream>
#include <string>
#include <ginac/ginac.h>
#include <ginac/power.h>
using namespace std;
using namespace GiNaC;

int main()
{
    lst all;
    all.append(symbol("x"));

    // no pow
    string str2 = "x*x";
    ex e2(str2, all);
    cout << "nopow : " << e2 << endl;

    // with pow
    string str = "pow(x, 2)";
    ex e(str, all);
    cout << "withpow: " << e << endl;

    return 0;
}

the output is:
nopow : x^2
terminate called after throwing an instance of 'std::runtime_error'
  what():  no function 'pow' with 2 parameters defined
Aborted
--------------------
-- 
saurav


More information about the GiNaC-list mailing list