I'm working on code that needs to multiply expression=
s that are in
partial fraction form and return the product in partial fr=
action form.
The expressions can be big and partfrac(f * g,x) can =
be slow.
Consider
(%i20) p : sum(k/(x-k),k,1,=
75)$
Evaluation took 0.00 seconds (0.00 elapsed)
(%i21) q : sum(k/(x+=
k),k,1,75)$
Evaluation took 0.00 seconds (0.00 elapsed)
(%=
i22) partfrac(p*q,x)$
Evaluation took 45.22 seconds (45.22 elapsed)
My simple-minded speedup is
(defun op-equalp (e op)
(and (consp e) (consp (car e)) (equal =
(caar e) op)))
(defun $pfmult (f g x)
=
(let ((acc 0))
(setq f (if (op-equalp f 'mplus) (marg=
s f) (list f)))
(setq g (if (op-equalp g 'mplus) (mar=
gs g) (list g)))
(dolist (fi f acc)
&n=
bsp; (dolist (gi g)
&nbs=
p; (setq acc (add ($partfrac (mul fi gi) x) acc))))))
(=
%i23) pfmult(p,q,x)$
Evaluation took 2.03 seconds (2.03 elapsed)
Does anyone know of (non simple-minded) maxima code&nbs=
p;for fast computations
with expressions in partial fraction form? =
;
By the way, compiling with non-cvs 5.9.1=
is broken under XP
(%i4) compile=5Ffile("C:\\Do=
cuments and Settings\\Barton Willis\\My Documents\\maxima\\pfrac.lisp");
Compiling C:/Documents and Settings/Barton Willis/My Documents/maxima/pfra=
c.lisp.
End of Pass 1.
End of Pass 2.
Maxima encount=
ered a Lisp error:
(SYSTEM "gcc -c -Wall -DVOL=3Dvolatile -=
fsigned-char -pipe -fno-zero-initialized-in-bss -mms-bitfields -mcpu=3Di386=
-march=3Di386 -Ic:/gcl/lib/gcl-2.6.5/unixport/../h -O -c -w C:=
/Documents and Settings/Barton Willis/My Documents/maxima/pfrac.c -o C:/Doc=
uments and Settings/Barton Willis/My Documents/maxima/pfrac.o") returned a =
non-zero value 1.
Barton
=