Back Up Next

50. Is there a way to predict how much memory a program will take up?

I recently began to wonder if there was an easy relationship between the size of the program on the computer (in bytes) and the size of the program after it is transferred to the calculator and run. For those who don't know, the first time you run a program an additional copy is created in machine language - that's why it's slow the first time but fast after that.

I checked for the programs I had done up to that point and found (to my surprise) that there was a VERY clear relationship - I was expecting some linkage but not so strong as I found.  A rough rule is:  "Whatever the size on the PC, triple it and add 30 to get the size on the calculator".

If you're interested - the precise relationship is  y = 2.936x + 33.137, where x is the number of bytes on the PC and y is the number on the calculator.  This had a correlation of 0.9938, which is very high.

Note that this investigation was done on the original 38G. I would expect that the relationship would be similar on any of the later models.

51. Is it possible to convert to other number bases on the the calculator? In particular, binary and hexadecimal?

Question:  I'm a sci/eng student from UWA, and was wondering if there were any programs/aplets available which allow you to work with numbers of different bases. Unlike most other scientific calculators, the HP seems to have forgotten about base conversions. In engineering, where converting between decimal, binary and hexadecimal numbers is essential, it would be extremely handy to have a function on the calculator to do it for me!!  Any advice or direction would be appreciated :).
Question submitted by:   Various people over the past 2 years.

Answer:  I agree that it's a pity that they didn't include a function for it in the MATH menu.  I wrote two programs which convert from any base to 10 and from 10 to any base respectively.  Click here to download them.  Note that they are programs not aplets - they must be downloaded using the Connectivity Kit into the Program view not into the APLET view.  If you don't have the Connectivity Kit and have to type it in yourself, then you can find the two programs displayed as images here along with a large collection of other small programs.

Update 24/12/02: A new aplet has recently been released for the HP39G called Library L1542 which will let you do conversions really easily and far better than my programs.  See the Misc Aplets page to download a copy.

Update 24/11/07: I've never had the time to check whether this library will work on later models such as the 39g+, 39gs and 40gs. If you try it an can answer this question please let me know.

52. How can I transfer the fit equation from the 2VAR Statistics PLOT view to the Function aplet?

Answer:  (Courtesy of Mark Howell)  Once you have found the equation of the line (or curve) of best fit in the PLOT view of the 2VAR Statistics aplet, it is sometimes desirable to be able to transfer the equation found to the Function aplet.  Of course you can always type it in by hand but there is an easier way.  Just go to F1(X) and enter the equation PREDY(X).  Now move the highlight back to F1(X) and press EVAL.  The equation will appear. This works for any function, not just for F1(X).

53. How can I transfer data from columns or lists on the calculator to a PC so that it can be used in Excel or some other application?

Answer: The problem is that when you use the Connectivity software to transfer an aplet or a list (or a matrix) to a PC the result is stored in binary (1s and 0s).  This is not readable by any other application, such as a spreadsheet. Nor is it in a form that is readable by you!  The trick to transferring the data in a readable form is to use the only calculator object which is NOT stored in binary on a PC - a program.

Suppose you have some data which is stored in C1 of the Statistics aplet and you want to transfer it to a PC and paste it into an Excel spreadsheet.  The first step is to transfer the data into a program.  Make sure in the APLET view that the Statistics aplet is the active one by STARTing it.

Go to the Program view and create a NEW program called DataStore (or whatever else you wish). When you create it you will find that you will be EDITing the program.
Press VAR and then press the second screen key (SK2) labelled to get access to the aplet variables.

Now press (SK4) so that the contents of C1 transfer instead of just the name.

This process will paste the set of numbers from C1 into the program as a list variable enclosed in curly brackets.

Now use the Connectivity software to transfer the program to a directory on the PC.  The result can be seen on the left. The file you want is the one labelled DATASTOR.000  We need to open this file in Excel.  Start Excel and use the File -> Open command.  You will need to change the file matching criteria (see below right) so that the window shows 'All files' rather than just *.xls files otherwise the file you want will not be visible.

When you open the file Excel will run its "Text Import Wizard".  In the first step you need to tell it that the data is 'Delimited' rather than 'Fixed width'.  In the second step you need to specify that the delimiting character is a comma (see left).  As you can see, there are a few extra characters which cause problems for the first number but they can be edited out later.

