• 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: Math expression help
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Math expression help


  • Subject: Re: Math expression help
  • From: deivy petrescu <email@hidden>
  • Date: Tue, 9 May 2006 17:59:21 -0400


On May 9, 2006, at 16:42, Dale J Martin wrote:

Hi all,

Can someone please explain this to me...... I have the expression in one statement and it gives the wrong answer. After breaking it up I get the answer is correct answer

Thoughts?

Thanks,

Dale

set HA to 256.84 * 3.1415926535 / 180 --in radians
set Dec to 29.82 * 3.1415926535 / 180 --in radians
set latitude to 42.55574 * 3.1415926535 / 180 --latitude location in radians.


set Dz to cos (latitude - pi / 2) * (cos (Dec) * (cos (-HA) + (sin (latitude - pi / 2) * (sin (Dec)))))

display dialog "Dz " & Dz

set x1 to cos (latitude - pi / 2)
set x2 to cos (Dec)
set x3 to cos (-HA)
set x4 to x1 * x2 * x3
set x5 to sin (latitude - pi / 2)
set x6 to sin (Dec)
set x7 to x5 * x6
set x8 to x4 + x7

display dialog "C " & x8

People pointed out some problems. You have too many parenthesis in the wrong places. Also, cos(x) is an even function so drop the - in -HA. Using the x's the formula you want is:

cos (latitude - pi / 2) * cos (Dec) * cos (HA) + sin (latitude - pi / 2) * sin (Dec)

Also, because cos(x) is even, cos (latitude - pi / 2)= cos (pi/2 - latitude), but the same is not true with sin(x).
So make sure you have the right subtraction in sin (latitude - pi / 2), as it is, I believe it is negative!


Deivy



_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Math expression help
      • From: Dale J Martin <email@hidden>
References: 
 >Math expression help (From: Dale J Martin <email@hidden>)

  • Prev by Date: Re: Math expression help
  • Next by Date: Character Encoding in plain text
  • Previous by thread: Re: Math expression help
  • Next by thread: Re: Math expression help
  • Index(es):
    • Date
    • Thread