patch for expand.
Chris Dams
chrisd at sci.kun.nl
Tue Dec 2 15:26:20 CET 2003
Hello everybody,
I found out that calling the expand() method on an expression like
(d*sqrt(a+b)+a*sqrt(c+d))*(b*sqrt(a+b)+a*sqrt(c+d))
results in
sqrt(b+a)*b*sqrt(d+c)*a+(d+c)*a^2+d*(b+a)*b+d*sqrt(b+a)*sqrt(d+c)*a
This result could be further expanded. A patch that is supposed to make
this happen is attached.
Best regards,
Chris
-------------- next part --------------
===================================================================
RCS file: /home/cvs/GiNaC/ginac/mul.cpp,v
retrieving revision 1.79
diff -r1.79 mul.cpp
920c920
< setflag(status_flags::dynallocated | (options == 0 ? status_flags::expanded : 0)));
---
> setflag(status_flags::dynallocated));
922,923c922
< return ((new add(distrseq))->
< setflag(status_flags::dynallocated | (options == 0 ? status_flags::expanded : 0)));
---
> return ex((new add(distrseq))->setflag(status_flags::dynallocated)).expand();
Index: ncmul.cpp
===================================================================
RCS file: /home/cvs/GiNaC/ginac/power.cpp,v
retrieving revision 1.88
diff -r1.88 power.cpp
760,761c760
< return (new add(result))->setflag(status_flags::dynallocated |
< status_flags::expanded);
---
> return ex((new add(result))->setflag(status_flags::dynallocated)).expand();
828c827
< return (new add(sum))->setflag(status_flags::dynallocated | status_flags::expanded);
---
> return ex((new add(sum))->setflag(status_flags::dynallocated)).expand();
More information about the GiNaC-devel
mailing list