## [MIN],[MAX] and [FIND]...how to?

Discussion around the Swiss Micros DM42 calculator.
mcc
Posts: 233
Joined: Fri Jun 23, 2017 5:10 am

### [MIN],[MAX] and [FIND]...how to?

Hi,

The Free42 calculator of Thomas Okken even includes functions, which HP does not made public...
The new Free42 version 2.50.20, which was released recently, made those easy accesible via the function
catalog now...they were "hidden" previously.

I tried those on my DM42 and did not get any results...I am unsure, whether they were included (but "hidden")
or not at all in the current firmware build or whether I am the reason for it.

For the [FIND] function I did this:
Create a named matrix (2x2) and fill them with 11,13,17,19
RCL it on the stack (x).
17 ENTER (x, matrix is on y now)
XEQ "[FIND]"
Response: "Not existent".

The link to Joseph K. Horns findings regarding these function is dead in the Free42 pdf but can be found here:
https://archived.hpcalc.org/hp42s/docs/ ... tions.html
...but I obviously didn't understand those correctly.

Background: Until a new firmware for the DM42 is released, which may include the newest Free42 code I want to place
those three functions into the CUSTOM menu...

Any help how to use these functions is very appreciated...thank you

Cheers
mcc
DM 42 - SN: 00373, Firmware release v.:3.16. / DMCP 3.20. as compiled by SwissMicros

whuyse
Posts: 81
Joined: Thu Dec 21, 2017 1:23 pm

### Re: [MIN],[MAX] and [FIND]...how to?

I don't quite understand what more help you need apart from Joe's very extensive documentation of these functions?
Werner
42S #3249S01123
DM42 #00345

firai
Posts: 23
Joined: Sun Sep 27, 2020 11:38 am
Location: NYC/HK

### Re: [MIN],[MAX] and [FIND]...how to?

The functions are documented at https://www.hpmuseum.org/forum/thread-8887.html. I believe you need to INDEX the matrix (under the MATRIX menu) before you execute [FIND].

Edit: I just tested this in Free42 Windows. The [FIND] function doesn't seem to work with a matrix that's only on the stack; you need to first STO the matrix and then INDEX it as documented by Joe Horn. The matrix that's been most recently indexed is the one that [FIND] will try to search in.
Last edited by firai on Mon Sep 28, 2020 11:32 am, edited 2 times in total.
Sam

Thomas Okken
Posts: 758
Joined: Tue May 02, 2017 5:48 pm
Location: United States
Contact:

### Re: [MIN],[MAX] and [FIND]...how to?

mcc wrote:
Mon Sep 28, 2020 7:16 am
For the [FIND] function I did this:
Create a named matrix (2x2) and fill them with 11,13,17,19
RCL it on the stack (x).
17 ENTER (x, matrix is on y now)
XEQ "[FIND]"
Response: "Not existent".
Try again without the ENTER...

grsbanks
Posts: 1021
Joined: Tue Apr 25, 2017 11:23 am
Location: Preston, Lancs, UK
Contact:

### Re: [MIN],[MAX] and [FIND]...how to?

mcc wrote:
Mon Sep 28, 2020 7:16 am
For the [FIND] function I did this:
Create a named matrix (2x2) and fill them with 11,13,17,19
RCL it on the stack (x).
17 ENTER (x, matrix is on y now)
No it isn't

17 is in X and Y and the matrix is in Z.
There are only 10 kinds of people in the world: those who understand binary and those who do not.

mcc
Posts: 233
Joined: Fri Jun 23, 2017 5:10 am

### Re: [MIN],[MAX] and [FIND]...how to?

Hi,

Thanks for the help! It works now. I missed the INDEX and ENTER was supferfluos.

Cheers!
mcc

DM 42 - SN: 00373, Firmware release v.:3.16. / DMCP 3.20. as compiled by SwissMicros

whuyse
Posts: 81
Joined: Thu Dec 21, 2017 1:23 pm

### Re: [MIN],[MAX] and [FIND]...how to?

firai wrote:
Mon Sep 28, 2020 7:52 am
Edit: I just tested this in Free42 Windows. The [FIND] function doesn't seem to work with a matrix that's only on the stack; you need to first STO the matrix and then INDEX it as documented by Joe Horn. The matrix that's been most recently indexed is the one that [FIND] will try to search in.
You can EDIT the matrix in the stack, and then [FIND] etc will work. Remember to exit the editor with EXITALL though.

Cheers, Werner
42S #3249S01123
DM42 #00345

firai
Posts: 23
Joined: Sun Sep 27, 2020 11:38 am
Location: NYC/HK

### Re: [MIN],[MAX] and [FIND]...how to?

whuyse wrote:
Mon Sep 28, 2020 4:52 pm
You can EDIT the matrix in the stack, and then [FIND] etc will work. Remember to exit the editor with EXITALL though.

Cheers, Werner
Do you mean executing the functions while the matrix editor is active, or going into the editor, exiting and then executing the functions? I can execute the functions while the matrix editor is active, but the result that would otherwise be written to the X register for MAX and MIN seems to replace the current matrix entry, and [FIND] always returns "yes".

If I exit out of the editor, even with EXITALL, the functions don't seem to work unless the matrix is explicitly indexed. This seems to be consistent with the 42S manual's suggestion that the matrix is no longer indexed once you exit out of the editor. Am I missing something here? Is there another way of executing the functions without explicitly indexing the matrix?
Sam

whuyse
Posts: 81
Joined: Thu Dec 21, 2017 1:23 pm

### Re: [MIN],[MAX] and [FIND]...how to?

An example says more than a thousand words
Create the matrix
[[ 4 5 6 ]
[ 7 8 9 ]
[ 1 2 3 ]]

Then:

Code: Select all

>LBL "M"
EDIT
Rv
[MAX]
RCLEL
EXITALL
Rv
END
will produce the max of the first column of the matrix, with its row value in Y.
You are EDITing the matrix, so EXITALL will write whatever is in X into the current position, that's what the RCLEL is for.

With the same matrix in Y and the element to search for in X:

Code: Select all

>LBL "F1"
X<>Y
EDIT
Rv
[FIND]
GTO 00
0
ENTER
GTO 01
LBL 00
RCLIJ
LBL 01
COMPLEX
RCLEL
EXITALL
Rv
END

eg [[]] 7 F1 returns (2,1)

Cheers, Werner
42S #3249S01123
DM42 #00345

firai
Posts: 23
Joined: Sun Sep 27, 2020 11:38 am
Location: NYC/HK

### Re: [MIN],[MAX] and [FIND]...how to?

Thanks for the examples! RCLEL was the missing link; I somehow skipped the page in the manual where it was introduced. I should RTFM harder.
Sam