[Edu-sig] An OOP view of the "number" concept

kirby urner kirby.urner at gmail.com
Thu Apr 19 18:42:21 CEST 2007


Forwarding from Math Forum:  more on how I think it pays
students nowadays to look at numbers differently, now that
they're consistently implemented as instances of a type
which includes methods and attributes per OOP.

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

Kirby

====

Re: Operations: binary vs unary
Posted: Apr 19, 2007 12:38 PM


In my math courses we consider a number's operational
capabilities to be a part of its "type" or "class".

Whereas we have the standard +, -, /, * operators to
play with, it's also possible to invoke these operations
using a consistent "dot notation" -- which I consider a
part of contemporary mathematics (characteristic of
several self-executing MNs [1]).

Using Python...

IDLE 1.2
>>> 3 .__neg__() # unary op takes no argument
-3
>>> -------3
-3
>>> 3 .__add__(5)
8
>>> 3 .__sub__(5) # binary op expects an argument
-2

Of course this still looks strange to people who grew
up in the 1900s (as I did) and think in a different paradigm.

In the old way of thinking, operations were not included
in our type definitions. The idea of "adding" was
somehow independent of the set theory definitions
(since dispensed with) of integers for example.

Nowadays, a number such as the integer 1 has "guts",
just as a string does.[2]

Kirby Urner
Saturday Academy
Silicon Forest, Oregon

[1] MNs = math notations, per Kenneth Iverson's treatise
thereon:
http://www.cacs.louisiana.edu/~mgr/404/burks/language/apl/camnweb/camn.htm

[2] 'OOP Meets Algebra, Suggesting New "Ways of Looking" '
by Kirby Urner First posted: Feb 24, 1999
http://www.4dsolutions.net/ocn/oopalgebra.html


More information about the Edu-sig mailing list