Useful tool for mathmatician pilots

Recommended Posts

In order for me to work with flight models in MSFS/P3D, or to create landclass assistant for the same series, or to make my free downloadable programs MirrorArt and Spirapaint, I had to be comfortable in my own skin with my high school and college math courses, which ended in trig with my becoming a calculus tutor.

Essentially programming, whether for word processing, databases, flight sims or spreadsheets, stripped to its beauty is a set of functions and basic mathematics.

One thing I could never achieve with the common programming languages, at least the free ones I use like MS Visual Studio, and GFA basic, was real precision mathematics.  Programming languages once they came to their variable limits, especially for integers, would either choke or give you a floating point approximation of what you were looking for.

I researched various languages that had unlimited precision (within the extents of available memory) for integers, real numbers, prime numbers, or irrational numbers like pi or squareroots.  Programming languages like this are what allow a spacecraft to take off from point A on earth and like the recent Crew Dragon, reach point B on something moving faster than a speeding bullet in low earth orbit.  And to also imagine New Horizons making it so close to Pluto!

Today I found a cool open source programming subset of Python called Sagemath.  It achieves full precision calculations, again within the limits of memory and computing time.  And I laugh, prime numbers that used to take some minutes to calculate using 6502 Assembly on my old Commodore 64 can be calced instantly, or in minutes or seconds, depending on how ambitious one is.

I conclude with this simple example program in sage:

sage: x=5

sage: print x^1000

Here is the result, to end the boredom.  Useful number, better than counting sheep between flights!




Share this post

Link to post
Help AVSIM continue to serve you!
Please donate today!

47 minutes ago, John_Cillis said:


I got my start on Assembly at MIT in 1965. Yea I know I'm old.

Out of boredom on one of my trips I was able to calculate 4*ATN(1) to 2^15 using QBasic on my laptop.  🤣

Grace and Peace, 

Share this post

Link to post
Posted (edited)
1 hour ago, Bluestar said:

I got my start on Assembly at MIT in 1965. Yea I know I'm old.

Out of boredom on one of my trips I was able to calculate 4*ATN(1) to 2^15 using QBasic on my laptop.  🤣

Grace and Peace, 

I miss QBasic, GFA Basic is cool and is free on the web for PC use.  I would have loved to have seen that Calculation if the response had unlimited decimal places, I mean the code.  In Sagemath I calced 5^250000 and the result, though instant, would have easily maxed out the available space in a forum message, not to mention the ire of the forum mods, eternal expulsion from Avsim like poor Lucifer found from heaven, and so on and so on.  But the answer did end in five and it is the largest number I have ever generated on any home computer with one line of code, since the rest is embedded in Python.  I wish I could come up with a useful calculation for pilots or write a basic sim, with unlimited precision you normally do not have to deal with clipping issues in 2-d or vector based sims.....

Edit: Thanks for mention of QBasic, found Microsoft had a free download for Win 10 users so I can play with code I have not touched in years, none of it useful for simming but it is great for home entertainment.

Wish I could find the path to the executable, but it appears to be browser based via DOSBOX

Edit #2 Found a link to QB64.EXE and love it, it is the simple old spaghetti code style of programming I used to enjoy when I wanted to write something down and dirty, like a database and lottery program I wrote pro bono for my old college when they sent someone to my PC user's group asking for help, none of their students of Basic could.  I knew how to create relational databases using random access reads and writes to files and wrote the program in about twenty minutes and sent it to their IT dept, such as it was, and they put it in place immediately making life so much easier when classes filled up and they had to resort to my lottery program.  I was given a file of student basics and integrated it with my program, which they generated from their mainframe.

I wish I had not lost my basic code, was lost when my old system was lost due to O/S failure 18 months ago, ran out of drive space during a Windows update and it hosed the system even though I tried to prevent the update from happening, it happened when an app froze and instead of using the power button I accidentally clicked shutdown without noticing the Win update was going into effect.  I still wish there was a perm way to keep update from running but I have tried every Win 10 hack or reg hack I can find, and none work.  If I stop the service and disable it on startup it still mysteriously comes back when Windows Defender or another app auto updates.

