Article Preview

Buy Now

*Instant purchase and download via GumRoad!*

REVIEW

## Numerical Recipes Routines and Examples in BASIC

**Issue:** 20.6 (November/December 2022)**Author:** Vince Du Beau**Article Description:** No description available.**Article Length (in bytes):** 5,904**Starting Page Number:** 12**Article Number:** 20602**Related Link(s):** None

**Full text of article...**

My first programming job was in the R&D department of a pharmaceutical company. We basically ran the data submitted by doctors for drug trials through various statistical analysis programs for submission to the FDA. Most of the programs were written in FORTRAN. I didn't personally write any from scratch, but it did peak my interest in statistics.

Fast forward to a few years ago. After seeing all of the CDC trend analysis of Covid, I again became interested in statistical programming. I am looking at Python and the R environment to learn more about data science. I remembered seeing the

Numerical Recipes: The Art of Scientific Computing book ages ago and wanted to see if there was one that addressed the routines in the basic language that could be helpful for Xojo programming.Numerical Recipes In BASIC is meant to be a companion to the original book, which gives more thorough explanations of the functions and routines presented.The original book came with 3.5 inch floppies containing all of the functions and routines with a license to use them in whatever way the purchaser wanted. The source code was written and tested for Microsoft's QuickBASIC version 4.5.

Sad to admit, but I actually have it running under FreeDos on my Mac. "Why?" you may be thinking. In the early 1980s I was hired by a guy to write a program to help him keep track of horse race results. The only computer that he had was a Radio Shack TRS-80. My only language choice was their BASIC interpreter. He eventually bought an IBM compatible, so I decided to bring the original code over to QuickBASIC. I did some interesting UI things that weren't really normal for the time, especially in BASIC.

I bought my copy of the book on Amazon used, so I didn't get the floppies. (And who has a floppy drive anymore?) If you really want the source code with a license to use it, a CD can be purchased from Amazon that contains the source for most languages that had a book published (

`https://www.amazon.com/Numerical-Recipes-Source-Code-CD-ROM/dp/0521706858`

). It is rather pricey.The first chapter of the book covers what it terms "Preliminaries." This is to get the reader familiar with the code in the book. It covers a Julian date routine as well as a program to calculate full moon phases. I'm not really sure how useful a Julian date routine could be these days, but I do remember writing both FORTRAN and COBOL subroutines back in the day to do just that (probably in order to calculate the number of days between dates).

Note: I tried running the Julian date code in QuickBasic. There seems to be some errors in the code as it would crash a lot. Admittedly, it's been many years since I used QuickBasic, so that spotting the errors were more difficult. As the saying goes, "Buyer beware." Eventually I plan on attempting to transcode some of the routines to Xojo. Might make for an interesting project and article. Hopefully, that will go better.The next four chapters cover Linear Algebra, Interpolation and Extrapolation, Integration of Functions, and Evaluation of Functions.

The sixth chapter talks about some special functions that could be useful for data analysis. Most of these are probably on any decent scientific calculator, but could be handy if you need to include such analysis in a program that you are writing.

The rest of the chapters address things from Random numbers to Differential Equations.

I'm not going to pretend that I understand all of the math presented in the book. It's been far too many years since I've had to use it. I have actually started collecting books from Amazon on advanced mathematics like Calculus, Linear Algebra, and Statistics. I also purchased a Udemy course to use as a review. I am trying to be serious about getting back to statistics programming and data analysis.

If you have any interest in the above or wish to explore the field of Data Science the "Numerical Recipes" books could be worth the effort of checking them out. Another series of books that could be useful are

The Art of Computer Programming by Donald Knuth. I don't personally own them, but I do remember looking through them as our department had a library of useful books. Maybe one day I'll see if I can purchase them for the nostalgia factor. In the earlier days they were the go-to books for algorithms.

End of article.