- To: mathgroup at smc.vnet.net
- Subject: [mg115227] Re: quadp
- From: Andrzej Kozlowski <akoz at mimuw.edu.pl>
- Date: Tue, 4 Jan 2011 18:49:15 -0500 (EST)
- References: <firstname.lastname@example.org> <4D21F917.email@example.com> <48AEFA8B-880D-4B9A-B9CC-C1C7414D1384@mimuw.edu.pl> <A934FC78-8B93-45FB-A48D-D5BE2606760E@mimuw.edu.pl> <4D2254B8.firstname.lastname@example.org> <CE956DA2-464F-4CFB-B2BB-8E4AEBB83CF4@mimuw.edu.pl>
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.