But that is for another forum!

End Edit


Edited by John_Cillis

Share this post

Link to post
2 hours ago, Bluestar said:

I got my start on Assembly at MIT in 1965. Yea I know I'm old.

Out of boredom on one of my trips I was able to calculate 4*ATN(1) to 2^15 using QBasic on my laptop.  🤣

Grace and Peace, 

It is so funny how a post about programming leads me to a well versed programmer sharing the language I started on, Basic although Pascal and Macro Assembler were my first purchased programming languages, followed by GFA Basic for the Atari ST, then QBasic and C++ for the PC.  Visual Basic 3.0 was given to me for free but I paid for VB Pro since it had more extensions and could do more with DB programming, writing shells, and so on.  From there the workplace took over my programming knowledge, I learned the OS Unix, how to write in Unix to create interfaces, I learned from there SQL when I moved to a company that used SQL (after a brief interlude with Lotus Notes), I learned the Novell OS and using PC Anywhere, DOD based at the time, I helped improve Doubletree's Central reservation interface.  Our system when I was hired on just as an instructor was dropping reservations but marking them as sent and thus they never made it to the property management systems at the local hotels our CENRES was trying to send them to.  I realized from earlier interface writing that the problem was due to issues with ACK-NACK protocol and found our interface was jumping the gun, assuming a reservation was successful just because we received an ACK which simply meant "I got something you are trying to send, I want you to know that, but it may be all gibberish to me, please tell me more".  I found a hole in our code that was not understanding the local system's response simply because it was suffering both from being in a hurry and a backlog of other reservations waiting for an ACK.  

So I worked with our programming GOD and guru, who normally did not like instructor non programmers telling him something was not quite right.  So I said "Hey Doug, let me send you something on a disk I carry with me, I wrote it once, it was an interface fix for my own program which simply drew pretty pics on the screen".....  LOL, he ran it and we had the trust we needed for him to let me play with his PC Anywhere cold while our client, the monstrous Doubletree in Dallas near the Galleria, waited with me and my partner placed in its Presidential suite, the only place I have ever been where presidents have slept, though I do not know who, probably all of them from the time the place was built to that point in time, 1995--so might have been Bill Clinton, maybe Bush one, maybe Reagan but I never asked.

I had a colleague with me who filled in for me during the classes I was supposed to teach, we were replacing their old system with ours and I knew their old system had also tried to work with our interface with the same failures.  Unbeknownst to our programming Guru I was asked by Doubletree's CEO, still a close friend but former CEO of them today, to see if I could offer help, since it was the CEO who had interviewed me along with our PMS systems manager whose position I originally wanted.  I was hired because I humbled myself to take a position I was overqualified for, being a former PMS systems lead, I just wanted to travel and work.

Anyway, I added a small wait loop that waited for one reservation to finish or fail before letting the next reservation inbound bother their old system and the new one we had, since we wanted to use the same code for both so cutover would roll smoothly.  I and my colleagues in my home office and there with me were heroes, wined on and dined on, and embarrassed by what for me was just a small job anyone can do.  It is like flying--anyone can code, the most basic program is in psuedo code -- Print "Hello World" which pops up that on the screen.

Another simple Psuedocode program that means something:



Dimension Variable Name as String ' Remark just means something that holds letters and numbers

Input your keystrokes into Variable Name using GetKeystrokes or some other similar function

Print Name


And your name appears on the screen, essential for our ATC interaction with our fav sims...

Since all this I usually pick up the syntax of a new programming language every year just in case I rejoin the workplace, especially as a CIO or Project Lead, because we have to know and be comfortable with what the devs know so if they are weak in biz background, we can be either Agile about it, scrum and get around the issue or resort to more detailed specs which require knowing how to flowchart on a high level and let the Devs earn what they earn, which is often deservedly more than a Project Lead and even a CIO one time, which happened to me just once.  The CIO found out and was not happy about it, sadly because she was linked to someone in HR.....  Both left and I left, due to the humiliation caused to the CIO for a fair response, she was better at her job than I was, otherwise I would have had ambitions for it.

Share this post

Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now