HP Forums
Astronomy: Effemeridi (Ephemeris) - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Software Libraries (/forum-10.html)
+--- Forum: HP Prime Software Library (/forum-15.html)
+--- Thread: Astronomy: Effemeridi (Ephemeris) (/thread-4262.html)

Pages: 1 2


RE: Astronomy: Effemeridi (Ephemeris) - salvomic - 07-15-2015 01:36 PM

here there is an ancillary program to Effemeridi (Astrolabio) and Astro Lab 4, with some tools to get interpolation (3, 5 points and Lagrange).

The tools are:
interpolation of 3 or 5 values
finding the "n" interpolation factor
finding the extremum (minimum, maximum of a list to interpolate)
finding the zero (3 or 5 values)
"halves" (4 values)
get a value with Lagrange interpolation.

Typical example: interpolation({1.9556788, 1.97345409, 1.965049586}, 0.18), nzero3({1.9556788, 1.97345409, 1.965049586}) ...
Very useful for RA (right ascension) and Declination (or lambda, beta: longitude, latitude) for an aster or planet or to find conjunction of planets, least angular distance and so on...

Salvo

Code:

// Ancillary program for Astro Lab 4 (Marcel Pelletier) and Effemeridi - Astrolabio (Salvo Micciché)
// lista = a list like {data1, data2, data3...}
// n = interpolation factor

EXPORT interpolation3(lista,n)
BEGIN
  LOCAL a,b,c,R,dif1,dif2;
  dif1:=ΔLIST(lista);
  dif2:=ΔLIST(dif1);
  a:=dif1(1);
  b:=dif1(2);
  c:=dif2(1);
  R:=lista(2)+(n/2)*(a+b+n*c);
  RETURN R;
END;

EXPORT interpolation5(lista,n)
BEGIN
  LOCAL a,b,c,R,dif1,dif2, dif3, dif4;
  LOCAL d,e,f,g,h,j,k;
  dif1:=ΔLIST(lista);
  dif2:=ΔLIST(dif1);
  dif3:=ΔLIST(dif2);
  dif4:=ΔLIST(dif3);
  a:=dif1(1);
  b:=dif1(2);
  c:=dif1(3);
  d:=dif1(4);
  e:=dif2(1);
  f:=dif2(2);
  g:=dif2(3);
  h:=dif3(1);
  j:=dif3(2);
  k:=dif4(1);
  R:=lista(3)+(n/2)*(b+c)+(n^2/2)*f+n*((n^2-1)/12)*(h+j)+(n^2*(n^2-1)/24)*k;
  RETURN R;
END;

EXPORT extremum3(lista)
BEGIN
  LOCAL a,b,c,R,dif1,dif2, ym, nm;
  dif1:=ΔLIST(lista);
  dif2:=ΔLIST(dif1);
  a:=dif1(1);
  b:=dif1(2);
  c:=dif2(1);
  ym:=lista(2)-((a+b)^2)/(8*c);
  nm:= -(a+b)/(2*c);
  RETURN ({ym, nm});
END;

EXPORT extremum5(lista)
BEGIN
  LOCAL a,b,c,R,dif1,dif2, dif3, dif4;
  LOCAL d,e,f,g,h,j,k, nm;
  LOCAL jj, temp;
  dif1:=ΔLIST(lista);
  dif2:=ΔLIST(dif1);
  dif3:=ΔLIST(dif2);
  dif4:=ΔLIST(dif3);
  a:=dif1(1);
  b:=dif1(2);
  c:=dif1(3);
  d:=dif1(4);
  e:=dif2(1);
  f:=dif2(2);
  g:=dif2(3);
  h:=dif3(1);
  j:=dif3(2);
  k:=dif4(1);
  jj:= 0; nm:=0; temp:= 0;
  WHILE 1 DO
  temp:= nm;
  nm:= (6*b+6*c-h-j+3*jj^2*(h+j)+2*jj^3*k)/(k-12*f);
    IF nm==temp THEN BREAK; END;
  jj:= nm;
  END;
  RETURN nm;
END;

