Thanks. This will help me in my learning how to write a function.
Doug
Richard Fateman wrote:
>
> Partfrac solves a given problem over the rational numbers,
> not the (approximate) real numbers.
>
> If you really want the (numeric, approximate) partial
> fraction expansion, that can be computed, but partfrac doesn't do that.
>
>
> See note below yours, for a program, fpfe, that does this.
>
> (C8) fpfe(d1,s);
> 1.677050983124843 1.677050983124843
> (D8) --------------------- - ---------------------
> s + 2.105572809000084 s + 3.894427190999916
> (C9)
> .... keepfloat:true$
> ratsimp(d8); gives
> almost the same as what you started with.
> But not exactly.
> RJF
>
> PS, as far as I know, this is not in the "share" directory. But
> it could be put there. LLGPL.
>
>
>
>
> Doug Stewart wrote:
>
>>>>
>> partfrac ( +3 /(s^2 +6*s +8.2),s) ;
>>
>> Since this has 2 real roots I would expect two terms in the answer
>> but I get only 1.
>> how do you make it give the two terms?
>> Doug Stewart
>>
>> _______________________________________________
>> Maxima mailing list
>> Maxima@math.utexas.edu
>> http://www.math.utexas.edu/mailman/listinfo/maxima
>
>
>
> fpfe(p,x):=
> block ([num, den,div, res,keepfloat:true,lroots,distinctroots,qq, L,
> c],
> local(r,q),
> p:rat(p), num:ratnumer(p), den:ratdenom(p), div: divide(num,den),
> res: ratdisrep(div[1]),
> num: ratdisrep(div[2]/ratcoef(den,x^hipow(den,x))),
> lroots:map(rhs,allroots(den)),
> r[i]:=0, for c in lroots do r[c]:r[c]+1,
> distinctroots: map(first,rest(arrayinfo(r),2)),
> qq:1,
> for c in distinctroots do qq:qq*(x-c)^r[c],
> for c in distinctroots do q[c]:qq/(x-c)^r[c],
> for c in distinctroots do for i: 1 thru r[c] do
> res: res+1/(r[c]-i)!
> *ratsimp(subst(c,x,diff(num/q[c],x,r[c]-i)))
> /(x-c)^i,
> return(res));
>
>
>
> /*
> Published in Proc. ISSAC'82, "Computer Algebra and Numerical
> Integration," by R. Fateman p 228 - 232 */
>