Forums: » Register « |  Free Tools |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support |

New Free Tools on Dev Shed!

#1
November 12th, 2012, 09:21 PM
 norm850
Registered User

Join Date: Sep 2012
Posts: 15
Time spent in forums: 4 h 13 m 33 sec
Reputation 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
November 12th, 2012, 09:34 PM
 norm850
Registered User

Join Date: Sep 2012
Posts: 15
Time spent in forums: 4 h 13 m 33 sec
Reputation 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?

#3
November 12th, 2012, 09:45 PM
 norm850
Registered User

Join Date: Sep 2012
Posts: 15
Time spent in forums: 4 h 13 m 33 sec
Reputation Power: 0
Solved! Just used .denominator

#4
November 12th, 2012, 09:48 PM
 Lux Perpetua
Contributing User

Join Date: Feb 2004
Location: San Francisco Bay
Posts: 1,939
Time spent in forums: 1 Month 1 Week 3 h 27 m 29 sec
Reputation Power: 1312
FYI, the degree of a polynomial is always a nonnegative integer, the only exception being the zero polynomial, whose degree is considered infinite.

 Viewing: Dev Shed Forums > Programming Languages > Python Programming > Figuring out if polynomial has negative degree?