EXPORT nzero3(lista)
BEGIN
  LOCAL a,b,c,R,dif1,dif2, n0, j;
  LOCAL temp;
  dif1:=ΔLIST(lista);
  dif2:=ΔLIST(dif1);
  a:=dif1(1);
  b:=dif1(2);
  c:=dif2(1);
  j:= 0; n0:=0; temp:= 0;
  WHILE 1 DO
  temp:= n0;
  n0:= -2*lista(2)/(a+b+c*j);
    IF n0==temp THEN BREAK; END;
  j:= n0;
  END;
  RETURN n0;
END;

EXPORT nzero5(lista)
BEGIN
  LOCAL a,b,c,R,dif1,dif2, dif3, dif4;
  LOCAL d,e,f,g,h,j,k, n0;
  LOCAL jj, temp;
  dif1:=ΔLIST(lista);
  dif2:=ΔLIST(dif1);
  dif3:=ΔLIST(dif2);
  dif4:=ΔLIST(dif3);
  a:=dif1(1);
  b:=dif1(2);
  c:=dif1(3);
  d:=dif1(4);
  e:=dif2(1);
  f:=dif2(2);
  g:=dif2(3);
  h:=dif3(1);
  j:=dif3(2);
  k:=dif4(1);
  jj:= 0; n0:=0; temp:= 0;
  WHILE 1 DO
  temp:= n0;
  n0:= (-24*lista(3)+jj^2*(k-12*f)-2*jj^3*(h+j)-jj^4*k)/(2*(6*b+6*c-h-j));
    IF n0==temp THEN BREAK; END;
  jj:= n0;
  END;
  RETURN n0;
END;

EXPORT halves4(lista)
BEGIN
  LOCAL y;
  y:= (9*(lista(2)+lista(3))-lista(1)-lista(4))/16;
  RETURN y;
END;

EXPORT lagrangeValue(lista_x, lista_y, xValue)
BEGIN
  LOCAL y, temp;
  temp:= lagrange(lista_x, lista_y);
  y:= EVAL(EXPR(temp+"|X="+xValue));
  RETURN y;
END;



RE: Astronomy: Effemeridi (Ephemeris) - salvomic - 07-19-2015 04:50 PM

New version!
thanks to Marcel and RoadRunner, this version check if the app Astro Lab 4 is installed, and if yes, it uses to calculate planets, the app, with much more precision, otherwise it use the old method, with a few arc seconds (in some cases arc minutes) of "error" (very few, however).

Added also other printing improvements (thanks Road!): now the user can tap or drag on screen when the printing results are given, to get other pages...

Improved routine to get phase, illumination, magnitudo of planets.
Improved routine to get phase, illumination, magnitudo of the Moon, also giving "selenographic phase angle", angle of the illuminated limb (χ) and cuspis of the illuminated part.
Exported new functions:
- to calculate Stellar composite magnitudo (giving a list of magnitudes)
- to calculate Apparent and absolute magnitudo for 18 asteroids and comets (giving distance from Sun, distance from Earth and a list with the date (i.e. {2015,7,22}) )
- to calculate Albedo for a few asteroids
- to calculate Semidiameter for an asteroid (giving absolute magnitude and albedo: in the comment inside the program the principal ones).
Other minor bug corrected.

Enjoy!

Salvo

Version: 2.6, 2015, July, 22


RE: Astronomy: Effemeridi (Ephemeris) - salvomic - 07-24-2015 01:43 PM

New improved Version:

