Object Oriented Rational Number Class

Rational Numbers have rules as an ordered pair of numbers.  One standard way of doing this is at Wikipedia.


As a slightly funky take on this, let us try to motivate it by an incomplete development of fractions.  We consider unsigned or presigned rational numbers.

A fraction or rational number is an ordered pair (m,n)  of natural numbers subject to rules or procedures.   (Alternative it is an equivalence class of ordered pairs but we avoid this extra verbiage for simplicity.)  In the fraction, n is never zero.  The rules we give are such that we never start from fractions with n non-zero and get n zero.

First we define mirror equality of (m,n) and (p,q) as m=p and n = q.

We can define equivalence of fractions as (m,n) and (p,q) are equivalent if m*q = n*p.

We now define division of an ordered pair by a natural number.

(p,q)/n = (p,q*n)

We define successor of an ordered pair.

(m,n)’ = (m’,n)

We allow m greater than or equal to n.

We now define addition with the same second element, the denominator.

(m,n) + (0,n) = (m,n)

(m,n) + (p’,n) =  [(m,n) + (p,n)]’

We can then prove that

(m,n) + (p,n) = (m+p,n)

We can define multiplication by a natural number

(m,n) * p = (m*p,n)

We can now define multiplication of (m,n) by (p,q)

as first multiplying by p and then dividing by q.

(m,n)*(p,q) = [(m,n)*p]/q = (m*p,n*q)

Exercise: Prove the last equality given the first equality.

This way of developing rational numbers has more motivation to it.  It parallels pizza slicing and adding pizza slices, but does not use pizza to define rational numbers.  Nor does it use area or geometry to define rational numbers.

Rational numbers have data and rules for manipulating data and rules for combining two or more rational numbers in a function.  The ordered pair nature of functions can be used to emphasize that addition and multiplication of rational numbers are functions. This can be done by first defining multiplying a fraction by a natural number as a function and then dividing a fraction by a natural number as a function and then the composition of them. This can be done with ordered pairs.  This gives us a project for students to do.

Exercise: Work out the above approach.  Illustrate it with numerical examples.


About New Math Done Right

Author of Pre-Algebra New Math Done Right Peano Axioms. A below college level self study book on the Peano Axioms and proofs of the associative and commutative laws of addition. President of Mathematical Finance Company. Provides economic scenario generators to financial institutions.
This entry was posted in Math Projects for Students, Number classes, Object oriented concepts, Object Oriented Rational Number, Rational Number Projects. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s