Hi Marcelo,
Well, after a lot of debugging I know the problem with my pade.mth now (it
has something to do with the built-in function TERMS, whose behaviour is
sometimes unpredictable), but I don't know how to fix it without a decrease
of performance.
For the time being, I can offer you the following fix though, which is
considerably slower, but on the other hand far more transparent. (Hence,
there might be people out there who appreciate this version even more!)
pade(y, x, x0, n, d, j_ := 0, t_ := 0) :=
PROG(
LOOP(
t_ :+ LIM(y, x, x0)·x^j_,
j_ :+ 1,
IF(j_ > n + d, exit),
y := DIF(y, x)/j_),
t_ :* SUM(STRING(k_ + n)·x^k_, k_, 1, d) + 1,
t_ :- SUM(STRING(k_)·x^k_, k_, 0, n),
y := SUBST(ITERATES(DIF(u_, x), u_, t_, n + d), x, 0),
y := FIRST(SOLUTIONS(y, STRING([0, ..., n + d]))),
SUM(y SUB (k_ + 1)(x - x0)^k_, k_, 0, n)/(SUM(y SUB (k_ + n + 1)(x -
x0)^k_, k_, 1, d) + 1))
Please check it (by copying the program into the input line) and tell me,
if there are still problems.
Cheers,
Johann
At 09:50 AM 5/2/03 -0300, you wrote:
>Hi derivians,
> I had a problem with pade.mth that appears in DNL #49. Apparently
>it does not work properly on rational functions for some initial value of
>the variable (x=0 in my example), but it does if you change the expansion
>point. You may say that it is foolish to look for a rational approximation
>to a rational function, but I was just testing the program.
> Best regards,
> Marcelo
>
>Francisco M. Fernández,
>CEQUINOR, Departamento de Química, Facultad de Ciencias Exactas,
>Universidad Nacional de La Plata, Calle 47 y 115, Casilla de Correo 962,
>1900 La Plata, Argentina.
>Phone/fax: (54-221) 482-2643/424-0172
>E-mail [log in to unmask]
> [log in to unmask]
> [log in to unmask]
>http://www.conicet.gov.ar/webue/cequinor/mick.htm
>
>
>Attachment Converted: "c:\internet\eudora\attach\bugpade.mth"
>
>---
>Outgoing mail is certified Virus Free.
>Checked by AVG anti-virus system (http://www.grisoft.com).
>Version: 6.0.476 / Virus Database: 273 - Release Date: 24/04/03
>
|