A partfrac limitation



Dear Robert, thank you for your help. WMI2 (development version) is already
using your code. ;-)

What I changed is

  if expand(expr)#expand(fac) then error(),

to

  if (not (expand(expr) = expand(fac))) then error(),

because WMI2 uses # for internal operations. (Probably this should be
changed someday to another symbol, not used by Maxima. Any suggestions?)

Best regards, Zoltan

2008/4/1, Robert Marik <marik at mendelu.cz>:
>
> Hi Zoltan, I think that there should be denom(e)
>
> my_partfrac(e, x) := partfrac(num(e)/factor_with_solve(denom(e), x), x)$
>
> Another problem is that factor_with_solve factors over complex numbers. I
> used the following:
> (factor_with_solve_real is very close to factor_with_solve but gives
> factorization over reals)
>
> factor_with_solve_real(expr, n) := block(
>   [sol, fac, expr1],
>   sol : solve(expr, n),
>   expr : ratexpand(expr),
>   fac : ratcoef(expr, n, hipow(expr, n)),
>   for i:1 thru length(sol) do (
>     if not(freeof(n, rhs(sol[i]))) then error(),
>     if imagpart(rectform(rhs(sol[i])))=0 then
>       fac : fac * (n - rhs(sol[i]))^multiplicities[i]
>       else
>         (if imagpart(rectform(rhs(sol[i])))>0 then
>           fac:
> fac*(ratsimp(expand((n-rhs(sol[i]))*(n-conjugate(rhs(sol[i]))))))^multiplicities[i])
>
>   ),
>   if expand(expr)#expand(fac) then error(),
>   fac
> )$
>
> my_partfrac(e, x) := partfrac(num(e)/factor_with_solve_real(denom(e), x),
> x);
>
>
> Robert M.
>
> On Tue, Apr 1, 2008 at 8:15 PM, Kov?cs Zolt?n <kovzol at matek.hu> wrote:
>
> > Dear All, I have the same problem with partfrac like Albert Reiner had:
> >
> > kovzol at pascal:~$ maxima
> > Maxima 5.13.0 http://maxima.sourceforge.net
> > Using Lisp CLISP 2.38 (2006-01-24)
> > Distributed under the GNU Public License. See the file COPYING.
> > Dedicated to the memory of William Schelter.
> > This is a development version of Maxima. The function bug_report()
> > provides bug reporting information.
> > (%i1) load(simplify_sum)$
> > (%i2) my_partfrac(e, x) := partfrac(num(e)/factor_with_solve(e, x), x)$
> > (%i3) my_partfrac(1/(x^4+20*x^2+120), x);
> > Division by 0
> > #0: my_partfrac(e=1/(x^4+20*x^2+120),x=x)(simplify_sum.mac line 511)
> > -- an error.  To debug this try debugmode(true);
> >
> > Am I using a too old version of Maxima?
> >
> > Best regards, Zoltan
> >
> > _______________________________________________
> > Maxima mailing list
> > Maxima at math.utexas.edu
> > http://www.math.utexas.edu/mailman/listinfo/maxima
> >
> >
>


-- 
matek.hu --- mert matekb?l ?retts?gizni mindenkinek kell...