Expand does not expands?

zellerin at winbase.software602.cz zellerin at winbase.software602.cz
Mon May 28 13:51:51 CEST 2001


Hello,

I got to GiNaC only recently, and I have some troubles with the expand()
function. I would expect following code

--------
#include <ginac/ginac.h>

using namespace GiNaC;

symbol x("x"), y("y");

ex laplace_in_oblates(const ex& potential)
{
	ex x_part=diff((x*x-1)*diff(potential,x), x);
	ex y_part=diff((1-y*y)*diff(potential,y), y);

	return normal(x_part+y_part);
}

int main()
{
    ex R=sqrt(x*x+y*y-1);
    ex tmp=expand(pow(R, 5)*laplace_in_oblates(1/R));
    cout << tmp<<" = "<<tmp.normal() << endl;
    return 0;
}
---------

to yield 0 = 0, but it gives

3*(-1+x^2+y^2)*y^2-3*x^2+3*x^4-3*(-1+x^2+y^2)*x^2-3*y^4+3*y^2 = 0

I would say that the polynomial on the left side is not expanded, in spite of
the fact that it should be result of an expand. Anyone give me a hint what I
am doing/expecting wrong?

(tried on GiNaC version 0.6.4 on RedHat Linux 6.1 and GiNaC 0.8.3 on RH 7.1)

Thanks

Tomas Zellerin
-
To UNSUBSCRIBE, email to ginac-list at ginac.de with a subject of "unsubscribe".



More information about the GiNaC-list mailing list