Re: quadp

*To*: mathgroup at smc.vnet.net*Subject*: [mg115220] Re: quadp*From*: Andrzej Kozlowski <akoz at mimuw.edu.pl>*Date*: Tue, 4 Jan 2011 04:28:37 -0500 (EST)*References*: <ifs30a$oor$1@smc.vnet.net> <4D21F917.2020209@cs.berkeley.edu> <48AEFA8B-880D-4B9A-B9CC-C1C7414D1384@mimuw.edu.pl> <A934FC78-8B93-45FB-A48D-D5BE2606760E@mimuw.edu.pl> <4D2254B8.8080703@eecs.berkeley.edu>

On 3 Jan 2011, at 23:59, Richard Fateman wrote: > On 1/3/2011 12:28 PM, Andrzej Kozlowski wrote: >> >> I forgot one obvious matter. A better way to solve this problem is: >> >> quadp[f_, x_] /; PolynomialQ[f, x]&& Exponent[f, x] == 2 := >> qq @@ CoefficientList[f, x] >> >> quadp[5 + 4*x + 3*x^2, x] >> >> qq(5,4,3) >> >> quadp[r*x^2 + s*x^2, x] >> >> qq(0,0,r+s) > > yours does not work for quadp[(x^3+x)/x, x], which I think is a quadratic. > my program agrees with me. > If you are going to include non-explcit polynomials than of course you need to use Simplify. Try your program on, for example, (Sin[x]^2 + Cos[x]^2) x or lots of other expressions of this kind. This is a "polynomial" as much as (x^3+x)/x is. Andrzej Kozlowski