Collection of functions for DM42/Free42 (updated on 2021-02-23)

Contributions to this software library are always welcome. Please ensure that you post program listings rather than .raw files. They give a reasonable idea of what your program does without having to load them into a DM42 and you can also include comments in your code. Check out the following link for a decoder/encoder: https://technical.swissmicros.com/decoders/dm42/

You can then copy/paste the listing and post it in "code" tags.
User avatar
salvomic
Posts: 186
Joined: Sat Dec 30, 2017 10:09 am
Location: Ragusa, Sicily
Contact:

Re: Collection of functions for DM42/Free42 (updated on 2021-02-03)

Post by salvomic »

ferni123 wrote:
Sun Feb 07, 2021 5:09 pm

Then, how do you compute the 2nd derivative?

Step 0: Write the new function/program FF as explained above
Step 1: Type FF in Alpha register
Step 2: Type 2 in X-register
Step 3: Run DERIV function
Step 4: Set value of A in the menu with the number you like (type the value in the x-register and press the A option in the soft menu)
Step 5: Set the value of x where you would like to evaluate the 2nd derivative, for instance 1. (type 1 in the x-register and press the X option in the soft menu)
Step 6: Press again on the X option in the soft menu to indicate that you would like to derivative using the X variable
Step 7: You get in X-register the value of the 2nd derivative of FF evaluated in X=1
...
Actually, HP 42s, Free42 and DM42 should have a standard interactive derivative function as the integral one, using custom menu:
∂f(x)
menu -> choose function, choose order, choose point, choose accuracy -> result

Salvo
∫aL√0mic (IT9CLU) :: DM42 (SN: 00881), DM41X (SN 00523), DM16, HP Prime, 50g, 41CX, 42s, 71b, 15C, 12C, 35s, WP34s -- Free42
User avatar
salvomic
Posts: 186
Joined: Sat Dec 30, 2017 10:09 am
Location: Ragusa, Sicily
Contact:

Re: Collection of functions for DM42/Free42 (updated on 2021-02-03)

Post by salvomic »

ferni123 wrote:
Sat Jan 23, 2021 8:00 pm

Since I am considering to keep updating them, I have published them in Gitlab to keep track of the changes: https://gitlab.com/fmartinp/programs42
...
UPDATE 2021-02-03
...
hi Fernando,
in Free42 I deleted all programs by yours and loaded last version. But with DERIV I get again "Non existent"...
Apparently the program DERIV stops in line 246: XROM 31,40
I put FF (my function) in Alpha, then 2 in X, then XEQ DERIV.

And more, is there no DRIVN as first?

A last hint requested: how to delete all routines (first of import the new ones) without doing it one by one?

thank you,
Salvo
∫aL√0mic (IT9CLU) :: DM42 (SN: 00881), DM41X (SN 00523), DM16, HP Prime, 50g, 41CX, 42s, 71b, 15C, 12C, 35s, WP34s -- Free42
Thomas Okken
Posts: 1102
Joined: Tue May 02, 2017 5:48 pm
Location: Netherlands
Contact:

Re: Collection of functions for DM42/Free42 (updated on 2021-02-03)

Post by Thomas Okken »

salvomic wrote:
Sat Feb 20, 2021 11:12 pm
Apparently the program DERIV stops in line 246: XROM 31,40
XROM 31,40 is the new PGMMENU function, which presents a menu of programs with MVAR, like the initial menu presented by SOLVE and ∫f(x). That function isn't in any official Free42 release yet, though, it's only in the test versions of Free42 and Plus42 that are currently on my web site. Using that function in published code is perhaps a bit premature.
User avatar
salvomic
Posts: 186
Joined: Sat Dec 30, 2017 10:09 am
Location: Ragusa, Sicily
Contact:

Re: Collection of functions for DM42/Free42 (updated on 2021-02-03)

Post by salvomic »

Thomas Okken wrote:
Sun Feb 21, 2021 2:17 am

XROM 31,40 is the new PGMMENU function, which presents a menu of programs with MVAR, like the initial menu presented by SOLVE and ∫f(x). That function isn't in any official Free42 release yet, though, it's only in the test versions of Free42 and Plus42 that are currently on my web site. Using that function in published code is perhaps a bit premature.
I see. Indeed, the previous version haven't this problem in Free42 (not still in DM42, as there it is not FUNC), maybe Fernando has put XROM starting by this version.

thanks,
Salvo
∫aL√0mic (IT9CLU) :: DM42 (SN: 00881), DM41X (SN 00523), DM16, HP Prime, 50g, 41CX, 42s, 71b, 15C, 12C, 35s, WP34s -- Free42
User avatar
salvomic
Posts: 186
Joined: Sat Dec 30, 2017 10:09 am
Location: Ragusa, Sicily
Contact:

Re: Collection of functions for DM42/Free42 (updated on 2021-02-03)

Post by salvomic »

ferni123 wrote:
Sat Jan 23, 2021 8:00 pm
CALC program

Collection of calculus related functions accessible through a CUSTOM menu.
List of functions:
...
– SUM1
- SUMN: Compute the sum of a serie specified by MVAR function (defining the step)
...
hi Fernando,
how to set the registers for the Sum function?
I tried:
– function (MVAR; FF) in Alpha
– low limit in X
– XEQ SUM1
but then, how to put the high limit, into X MVAR?

