Discussion:
getDegree method
(too old to reply)
Anthony Bow
2005-02-05 17:54:55 UTC
Permalink
Hi,

for the getDegree() method,

the requirements say that it should return the highest power which has a
nonzero coefficient. What if all the coefficients of a certain polynomial
are zero? then what should the getDegree method return?

thx
Jimmy XU
2005-02-05 20:32:02 UTC
Permalink
zero of coz

thx
Post by Anthony Bow
Hi,
for the getDegree() method,
the requirements say that it should return the highest power which has a
nonzero coefficient. What if all the coefficients of a certain polynomial
are zero? then what should the getDegree method return?
thx
Amir Safavi
2005-02-11 23:26:54 UTC
Permalink
It's really not *that* obvious.

Most (math) people I've seen (ie. Herstein "Topics in Algebra", Friedberg
"Linear Algebra", Hoffman "Linear Algebra") don't define it at all.
Others define it to be either -1 or -infinity
[http://mathworld.wolfram.com/ZeroPolynomial.html]. -infinity probably
makes the most sense from a mathematician's point of view because then
equations like deg pq = deg p + deg q don't need to have a "non-zero"
clause.

I guess in the context of this project though, 0 is the most natural
choice for deg 0, which is what I implemented for my submission.

-Amir
Post by Jimmy XU
zero of coz
thx
Post by Anthony Bow
Hi,
for the getDegree() method,
the requirements say that it should return the highest power which has a
nonzero coefficient. What if all the coefficients of a certain polynomial
are zero? then what should the getDegree method return?
thx
Loading...