Page 1 of 1 [ 11 posts ] 

FePixie
Snowy Owl
Snowy Owl

User avatar

Joined: 29 Oct 2008
Age: 55
Gender: Female
Posts: 157
Location: NZ

07 Jul 2009, 7:33 pm

Can anyone help me with an equation that calculates the longitudinal position of the moon for any given day and time? (eg which constellation its in for each day)

Also calculation for working out planetary transit times for the major planets...

I dont want to download the dataset - i want the calculation to work out the data.... some big long mathematical gibble that i can translate to php

So far i've made scripts to calculate...
* sun rise and set times from any long/lat
* suns daily longitudinal position (what starsign/constellation its in)
* moon phase (full moon, new moon etc)

But i'm a bit stuck on these more difficult calculations....

Anyone?



lau
Veteran
Veteran

User avatar

Joined: 17 Jun 2006
Age: 75
Gender: Male
Posts: 9,795
Location: Somerset UK

08 Jul 2009, 8:00 am

I wrote an ephemeris program, in BASIC, some 28 (*) years ago.

The sun... pretty simple.

The planets... none were terribly hard, but I seem to recall Mercury being the worst. They mostly require odd "tweaks" to their calculation, to accommodate interactions with each other.

The moon... a complete nightmare. Nothing about it is simple. I think I finally settled with code that rambled on for quite a while, and at least managed ten years with tolerably accurate results.

At the time, I was working for a software house (Zeus-Hermes) in Tottenham Court Road, London, and I used just about every source of information. That included the Library Special Collection for mathematics, University College's library, and the Patent Office (who have an amazingly large technical library).

The bad news... I no longer have the program.

(*) I say 28 years, because I was also working on the first IBM PCs to get into the UK (via a "back door").


_________________
"Striking up conversations with strangers is an autistic person's version of extreme sports." Kamran Nazeer


FePixie
Snowy Owl
Snowy Owl

User avatar

Joined: 29 Oct 2008
Age: 55
Gender: Female
Posts: 157
Location: NZ

08 Jul 2009, 8:15 am

Awesome :D

Wunna learn php? :lol:

I've found this which seems to be the calculations needed for the planets

http://www.davidcolarusso.com/astro/

now i just need that converted to english or phpish or some other computerish i can understand

I'm stuck at step 2 - in that the variables they ask for arnt the ones supplied in the dataset they say to use... 8O

have i got the right ones? http://ssd.jpl.nasa.gov/txt/p_elem_t1.txt

they give me a,e,I,L,long.peri,long.node
but ask for a,r,P,v,E,e
Image

Geez - an example would be a handy thing on these maths gibberish bits.... :oops:



lau
Veteran
Veteran

User avatar

Joined: 17 Jun 2006
Age: 75
Gender: Male
Posts: 9,795
Location: Somerset UK

08 Jul 2009, 9:40 am

You could always download the source code for "kstars", say, and find out how that does it all.

Note that the link you gave states quite clearly that it does not handle the moon. The planetary data seems to be all just rely on the simple orbital parameters stuff, omitting any attempt at handling perturbations... which is accurate enough for the limited span the flash animation there permits (2000 - 2015).

You could, of course, ask someone at an astrology site how their code does it. I wonder how much they would charge you, to supply you with some trivial code that works for a year or two, and which is probably just using a bunch of poorly interpolated data copied out of a book of tables.


_________________
"Striking up conversations with strangers is an autistic person's version of extreme sports." Kamran Nazeer


FePixie
Snowy Owl
Snowy Owl

User avatar

Joined: 29 Oct 2008
Age: 55
Gender: Female
Posts: 157
Location: NZ

08 Jul 2009, 6:48 pm

Yeah - i know its not the moon one... it should do fine for the planets though - if i can get it translated... And can figure what the starting data should be :?

That flash animation is cute huh?

I'll need to find the moon calculations somewhere still...



idle
Butterfly
Butterfly

User avatar

Joined: 23 Nov 2008
Age: 57
Gender: Male
Posts: 13
Location: Auckland New Zealand

09 Jul 2009, 6:35 pm

FePixie
Snowy Owl
Snowy Owl

User avatar

Joined: 29 Oct 2008
Age: 55
Gender: Female
Posts: 157
Location: NZ

09 Jul 2009, 8:27 pm

Hi Idle

Yep - thats the one i've got - but the variables it asks for aren't the ones supplied in the tables - or they call em something different and i don't know which ones to use....

they give me a,e,I,L,long.peri,long.node
but ask for a,r,P,v,E,e



idle
Butterfly
Butterfly

User avatar

Joined: 23 Nov 2008
Age: 57
Gender: Male
Posts: 13
Location: Auckland New Zealand

09 Jul 2009, 9:39 pm

Are you looking at the PDF? it seems to look right in there!



pakled
Veteran
Veteran

