Sorting C++ Source Code and Testing Application by James Pate Williams, Jr.

I read the treatise Sorting and Sort Systems by Harold Lorin in the summer of 1979. That excellent intellectual work inspired me to implement the code and and algorithms from that book. Lorin used Algol, FORTRAN and IBM’s language PL/I. I used the Data General Eclipse minicomputer at LaGrange College from which I had graduated with a Bachelor of Arts degree in Chemistry. I utilized the computer language BASIC (Beginner’s All-purpose Symbolic Instruction Code) and Data General’s Advanced Operating System Macro-assembly language. Later in my academic life at Auburn University I learned about Heap Sort. I wrote about six sorting algorithms on Facebook that I implemented in the C# computer language back in 2015. It took me two days to create a similar application using the C++ computer language. Here are some results and the source code in PDF file format.

Insertion Sort Results
Selection Sort Results
Quick Sort Results
Heap Sort Results
Singleton’s Sort Results

Knight’s Tour C++ Application by James Pate Williams, Jr.

Using the chronological backtracking C++ code that I developed from the backtracking algorithm applied to the N-Queens constraint satisfaction problem, I developed an algorithm to solve the Knight’s Tour Problem. The general backtracking algorithm is from Foundations of Constraint Satisfaction by E. P. K. Tsang Chapter 2 page 37. I display some executions of the program in this blog.

Chronological Backtracking Closed Tour Solution for a 6×6 Chess Board
Warnsdorff Closed Tour Solution for a 6×6 Chess Board
Warnsdorff Open Tour Solution for an 8×8 Chess Board
Knight Move Count Matrix Used by Warnsdorff Heuristic

Data from another of my Knight’s Tour applications.

Eigenfunctions of a Nonlinear Second Order Ordinary Differential Equation Initial Value Eigenvalue Problem by James Pate Williams, Jr.

Solutions of a nonlinear second order ordinary differential equation initial value eigenvalue problem:

y”(x) = x * x * y(x) + n * n * y(x) * y(x) for all x in [0, 1]
y(0) = 0
y'(0) = 1
n in [0, 1, 2, …]

I graphed the first five eigenfunctions.

Graphs for n = 0 to n = 4

Planetary Precession by James Pate Williams, Jr.

There are three classic theoretical tests of Albert Einstein’s  Theory of General Relativity: the perihelion precession of Mercury, the other Solar System planets, and the planetoid Pluto, the bending of light by massive bodies, and the gravitational red shift. I recently wrote a C# program for displaying the exaggerated Rosette motion of theoretical planets (Schwarzschild’s solution to Einstein’s general relativity field equation that admit the existence of black holes). I also wrote a C++ program to calculate planetary precession values that agree with experimental results.

Precession.cpp (c) James Pate Williams, Jr. August 2022

This program calculates the planetary precessions of the planets in our solar system. Some of the  equations and data are from “General Relativity” by Hans Stephani 1982 page 103 and the following websites. Also, two calculations of the mass of the Sun are exhibited, along with my weight on different planets:

https://nssdc.gsfc.nasa.gov/planetary/factsheet/

https://farside.ph.utexas.edu/teaching/celestial/Celestialhtml/node44.html

https://imagine.gsfc.nasa.gov/features/yba/CygX1_mass/gravity/sun_mass.html

https://socratic.org/questions/how-do-you-calculate-the-mass-of-the-sun-m-sun-using-kepler-s-third-law-t-2-4-pi

https://en.wikipedia.org/wiki/Surface_gravity

https://www.schoolsobservatory.org/discover/quick/weight/https://physicscalc.com/physics/escape-velocity-calculator/#:~:text=Steps%20to%20Find%20Escape%20Velocity%201%20Obtain%20the,the%20double%20the%20result%20is%20the%20escape%20velocity

Planetary Precession C++ Program Output

Rosette Motion 1

Rosette Motion 2
Rosette Motion 3
Rosette Motion 4
Rosette Motion 5

Rosette Motion 6

Rosette Motion 7

Blog Entry Monday April 4, 2022

This morning as I was leaving the gym at about 2:00 AM a fellow gym member made the following remark to me: “I hear you are a scientist” and I responded “yes, a computer scientist and computer or software engineer”. Later as I was headed towards my car, this same other gym member pointed towards a planet or star in the early morning sky and asked, “what is the object in the sky he was pointing towards was?”. I did note answer his question on the spot and now I offer the following theories. Well, if we had a high-resolution telescope and/or a spectroscope we could differentiate a planet from a star due to the chemical composition of the object. There is a theory posed by Alpher, Bethe, and Gamov which states the lightest elements in the universe, namely hydrogen and helium were formed during the Big Bang and the other 115 elements were either made by humans in nuclear physics laboratories (breeder nuclear reactors or other means) or the rest of the chemical elements were synthesized in the stars. Stars are classified by the Alpher, Bethe, and Gamov scheme:

Star Type Classification / NASA | Kaggle

https://blogs.scientificamerican.com/basic-space/httpblogsscientificamericancombasic-space20110802on-the-origin-of-chemical-elements/

Asymptotic giant branch – Wikipedia

Blog Entry Tuesday March 29, 2022

This application’s code was translated from vanilla C to C#. The C code is from the treatise “A Numerical Library for Scientists and Engineers” by H. T. Lau “Chapter 5: Analytic Problems – Runge-Kutta 5th order no derivatives in the right hand side”. The first test case is from the preceding tome.

RK2 Test Case
Micheal Penn’s Nonlinear ODE Data Table

I found an interesting differential second order nonlinear initial value equation on Michael Penn’s voluminous YouTube website: Michael Penn – YouTube. The equation is y”(x) = -exp(y). The solution is illustrated in the following table and graph:

Micheal Penn’s Nonlinear ODE Graph