Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 54
Default Variable Step rates in loops

I am working on an astronomy project where I need to get all the
conjunctions of 2 planets between 2 dates.
I have functions that give me the Longitude of each planet and the
Angular Separation between 2 longitudes. These are based on a Julian
Day.

I need help with how to get the most accurate date/time of each event
where PAS (Planetry Angular Separation) = 0 or less than X (say
0.001*)

When I step thur my routine with the Julian Day (JD) by 1 I dont get
the precision as if I steped thru at 0.0001.
Obvously the 0.0001 step would take forever if I am searching over 30
years.

Is there a way to have a variable STEP that reduces based on the value
of my PAS?
Then once one event is solved, the step would go back to 1 and start
the loop over?

Thanks

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Variable Step rates in loops


gtslabs;230211 Wrote:
I am working on an astronomy project where I need to get all the
conjunctions of 2 planets between 2 dates.
I have functions that give me the Longitude of each planet and the
Angular Separation between 2 longitudes. These are based on a Julian
Day.

I need help with how to get the most accurate date/time of each event
where PAS (Planetry Angular Separation) = 0 or less than X (say
0.001*)

When I step thur my routine with the Julian Day (JD) by 1 I dont get
the precision as if I steped thru at 0.0001.
Obvously the 0.0001 step would take forever if I am searching over 30
years.

Is there a way to have a variable STEP that reduces based on the value
of my PAS?
Then once one event is solved, the step would go back to 1 and start
the loop over?

Thanks


Hello gtslabs,

I am not an astronomer, so I can't fully answer your question. What you
need is a recursive VBA Function. The function would need to be seeded
and then the results of the algorithm are fed back into the function as
arguments. There needs to be some check inside the algorithm to
determine when the function should stop calculating and return the
result.

Which algorithm or algorithms you need I can't say. If I owned a copy
of Jean Meeus book "Astronomical Algorithms, second edition", I probably
could. Perhaps someone who is an astronomer will be able to offer you
more insight. I do know that it is possible.


--
Leith Ross

Sincerely,
Leith Ross

'The Code Cage' (http://www.thecodecage.com/)
------------------------------------------------------------------------
Leith Ross's Profile: http://www.thecodecage.com/forumz/member.php?userid=75
View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=64330

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 947
Default Variable Step rates in loops

Hi. Would a simple linear interpolation function work for you?
If at day 10, planet a is 4 degrees ahead of B, and on day 20 it is -12
degrees behind, then a very simple next guess might be...

Sub Example()
Debug.Print NextGuess(10, 4, 20, -12)
End Sub

Returns: 12.5

Meaning that a guess of when they were the closest is day 12, at around
noon.
Use this, and the closest of the previous two observations, and loop again.

Function NextGuess(t1, d1, t2, d2)
'Time 1, Difference 1, time 2, Difference 2

NextGuess = (d1 * t2 - d2 * t1) / (d1 - d2)
End Function

= = =
HTH :)
Dana DeLouis



gtslabs wrote:
I am working on an astronomy project where I need to get all the
conjunctions of 2 planets between 2 dates.
I have functions that give me the Longitude of each planet and the
Angular Separation between 2 longitudes. These are based on a Julian
Day.

I need help with how to get the most accurate date/time of each event
where PAS (Planetry Angular Separation) = 0 or less than X (say
0.001*)

When I step thur my routine with the Julian Day (JD) by 1 I dont get
the precision as if I steped thru at 0.0001.
Obvously the 0.0001 step would take forever if I am searching over 30
years.

Is there a way to have a variable STEP that reduces based on the value
of my PAS?
Then once one event is solved, the step would go back to 1 and start
the loop over?

Thanks

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Loan amortization schedule for variable interest rates Shaun Excel Worksheet Functions 6 April 3rd 23 02:27 PM
Can Step through but when run defines variable wrong sportzrule Excel Programming 1 August 30th 06 07:33 PM
How show value of variable in single step debug mode? Chet Shannon[_4_] Excel Programming 2 November 28th 05 06:57 AM
Loops or Do/ while or STEP !!!! A better solution Kevan Hughes Excel Programming 1 April 4th 05 12:44 PM
variable string and loops Mourinho Excel Programming 2 October 27th 04 09:15 PM


All times are GMT +1. The time now is 03:47 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"