[Tutor] a puzzle about -3**2 vs (-3)**2

D Wyatt fiberfolly at gmail.com
Fri Jul 31 19:48:57 CEST 2015


<snip>
>
> Mathematically, this is perfectly acceptable, and what we would
> normally expect. In algebra, if we write:
>
> -x²
>
> we normally mean the negative of (x squared), not (negative x) squared,
> which would be just x². So Python here agrees with standard mathematical
> notation.
>
>
<snip>
> Speaking as a maths tutor with about 20 years experience, and a B.Sc.
> with a major in mathematics, I'm not sure I understand what you are
> getting at. There is no mathematical difference between the inherent
> negativeness of -1 and the arithmetic operation - 1 (unary minus
> operator followed by 1).
>
> Whichever way you treat it, we have to agree what it means. For example,
> 2x means 2 multiplied by x; but 23 doesn't mean 2 multiplied by 3. It
> could if we wanted it to, but that would be inconvenient. Mathematicians
> could define -3² as (-3)² = 9 if they wanted to, but generally they
> don't, although there are exceptions. Consequently such expressions are
> ambiguous and are best avoided. Although -x² never means -x squared,
> it always means minus (x squared).

>
>
> --
> Steve

I have never really thought about any of this before, but many of you
have responded like this is so obvious.  That is not helpful.  I'm
looking at a negative number as being an object that is one less than
zero, and the unary sign being a part of that object, glued to it.
Why is that so hard to understand?  So, mathematically, it works the
way python works.  I never realized that, though I've always been good
at math.  It's just not something that has ever explicitly come up
anywhere until I read it in the Python book.

The whole purpose of this email group is to share knowledge and help
each other, but when you forget that what seems obvious to you is not
obvious to everybody, you lose the ability to be as helpful as you
could be.  I'm sorry my question turned out to be more about math than
Python.  I had no idea.

This semi-rant is NOT directed at you, personally, Steve.  I would
like to thank almost everybody for their responses.  I've learned a
few things.  But I'll keep asking questions anyway, even if some of
your responses imply they're stupid questions.  The only stupid
question is the question you don't ask.
-- 
Deb Wyatt in WA


More information about the Tutor mailing list