[Date Index] [Thread Index] [Author Index]
On 4 Jan 2011, at 07:27, Andrzej Kozlowski wrote: > > 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 > Obviously I meant (Sin[x]^2 + Cos[x]^2) x^2. AK.