stepthom/math-fun — pull request #44 by jgus (2013-12-03 00:00:37+00:00)
Title: Issue 39

This fixes #39.

I'd actually argue that I'd prefer the behavior _before_ this fix; that is, a constant function is a perfectly valid linear function in my mind.

Given that we do, however, want to be able to limit function creation to strictly first-degree polynomials, then I think a simple boolean "forceLinearFunction" flag on MathFunctionFactory.create() isn't really the right approach. We're using that one flag to control two behaviors: (1) Limiting the degree of the polynomial to 1, and (2) requiring that the first-degree coefficient be non-zero. Those behaviors seem pretty orthogonal to me, so I made an overload of create() that controls them independently, and just forwarded the original to the new implementation.

Note this builds on the (minor) PR for the doc updates, which ideally should be merged before this.