5-Number Summary Calculation for the HP 42s - Printable Version +- HP Forums (https://www.hpmuseum.org/forum) +-- Forum: HP Calculators (and very old HP Computers) (/forum-3.html) +--- Forum: General Forum (/forum-4.html) +--- Thread: 5-Number Summary Calculation for the HP 42s (/thread-22563.html) |
5-Number Summary Calculation for the HP 42s - cylurian - 10-23-2024 10:11 PM Can someone help me with programming the 5-number summary for the HP 42s. I'm working on two programs to calculate the 5-number summary using both the "Exclusive" and "Inclusive" methods. Usually, the TI calculators do the Exclusive method - meaning that they don't use the median to calculator Q1 or Q3. Here's a breakdown of what could happen. Program 1: Exclusive Method 1. Create an nx1 matrix. 2. Sort the matrix in ascending order. 3. Identify the minimum and maximum values from the sorted matrix. 4. Determine if the dataset has an odd or even number of elements using a modulo operation. 5. Find the Median and Store it in M 6. Calculate Q1 and Q3: - If the dataset is odd, exclude the median when dividing the data for Q1 and Q3. 7. Display the five-number summary: Min, Q1, Median, Q3, Max. Program 2: Inclusive Method 1. Create an nx1 matrix. 2. Sort the matrix in ascending order. 3. Identify the minimum and maximum values from the sorted matrix. 4. Determine if the dataset has an odd or even number of elements using a modulo operation. 5. Find the Median 6. Calculate Q1 and Q3: - If the dataset is odd, include the median when dividing the data for Q1 and Q3. 7. Display the five-number summary: Min, Q1, Median, Q3, Max. Any guidance on how to implement this on an HP 42S calculator would be greatly appreciated! RE: 5-Number Summary Calculation for the HP 42s - Gjermund Skailand - 10-24-2024 06:17 PM Hi, here is a building block that you may find useful. It sorts a column or matrix using the first column as index. It illustrates some "advanced" techniques on the HP42S input on stack: matrix [m,1] or matrix[m,n] output : sorted matrix 00 { 35-Byte Prgm } 01 LBL "SORT" 02 STO "." 03 INDEX "." 04 1 05 LBL 00 06 [MIN] @ get index and value of minimum row from current position 07 Rd 08 R<>R @ swap current row with the minimum row 09 ISG ST Y 10 CLX @ on DM42, Free42 use NOP 11 Rd 12 I+ 13 FC? 76 @ row index not wrapped? 14 GTO 00 15 RCL "." Notes Rd means the R_down_arrow [MIN] must on the HP42s be entered as XEQ "[MIN]", on DM42/Free42 you can find it at end of the CATALOG/FCN menu. [MIN] searches from indexed position to end of column, returns position of minimum value in Y, and minimum value in X Similar with [MAX] In case you want to modify the program to sort on a different column, say i, then insert after line 4: i STOIJ X<>Y mvh Gjermund RE: 5-Number Summary Calculation for the HP 42s - cylurian - 10-24-2024 10:00 PM Thanks for the code. I'm testing this on my DM 42. For a 6x1 it looked good, but when there were duplicates, the sorting fell apart for exam 6x1 = {4, 4, 5, 2, 1, 6} it wasn't able to sort, and a 10X1 the program gave me a Dimension Error. thx. RE: 5-Number Summary Calculation for the HP 42s - Paul Dale - 10-24-2024 10:08 PM Installing the C47 firmware on your DM42 makes this really easy. It's got the five functions built it and they operate on the stats matrix. RE: 5-Number Summary Calculation for the HP 42s - cylurian - 10-24-2024 10:17 PM Thank you for telling me. I've been waiting for my overlay for weeks! I can't wait to see what the C47 can do. In the mean time, I've been asking folks to help me program the HP 42s for some basic stats. RE: 5-Number Summary Calculation for the HP 42s - Paul Dale - 10-25-2024 01:24 AM I've asked for a check up on your overlay shipping. RE: 5-Number Summary Calculation for the HP 42s - Jaco@cocoon-creations.com - 10-25-2024 04:57 AM (10-24-2024 10:17 PM)cylurian Wrote: … I've been waiting for my (C47) overlay for weeks! … Please send me an email with your name and I will gladly check on the order. My user name here is my valid email address. |