Post Reply 
long dropdown list issue
07-23-2015, 05:58 AM
Post: #1
long dropdown list issue
hi,
the code below sometimes works, sometimes gives "Bad argument value", sometimes resets the Prime (grrrr!)...
Why?
I reset the sunCalc() function to test here (also if the problem be there, but it from elsewhere works well)...
Try with:
asteroidMagnitude(2,2,{2015,7,22}) -> {7.68, 3.34, "Ceres"}
asteroidMagnitude(9,9,{2015,7,22}) -> should returns {16.54, 6.5, "Chiron"} but gives also Error: Bad argument value or resets.
Also when "Aten" is chosen...

Is it a 18 item list "too" long?

Salvo

Code:

EXPORT asteroidMagnitude(r, delta, lista)
// r distance from Sun, delta Δ distance from Earth, R distance Earth-Sun
BEGIN
  LOCAL R, H, G, magni, beta, phi1, phi2;
  LOCAL ch, asteroid, name;
  INPUT({{ch, asteroid:={"Ceres","Pallas","Juno", "Vesta", "Astraea", "Hebe", "Iris", "Flora",
  "Metis", "Eunomia", "Melpomene", "Massalia", "Eros", "Icarus", "Geographus", "Apollo", "Chiron", "Aten"}, 
  {20,30,1}}},
  "Choose asteroid or comet", 
  "asteroid: ", "Choose asteroid or comet and press OK", 0,4);
  name:= asteroid(ch);
  // calc distance Sun-Earth
  // sunCalc(lista);
  // R:= sunlist(15);
  R:= 1.016; // the actual program calculates it with the above lines...
  // end Sun

  CASE
  IF ch==  1 THEN H:=3.34; G:=0.12; END;
  IF ch==  2 THEN H:=4.13; G:=0.11; END;
  IF ch==  3 THEN H:=5.33; G:=0.32; END;
  IF ch==  4 THEN H:=3.20; G:=0.32; END;
  IF ch==  5 THEN H:=6.85; G:=0.15; END;
  IF ch==  6 THEN H:=5.71; G:=0.24; END;
  IF ch==  7 THEN H:=5.51; G:=0.15; END;
  IF ch==  8 THEN H:=6.49; G:=0.28; END;
  IF ch==  9 THEN H:=6.28; G:=0.17; END;
  IF ch== 10 THEN H:=5.28; G:=0.23; END;
  IF ch== 11 THEN H:=6.51; G:=0.23; END;
  IF ch== 12 THEN H:=6.50; G:=0.25; END;
  IF ch== 13 THEN H:=11.16; G:=0.46; END;
  IF ch== 14 THEN H:=16.9;  G:=0.09; END;
  IF ch== 15 THEN H:=15.6;  G:=0.15; END;
  IF ch== 16 THEN H:=16.25; G:=0.09; END;
  IF ch== 17 THEN H:=6.5;   G:=0.15; END;
  IF ch== 18 THEN H:=16.8;  G:=0.15; END;
  DEFAULT H:=1; G:=0.1;
  END; // case
  // H absolute visual magnitude, G slope parameter
  beta:= ACOS((r^2+delta^2-R^2)/(2*r*delta));
  phi1:= e^(-3.33*tan(beta/2)^0.63);
  phi2:= e^(-1.87*tan(beta/2)^1.22);
  magni:= H+5*log(r*delta)-2.5*log((1-G)*phi1+G*phi2); // apparent magnitude
  RETURN {ROUND(magni,2), H, name};  // apparent and absolute
END;

∫aL√0mic (IT9CLU) :: HP Prime 50g 41CX 71b 42s 39s 35s 12C 15C - DM42, DM41X - WP34s Prime Soft. Lib
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
long dropdown list issue - salvomic - 07-23-2015 05:58 AM
RE: long dropdown list issue - DrD - 07-23-2015, 09:59 AM
RE: long dropdown list issue - salvomic - 07-23-2015, 11:24 AM
RE: long dropdown list issue - DrD - 07-23-2015, 11:38 AM
RE: long dropdown list issue - salvomic - 07-23-2015, 12:30 PM
RE: long dropdown list issue - DrD - 07-23-2015, 03:53 PM
RE: long dropdown list issue - salvomic - 07-23-2015, 04:01 PM
RE: long dropdown list issue - Marcel - 07-23-2015, 09:28 PM



User(s) browsing this thread: