Maxima] numerical summation of series, rational case.
Subject: Maxima] numerical summation of series, rational case.
From: miguel lopez
Date: Tue, 26 Dec 2006 22:32:08 +0000 (UTC)
Richard Fateman <fateman <at> cs.berkeley.edu> writes:
>
>
> I don't know exactly what you are trying to do with ?principal, but I
> suspect it can be written without using lisp directly.
> Try reading about ratnumer, ratdenom, hipow, ratcoeff.
>
Yes, this is in maxima:
principal(ex):= block([num,den,h1,h2,c1,c2],num:ratnum(ex),den:ratdenom(y),
h1:hipow(num,n),h2:hipow(den,n),
[ratcoef(num,n,h1),ratcoef(den,n,h2),h2-h1]);
The code was a quick response, so it is not optimized. For example, there is not
need to compute the partfrac, when p is about 16-20 the computation produces
stack overflow!,
perhaps another day I can improve this code, but levin seems a little better.
Regards,
-M