• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Order of operations (was: Eigenvalues &/or eigenvectors,
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Order of operations (was: Eigenvalues &/or eigenvectors,


  • Subject: Re: Order of operations (was: Eigenvalues &/or eigenvectors,
  • From: email@hidden (Michael Sullivan)
  • Date: Mon, 12 May 2003 15:28:57 -0400
  • Organization: Business Card Express

email@hidden (Dennis W. Manasco) writes:
> At 3:54 pm -0400 5/9/03, Michael Sullivan wrote:

> >It's ridiculous to have the minus have a higher precedence than the
> >power operator, because it just gets lost if the power is even.
>
>
> x^2 is defined mathematically as (x) * (x)
> x^3 is defined mathematically as (x) * (x) * (x)
> x^4 is defined mathematically as (x) * (x) * (x) * (x)
> x^5 is defined mathematically as (x) * (x) * (x) * (x) * (x)
>
> 3^2 = (3) * (3) = 9
> 3^3 = (3) * (3) * (3) = 27
> 3^4 = (3) * (3) * (3) * (3) = 81
> 3^5 = (3) * (3) * (3) * (3) * (3) = 243

> -3^2 = (-3) * (-3) = 9
> -3^3 = (-3) * (-3) * (-3) = -27
> -3^4 = (-3) * (-3) * (-3) * (-3) = 81
> -3^5 = (-3) * (-3) * (-3) * (-3) * (-3) = -243

> I see nothing _ridiculous_ about producing an algebraically and
> mathematically correct result. I would be very upset if the results I
> received from a power function deviated from what I would calculate
> with pencil and paper or a calculator.

With explicit numbers, I will concede that your interpretation is at
least as reasonable as mine (which would be that -3^2 is to be read as:
- (3)^2).

But not with variables.

If I write -x^2, I expect the result to be a *negative* number.

But applescript doesn't:

set foo to 3
-foo ^ 2

--> 9.0

Sorry, but that's just wrong.


Michael
_______________________________________________
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.

  • Follow-Ups:
    • Re: Order of operations (was: Eigenvalues &/or eigenvectors,
      • From: Paul Berkowitz <email@hidden>
References: 
 >Re: Order of operations (was: Eigenvalues &/or eigenvectors, (From: "Dennis W. Manasco" <email@hidden>)

  • Prev by Date: iCal event scripting
  • Next by Date: Re: SE2beta contextual Find feature request
  • Previous by thread: Re: Order of operations (was: Eigenvalues &/or eigenvectors,
  • Next by thread: Re: Order of operations (was: Eigenvalues &/or eigenvectors,
  • Index(es):
    • Date
    • Thread