# [Maxima] Bug # 535363 and using polynomialp

Richard Fateman fateman at cs.berkeley.edu
Fri Sep 21 11:27:25 CDT 2007

```I'm missing something here..
A polynomial at any finite point is finite.
A polynomial at infinity looks like its leading term.
Why would you use lHopital's rule?
As for testing whether something is a polynomial, consider converting it to
rational form and see
(1) if the denominator is a constant
(2) there is only one variable in the list of variables in the header.
This would be a 3 line program.  It might take more time but it would
notice that (x^2-1)/(x+1) was a polynomial.

I don't know what program is in the linear algebra package.

If you want to fix all the bugs in the limit package, I think that looking
at Gruntz's PhD thesis would give you a guide as to how to replace it by
something more likelyto work.
RJF

> -----Original Message-----
> From: maxima-bounces at math.utexas.edu
> [mailto:maxima-bounces at math.utexas.edu] On Behalf Of Rupert Swarbrick
> Sent: Friday, September 21, 2007 8:53 AM
> To: maxima at math.utexas.edu
> Subject: [Maxima] Bug # 535363 and using polynomialp
>
> Hi!
>
> I'm trying to get better at both lisp and maxima, and thought that
> looking at some of the ancient bugs on sourceforge might help me.
>
> For this one, rtoy suggests:
>
> "Alternatively, we could make L'Hopital check to see if the
> numerator or denominator is a polynomial and change the
> limit appropriately."
>
> which I think is a good idea, so I was looking at limit.lisp and
> finally worked out the calling structure of limit2 down to
> lhospital. I
> thought a logical thing to do might be to have another global
> variable,
> \$lhospitalpolylim, which would be bigger by default than
> \$lhospitallim.
>
> When lhospital-catch got hold of a numerator/denominator pair for the
> first time, it would test to see whether the denominator was a
> polynomial in the variable that was tending to wherever. If so, it
> would allow \$lhospitalpolylim iterations instead of \$lhospitallim
> iterations if \$lhospitalpolylim was bigger than the degree of the
> polynomial. This would be absolutely sure to finish happily.
>
> Thoughts:
>  - There should still be an upper limit even if there's a poly
> underneath, as the top might get arbitrarily horrible, so you don't
> want to be calling limit2 1000 times for example.
>  - This idea could be extended if there's some nice way of telling
> what the behaviour of the denominator under repeated differentiation
> is. I don't know whether that is easily doable.
>
> HOWEVER:
>
> Clearly to implement this, I'd need to test whether the denominator
> was a polynomial. This is trivial with polynomialp, I think, but I
> wanted to check:
>
> a) Whether the whole idea was a waste of time anyway
> b) Whether people were averse to having the linear algebra package
> pulled into limit.lisp
>
> and if so
>
> c) Whether there was another approach - polynomialp looks rather
> overly clever for what this would need.
>
>
>
> Any suggestions?
>
> Rupert
>
```