New routine to calculate the most important Asteroids (and ex Comets): data about eccentricity, inclination, semi-major axis, mean anomaly, argument of perihelion, node, right ascension and declination, longitude and latitude, passage through perihelion, distance from Earth and Sun, diameter (approximate), magnitudo and albedo.
If instead of anomaly the user knows the date of passage at perihelion, he could calculate anomaly with the function anomaly() that requires a (semi-major axis), eccentricity, date of passage to the perihelion and actual date list, to give mean, eccentric and true anomaly.
For now included four series (the most brilliant and/or important or famous):
1 Ceres, 2 Pallas, 3 Juno, 4 Vesta, 5 Astrea, 6 Hebe, 7 Iris, 8 Flora, 9 Metis;
15 Eunomia, 18 Melpomene, 19 Fortuna, 20 Massalia, 22 Kalliope;
243 Ida, 433 Eros, 437 Rhodia, 1566 Icarus, 1620 Geographos, 1862 Apollo, 2060 Chiron, 2062 Aten;
dwarf planets (Ceres is in the first series, Pluto among planets): Haumea, Eris, Makemake,
plus a function to calculate an elliptical orbit given eccentricity, inclination, semi-major axis, anomaly, argument of perihelion and Node (from Almanac or online ephemerides): the default is set on comet 2P/Encke (data 2014 August)...
Passage through perihelion and aphelion for planets (for now approximate for Neptune, not so easy to treat and Pluto, but better than Neptune in some way).
Exported variables for passage through perihelion and orbital period for planets, bodies with elliptical and parabolic motion (comets...).
Included also two functions to calculate passage through perihelion given anomaly or anomaly given passage date...
Function to calculate passage through nodes (ascending and descending) for planets, elliptic and parabolic bodies...
Function to calculate perigee and apogee of the Moon (with relatives parallaxes) for a given date and passages through the nodes of the Moon.

Some data are still approximated (better precision coming, but sometimes isn't easy to do better, i.e. with slow farthest planets...) but very interesting.

Enjoy!

Salvo

***
new uploaded zip file
Version: 2.9
Date: 2015, July 29


RE: Astronomy: Effemeridi (Ephemeris) - Wolfgang - 11-09-2015 11:06 AM

Very impressive.

Thank you very much, Salvo.


RE: Astronomy: Effemeridi (Ephemeris) - salvomic - 11-09-2015 11:10 AM

(11-09-2015 11:06 AM)Wolfgang Wrote:  Very impressive.

Thank you very much, Salvo.

thanks a lot, Wolfgang!
the program works but for now (I don't know why) I get a reset on the real Prime when I change something on the code...
Sure it could be re-written with a better coding but for now I've no time to do it.

Salvo


RE: Astronomy: Effemeridi (Ephemeris) - salvomic - 04-22-2016 09:10 PM

The program could not work after firmware 10077.
Try this version 3.0 that should be ok.
If you find an error, please, let me know.
Use the program with the new version of AstroLab 4 for better experience.

Salvo M.


RE: Astronomy: Effemeridi (Ephemeris) - Spybot - 04-22-2016 11:23 PM

Hello!
I can't make it run... on (FW10077) it gives me an error.

I copied and paste the code from word to conkit, creating a new program called effemeridi, then try to run it, it is not running here.


RE: Astronomy: Effemeridi (Ephemeris) - salvomic - 04-23-2016 08:50 AM

(04-22-2016 11:23 PM)Spybot Wrote:  Hello!
I can't make it run... on (FW10077) it gives me an error.

I copied and paste the code from word to conkit, creating a new program called effemeridi, then try to run it, it is not running here.

what's the error? Can you explain here better?
Have you also AtroLab 4 installed and active?
Install the last version (3.0) from above post.

I hope to help you, here it runs.

Salvo


RE: Astronomy: Effemeridi (Ephemeris) - Username - 08-21-2020 02:12 PM

The program is doesn't working for me.
When I copy code to the calculator, I have syntax errors in the program. :-(


RE: Astronomy: Effemeridi (Ephemeris) - Joe Horn - 08-21-2020 08:31 PM

(08-21-2020 02:12 PM)Username Wrote:  The program is doesn't working for me.
When I copy code to the calculator, I have syntax errors in the program. :-(

Which version of the program did you install? Version 3 is in posting #26 in this thread.

If version 3 of the program gives you syntax errors, please help us help you by telling us which Prime firmware version you have installed.


RE: Astronomy: Effemeridi (Ephemeris) - Username - 08-22-2020 12:25 PM

I am very sorry!
Everything is now OK! I pasted incorretly program to the calculator.


RE: Astronomy: Effemeridi (Ephemeris) - salvomic - 08-22-2020 01:25 PM

(08-22-2020 12:25 PM)Username Wrote:  I am very sorry!
Everything is now OK! I pasted incorretly program to the calculator.

Well!
enjoy the program Smile

thanks Joe Horn for the tips.

Salvo (salvomic)


RE: Astronomy: Effemeridi (Ephemeris) - Josef - 04-02-2021 04:42 PM

Great job! Very nice result for the planets and good for asteroids!