
Boost : 
Subject: Re: [boost] Math tools polynomial enhancements
From: Marc Glisse (marc.glisse_at_[hidden])
Date: 20151029 11:23:34
On Fri, 30 Oct 2015, Jeremy Murphy wrote:
>> Division is interesting because it's not actually clear to me what the
>> result should be  is it a polynomial (plus remainder) or is it a rational
>> function (suitable reduced by the greatest common divisor).
>
> Yes, I was initially troubled by this question but resolved, admittedly
> more through intuition than proof, that polynomial division is Euclidean
> (integer) division: the / operator gives you the quotient, and % gives you
> the remainder. Someone with a deeper understanding of abstract algebra
> could presumably validate or discredit this claim. However, if one accepts
> this, then everything falls neatly into place, for example the /= operator
> makes sense, which it obviously wouldn't otherwise.
This looks like a sensible choice. The situation is pretty similar to
integers. 10 / 4 could return a rational type, but the choice was made to
stay in the original type and use the Euclidean domain structure instead.
You might want to provide a divlike function for people who want both the
quotient and the remainder without duplicating too much computation.
 Marc Glisse
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk