Re: Math expression help
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