Popular recipes tagged "polynomial" but not "rational"http://code.activestate.com/recipes/tags/polynomial-rational/2014-02-13T20:55:55-08:00ActiveState Code RecipesSimple polynomial class (Python) 2014-02-13T20:55:55-08:00Sam Dentonhttp://code.activestate.com/recipes/users/4172262/http://code.activestate.com/recipes/576953-simple-polynomial-class/ <p style="color: grey"> Python recipe 576953 by <a href="/recipes/users/4172262/">Sam Denton</a> (<a href="/recipes/tags/arithmetic/">arithmetic</a>, <a href="/recipes/tags/calculator/">calculator</a>, <a href="/recipes/tags/polynomial/">polynomial</a>). Revision 7. </p> <p>This implements polynomial functions over a single variable in Python. It represents the polynomial as a list of numbers and allows most arithmetic operations, using conventional Python syntax. It does not do symbolic manipulations. Instead, you can do things like this:</p> <pre class="prettyprint"><code>x = SimplePolynomial() eq = (x-1)*(x*1) print eq # prints 'X**2 - 1' print eq(4) # prints 15 </code></pre>