[GiNaC-list] pole_error when expanding power into series
Camille Gillot
k1000.jlo at wanadoo.fr
Tue Nov 2 12:34:37 CET 2010
Hello,
I recently came across Ginac and I found it was an excellent tool.
The speed of series expansion is amazing compared to my hand-held calculator.
However, ginac 1.5.8 is unable to expand expressions like :
cos(x)^(sin(x)/x), even if it expands well sin(x)/x.
Using ginac compiled from git some days ago,
ginac-git/ginsh/ginsh
[...]
> series(cos(x)^(sin(x)/x),x==0,5);
power::eval(): division by zero
> series(((a^x+b^x)/2)^(1/x),x==0,2);
power::eval(): division by zero
I found out that was caused by ginac's attempt to use taylor formula in these
cases (in power::series in pseries.cpp line 1129 and 1134).
I give you a patch for it, that enables that kind of calculations :
(in patched ginsh)
> series(cos(x)^(sin(x)/x),x==0,5);
1+(-1/2)*x^2+1/8*x^4+Order(x^5)
> series(((a^x+b^x)/2)^(1/x),x==0,2);
(exp(1/2*log(b)+1/2*log(a)))+(-1/8*exp(1/2*log(b)+1/2*log(a))*(2*log(b)*log(a)-
log(a)^2-log(b)^2))*x+Order(x^2)
(or human-simplified sqrt(a*b)+(1/8*sqrt(a*b)*(log(a)-log(b))^2*x+Order(x^2) )
The exponential simplification is none of my abilities in Ginac.
Bye
Camille Gillot
-------------- next part --------------
A non-text attachment was scrubbed...
Name: pseries.diff
Type: text/x-patch
Size: 1004 bytes
Desc: not available
URL: <http://www.cebix.net/pipermail/ginac-list/attachments/20101102/3f58ee9b/attachment.diff>
More information about the GiNaC-list
mailing list