Negative hipow or something



"Stavros Macrakis" <macrakis at alum.mit.edu> writes:

> On Tue, Apr 29, 2008 at 7:27 AM, Rupert Swarbrick <rswarbrick at googlemail.com>
> wrote:
>
>     You get some function, f(w) and want to know the power of the leading
>     term in the taylor series of f about 0.
>     ...hipow( rat( first( taylor( f, w, 0, 0 ) ) ) )
>     (well actually it's in lisp, but it's basically this)
>
>     But if the power is negative then hipow returns 0.
>
>
> I don't have this problem (Maxima 5.14 GCL).
>
> taylor(atan(x)/x^3,x,0,4)  =>  1/x^2-1/3+x^2/5-x^4/7
> ff: first(%)  =>  1/x^2
> hipow(rat(ff),x) => -2
> hipow(ff,x)  =>  -2
>
> Could you please show us your exact code so we can reproduce and debug the
> problem? I wonder if it has something to do with rat variable ordering?  (Why
> do you have rat in there?)
>
>            -s

Ahah! I've hit it again, but now I know why:

MAXIMA> ($hipow '((MQUOTIENT) 2 $x) '$x)
1
MAXIMA> ($hipow '((mtimes) 2 ((mexpt) $x -1)) '$x)
-1
MAXIMA> 

The problem is that $hipow doesn't know about mquotient - is there a
nice way to do the transformation above? (which I did by hand!)

Feeling (very marginally) less stupid,

Rupert



P.S. No, I have no idea why I ended up with rat in there.