Re: Order of operations (was: Eigenvalues &/or eigenvectors, anyone?)
Re: Order of operations (was: Eigenvalues &/or eigenvectors, anyone?)
- Subject: Re: Order of operations (was: Eigenvalues &/or eigenvectors, anyone?)
- From: Deivy Petrescu <email@hidden>
- Date: Thu, 8 May 2003 18:50:43 -0400
On Thursday, May 8, 2003, at 05:03 PM, Doug McNutt wrote:
At 12:42 -0400 5/8/03, Deivy Petrescu wrote:
AS is right and the other programs are all, if not wrong, using a
not canonic notation.
One more and I promise to be quiet:
Please do not. We do not have to fight, the beginning of response was
just a joke. At someone else... 8)
Go back to your high school days and simplify this:
y = (1-x)(1+x)-1
I get -x^2
Did you feel any need for parentheses in the result?
Absolutely not!
Doug,
there is a big difference in both cases.
Do you recognize those:
{..., -2, -1, 0, 1, 2,..}
those are representation of the abstract concept of numbers. Actually,
the positive should have a "+" in front, by default they don't! Think
of the time, ink, paper and keystrokes this save.
So writing -2^2 is the same as writing +2^2. The sign is part of the
number.
I'll give you one ambiguous instance, -e^2. I would have used pi, but
the mailer... 8)
I would probably write (-e)^2 to mean the square of the negative e.
I would probably put parenthesis in general to prevent ambiguities.
Using your example:
-2=0-2 (no parenthesis)
then -2*-2 = 0-2*0-2 = -2 using the precedence of operations.. ;)
And neither 4 or -4 is right.
Another thing, I did not try perl, but you can include python in the
ones that use -2^2=-4.
bc uses the same notation that A, -2^2=4
A calculator does the same thing..
In order to avoid problems, to be certain, I'd always insert
parenthesis in the expression.
I would call it a bug. I still feel that the canonical way is -2^2=4,
nothing wrong with (-2)^2=4.
Regards
Deivy Petrescu
http://www.dicas.com/
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.