35s prompt for multi-character variables in program like "low footprint" root finder



#2

I'm new to the 35s , and loving it, and wanting to learn to use more features. I was looking at programs and found the low footprint root finder (here: http://www.hpmuseum.org/cgi-sys/cgiwrap/hpmuseum/archv019.cgi?read=146636 ). It looked great but I couldn't get it to work, so I ended up going with another root finder. The low foot footprint one stuck in my head because of how the writer prompted for variables using multiple characters, which would help make sure the correct value was entered in the correct place in an equation. (He prompted for X1 and X2 and Y1 and Y2.)

I tried to figure out the low footprint code, but I never could, so that's why I'm starting this thread. I'd like to be able have this functionality for a class where there are dozens of equations, and I need to make sure I enter the correct variable values in the correct places.

So, question (a): The author says he uses unnamed indirect variable addresses. Is doing this necessary to be able to use multiple characters to prompt for variables? (I don't store variable values in the A-Z spaces, so I don't need to preserve anything in those spaces.)

Question (b): How do I do this as simply as possible for programming and usage?

Thank you all,
Chris C

Edited: 14 Feb 2012, 11:24 a.m. after one or more responses were posted


#3

Quote:
do I need to use unnamed indirect addressing?

No.
Quote:
It is my understanding that that is only necessary if I want to preserve the contents of the named A-Z variables

that is correct. If you are not concerned with preserving the contents of the named A-Z variables (or actually want to use them), you can use e.g. "STO A" instead of "STO (I)".


The other post is using the "message" function of the 35s to prompt for variables, load them on the stack and then stores them. The INPUT does it all in one step, but with the limits of single letter variables.

See page 13-16 in the manual, section "Using Equations to Display Messages".
Also see this thread:
HP-35s messages

Regards, Bart

Edited: 14 Feb 2012, 11:19 a.m.


#4

Thanks Bart.

I've read and read in the manual and tried things but haven't been able to put it together into what I need. I do understand how to use flag 10 and show the multi-character prompts on screen. I just don't understand how the calculator treats the entries entered after the prompts. If you, or someone, wouldn't mind, could you post code for a small sample program so I could learn from it and apply it to my other needs?

NC=(H1-H2A)/(H1-H2S)

Thank you!


Edited: 14 Feb 2012, 12:13 p.m.


#5

As I mentioned, the "low footprint" program first loads variable values onto the stack, then stores them.

So firstly to use the stack you must be in RPN mode.
Secondly, as the stack is only 4 levels, you can only do 4 variable values in one go.


LABEL STEP             COMMENT
A001 LBL A
A002 SF 10
A003 H1, H2A, H2S the three inputs, enter them in sequence pressing ENTER after the first two and R/S after the last one
A004 CF 10
A005 STO C stores H2S into C, the last entered value is at the bottom of the stack (X-register)
A006 Rv This is the Roll Down arrow, roll the stack down so H2A is in X-register
A007 STO B stores H2A into B
A008 Rv This is the Roll Down arrow, roll the stack down so H1 is in X-register
A009 STO A stores H1 into A
A010 (A-B)/(A-C) the actual formula, note the answer is put on the stack (X-register)
A011 SF 10
A012 NC= displayes "NC="
A013 PSE but only briefly
A014 CF 10
A015 RTN


You will see the answer in the X-register (bottom line), and the values of the entered variables above. If you want a "clean" display showing zero's and the answer, then do a "clear stack" before executing the formula:
LABEL STEP             COMMENT
A001 LBL A
A002 SF 10
A003 H1, H2A, H2S the three inputs, enter them in sequence pressing ENTER after the first two and R/S after the last one
A004 CF 10
A005 STO C stores H2S into C, the last entered value is at the bottom of the stack (X-register)
A006 Rv This is the Roll Down arrow, roll the stack down so H2A is in X-register
A007 STO B stores H2A into B
A008 Rv This is the Roll Down arrow, roll the stack down so H1 is in X-register
A009 STO A stores H1 into A
A010 CLSTK
A011 (A-B)/(A-C) the actual formula, note the answer is put on the stack (X-register)
A012 SF 10
A013 NC= displayes "NC="
A014 PSE but only briefly
A015 CF 10
A016 RTN


Regards

#6

Thanks very much. This looks like just what I was hoping for.

One question on something you said though. When you said:

"...the stack is only 4 levels, you can only do 4 variable values in one go."

are you meaning this is applies if using unnamed indirect variable addressing or does it apply to your example too? Can't your example below use up to 26 variables (A-Z)? Or am I misunderstanding? What if the variable values were entered one at a time? Like:

A003 ENTER H1

A004 STO C

A005 ENTER H2A

A006 STO B

A007 ENTER H2S

A008 STO A

A009 CF 10

A010 (A-B)/(A-C)



Edited: 14 Feb 2012, 6:59 p.m.


#7

I was referring to the number of variable values that could be handled in one line, as in my A003. You can still do 261, but just 4 at a time.

Doing it one variable at a time as in your example, you do not have
to be concerned with stack depth limits.

1) more if you use indirect addressing.

Edited: 14 Feb 2012, 7:52 p.m.


#8

I understand. Thanks very much!

#9

LBL A

SF 10 (Set message mode)

KEY IN VALUE (the message)

CF 10 (End of message mode)

STO A (store in A whatever was keyed in during message was shown and after R/S was pressed in Run mode)

VIEW A

RTN


#10

Thank you.


Possibly Related Threads…
Thread Author Replies Views Last Post
  HP: Dump the predefined variables! bluesun08 12 3,898 11-19-2013, 02:18 PM
Last Post: bluesun08
  HP Prime: run a program in another program Davi Ribeiro de Oliveira 6 2,738 11-11-2013, 08:28 PM
Last Post: Davi Ribeiro de Oliveira
  [HP Prime] Using n-root symbol and exponent problem uklo 7 2,964 11-11-2013, 01:39 AM
Last Post: Alberto Candel
  HP Prime - local variables retain their initial type BruceH 4 1,919 11-10-2013, 12:42 PM
Last Post: Michael de Estrada
  Shutdown with the Apps key and more than 10 variables in a program. Davi Ribeiro de Oliveira 10 3,933 11-05-2013, 01:26 PM
Last Post: Han
  HP Prime: Number of external Variables Davi Ribeiro de Oliveira 0 1,039 11-01-2013, 08:10 PM
Last Post: Davi Ribeiro de Oliveira
  HP Prime variables Davi Ribeiro de Oliveira 3 1,721 10-31-2013, 02:24 AM
Last Post: cyrille de Brébisson
  HP Prime - deleting variables bluesun08 1 1,260 10-29-2013, 06:36 PM
Last Post: Joe Horn
  HP Prime: CAS Variables - -How to save? Helge Gabert 2 1,879 10-27-2013, 11:26 PM
Last Post: Helge Gabert
  HP Prime Solver Variables Issue Anibal Morones Ruelas 8 3,147 10-19-2013, 09:45 AM
Last Post: Harold A Climer

Forum Jump: