Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Community > MacNN Lounge > Simplish (I think) Math and Programming Question

Simplish (I think) Math and Programming Question
Thread Tools
subego
Clinically Insane
Join Date: Jun 2001
Location: Chicago, Bang! Bang!
Status: Offline
Reply With Quote
Dec 5, 2007, 12:59 AM
 
Well, I'm writing a program that will solve some basic astronomical equations for a planet revolving around a sun and also happens to use a bunch of math beyond my skills. Yes, this is stupid. I'm trying to teach (or relearn) what I need to get by, and I've been more or less fine up to this point.

The equation I need to solve is:

Atan(sin(λ)*cos(ε)/cos(λ))

Where λ is the ecliptic longitude of the sun as seen from the planet (i.e. an angle from 0-360º) and ε is obliquity of the planet with respect to the sun's ecliptic (an angle from 0-90º)

Okay, I can do that, but I need to figure out the correct quadrant for my solution so I can get a number between 0-360º. I could use Atan2 if I had any idea of how to properly derive x and y, but I don't. I could probably figure it out if it was just one angle, but the multiplication of angles and different trigonometric functions is just going to make my head hurt.

So I tried to brute force it for awhile by plugging in different values for λ. It appears the solution is always going to be in the same quadrant as λ, except when undefined.

Do I have this right? Can I use which quadrant λ is in to determine which quadrant my solution is in for any value of ε?

Does any of this make sense? Did I blow it by not understanding the quadrant thing from the outset?

     
olePigeon
Clinically Insane
Join Date: Dec 1999
Status: Offline
Reply With Quote
Dec 5, 2007, 01:02 AM
 
I'm surprised I squeaked by Trig with a C cuz I haven't a clue what the f*ck you just said.
"…I contend that we are both atheists. I just believe in one fewer god than
you do. When you understand why you dismiss all the other possible gods,
you will understand why I dismiss yours." - Stephen F. Roberts
     
subego  (op)
Clinically Insane
Join Date: Jun 2001
Location: Chicago, Bang! Bang!
Status: Offline
Reply With Quote
Dec 5, 2007, 01:03 AM
 
That makes two of us.
     
subego  (op)
Clinically Insane
Join Date: Jun 2001
Location: Chicago, Bang! Bang!
Status: Offline
Reply With Quote
Dec 6, 2007, 12:41 AM
 
Worked this out with my dad, who's M.S. in math came in handy.

Since I know everyone is aching to hear the answer, here it is:

The solution is in the same quadrant as λ.

Cos(ε) is always in the 1st quadrant, so the pair of numbers that define the triangle are always both going to be positive. Multiplying something by a positive doesn't change its sign, so the pair of numbers which define the triangle for sin(λ)/cos(λ) aren't going to change their sign when multiplied by cos(ε), and therefore remain in the same quadrant.

Yay for math!

     
loki74
Mac Elite
Join Date: Apr 2005
Location: Las Vegas, NV
Status: Offline
Reply With Quote
Dec 6, 2007, 05:22 AM
 
Cool. Although if I may, exactly what are you making this for? Any chance you could post some screens of the app and its functionality when you're done?

"In a world without walls or fences, what need have we for windows or gates?"
     
subego  (op)
Clinically Insane
Join Date: Jun 2001
Location: Chicago, Bang! Bang!
Status: Offline
Reply With Quote
Dec 6, 2007, 05:48 AM
 
Sure. It'll be awhile before I'm done. I just started.

It's going to be the first piece of a random weather generator. I want it to have proper almanac data like sunrise and sunset times, as well as have the weather it generates be influenced by such.

Of course that's the first piece of an 11th century feudal manor simulation (I want the thing to have weather, don't I?) but I wanted to start, ahem... small.

Relevant to the original topic, a few hours ago I found the answer to this question on Wiki. Not the answer in general, but the answer for this specific question (i.e. when converting ecliptic coordinates into equatorial coordinates, the quadrant for right ascension (which is what I'm solving for) is in the same quadrant as ecliptic longitude (λ))
     
   
 
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Top
Privacy Policy
All times are GMT -4. The time now is 01:30 PM.
All contents of these forums © 1995-2017 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.8 © 2000-2017, Jelsoft Enterprises Ltd.,