expand()

Chris Dams chrisd at sci.kun.nl
Fri Dec 12 13:41:30 CET 2003


Hello,

On Thu, 11 Dec 2003, Christian Bauer wrote:

> I've put something into CVS that I'm still not fully satisfied with but that
> appears to work and is faster than the original patch. Comments and
> suggestions are appreciated...

chrisd at gamow:~/c++> more test.C
#include<iostream>
#include<ginac/ginac.h>

using namespace std;
using namespace GiNaC;

int main()
{       symbol a("a");
        symbol b("b");
        symbol c("c");
        symbol d("d");
        ex result=power(sqrt(a+b)+sqrt(c+d),3);
        cout << result.expand() << endl;
        return 0;
}
chrisd at gamow:~/c++> g++ -o test test.C -lginac
chrisd at gamow:~/c++> ./test
(d+c)^(3/2)+3*(b+a)*sqrt(d+c)+(b+a)^(3/2)+3*sqrt(b+a)*(d+c)

Bye,
Chris




More information about the GiNaC-devel mailing list