Once you have pasted the data into Excel you will find that it has been imported as a row.  This is not always convenient and you may wish to change this to a column. To do this just highlight the row of data and Edit -> Copy it.  Reposition the cursor to the cell where you would like the column to start.  Now do an Edit ->Paste Special.  In the box which pops up you need to tick the box labelled 'Transpose' (see right).


Similar methods can be used to get data from the PC back onto the calculator.  The process starts similarly to the above, except that the data in C1 should be just a couple of dummy values which are only there to space things out.  Transfer the program to the PC.

Meanwhile you need to use the File/SaveAs command to save the Excel data in a special format called CSV, which stands for "comma separated".  Once this has been done you can exit from Excel and open the CSV file in Notepad.  Highlight the data, which should be separated by commas and use the Edit -> Copy command to transfer it to the clipboard.

Now use the ADK (or as a last resort Windows Notepad) to open and edit the file you transfered from the calculator.  DO NOT use any other editors as they can damage the file. Remove the dummy data, leaving the curly brackets in place.  Paste the data from the CSV file into this position.  Check carefully to ensure that the format of the list is correct for the calculator. If you're using Windows Notepad then don't play around with the characters at the top of the file!

Transfer the program back to the calculator.  In the Program view, EDIT the program and put a C1 at the end of the list.  This means that the program now contains a command to the data into C1.  RUN the program and check that it has successfully transferred.  Delete the program at this point to save memory unless there's a very good reason to keep it.

54. How can I edit notes using the ADK?

Answer: Very easily (as of May 2002) using ADK39.  Just go to my Utilities page and download the program. If you don't yet have the Connectivity kit then you can download both it and ADK39 in one package. Otherwise scroll down until you find the ADK39 and download just that. You need a cable to connect to the PC. The Connectivity software does the transfer to and from the PC. The ADK39 does the editing on the PC.

55. My calculator has locked up and I have important data on it that I don't want to lose.

As calculators become more complex so do their operating systems (the way they 'talk' to you).  The HP series has one of the most complex operating systems around and with greater complexity comes greater flexibility but also, sometimes, a little touch of instability.  Teams of enthusiasts spend months before the calculators are released trying to crash them by doing the most ridiculous things they can think of, just so that when you do it, the calculator metaphorically shrugs and says "Ok" rather than locking up and losing your data.  But.... no matter how we try, we still miss some bugs.  As I am writing this I have just sent a message to HP about a bug that I have found in the Solve aplet.  It's not a serious one and I doubt you'd ever find it (I was playing) but there are surely others - we just can't think of every possible thing that users can do.
Note:  If you are using an aplet and strange things have started to happen then click here before continuing.
So what do you do if your calculator has locked up (frozen) and you have important information on it that you don't want to lose?

First:  Learn from this!  The socket at the top of the calculator is there so that you can plug a cable into it and save your precious information onto a computer.  DO IT!  Go out and buy a cable - save your notes, programs and aplets regularly so that you won't worry if this happens again.

Second:  Try these possible remedies, in the order that they appear below.
bulletPress the ON button quickly and repeatedly 3 or 4 times.  If the calculator is just 'stuck in a loop' then this may break it out.
bulletDo a soft re-boot.  Hold down the ON button and, while holding it down, press and hold screen key 3 (the third one from the left below the screen).  Now release SK3 then ON.  If it works then you should find yourself back in the HOME view.  Normally this process DOES NOT LOSE DATA but if the problem was serious then you may be unlucky.  It does clear the History in the HOME view but this should not be a problem I hope.
bulletDo a physical reset.  This involves sticking a pin or a paper clip into the hole on the back of the calculator and pressing down gently.  At the bottom of the hole there is a switch that you can push to trigger the reset.  This option is equivalent to the previous step but works even if the keyboard is locked up. IT MAY LOSE DATA.  The chances are on your side but there are no guarantees.  It's your risk.  The worst that can happen is that you lose the data.
bulletThe next option is a desperation move if nothing has worked so far.  It will almost certainly cause loss of all data but the powers might smile upon you.  Do a hard re-boot.  Hold down the ON button and, while holding it down, press and hold screen key 1 and 6 (the first and last of the row below the screen).  Now release first SK6, then SK1, then the ON button.  If it works then you should find yourself looking a screen that says "Memory clear?" with an OK button.  Don't fool yourself - it's not asking you a question: your data is lost.  But at least your calculator is un-frozen.
bulletThe final option is a last resort and will certainly cause complete loss of data (back to factory settings).  The only reason you should get this far is if there is something fairly seriously wrong.  Take the batteries out (including the small circular backup battery!) and leave them out overnight.  There's usually a small residual charge in the internal capacitors but that won't last overnight. When you put them back in, use fresh batteries.  Hopefully you'll find that the calculator is back to normal.  If it's not then I hope your warrantee is still valid :-).

