[GiNaC-devel] Function & Power patch
Vladimir Kisil
kisilv at maths.leeds.ac.uk
Mon Sep 26 23:32:43 CEST 2005
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 at maths.leeds.ac.uk
-- www: http://maths.leeds.ac.uk/~kisilv/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: text/x-c
Size: 3988 bytes
Desc: Diff file of the patch
Url : http://www.cebix.net/pipermail/ginac-devel/attachments/20050926/173db122/attachment.bin
More information about the GiNaC-devel
mailing list