User avatar

Joined: 12 Nov 2007
Age: 67
Gender: Male
Posts: 7,015

10 Jul 2009, 12:56 am

A couple of centuries (well, maybe more), someone in Europe came up with a way of using the moon to navigate with. It's long since been replaced by accurate timepieces and gyros and whatnot, but I wouldn't be surprised if there's something on the web about the original method. Having to know where the moon is would probably entail knowing where in the sky it would be at given times and dates.



FePixie
Snowy Owl
Snowy Owl

User avatar

Joined: 29 Oct 2008
Age: 55
Gender: Female
Posts: 157
Location: NZ

10 Jul 2009, 6:23 am

ok - so this must still have something missing - can anyone help with what else i need to do? All i want is the starsign for each day...

Code:
<?php

// Keplerian elements and their rates, with respect to the mean ecliptic
// and equinox of J2000, valid for the time-interval 1800 AD - 2050 AD.

// venus
$Lo=       181.97909950; // mean longitude [degrees]
$LC=       58517.81538729; // mean longitude [degrees/century]

$month = 3;
$year = 2010;
$hour = 04;
$min = 00;
$sec = 00;

$signs = array (0 => 'Aries', 'Taurus', 'Gemini', 'Cancer', 'Leo', 'Virgo', 'Libra', 'Scorpio', 'Sagittarius', 'Capricorn', 'Aquarius', 'Pisces');

for ($day=1;$day<32;$day++) {

$phpdate = mktime($hour,$min,$sec,$month,$day,$year);
$julianDate = gregoriantojd($month, $day, $year);

  //correct for half-day offset
  $dayfrac = date('G',$phpdate) / 24 - .5;
  if ($dayfrac < 0) $dayfrac += 1;

  //now set the fraction of a day
  $frac = $dayfrac + (date('i',$phpdate) + date('s',$phpdate) / 60) / 60 / 24;
  $julianDate = $julianDate + $frac;
   
$Teph = $julianDate;

// number of centuries past J2000.0
$T = (($Teph - 2451545.0)/36525);

// compute value of elements for date
$L = ($Lo+($LC*$T));

// remove whole circles
$z = fmod($L,360);

// find the starsign
$sign_num = floor($z / 30);

$thedate = date("d-m-Y",$phpdate);
echo "$thedate - $z - $sign_num - $signs[$sign_num]<br />";

}

 ?>


output
Code:
01-03-2010 - 10.1554881252 - 0 - Aries
02-03-2010 - 11.7576185944 - 0 - Aries
03-03-2010 - 13.3597490636 - 0 - Aries
04-03-2010 - 14.9618795328 - 0 - Aries
05-03-2010 - 16.564010002 - 0 - Aries
06-03-2010 - 18.1661404712 - 0 - Aries
07-03-2010 - 19.7682709404 - 0 - Aries
08-03-2010 - 21.3704014096 - 0 - Aries
09-03-2010 - 22.9725318788 - 0 - Aries
10-03-2010 - 24.574662348 - 0 - Aries
11-03-2010 - 26.1767928172 - 0 - Aries
12-03-2010 - 27.7789232864 - 0 - Aries
13-03-2010 - 29.3810537555 - 0 - Aries
14-03-2010 - 30.9831842247 - 1 - Taurus
15-03-2010 - 32.5853146939 - 1 - Taurus
16-03-2010 - 34.1874451631 - 1 - Taurus
17-03-2010 - 35.7895756323 - 1 - Taurus
18-03-2010 - 37.3917061015 - 1 - Taurus
19-03-2010 - 38.9938365707 - 1 - Taurus
20-03-2010 - 40.5959670399 - 1 - Taurus
21-03-2010 - 42.1980975091 - 1 - Taurus
22-03-2010 - 43.8002279783 - 1 - Taurus
23-03-2010 - 45.4023584475 - 1 - Taurus
24-03-2010 - 47.0044889167 - 1 - Taurus
25-03-2010 - 48.6066193859 - 1 - Taurus
26-03-2010 - 50.2087498551 - 1 - Taurus
27-03-2010 - 51.8108803243 - 1 - Taurus
28-03-2010 - 53.4130107934 - 1 - Taurus
29-03-2010 - 55.0151412626 - 1 - Taurus
30-03-2010 - 56.6172717318 - 1 - Taurus
31-03-2010 - 58.219402201 - 1 - Taurus



FePixie
Snowy Owl
Snowy Owl

User avatar

Joined: 29 Oct 2008
Age: 55
Gender: Female
Posts: 157
Location: NZ

13 Jul 2009, 11:18 pm

hmm - ok - i get it - thats the heliocentric (as seen from the sun) bit - next it needs adjusted to allow for geocentric (view from earth) changes...

eerrrm - yeah
solving keplars equation in php - ????

.... * goes back to thinkin on that one for a while longer * ....