patch for expansion of log.

Chris Dams chrisd at sci.kun.nl
Fri Apr 16 20:03:50 CEST 2004


Hello,

I found out that trying to calculate

	log(a*x+b*x*x*log(x)).series(x==0,3)

does not terminate. This is because in the function the argument has a
pole even if a log(a*x) is subtracted. The attached patch should solve
this. With this patch the result of the calculation is

(log(x*a))+(a^(-1)*b*log(x))*x+(-1/2*a^(-2)*b^2*log(x)^2)*x^2+Order(x^3)

as expected.

Have a nice weekend,
Chris Dams
-------------- next part --------------
Index: inifcns_trans.cpp
===================================================================
RCS file: /home/cvs/GiNaC/ginac/inifcns_trans.cpp,v
retrieving revision 1.54
diff -r1.54 inifcns_trans.cpp
200a201,216
> 			if(n==0 && coeff==1) {
> 				epvector epv;
> 				ex acc=(new pseries(rel, epv))->setflag(status_flags::dynallocated);
> 				epv.reserve(2);
> 				epv.push_back(expair(-1, _ex0));
> 				epv.push_back(expair(Order(_ex1), order));
> 				ex rest=pseries(rel, epv).add_series(argser);
> 				for(int i=order-1; i>0; --i) {
> 					epvector cterm;
> 					cterm.reserve(1);
> 					cterm.push_back(expair(i%2 ? _ex1/i : _ex_1/i, _ex0));
> 					acc = pseries(rel, cterm).add_series(ex_to<pseries>(acc));
> 					acc = (ex_to<pseries>(rest)).mul_series(ex_to<pseries>(acc));
> 				}
> 				return acc;
> 			}


More information about the GiNaC-devel mailing list