Showing posts with label custom menu. Show all posts
Showing posts with label custom menu. Show all posts

Monday, January 31, 2022

HP Prime: Custom Menu Using a User Key

HP Prime: Custom Menu Using a User Key


Steps:


1.  Create a new program.  Press [ Shift ], [ Esc ] (Clear) to clear the default text.

2.  Press [ Menu ] and select 4.  Create User Key.  Press a key combination.

3.  Use a CHOOSE command to create a pop up menu.   Enclose commands in a string.  For mathematical expressions, use parenthesis.   You may need to test commands.

4.  Use the RETURN command to return a user's choice.


To use the custom menu:

Press [ Shift ], [ Help ] (User), < your user key> 


Template:


KEY K_<your key>()

BEGIN

...

CHOOSE(var, "Custom Menu", list of commands)

RETURN list(var);

END;


The following is an example menu with the following commands:


1.  DDAYS - days between dates (yyyy.mmdd)

2.  DATEADD - add number of days to a base date

3.  QPI - find an exact representation of a floating number

4.  approx - approximate an exact number

5.  B→R - base number to real number

6.  R→B - real number to base number

7.  *(π/180) - convert from degrees to radians

8.  *(180/π) - convert from radians to degrees

9.  rectangular_coordinates - convert polar coordinates to rectangular coordinates (Geometry app).  Use a vector or a complex number.

A.  polar_coordinates - convert rectangular coordinates to polar coordinates (Geometry app).  Use a vector a complex number.   The angle symbol is found by [ Shift ], [ × ]



HP Prime PPL Program:  CUSTOMMENU


I use the Toolbox key.  


KEY K_Math()

BEGIN

LOCAL LM, I;

LM:={"DDAYS()","DATEADD()",

"QPI()","approx()","B→R()","R→B()",

"*(π/180)","*(180/π)",

"rectangular_coordinates()",

"polar_coordinates()"};

CHOOSE(I,"Custom Menu",LM);

RETURN LM(I);

END;



Add any commands you like.  Defining a list before hand.   I hope you find this useful.  



All original content copyright, © 2011-2022.  Edward Shore.   Unauthorized use and/or unauthorized distribution for commercial purposes without express and written permission from the author is strictly prohibited.  This blog entry may be distributed for noncommercial purposes, provided that full credit is given to the author. 


Sunday, December 20, 2020

Review: Swiss Micros DM41X

 Review: Swiss Micros DM41X






General Information


Company:  SwissMicros, https://www.swissmicros.com

Type:  Programmable Scientific

Memory:  319 registers (at default) - calculator; 32 MB external flash

Battery:  CR 2032

Date:  September 2020 - current