56. What is 'RelError?'?

The value of RelError is available on all models but it only appears in the STAT list on the later models.  On the HP38G you have to type RelErr into the HOME view to get its value.

Suppose that you have a set of bivariate (2VAR) data which is not linear and you have used the SYMB SETUP view to change to an exponential fit. You may have already noticed that the value of the correlation coefficient does not change and so, on the 38G, there seems to be no way to tell numerically whether your change was justified.  The reason for this is that the correlation coefficient is a linear measure and, mathematically, can't be used with other fits.  The value of RelErr is there to compare other curves.  RelErr is defined as the measure of the relative error in predicted values when compared to data values and its formula is given right.

Unlike the correlation coefficient, RelErr is not constrained to a range from zero to 1, with 1 being best.  RelErr has no upper limit and the lower the value of RelErr, the better the fit is considered to be.

57. How can I get 'nice' values in the table when I use the split view of the Plot-Table view.

If you use the default scale of -6.5 to 6.5 in the Plot-Table view then you will find that the table values are not at all 'nice' values.  The reason is the pixels taken up by the stripe down the centre of the screen. The answer is to use a scale of -6.4 to 6.4 instead.  In actual fact, any values that are powers of two will work.  For example, a scale of -8 to 8 will give table values going up in steps of 0.25.  -32 to 32 or -3.2 to 3.2 would also be good. See also how to get 'nice' values in the normal PLOT view.

58. How can I easily display the roots of a polynomial?

The POLYROOT function is an easy way to find the roots of any polynomial, but if the roots are complex or irrational you will find that the dispay in the HOME view is difficult toread.  The simplest way to deal with this is to store the results into a matrix as a vector.  For example, suppose we wish to find the roots of the polynomial x3+8=0.  If we the results into M1 then they are easily readable and accessible.
If you now change to the Matrix view and EDIT matrix M1, you will find the roots displayed.  You can also refer to them on an individual basis in the HOME view by referring to M1(1), M1(2) etc.

59. What are "Easter Eggs" and do the calculators have any?

An "Easter Egg" is a small hidden trick that programmers sometimes deliberately leave inside the finished product but which does not appear in the documentation.  Generally it will be triggered by some combination of key strokes that would not normally occur.  The programmers of the HP38G included a couple of these in the machine and those of the HP39G and later models added others.

Some of these are:
bulletIn the HOME view, type RULES and hit ENTER and you will see a crossword giving the list of HP38G programmers.  The same trick works on the later models but gives a different list of course.  On the later models there is another list that contains the names of all the people who were key contributors but were not direct employees of HP at the time.  To see this list, type AMIGOS.  My name's on there :-). You can also try typing SYNTAX RULES and SYNTAX AMIGOS.  
bulletIn the HOME view, type WSLOG.  This gives a view of the warm start log, which is a list of events since the last warm start.  Not of any use normally.
bulletThere are a number of ON+key combinations that perform various tasks.  To see more information on these, see question #38.
bulletIf you type SYSEVAL 171591 on the HP38G in HOME and press ENTER then you will see a very odd piece of left over code.  DON'T DO THIS on later models.  When the HP38G was being designed there was originally a plan to have a separate view for independent sketches, in the same way that there is a Notepad view of independent notes, in addition to a Note view for the notes attached to an aplet.  In the end they decided not to do this, probably due to lack of memory since each sketch consumes 1Kb and the 38G only had 23Kb to play with, but the partially completed code was left in. The soft key labels at the bottom of the screen don't actually do anything except put messages on the screen.  The "Elsie" referred to in these messages was the code name for an HP38G during the construction phase.
PS. It was originally Jordi Hidalgo, an HP user from Spain, who discovered this fascinating leftover from the design process. I had omitted to give him credit for finding it and I do apologise for that. Jordi also independently discovered the SYSEVALs which run the games in the BIOS (see below) and even wrote an aplet (see my Games page) to run these games more easily.
bulletTyping SYSEVAL 260387 in the HOME view of an HP39G or HP40G will run a game called Dynablaster. Typing SYSEVAL 260385 will run the game Tetris. Press DEL to get out of the games.  Both of these are built into the chip as a bit of a secret joke by the programmers. On later models I found that Tetris works but Dynablaster does not.
bulletTyping SYSEVAL 535863 in the HOME view of an HP38G will return the amount of free memory in bytes.  DON'T DO THIS on an HP39G as you will crash the operating system and lose all memory (ie a full factory reset).
bulletTyping VERSION in the HOME view will display a box which gives the ROM version.  There is also another LIBEVAL command that gives more detail. The results on various machines are shown below.  Thanks again to Jordi Hidalgo for the LIBEVAL information and to J. Manrique for the CAS VER info.
VERSION on an HP38G VERSION on an HP39G and HPH40G
LIBEVAL 171;0 on an HP38G LIBEVAL 171;58 on an HP39G or HP40G
VERSION on my HP39G beta machine VER in the CAS of an HP40G

