MathGroup Archive 2011

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

Search the Archive

Re: quadp


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



  • Prev by Date: Re: How to change the directory for the docs?
  • Next by Date: Re: NDSolve, three 2-d order ODE, 6 initial conditions
  • Previous by thread: quadp
  • Next by thread: Re: quadp