MathGroup Archive 2011

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: quadp

  • To: mathgroup at smc.vnet.net
  • Subject: [mg115236] Re: quadp
  • From: DrMajorBob <btreat1 at austin.rr.com>
  • Date: Tue, 4 Jan 2011 18:50:56 -0500 (EST)

Perhaps adding Expand will do:

quadp[f_, x_] /; PolynomialQ[f // Expand, x] && Exponent[f, x] == 2 :=
   qq @@ CoefficientList[f, x]

quadp[(x^3 + x)/x, x]

qq[1, 0, 1]

Bobby

On Tue, 04 Jan 2011 03:25:56 -0600, Richard Fateman  
<fateman at eecs.berkeley.edu> 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.
>
>
>


-- 
DrMajorBob at yahoo.com


  • Prev by Date: Why are both locators moving?
  • Next by Date: original meaning of System` functions
  • Previous by thread: Re: quadp
  • Next by thread: Re: quadp