Dear All, There are many functions (abs, Heaviside, exp) which possess some power-simplification rules. I propose a patch to power.cpp and function.pl which allows to defines such rules in a way similar to derivative rules of functions. With the help of this I slightly improve the definition of abs() and it work now in this way: #include <ginac/ginac.h> using namespace GiNaC; int main(){ realsymbol a("a"); cout << pow(abs(a), 2) << endl; // -> a^2 cout << pow(abs(a), 3) << endl; // -> abs(a)^3 symbol r("r"); cout << pow(abs(r), 2) << endl; // -> abs(r)^2 cout << pow(abs(r), 3) << endl; // -> abs(r)^3 } i.e. pow(abs(a), 2*n) is simplified to pow(a, 2*n) for real a. I also delete a duplicated line from ginac.texi. If it will be useful to add a definition of Heaviside function to the GiNaC core, I can send a patch as well. Best wishes, Vladimir -- Vladimir V. Kisil email: kisilv@maths.leeds.ac.uk -- www: http://maths.leeds.ac.uk/~kisilv/
participants (1)
-
Vladimir Kisil