Cost:  229 CHF, about $257.34 according to currency converter on December 12, 2020 (https://www.xe.com/currencyconverter/convert/?Amount=229&From=CHF&To=USD)

Current Software Version:  2.1 (November 13, 2020)

Case Included?  Yes


The DM41X is a long waited calculator, and joins the DM 41L and DM41 family.  The family runs HP-41CX firmware, including a clock, time, and date functions.    On February 23, 2018, I reviewed the DM 41L which you can see here:


http://edspi31415.blogspot.com/2018/02/review-swissmicros-dm41l.html


I am going to address the features that are specific to the DM41X, which is added to all the great features of the DM41 and DM41L.  


A Return to the Original Layout





The DM41X's keyboard is in a portrait design, like the original Hewlett Packard HP-41C family (HP-41C, HP-41CV, HP-41CX)


Instead of the row of ON, USER, PRGM, and ALPHA keys on the top row, the DM41X adds a column of keys to the right of the main keyboard:


ON/CLK:  ON/OFF button, the shifted CLK displays the current time


USR/SETUP:  The user keyboard.  SETUP shows the DM41X's system menu where stve states and RAW progams can be saved, USB communication can be activated, modules can be saved and loaded, system settings can be changed, and accessing the About screen.


Blue Key:  This is the ALPHA key


Backspace Key


Up Arrow: for program scrolling and debugging


Down Arrow: for program scrolling and debugging


PRG/SIZE:  The PRGM button.  The shifted function allows the user set the number of registers to be set for numerical constants.


R/S/VIEW:  Run/Stop Key, View prompts for a view of a register's value without affecting the stack.


The Big Screen


The DM41X has three screen settings that is set by the DSP key:


1.  All four stacks, T, Z, Y, and X are displayed.  This is my preferred display. 


2.  The X stack and the Alpha Register are displayed.  On the top of the screen:  alarms, the number of storage registers designated for numerical constants, free memory, the current program loaded and it's pointer location.  


3.  Two stacks, Y and X are displayed. On the top of the screen:  alarms, the number of storage registers designated for numerical constants, free memory, the current program loaded and it's pointer location.  


Connectivity


The DM41X's connectivity interface is in line with the DM42's connectivity interface.  Simply plug the DM41X with a USB-Micro B port, then on the calculator press [shift], [USR] (SETUP), 1 for File, 5 for Activate USB Disk.  The DM41X now acts as a USB storage device like a smart phone.  


You can take screenshots by pressing and holding [SHIFT] and [DSP].  Screen shots are saved as .bmp files under the disk's SCREEN folder.


Black and white images of 400 x 240 pixels, 1 bit depth, .bmp format, can be saved to the disk's OFFIMG folder.  Every picture in the folder will be shown on a rotated basis every time the calculator is turned off.  


Custom Menu


Pressing the CST key will give you access to a custom menu 16 available slots for commands and programs.  CST also gives access to Help, ROM Map, and USB Disk activation.  To learn about how to set up the custom menu, click here:  https://edspi31415.blogspot.com/2020/10/swiss-micros-dm41x-custom-menus.html.


Programming


The DM41X operates like the HP-41CX in its programming language except the DM41X has a lot more room for ROM modules.


Verdict


Like the DM41L, the DM41X is a winner.  The keys feel good, I love seeing all four stack levels on the screen, and I am fan of the custom menu built into the DM41X.  This is definitely worth a purchase.


If the price tag of DM41X is too high, consider the DM41 or DM41L.  They may not have a four line display or a custom menu, but the high-quality calculator software and firmware is still present.  Currently only the DM41L is in stock from Swiss Micros, at CHF 129.  


- - - - - -


Announcement


This is the last post for 2020.  I want to wish everyone Merry Christmas, Happy Holidays, and Happy New Year.  2020 has been a brutal year in every respect.  May 2021 be free from disease, war, economic, social, and spiritual struggle; and be full of joy, health, and happiness.  Thank you to my blog's followers and readers; I appreciate all of you!  Take care, and the next schedule blog will be on January 2, 2021.  


Eddie


All original content copyright, © 2011-2020.  Edward Shore.   Unauthorized use and/or unauthorized distribution for commercial purposes without express and written permission from the author is strictly prohibited.  This blog entry may be distributed for noncommercial purposes, provided that full credit is given to the author. 


Sunday, October 25, 2020

Swiss Micros DM41X: Custom Menus

 Swiss Micros DM41X: Custom Menus




Customize It


With the new Swiss Micros DM41X, custom menus comes to the HP 41C engine.   The custom menu can hold up to 16 commands or user program shortcuts.   Best yet, the customized menu can be saved and transferred among fellow DM 41X users.   The custom menu is very easy to use and set up.


To access the custom menu, just press the [ CST ] key.   To use one of the commands, just press the corresponding key related to the assigned letter, no prior alpha key is required.  For example, to access the command in the A slot, press [ CST ] [ Σ+ ].  


The custom menu has six other commands that are always present:


1.  Help:  The DM41X's help facility which additional commands that come with the 41X, information about the ISG/DSE loops, date, time, and alarms, and additional topics like Angel's references.


2.  ROM Map:  A map where all the modules are loaded into the virtual ROM facility of the DM41X.


3.  Load a RAW file


4.  Save a RAW file


5.  USB Disk:  Put the DM41X in USB mode, allowing to transfer files between the calculator and the computer


6.  Flags:  A map listing the state of all the DM41X's flags.  0 means the flag is off, 1 means the flag is on.


To customize the custom menu, press [gold shift] [ CST ] (CONF).


Pick any of the slots A through P.  While in this mode, you can customize three additional key sequences:


[ gold shift ] [ blue alpha ]


[ gold shift ]  [ ↑ ] 


[ gold shift ]  [ ↓ ]


When prompted, just type the command, label, or program name.  Alpha mode has been turned on automatically.  Finish and accept by pressing the [ R/S ] key.   Pressing the [ ON ] cancels the customization.   The custom menu does not affect the programming memory.


One more thing, the name cannot have a space.   For example:  ARCL ST X is not allowed.   ARCL is.  


That's all there is to it.  Have fun,


Eddie


All original content copyright, © 2011-2020.  Edward Shore.   Unauthorized use and/or unauthorized distribution for commercial purposes without express and written permission from the author is strictly prohibited.  This blog entry may be distributed for noncommercial purposes, provided that full credit is given to the author. 


Friday, November 3, 2017

HP Prime: User Key: Building a list of Templates

HP Prime:  User Key:  Building a list of Templates

Introduction

You can assign a custom menu to a user key.  The program TEMPLATES assigns a list of functions to the templates key (the key to the right of the Toolbox key, key 18 I believe). 

When this program is completed, you call the custom menu by pressing [Shift], [Help] (User), [template key]. 

Choose a function or command.  Whatever you choose will be inserted into the entry line.  This user key works in program editing as well.



HP Prime Program:  TEMPLATES

Note:  I do not have a main “TEMPLATES” program block.  In terms of making a custom menu like this, it is not necessary.


// a custom menu
// 2017 EWS

KEY K_Templ()
BEGIN
LOCAL str,lst,cst,ch;
// templates
lst:={"Function.ROOT()",
"Function.AREA()",
"Function.SLOPE()",
"Finance.TvmNbPmt()",
"Finance.TvmIPYR()",
"Finance.TvmPV()",
"Finance.TvmPMT()",
"Finance.TvmFV()"};


// choose list
cst:={"ROOT",
"AREA",
"SLOPE",
"N",
"I%YR",
"PV",
"PMT",
"FV"};

CHOOSE(ch,"Template",cst);

RETURN lst(ch);

END;

This is one of my favorite programs because now I will be able to quickly access functions that would take additional keystrokes and with the App specific functions, dealing with dynamic menus.  I encourage this type of custom menu for other functions and commands you frequently use from the catalog.  Try it.  Please let me know how it goes.

Eddie


This blog is property of Edward Shore, 2017.

Tuesday, October 18, 2011

RPL Programming Tutorial - Part 13 - HP 49g+/50g: CST Menu and Quadratic Fit

Custom Menus

This may be Part 13 of our RPL tutorial, but it is not going to be an unlucky section (knock on wood). Today, we will create a custom menu and use it for programming.

The calculator contains a custom menu, which can contain as many commands as you want, and whatever commands and programs you want. The custom menu can be changed at any time to fit your needs.

The contents of the menu is a list of contents stored in the variable CST. The custom menu can be accessed by the key sequence [LS] [MODE] (CUSTOM). Best of all, the custom menu can be accessed during program.

To store the custom menu:

1. Have the menu ready at Level 1 on the stack.
2. Press [ ' ] [LS] [EVAL] (PRG) [NXT] [F4] (MODES) [F5] (MENU) [F2] (CST).
3. Press [STO>].

In the program QREG (Quadratic Regression), we will develop a custom menu to assist us.

The QREG takes a two-column matrix, with the first column acting as the x-variable (dependent) and the second column acting as the y-variable (independent) and attempting to find a quadratic fit (see the equation below) of the data by the least-squares method.

y = a + b x + c x^2

The coefficients are found by solving the system of normal equations:

n * a + ∑x * b + ∑x^2 * c = ∑y
∑x * a + ∑x^2 *b + ∑x^3 * c = ∑xy
∑x^2 * a + ∑x^3 * b + ∑x^4 * c = ∑x^2y

Please be aware that QREG is a large program; please take your time with entry. I recommend that you set up the suggested custom menu first - it will save a lot of keystrokes during the entry of the main program.

Source Used: Murray R. Spiegel, Ph. D., John Liu, Ph. D., and Seymour Lipschutz, Ph. D. "Schaum's Outlines: Mathematical Handbook of Formulas and Tables" 2 ed. McGraw-Hill, 1999

The Program QREG

We are going to do things in a little different order in Part 13, starting with the finished program and then let's deal with the keystrokes needed.

<< ->COL DROP SWAP DUP AXL SQ AXL
OVER AXL 3 ^ AXL
3 PICK AXL 4 ^ AXL
5 ROLL
DUP AXL 6 PICK AXL * AXL
2 PICK AXL 6 PICK AXL * AXL
7 COL-> STO∑ CLEAR
N∑
TOT 1 GET
TOT 2 GET
TOT 5 GET
4 ->LIST AXL
TOT 1 GET
TOT 2 GET
TOT 3 GET
TOT 6 GET
4 ->LIST AXL
TOT 2 GET
TOT 3 GET
TOT 4 GET
TOT 7 GET
4 ->LIST AXL
3 ROW-> RREF 4 COL- >>


Note that the commands AXL, STO∑, TOT, PICK, GET, and &#8594LIST appear frequently. Let's make a custom menu with these six commands before we start programming QREG.

Setting Up the Custom Menu

[LS] [ + ] ( { } )
* Start the list
[LS] 6 [F5] (MATRX) [F1] (AXL)
* The first command AXL
[RS] [SYMB] (CAT) [ALPHA] [SIN] (S) find STO∑ [F6] (OK)
* The second command STO∑
[RS] [SYMB] (CAT) [ALPHA] [COS] (T) find TOT [F6] (OK)
* The third command TOT
[LS] [EVAL] (PRG) [F1] (STACK) [NXT] [F3] (PICK)
* The fourth command PICK
[LS] [EVAL] (PRG) [F6] (LIST) [F1] (ELEM) [F1] (GET)
* The fifth command GET
[NXT] [F6] (LIST) [F4] (->LIST)
* The sixth command &#8594LIST, going from the current menu
[LS] [EVAL] (PRG) [NXT] [F4] (MODES) [F5] (MENU) [ ' ] [F2] (CST) [ENTER] [STO>]
* Stores the custom menu.

The commands in the custom menu:

AXL: a toggle. AXL changes a list to a vector. AXL changes a vector to a list.
STO∑: stores a matrix into the variable ∑DAT. ∑DAT is used for statistical analysis.
TOT: Totals each column of ∑DAT.
PICK: Picks a certain level from the stack. Syntax: n PICK
GET: Gets or retrieves an element of a list, vector, or matrix. Syntax: list n GET
->LIST: Takes n levels from the stack and creates a list. Syntax: n &#8594LIST

The custom menu will set up with the soft keys:

[F1] (AXL)
[F2] (STO∑)
[F3] (TOT)
[F4] (PICK)
[F5] (GET)
[F6] (->LIST)

Other Commands Used

->COL: Matrix to Columns command. Extracts a column from a matrix.
COL->: Columns to Matrix command. Transfers a given set of column vectors to a matrix.
ROW->: Rows to Matrix command. Creates a matrix from a given set of row vectors.
RREF: Calculates the row-reduced-echelon form of a matrix.


Setting up ∑DAT

In order to get ∑x, ∑x^2, ∑x^3, ∑x^4, ∑y, ∑xy, and ∑x^2y, the statistics matrix ∑DAT is set up as:

Column 1: x-data
Column 2: x-data^2
Column 3: x-data^3
Column 4: x-data^4
Column 5: y-data
Column 6: x-data * y-data
Column 7: x-data^2 * y-data

TOT will be used to extract the sums of the columns.

Keystrokes - Main Program (QREG)

This assumes that you have the custom menu set up as discussed above.


[RS] [ + ] (<< >>)
[LS] 5 (MATRICES) [F1] (CREAT) [F1] (COL) [F1] (->COL)
[LS] [EVAL] (PRG) [F1] (STACK) [F3] (DROP) [F2] (SWAP) [F1] (DUP)
[LS] [MODE] (CUSTOM) [F1] (AXL) [LS] [ √ ] (x^2) [F1] (AXL)

* First of many instances the custom menu is used - building the x-data^2 column
[LS] [EVAL] (PRG) [F1] (STACK) [F4] (OVER)
[LS] [MODE] (CUSTOM) [F1] (AXL) 3 [y^x] [F1] (AXL)

* Building the x-data^3 column
3 [F4] (PICK) [F1] (AXL) 4 [y^x] [F1] (AXL)
* Building the x-data^4 column
5 [LS] [EVAL] (PRG) [F1] (STACK) [NXT] [F1] (ROLL)
[LS] [NXT] (PREV)

* PREV goes to the previous page of a menu
[F1] (DUP)
[LS] [MODE] (CUSTOM) [F1] (AXL) 6 [F4] (PICK) [F1] (AXL) [ x ] [F1] (AXL)

* Building the x-data * y-data and x-data^2 * y-data columns 

2 [LS] [MODE] (CUSTOM) [F4] (PICK)
[F1] (AXL) 6 [F4] (PICK) [F1] (AXL) [ x ] [F1] (AXL)
* Thanks to Alan Jones for pointing out to me that I was missing this point in the instruction. (added 12/30/2015)

7 [LS] 5 (MATRICES) [F1] (CREAT) [F1] (COL) [F2] (COL&#8594)
* Build the matrix from the 7 column vectors
[LS] [MODE] (CUSTOM) [F2] (STO∑) [RS] [backspace] (CLEAR)
* Stores the matrix to ∑DAT and clears the stack - the Custom menu (should be) is active
[RS] [SYMB] (CAT) [ALPHA] [EVAL] (N) find N∑ [F6] (OK)
[F3] (TOT) 1 [F5] (GET)
[F3] (TOT) 2 [F5] (GET)
[F3] (TOT) 5 [F5] (GET)
4 [F6] (->LIST) [F1] (AXL)

* First row of the normal equations is formed. The next two equations are formed in the similar way.
[F3] (TOT) 1 [F5] (GET)
[F3] (TOT) 2 [F5] (GET)
[F3] (TOT) 3 [F5] (GET)
[F3] (TOT) 6 [F5] (GET)
4 [F6] (->LIST) [F1] (AXL)

* Second normal equation
[F3] (TOT) 2 [F5] (GET)
[F3] (TOT) 3 [F5] (GET)
[F3] (TOT) 4 [F5] (GET)
[F3] (TOT) 7 [F5] (GET)
4 [F6] (->LIST) [F1] (AXL)

* The third and final normal equation
3 [LS] 5 (MATRICES) [F1] (CREAT) [F2] (ROW) [F2] (ROW->)
* Form the matrix from the three row vectors
[LS] 5 (MATRICES) [F5] (LIN S) [F4] (RREF)
* Row-reduced echelon form
4 [LS] 5 (MATRICES) [F1] (CREAT) [F1] (COL) [F4] (COL-) [ENTER]
* Extract the column [a, b, c] and terminates program entry.
[ ' ] [ALPHA] [ALPHA] [y^x] (Q) [ √ ] (R) [F5] (E) [APPS] (G) [ENTER] [STO>]

Instructions:

1. Enter a two column matrix. One way to enter matrices is to use the calculator's matrix writer by pressing the sequence [LS] [ ' ] (MTRW). To enter the matrix, press [ENTER] after entering the last element. To cancel matrix entry, press [ON].
2. Run QREG.

Results:

Level 2: Matrix
Level 1: Coefficients Vector

Coefficients vector [ a b c ] represents:

y = a + b * x + c * x^2

If the matrix is an identity matrix of size 3 ([[1,0,0][0,1,0][0,0,1]]), then a definite solution has been found.
Example:

Fit a quadratic curve to this data:

(1, 1)
(2, 3.6)
(3, 8.9)
(4, 17)
(5, 26.5)

So the matrix that is needed is:

[[1 1]
[2 3.6]
[3 8.9]
[4 17]
[5 26.5]]

To four decimal places QREG returns:

Level 2: [[1 0 0][0 1 0][0 0 1]]
Level 1: [.3800 -.6743 1.1857]

That means the quadratic curve that best fits the data is:

y ≈ 0.38 - 0.6743x + 1.1857x^2

Have fun fitting other sets of data to quadratic equations. Next time I will present additional programming examples. Keep on programming, Eddie!

This tutorial is property of Edward Shore. Mass reproduction and distribution requires express permission by the author.

Python: Drawing a Ring of Circles

Python: Drawing a Ring of Circles The goal: Draw a number of circles that revolve around the origin (0,0). The center of each circle i...