rat and bothcoef error



On 2/20/2012 11:44 AM, nijso beishuizen wrote:
> Dear all,
>
> Iam playing with a routine that checks if an input function is linear 
> or not. In the bothcoef example in the manual, rat is used inside 
> bothcoef like this:
>          c: bothcoef (rat (expr, x), x),
>
> with some expressions, this gives me an error (bothcoef: invalid arguments) due to the use of 'rat',
> for example here:
>
> (%i01) expr :  -(x)/(x*x+y);
>
bothcoef works if expr is a polynomial in x.  In this case, bothcoef is 
called on a rational expression
in x.

If you want to make expr into a polynomial, you can use taylor series 
and get
-x/y + x^3/y^2 -x^5/y^3 + ....   which is unlikely to be what you want.

ratcoef and coef have different results. Not clear what you really want 
to produce.

RJF