5-Number Summary Calculation for the HP 42s
|
10-23-2024, 10:11 PM
(This post was last modified: 10-24-2024 02:52 AM by cylurian.)
Post: #1
|
|||
|
|||
5-Number Summary Calculation for the HP 42s
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! |
|||
10-24-2024, 06:17 PM
(This post was last modified: 10-24-2024 06:19 PM by Gjermund Skailand.)
Post: #2
|
|||
|
|||
RE: 5-Number Summary Calculation for the HP 42s
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 |
|||
10-24-2024, 10:00 PM
Post: #3
|
|||
|
|||
RE: 5-Number Summary Calculation for the HP 42s
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. |
|||
10-24-2024, 10:08 PM
Post: #4
|
|||
|
|||
RE: 5-Number Summary Calculation for the HP 42s
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.
|
|||
10-24-2024, 10:17 PM
Post: #5
|
|||
|
|||
RE: 5-Number Summary Calculation for the HP 42s
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.
|
|||
10-25-2024, 01:24 AM
Post: #6
|
|||
|
|||
RE: 5-Number Summary Calculation for the HP 42s
I've asked for a check up on your overlay shipping.
|
|||
10-25-2024, 04:57 AM
Post: #7
|
|||
|
|||
RE: 5-Number Summary Calculation for the HP 42s
(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. Jaco Mostert, Elec Eng C47 on DM42, 42S, WP34C&S, 28C, 35S, 32Sii, had 11C; used 67, 85; iOS:42s, Free42, WP31S&34S, HCalc; OSX:WP34C. |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 4 Guest(s)