List Info

Thread: Picking Nits in "Learning to Program"




Picking Nits in "Learning to Program"
user name
2007-02-16 12:28:02
Alan:

This is arguably a minor detail, and not directly related to
Python but, hey, I'm a programmer.  Minor details are my
stock in trade.  So here goes.  

In "Learning to Program", look at "The Raw
Materials", "Real Numbers".  The first
sentence, "These are fractions" is technically
incorrect, but incomplete.  While it's true that fractions
(i.e. rational numbers) are real numbers, there are far more
real numbers that cannot be expressed as a ratio of two
integers.  Hence the name "Irrational Numbers". 
The square root of two is the prime example. (Sorry, can't
do the math symbol in Plain Text.)  

You might say something like, "Fractions are examples
of real numbers."  

I know, I know.  Strictly speaking, integers are real
numbers, too.  But let's not quibble. 8^)

Regards,
 
Barry
barry.carrollpsc.com
541-302-1107
________________________
We who cut mere stones must always be envisioning
cathedrals.
-Quarry worker's creed


_______________________________________________
Tutor maillist  -  Tutorpython.org
http://
mail.python.org/mailman/listinfo/tutor

Re: Picking Nits in "Learning to Program"
country flaguser name
Belgium
2007-02-16 19:39:35
Carroll, Barry schreef:
> Alan:
> 
> This is arguably a minor detail, and not directly
related to Python
> but, hey, I'm a programmer.  Minor details are my stock
in trade.  So
> here goes.
> 
> In "Learning to Program", look at "The
Raw Materials", "Real
> Numbers".  The first sentence, "These are
fractions" is technically
> incorrect, but incomplete.  While it's true that
fractions (i.e.
> rational numbers) are real numbers, there are far more
real numbers
> that cannot be expressed as a ratio of two integers. 
Hence the name
> "Irrational Numbers".  The square root of two
is the prime example.
> (Sorry, can't do the math symbol in Plain Text.)

That's all true, but it's also that true that real numbers
as they are 
implemented in computers are not really real numbers. They
are 
implemented as binary fractions multiplied by some power of
two (just 
like scientific notation, but binary based instead of
decimal based). 
Have a look at http://en.wikip
edia.org/wiki/IEEE_754 for the details.

That makes them effectively rational numbers or fractions.
It's about 
the best approximation for real numbers computers have to
offer.

-- 
If I have been able to see further, it was only because I
stood
on the shoulders of giants.  -- Isaac Newton

Roel Schroeven

_______________________________________________
Tutor maillist  -  Tutorpython.org
http://
mail.python.org/mailman/listinfo/tutor

Re: Picking Nits in "Learning to Program"
country flaguser name
Belgium
2007-02-16 19:47:56
Carroll, Barry schreef:
> In "Learning to Program", look at "The
Raw Materials", "Real
> Numbers".  The first sentence, "These are
fractions" is technically
> incorrect, but incomplete.  While it's true that
fractions (i.e.
> rational numbers) are real numbers, there are far more
real numbers
> that cannot be expressed as a ratio of two integers. 
Hence the name
> "Irrational Numbers".  The square root of two
is the prime example.
> (Sorry, can't do the math symbol in Plain Text.)
> 
> You might say something like, "Fractions are
examples of real
> numbers."

Notwithstanding my other mail, it might be better to use
another term. 
Alan, you already use the name 'floating point numbers' in
that section; 
I think it's a bit better to always refer to those numbers
by that name, 
and mention 'real numbers' as an alternative name. The
opposite of the 
current situation more or less actually.

-- 
If I have been able to see further, it was only because I
stood
on the shoulders of giants.  -- Isaac Newton

Roel Schroeven

_______________________________________________
Tutor maillist  -  Tutorpython.org
http://
mail.python.org/mailman/listinfo/tutor

Re: Picking Nits in "Learning to Program"
country flaguser name
United Kingdom
2007-02-16 19:48:53
"Carroll, Barry" <Barry.Carrollpsc.com> wrote

> "Real Numbers".  The first sentence,
"These are fractions" is 
> technically incorrect, but incomplete.  

Yep, I thought I'd changed that following a discussion 
with Dick Moores about the same section.

> While it's true that fractions (i.e. rational numbers)


But here we come to an interesting divergence of opinion. 
You see, in UK Math classes fractions cover more than 
the rational numbers. A fraction is any number which is 
not a whole number(*). That's their definition in English
(here) 
too. Of course that still makes my Real numbers wrong 
since, as you say, Reals include both whole numbers and 
fractions. 

(*) Thus we have decimal fractions...Blood fractions, 
atomic fractions etc etc...

> real numbers that cannot be expressed as a ratio of 
> two integers.  Hence the name "Irrational
Numbers".  

I prefer rational and irrational as definitions because they

mean the same both sides of the pond!

> "Fractions are examples of real numbers."  

And that's almost what I thought I'd said....

It seems I didn't upload the changed version. 
It now says of Reals: 'These include fractions'

I'll get the changed version uploaded over the weekend.
I'm happy for the nitpicking, because I do try to be very 
careful about my terminology, because as you say it is 
extremely important to be precise in programming. 
Occasionally we get these minor trans-Atlantic glitches 
but usually it's consistent 

-- 
Alan Gauld
Author of the Learn to Program web site
http://ww
w.freenetpages.co.uk/hp/alan.gauld

_______________________________________________
Tutor maillist  -  Tutorpython.org
http://
mail.python.org/mailman/listinfo/tutor

Re: Picking Nits in "Learning to Program"
country flaguser name
United Kingdom
2007-02-17 03:42:08
"Roel Schroeven" <rschroev_nospam_mlfastmail.fm> wrote

> Notwithstanding my other mail, it might be better to
use another 
> term.
> Alan, you already use the name 'floating point numbers'
in that 
> section;

I did consider that but since some programming languages
specifically
have a "Real" type(Pascal, Modula, etc) I decided
to leave it as it 
was.
Even though the 'Real' is really a Float...

> I think it's a bit better to always refer to those
numbers by that 
> name,
> and mention 'real numbers' as an alternative name. The
opposite of 
> the
> current situation more or less actually.

Yeah, That might be a better way to deal with it.
I'll consider a rewrite of that section to that style next
time 
through.
For now its not top of my priority list! 

Alan G. 


_______________________________________________
Tutor maillist  -  Tutorpython.org
http://
mail.python.org/mailman/listinfo/tutor

[1-5]

about | contact  Other archives ( Real Estate discussion Medical topics )