This was the final beta before release
1st screen                   2nd screen
showing authors & that it is Vers. 4 of Erable
and completed 27th of April, 2000
  DEDICACE in the HOME of an HP40G

A salute to HP Users. Contributed by "Monsieur HP"

In addition to the above, MichaŽl De Coninck sent me a list of SYSEVALS and LIBEVALS that overlaps in some places but also contributes new material and may be of use to readers. I do NOT vouch for it's accuracy and you should be aware that using SYSEVALs and LIBEVALs can cause loss of memory on your calculator. The worst that can happen is that it will be reset back to factory defaults.




AMIGOS HOME Shows the names from the creators of the HP in the form of a crossword puzzle.
RULES HOME Shows the names from the creators of the HP in the form of a crossword puzzle.
DEMO HOME Shows a demo of the most important functions of the HP-39/40g.
(HP-40g only)
Shows a little message for the HP-40g users.
WSLOG HOME Shows the log of the HP-39/40g
(HP-40g only)
Play tetris! (HP-39g users see SYSEVAL below)
Shows the currently available RAM.
VERSION HOME Shows the version of the ROM.
(HP-40g only)
List of all! the commands for the CAS (+explanation).
ON+F4  Displays the Tests from the calculator. If you press F1 you get a hexadecimal editor.


The command SYSEVAL allows the user to acces an adress from the memory of the calculator.
You can do some handy things with the command SYSEVAL. A warning though using SYSEVALS can be dangerous!

SYSEVAL 151587 Puts the keyboard in ALPHA mode.
SYSEVAL 151607 Puts the keyboard again in his normal state.
SYSEVAL 19027 Turns the calculator off.
SYSEVAL 258091 Let you recieve Aplets, Notes, Programmes, lists, matrices from in the homescreen.
SYSEVAL 258092 Let you send Aplets, Notes, Programmes, lists, matrices from in the homescreen. This function doesn't really work well.
SYSEVAL 258960 Gives the version of METAKERNEL in a grob.
SYSEVAL 259723 Makes some new menus that surely comes from METAKERNEL.
SYSEVAL 260385 Tetris for the HP-39 users. It's the same as the one hidden in the CAS.
SYSEVAL 260387 Dynablaster for the HP-39/40g users. Press DEL to get out of it.
SYSEVAL 260243 Built-in Filer. Thanks to Jordi Hidalgo for this information.
SYSEVAL 259588 Clear list 0.
SYSEVAL 259597 Clear list 9.
Eg: if you want to clear list 7 do SYSEVAL 259595 ( because 259588+7 = 259595)


The command LIBEVAL allows you to acces a library on the calculator.

LIBEVAL 2290;302 Warning I think this is the wrong number. Allows you to modify some flags of the cas, but I got a mem clear.
LIBEVAL 2;0 Shows you the sources from all the commands of the menu math.
LIBEVAL 2;149 This command allows you to find new functions of math.

(c) 2002-2003
(c) translation to English by MichaŽl De Coninck

Last modified: 19 Dec 2007                                             Sitemap        Home        Contact Me