[Edu-sig] using Python as a calculator
Edward Cherlin
echerlin at gmail.com
Mon Apr 12 04:17:18 CEST 2010
On Sun, Apr 11, 2010 at 17:51, kirby urner <kirby.urner at gmail.com> wrote:
>>> Sorry, I don't know J (Kirby does), but this is exactly the reason I prefer
>>> Python. Readability counts (for me).
>>
>> That's what they said to Fibonacci when he tried to explain why Arabic
>> numerals were better for math than Roman numerals. But Roman numerals
>> are better in readability and algorithmic complexity if you rarely do
>> anything but add and subtract, as merchants did before interest
>> payments became critical.
The chapter on interest calculations in Liber Abaci was particularly important.
>> Roman numerals are precisely equivalent to
>> abacus notation. It is odd that the distinction between math/science
>> programming and business programming is nearly a thousand years old,
>> but there it is.
>>
> Fibonacci's Liber Abaci introduced the Indian/Arabic number system,
> based on the abacus.
No, in spite of the title, not based on the abacus, any more than
calculus is based on pebbles.
http://faculty.evansville.edu/ck6/bstud/fibo.html
Though the title of the book suggests the use of the abacus, in fact
Fibonacci freed arithmetic from calculations using the abacus.
> The place value system corresponds to the
> rods of the abacus, with the zero corresponding to a rod with no beads
> (a place holder).
>
> Roman numerals, in contrast, have nothing to do with abacus notation
> and have no place value e.g XIV for 14 or MMMCCC for 3300.
The Japanese, Chinese, and Roman abacI use beads or pebbles (calculi)
with values of 1 and 5.
http://en.wikipedia.org/wiki/Abacus
http://en.wikipedia.org/wiki/Roman_abacus
The Roman notation uses letters with values of 1 and 5 times a power
of 10, so that one can write down the Roman numeral for an abacus
setting simply by writing the letter corresponding to each calculus on
the board, or put a number on the board by placing a pebble for each
letter. Adding and subtracting Roman numerals is isomorphic with
manipulating an abacus.
7 --> 5+2 --> VII
3 --> 0+3 --> III
VII + III --> VIIIII --> VV --> X
5+2 + 0+3 --> 5+5 --> 0+1,0+0
and similarly for LXX + XXX etc.
> http://www.novaroma.org/via_romana/numbers.html
>
> Roman numbers suck for arithmetic operations of any kind IMO.
>
>> numbers =. i. 11 NB. 0..10
>
> ...similar to Python's range built-in.
>
>> These objections are trivial and uninformed. You aren't a
>> mathematician, you don't like math and math notation, so there is
>> nothing more to say, except please stand out of the way of people who
>> can benefit from it and want it.
>
> One could argue any computer language comprises a math notation.
In the mathematical theory of languages, we can regard any
Turing-complete symbol-and-rule set as a way to express all of
mathematics, but that is outside the question of what language to
teach or publish in, when the aim is communication with humans.
> Also, one could argue that all creatures are mathematicians in some
> innate way (Keith Devlin's point).
So they are, beyond argument. So why are we telling them how they want
to do math and computing? The mindset of "When I want to hear your
opinion, I'll tell it to you" is what I hate most about education
systems of the past and present.
> Carving out a special caste of humans and calling them "mathematicians"
> is a practice within various institutions.
Mathematicians are not a caste, but a guild with stiff entry
requirements. I am not a full member, since I quit after my BA and
went to teach in the Peace Corps.
> I've noticed many of these institutions promote a kind of snobbery,
> but then such is the human ego.
See The Theory of the Leisure Class, by Thorstein Veblen, and Buddhist
teachings on no-self. Reverse snobbery is also a feature of human ego.
>> You can append a table to a table if they have a dimension in common.
>> You can't append a table to a list unless the list is turned into a
>> one-row table.
>>
>
> Note that numpy shares some of APL's and J's ability to shape data
> into multi-dimensional objects with rank.
Yes. It would be more productive to discuss numpy here rather than
fight a meaningless rwar.
>>>> import numpy
>>>> a = numpy.array(range(10))
>>>> a
> array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])
>>>> a.reshape((2,5))
> array([[0, 1, 2, 3, 4],
> [5, 6, 7, 8, 9]])
>>>> a
> array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])
>>>> a = a.reshape((2,5))
>>>> a
> array([[0, 1, 2, 3, 4],
> [5, 6, 7, 8, 9]])
>>>> numpy.concatenate((a,a))
> array([[0, 1, 2, 3, 4],
> [5, 6, 7, 8, 9],
> [0, 1, 2, 3, 4],
> [5, 6, 7, 8, 9]])
>>>> numpy.concatenate((a,a), axis=1)
> array([[0, 1, 2, 3, 4, 0, 1, 2, 3, 4],
> [5, 6, 7, 8, 9, 5, 6, 7, 8, 9]])
>
>>>> I can easily give you a short sequence of lessons leading to this
>>>> level, introducing some other arithmetic, transcendental, and
>>>> array-handling functions along the way, and a little more about
>>>> operating on functions to define new functions.
>>>
>>> Python is much nearer to standard Math-notation, that is a good thing.
>>
>> LOL. Math notation is what mathematicians use, not schoolchildren.
>
> Math notations, like music notations, are the common heritage of
> humankind, not the special property of an elite caste of human.
>
> That being said, many math notations, including computer languages,
> are quite opaque until deciphered.
>
> Those already "in the know" may exult in their exclusive knowledge,
> that's been true since time immemorial.
>
> Those cryptic expressions on a T-shirt from the MIT gift shop serve
> as mnemonics, are reminders of long hours spent unpacking the
> meanings.
>
> To a non-initiate, it all looks like so much unreadable APL. :)
>
> Of course non-math notations share in these encrypting / compacting
> capabilities. You needn't use math notations to create operational
> systems (institutions) with their respective insiders and outsiders,
> with insiders often ranked according to their "degree" of inner-ness.
>
> We've not really defined "mathematics", "mathematician" or
> "math notation" for the purposes of this thread, so maybe one
> could argue that all notations are inherently mathematical in
> that they're aids to thought processes, which processes by their
> very nature are computational in some degree.
>
> Is Chinese a math notation? Write a 500 word essay on why it
> is. Write another 500 word essay on why it isn't.
>
>> They are constantly inventing more of it. What you call math notation
>> is known to mathematicians as "arithmetic".
>>
>
> Iverson called APL an executable math notation (MN). MNs were
> divided into machine-executable and not.
>
> Leibniz dreamed of machine-executable logical languages. We have
> them now, call them "computer languages".
>
>> There is no standard math notation.
>>
>
> Nor is there a strongly fixed meaning to the concept of "math
> notation". Is Python a math notation? One could argue that it
> is. Or call it a machine-executable logic.
>
>> Polish: + 1 2
>> Infix: 1 + 2
>> Reverse Polish: 1 2 +
>>
>> Reverse Polish is one of the two standard calculator input systems,
>> the one used by engineers, from HP. Polish is standard in LISP and
>> combinatory logic. Neither requires parentheses. Infix notation, as on
>> TI and related calculators, requires parentheses, and is much more
>> difficult for complex expressions.
>>
>>> I like to learn new languages - up to a point. I don't see the added value of
>>> J in this case.
>>
>> I like to learn languages a lot more than you, then. I don't consider
>> anybody educated in computing without knowing something of languages
>> from the LISP, APL, FORTH, OOP, and scalar language families.
>>
>
> "Like" may not be the operative word in all cases. Some people just
> don't have the privilege to study that much. I wish that they did.
>
> Socrates worked with that slave boy to show how intelligence was
> innate, but he didn't manage to abolish slavery.
>
> This is clearly a Python list, so I'm never going to apologize for showing
> a Pythonic solution or implementation that could just as well be done
> in another language in far fewer steps.
>
> I'm happy to have APL and J mentioned for comparing and contrasting
> (I mention them myself), but if one judges one needs to stick with
> Python for a given task (because it's what they know, and because
> the task is looming), then it's hardly my place to judge them mentally
> and/or morally deficient in some way.
>
>>> Just my 2c
>>>
>>> Christian
>>>
>
> Thanks for your remarks Christian. Don't let this Ed character bully
> or intimidate you. He likes to show off, which is fine, but he lacks
> diplomatic skills IMO. But then some say the same about me.
I don't like to show off. I like to get facts straight. The lack of
diplomatic skills is a symptom of my strong ADHD.
> Kirby
>
>>> _______________________________________________
>>> Edu-sig mailing list
>>> Edu-sig at python.org
>>> http://mail.python.org/mailman/listinfo/edu-sig
--
Edward Mokurai (默雷/धर्ममेघशब्दगर्ज/دھرممیگھشبدگر ج) Cherlin
Silent Thunder is my name, and Children are my nation.
The Cosmos is my dwelling place, the Truth my destination.
http://www.earthtreasury.org/
More information about the Edu-sig
mailing list