[Edu-sig] polystuff.py

kirby urner kirby.urner at gmail.com
Fri Feb 11 17:56:07 CET 2011


I link back to our posts from here:

http://mathforum.org/kb/message.jspa?messageID=7381491&tstart=0

<http://mathforum.org/kb/message.jspa?messageID=7381491&tstart=0>The next
turn of the spiral might involve taking such functions and
making them methods of a Polynomial object.

Example framework:

http://www.4dsolutions.net/ocn/python/simppoly.py

So you'd have operator overloading and write things like:

>>> p1 = Poly( {2:3, 1:4, 0:5} )
>>> p2 = Poly( {1:1, 0:5} )
>>> p1**4
>>> p1 * p2
>>> p1 + p2 etc.

Once you have polynomials as "math objects" you might
compare them with other objects that also add, multiply
etc.

Questions about closure arise i.e. what operations might
take you outside the Polynomial type for answers, etc.


<http://www.4dsolutions.net/ocn/python/simppoly.py>Kirby


On Thu, Feb 10, 2011 at 3:17 AM, Andrzej Kapanowski <ufkapano at gmail.com>wrote:

>
> Hello!
> Here is my representation of polynomials in Python as dictionaries.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/edu-sig/attachments/20110211/23d0e8c7/attachment.html>


More information about the Edu-sig mailing list