# HP-42S/Free42 Programs

 plot_orig: raw txt Original version of PLOT from the HP-42S manual. Plots a function on an HP-82240 printer. plot_thomas: raw txt Modified version of PLOT; like the original, with SOLVE support added. miscfn: raw txt Original version of MISCFN from the HP-42S manual. Calculates (x/360) * sin(3*x) + 1; used to demonstrate the PLOT program. Set DEG and ALL modes; in PLOT, use YMIN=-0.5, YMAX=2, AXIS=0, XMIN=-360, XMAX=360, XINC=45. dplot_orig: raw txt Original version of DPLOT from the HP-42S manual. dplot_thomas: raw txt Modified version of DPLOT; like the original, with SOLVE support added. wave: raw txt Calculates sin(x) * sin(5*x). Used to demonstrate DPLOT. Set DEG mode; in DPLOT, use YMIN=-1, YMAX=1, AXIS=0, XMIN=0, XMAX=180. gc: raw txt SOLVE program to compute the Great Circle Distance between two points on the Earth. Coordinates should be entered in decimal degrees; distance is computed in kilometers. sun: raw txt SOLVE program to compute the height of the sun above the horizon. Variables used: TILT: the angle between the Earth's axis of rotation and the normal of the ecliptic (23.5 degrees); LAT: observer's latitude (use positive values for Northern latitudes, negative values for Southern latitudes); SEAS: the current season, given as an angle between 0 and 360 degrees, with 0 being mid-winter in the Northern hemisphere, 90 being the Northern Spring equinox, etc.; TOD: time of day (solar time, from 0-24, where 12 is noon; solar time differs from official time, depending on where you are within your time zone); HGHT: height of the sun above the horizon, in degrees; negative numbers mean nighttime. prm_dec: raw txt Original version of Erik Ehrling's PRM? program. NOTE: this program relies on decimal math, and will NOT produce correct results on Free42 Binary. prm_bin: raw txt Modified version of PRM?; works with binary math, enabling it to run on Free42 Binary. Before using, store 2^20 in "E6" and 2^40 in "E12" (you can use 2^26 and 2^52, respectively, too; that way the program can work with even larger numbers). diag: raw txt Constructs band-diagonal matrices. Put the desired dimension in X, and put a vector containing the (off-)diagonal elements in Y. If the vector's length is odd, its middle element will go on the diagonal; if its length is even, the element just before the middle will go on the diagonal. stress: raw txt synth: raw txt Not actually a functional program; just contains all the HP-42S instructions with all legal types of arguments. I used this to test the "raw" mode program import/export in Free42. The synth program contains some synthetic functions. It doesn't exercise all the synthetic function/argument combinations possible on the HP-42S, just the ones that could result from importing HP-41 code. mast: raw txt The classic Master Mind number-guessing game. Numbers can contain digits 1 to 6, with duplicates allowed. Results are displayed as B.W, with B the number of black pegs (right color AND right position), and W the number of white pegs (right color, wrong position). Use the "up" and "down" keys to scroll through the current game's history. minehunt: raw txt Minehunt game, similar to the built-in game on the HP-48. By Erik Ehrling. Slightly modified from the original to keep running when the calculator is power-cycled. Also, fixed a bug where a mine could be placed in the exit square, which would cause invalid mine counts to be displayed in the two squares above the exit. Okie Dokie: raw txt Okie Dokie, a puzzle game, based on an original for the Atari 2600. By Erik Ehrling. See here for documentation. rtmin: raw txt A program that finds extrema and roots of arbitrary functions. Contributed by Namir Shammas; see here for documentation. RootsEqns: raw txt A program that solves multiple nonlinear equations. Contributed by Namir Shammas; see here for documentation. mlran: raw txt A program that performs multiple linear regression. Contributed by Namir Shammas; see here for documentation. pi_dec: raw txt Calculates up to 1110 Digits of pi on the HP-41, more on a 42S. Put the desired number of digits in X and do XEQ "PI". When done, the digits of pi will be stored in register 04 and up. See here for documentation and the program listing. NOTE: this program relies on decimal math, and will NOT produce correct results on Free42 Binary. NikkelTaylorCadastral.zip Cadastral Program, contributed by Tony Nikkel. (Blurb, Flyer, Installation Instructions. Note: these materials are also included in the download package.) aes: raw txt aesprep: raw txt Advanced Encryption Standard, contributed by Brett Stevens. Program listing and documentation is here; the author's web page is here. Note: the aesprep.raw file contains a program that initializes registers 00-63 and 90-153 as described in the documentation; the aes.raw file contains the AES code itself. Base: raw txt ASCII, Hex, Decimal, and Binary conversions. See here for documentation. Contributed by Ton van de Burgt. Convert: raw txt Unit conversions. See here for documentation. Contributed by Ton van de Burgt. Finance: raw txt A collection of financial programs. See here for documentation. Contributed by Ton van de Burgt. Triangle: raw txt Calculate the sides and angles of a triangle. See here for documentation. Contributed by Ton van de Burgt. ses: raw txt sestest: raw txt Simultaneous Equation Solver, based on an RPL program by Mike Ingle. See here for documentation. RealEigenvalues: raw txt Calculate real eigenvalues of a real-valued square matrix. Contributed by Pierre Gillet; see here for documentation. G4_G3_G2: raw txt Solves 2nd, 3rd, and 4th order polynomials. using closed-form solutions. Contributed by Christian Vetterli. STATISTICS: raw txt Statistics package, with four regression models, mean, standard deviation, median, extremes, chi-square and Student-t distributions, and more. There is some documentation here. Contributed by William Solano. ntrp: raw txt Perform linear interpolation. Contributed by Russ Jones. lrnc: raw txt Perform learning curve calculations. Contributed by Russ Jones. mort: raw txt Perform time value of money (annuity) calculations. Contributed by Russ Jones. FWIW-1.1.zip SHOW replacement that displays the contents of X in Free42's full 34 digits of precision. Includes an annotated listing. Contributed by Glen Sanft. delsnider.zip A collection of civil, road, and municipal programs. Contributed by Ken Delsnider. cogo-42.zip COGO-42 coordinate geometry package. Contributed by Mike Reed. cw-16-04-10d.zip CW+ Pipe flow calculator using the Colebrook White equation. May be of interest to Civil and Mechanical Engineers and practicioners. Documentation included in download. Contributed by Andrew Happ. CP4GC: raw txt Construction of 4th degree monadic polynomial from two complex conjugated zeros, with documentation. Contributed by Günter Gaus. CP4GR: raw txt Construction of 4th degree monadic polynomial from four real zeros, with documentation. Contributed by Günter Gaus. CP4GRC: raw txt Construction of 4th degree monadic polynomial from two real and one complex conjugated zeros, with documentation. Contributed by Günter Gaus. G4G: raw txt Monadic quartic equation solution, with documentation. Contributed by Günter Gaus. ASTRO_TSO: raw txt ASTRA_TSO: raw txt Astronavigation (Celestial Navigation) The target audience of both programs is the 'sextant community'. These programs make the HP-42S (Free42) a worthy equivalent of an astrocomputer to navigate by the sun. A thorough knowledge of the calculator is not required. ASTRO_TSO: calculates the fix using the standard azimuth-intercept method of Marcq St. Hilaire which is based on the calculation of the point of intersection of 2 position lines. ASTRA_TSO: calculates the fix using an alternative method, calculating by iteration the points of intersection of two circles of equal altitude. Both programs have a built-in almanac of the sun with an average error of +/- 0.3' on the GHA and DEC and make the use of plotting sheets superfluous. Date, time and fix appear simultaneously in the display and can be shown in a custom format in the "Print-Out". Documentation in English and Dutch. Programs contributed by Harry Ackermans. Updated December 18, 2019. unixtime: raw txt Conversion between Unix timestamps and local time: UTIME returns current time as a Unix timestamp; T2U converts from local time (date in Y, time in X) to a Unix timestamp, and U2T converts a Unix timestamp to local time (date in Y, time in X). It uses TZOFF to hold the offset between local time and UTC, in hours. For example, Central European Standard Time is one hour ahead of UTC, so set TZOFF = 1. If TZOFF is unset, it is assumed to be zero. DO_CALC: raw txt N_CAL: raw txt Dissolved Oxygen and Ammonia Nitrogen calculations. The author writes: "I have two programs for upload and review. They have helped me immensely in the waste water laboratory setting and would like to share. One calculates the Dissolved oxygen (DO) in saturated laboratory grade water at temp and barometric pressure. This is used for the air calibration of a DO meter used in the five day Biological Oxygen Demand (BOD) test. The other is used for the calculation of ammonia nitrogen using an ammonia nitrogen probe with standard addition. This is a much faster method than is normally used, it just takes a bit more mathematics." Contributed by Martin Moeglein. fac: raw txt ack: raw txt Two small programs that demonstrate the use of local variables to implement recursive algorithms. FAC implements the factorial, and ACK implements the Ackermann function. twix: raw txt ufl: raw txt Twix, a number puzzle game. Contributed by Daniel Bausset. With documentation.