# Re: Formula Wanted

```
On Sun, 01 Nov 1998 14:46:38 -0500 Ron Parise <parise@gelato.gsfc.nasa.gov> wrote:

> At 11:39 11/03/98 -0500, Jerald R. Malin wrote:
>
> >Does anybody have the formula that will calculate the course you must
> >fly and your ground speed if you know your true course, true air speed,
> >wind direction and wind speed?
> I don't know of any way to do an iterative solution to this problem
>
> Good Luck!
> Ron, wa4sir

I don't know much about vector mathematics or aeronautics, but I know
a lot about spreadsheets.  With a tiny bit of dibbling around with the Help
screens, and maybe a beginner's book on VisualBasic, one can learn enough
macro-language to build a short macro in Excel (or the spreadsheet of
your choice as long as it allows "IF" branches) which can do iterations.
This should be covered in about the first or second chapter in VisualBasic
programming books.

You first put your desired heading in one cell, then the parameters which
are used by your heading calculation formula in another set of cells.
Next, you program the simplistic heading-calculation formula into still another
cell.  Of course, the first time around,  as Ron points out, the calculated heading
based on a guess of what the correct parameters might be.

So next, you program (and then run) a macro which would compare the calculated heading
with the desired heading and if the two were within an xxx tolerance then the
macro branches out to a QUIT statement.  Otherwise, the macro increments the
parameters (the input cells used by the calculation formula) by a tiny
amount (causing the spreadsheet to automatically calculate a new
calculated heading), and the macro loops back to the beginning and
compares the new calculated heading with the desired heading and the macro
repeats this loop until the two are within the tolerance you specified.

You cannot "record" an IF statement in a macro language (for those of you
who know what "recording" a macro means).  Thus, you need to learn some
rudimentary macro-language programming.  But my wife is teaching
seventh-graders how to do IF statements in Visual Basic macros using
Excel97, and I require it in my accounting systems class. Of course,
my students' formulas yield stuff like depreciation and tax liabilities instead
of course headings, but the actual macro programs should behave the same.
It shouldn't take more than an hour or two to learn enough VisualBasic
to do a simple IF statement compare and branch.

Incidently, this is the way my dad used to calculate satellite plots
on the business-oriented mainframe computer back in the early 1960's before
we had commercial satellite tracking software.  COBOL does nifty
IF statements and loops, and the programs were ultrasimple, ... about
ten lines of code was all.  That was way back in the good ol' days
when the Smithsonian Institute used to mail out those tiny-print,
onion-skin computer printouts of who-knows-what kind of elements that
nobody uses anymore --- a whole page of numbers for one week's passes,
that still didn't tell you anything unless you did some awful
calculations with polar coordinate graph paper and a slide rule!  Ah, me,
those were the days!  But they sure predicted when the Echo balloon
satellites would go by.  And remember Pageos?  The one in retrograde
orbit?  This was probably before most of today's satellite operators were
born! ...   "Hey, Dave, what the heck is a COBOL?"

Good luck, Jerald.

By the way, Ron, you might want to check the date and time settings
on your mail server (...or maybe it's your client that time-stamps your
mail).  According to your email timestamp, you replied to Jerald

-------------------------------------------
David R. Fordham
ARS KD9LA
CPA, CMA, Ph.D.,
School of Accounting ZSH 334
Harrisonburg, VA 22807
Voice:  540-568-3024
Fax:    540-568-3017

Check out the Massanutten Amateur Radio Association