C
Chris Angelico
Cool; if only it were in the math module id be totally happy.
That's easily solved.
import math
math.divmod=divmod
del __builtins__.divmod
ChrisA
Cool; if only it were in the math module id be totally happy.
Cool; if only it were in the math module id be totally happy.
Thanks, I intend to.
Of course I dont. If you wish to restrict your attention to the
exploration of the consequences of axioms others throw at you, that is
a perfectly fine specialization. Most mathematicians do exactly that,
and thats fine. But that puts them in about as ill a position to
judged what is, or shouldnt be defined, as the average plumber.
Compounding the problem is not just that they do not wish to concern
themselves with the inductive aspect of mathematics, they would like
to pretend it does not exist at all. For instance, if you point out to
them a 19th century mathematician used very different axioms than a
20th century one, (and point out they were both fine mathematicians
that attained results universally celebrated), they will typically
respond emotionally; get angry or at least annoyed. According to their
pseudo-Platonist philosophy, mathematics should not have an inductive
side, axioms are set in stone and not a human affair, and the way they
answer the question as to where knowledge about the 'correct'
mathematical axioms comes from is by an implicit or explicit appeal to
authority. They dont explain how it is that they can see 'beyond the
platonic cave' to find the 'real underlying truth', they quietly
assume somebody else has figured it out in the past, and leave it at
that.
For what its worth; insofar as my views can be pidgeonholed, im with
the classicists (pre-20th century), which indeed has a long history.
Modernists in turn discard large swaths of that. Note that its largely
an academic debate though; everybody agrees that 1+1=2. But there are
some practical consequences; if I were the designated science-Tsar,
all transfinite-analysist would be out on the street together with the
homeopaths, for instance.
As a rule of thumb: absolutely not, no. I dont think I can think of
any philosopher who turned his attention to mathematics that ever
wrote anything interesting. All the interesting writers had their
boots on mathematical ground; Quine, Brouwer, Weyl and the earlier
renaissance men like Gauss and contemporaries.
The fragmentation of disciplines is infact a major problem in my
opinion though. Most physicists take their mathematics from the ivory-
math tower, and the mathematicians shudder at the idea of listning
back to see which of what they cooked up is actually anything but
mental masturbation, in the meanwhile cranking out more gibberish
about alephs.
You are completely mistaken. Whatever the axiomatisation of the
mathematics that we do, we can still do the same mathematics. We
don't even need an axiomatic basis to do mathematics. In fact, the
formalisation of mathematics has always come after the mathematics
were well established. Euclid, Dedekind, Peano, Zermelo, Frankael,
didn't create axiomatic systems out of nothing. They axiomatised
pre-existing theories.
Axiomatising a theory is just one way of exploring it.
Again, you are completely mis-representing the situation. In my
experience, most mathematicians (I'm not talking about undergraduate
students here) do not see the axioms are the root of the mathematics
that they do. Formal systems are just one way to explore mathematics.
Of course they can in some cases be very useful and enlightening.
As for inductive reasoning, I really can't understand your point. Of
course mathematicians use inductive reasoning all the time. Where do
you think the Riemann Hypothesis comes from? Or Fermat's last theorem?
Do you think that mathematicians prove results before they even think
about them? On the other hand, a result needs to be proved to be
accepted by the mathematical community, and inductive reasoning is not
valid in proofs. That's in the nature of mathematics.
It's telling that on the one hand you criticise mathematicians for not
questioning the "axioms which are thrown at them", on the other hand
you feel able to discard a perfectly fine piece of mathematics, that
of the study of transfinite numbers, because it doesn't fit nicely
with traditional views. The fact is that at the end of the 19th
century mathematics had reached a crisis point.
Only a minority of mathematicians have an interest in "alephs", as you
call them.
IMHO, the mathematics they do is perfectly valid. The
exploration of the continuum hypothesis has led to the creation of
very powerful mathematical techniques and gives an insight into the
very foundations of mathematics.
Again, on the one hand you criticise
mathematicians for not questioning the axioms they work with, but
those who investigate the way these axioms interact you accuse of
"mental masturbation".
Arguably, the most elegant thing to do is to define integer division
and remainder as a single operation;
(3, 1)which is not only the logical
thing to do mathematically, but might work really well
programmatically too.
The semantics of python dont really allow for this though. One could
have:
d, r = a // b
But it wouldnt work that well in composite expressions; selecting the
right tuple index would be messy and a more verbose form would be
preferred.
However, performance-wise its also clearly the best
solution, as one often needs both output arguments and computing them
simultaniously is most efficient.
'Kindof' off-topic, but what the hell .
Its your word versus mine I suppose.
<deja-vu>
We keep having these debates -- so I wonder how off-topic it is...
And so do famous CSists:http://research.microsoft.com/en-us/um/people/gurevich/opera/123.pdf
</deja-vu>
So this was *one* person making that claim?
I understand that, in general, mathematicians don't have much need for a
remainder function in the same way programmers do -- modulo arithmetic is
far more important. But there's a world of difference between saying "In
mathematics, extracting the remainder is not important enough to be given
a special symbol and treated as an operator" and saying "remainder is not
a binary operator". The first is reasonable; the second is not.
In other words, what logic needs is a better exception-handling
system, which completes the circle with programming languages quite
nicely.
42 = 2 mod 5
2 = 42 mod 5
The professional mathematicians that I know personally don't say that "remainder
is not a binary operator". They *do* say that "modulo is not an operator"in
mathematics just because they have reserved that word and the corresponding
notation to define the congruence relations. So for example, the following two
statements are equivalent:
42 = 2 mod 5
2 = 42 mod 5
The "mod 5" notation modifies the entire equation (or perhaps the = sign if you
like to think about it like that), not the term it is immediately next to..
Python's % operator is a binary operator that binds to a particular term,not
the whole equation. The following two are not equivalent statements:
42 == 2 % 5
2 == 42 % 5
It's mostly kvetching on their part that programming language designers
misunderstood the notation and applied the name to something that is confusingly
almost, but not quite, the same thing. They aren't saying that you couldn't
*define* such an operator; they would just prefer that we didn't abuse the name.
But really, it's their fault for using notation that looks like an operator.
--
Robert Kern
"I have come to believe that the whole world is an enigma, a harmless enigma
that is made terrible by our own mad attempt to interpret it as though it had
an underlying truth."
-- Umberto Eco
It might make more sense to programmers if you think of it as written:
42 = 2, mod 5
2 = 42, mod 5
ChrisA
Cute... but dangerously recursive (if taken literally)
Remember that logic is the foundation of programming language
semantics.
And your idea (suggests) that programming language semantics be made
(part of) the foundation of logic.
Of course I assume you are not being very literal.
Still the dangers of unnoticed circularity are often... well
unnoticed
rusi said:For the record I should say that the guy who taught me abstract
algebra, said about as much:
He said that the notation
a == b mod n
should be written as
a ==n b
(read the == as 3 horizontal lines and the n as a subscript)
For the record I should say that the guy who taught me abstract
algebra, said about as much:
He said that the notation
a == b mod n
should be written as
a ==n b
(read the == as 3 horizontal lines and the n as a subscript)
Eelco said:To tie it back in with python language design; all the more reason not
to opt for pseudo-backwards compatibility. If python wants a remainder
function, call it 'remainder'. Not 'rem', not 'mod', and certainly not
'%'.
Its the more pythonic way; a self-describing name, rather than
poorly defined or poorly understood cryptology.
Good luck with the PEP.
"Although practicality beats purity."
I'm still utterly agog that anyone finds the operator % confusing.
In financial circles it could be an operator for calculating
percentages, eg. "5 % x" would be 5 percent of x.
It's an oddity, but an established one.
And I would be most sorry to see % renamed to mod in Python.
"Hello, %s! My favourite number is %d." mod ("Fred",42) # This just
looks wrong.
Finally we can give this operator a more fitting name - I propose
'inject' - and put an end to this insane desire to leverage off pre-
existing knowledge of other languages.
Furthermore, I suggest that no two languages should ever have
identical semantics, just to avoid potential confusion.
New concepts for all!
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.