e.g.: FF is 1/(1+x) and I want calculate sum(1/(1+x), 0, 10)

thanks,
Salvo
∫aL√0mic (IT9CLU) :: DM42 (SN: 00881), DM41X (SN 00523), DM16, HP Prime, 50g, 41CX, 42s, 71b, 15C, 12C, 35s, WP34s -- Free42
ferni123
Posts: 36
Joined: Tue Aug 08, 2017 11:24 am

Re: Collection of functions for DM42/Free42 (updated on 2021-02-03)

Post by ferni123 »

Hi Salvo,

In the version that you are using, input the FF in Alpha and the top limit of the sum in X-register. Afterwards, run XEQ SUM1. The VARMENU will show up and you set the variable with the lower limit and select it pressing again on it.

Notice that I have just uploaded a new version of CALC where all the functions are interactive. However, it will only work with Free42 v3.0.0 which is not yet officially available. The good thing of gitlab is that you can navigate through the different commits and select older versions of CALC.

Cheers,
Fernando
User avatar
salvomic
Posts: 186
Joined: Sat Dec 30, 2017 10:09 am
Location: Ragusa, Sicily
Contact:

Re: Collection of functions for DM42/Free42 (updated on 2021-02-03)

Post by salvomic »

ferni123 wrote:
Sun Feb 21, 2021 10:21 pm
Hi Salvo,

In the version that you are using, input the FF in Alpha and the top limit of the sum in X-register. Afterwards, run XEQ SUM1. The VARMENU will show up and you set the variable with the lower limit and select it pressing again on it.

Notice that I have just uploaded a new version of CALC where all the functions are interactive. However, it will only work with Free42 v3.0.0 which is not yet officially available. The good thing of gitlab is that you can navigate through the different commits and select older versions of CALC.

Cheers,
Fernando
oh, well, thanks; now it works. I thought tu put the low limit first...
Ok for the new version, but, as Tom said, I prefer to wait for the official version. However Calc is very nice to have in Free42 and DM42 (maybe for this one a new FW will be soon...), as also the other utilities.

To install the new version we must first deinstall the old. It would be nice to replace a program in DM42 without first clearing the old labels, maybe someday :)

Salvo
∫aL√0mic (IT9CLU) :: DM42 (SN: 00881), DM41X (SN 00523), DM16, HP Prime, 50g, 41CX, 42s, 71b, 15C, 12C, 35s, WP34s -- Free42
ferni123
Posts: 36
Joined: Tue Aug 08, 2017 11:24 am

Re: Collection of functions for DM42/Free42 (updated on 2021-02-03)

Post by ferni123 »

In case you would like to see how the interactive CALC looks like, you can have a look at in the computer using the test versions of Free42: https://thomasokken.com/free42/download/test/

The addition of PGMENU (in version Free42 v3) + FUNC and RTN functions give the flexibility needed to create programs as the built-in functions.

By the way, I have added also a new behaviour in UNIT module. It uses FUNC command, so it only works in Free42, but not officially yet in DM42.

Regards,
Fernando
User avatar
salvomic
Posts: 186
Joined: Sat Dec 30, 2017 10:09 am
Location: Ragusa, Sicily
Contact:

Re: Collection of functions for DM42/Free42 (updated on 2021-02-03)

Post by salvomic »

thanks a lot, Fernando!
Salvo

EDIT: I'm trying Calc (Deriv) in my Mac with Free42 test 2.25 and your new interactive version.
Very interesting.
Please, could you explain to me which values to put in "Accuracy"? I get a wrong (too high) value of the derivative or "out of range" or "invalid data"...
I'm testing FF (1/(1+x)), order 2, in the point 3, I should get 0.03125...

You could also put some examples in Gitlab.com among the info files...
∫aL√0mic (IT9CLU) :: DM42 (SN: 00881), DM41X (SN 00523), DM16, HP Prime, 50g, 41CX, 42s, 71b, 15C, 12C, 35s, WP34s -- Free42
ferni123
Posts: 36
Joined: Tue Aug 08, 2017 11:24 am

Re: Collection of functions for DM42/Free42 (updated on 2021-02-03)

Post by ferni123 »

Hi Salvo,

Regarding the accuracy, I have used the same definition as here: https://en.wikipedia.org/wiki/Finite_di ... oefficient and it is an integer which relates with the amount of elements used for the the derivative computation. By default, it is set to ORDER + 2. If you modify it, the label of the ACC menu changes and disappear the +2 in the label. Every time that you set an order the accuracy is updated to ORDER+2.

The steps are:

1)Define the function
LBL "FX"
MVAR "X"
1
RCL+ "X"
1/X
END
2) XEQ DERIV
3) Select FX
4) Set "X" to 3
5) Select "X" as variable
6) Define the order to "2" in the menu
7) No need to change the accuracy
8) Press DERIV

Thanks for the suggestion on including some examples in Gitlab.com

I also will add some tags (when I know how to do it) to differentiate which version of the file works with the released Free42. So, whatever is not tagged, it would mean that is work in progress.

Cheers,
Fernando
Post Reply