#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2012
    Posts
    15
    Rep Power
    0

    Figuring out if polynomial has negative degree?


    How would I go about printing out "Degree is below 0" of a polynomial, such as x^-2 + x + 1 or x^2 + x^-1 + 1?

    I've tried something like: x^n = x^-2, if n<0: print 'Degree is below 0'.

    Any other ideas?
  2. #2
  3. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2012
    Posts
    15
    Rep Power
    0
    I believe I have figured out how to do it, though now my question is, how would I access each term of the polynomial?
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2012
    Posts
    15
    Rep Power
    0
    Solved! Just used .denominator
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    Feb 2004
    Location
    San Francisco Bay
    Posts
    1,939
    Rep Power
    1313
    FYI, the degree of a polynomial is always a nonnegative integer, the only exception being the zero polynomial, whose degree is considered infinite.

IMN logo majestic logo threadwatch logo seochat tools logo