Post Reply 
line breaks with HP50g
08-30-2015, 12:48 PM
Post: #10
RE: line breaks with HP50g
(08-30-2015 11:46 AM)tigger Wrote:  Cool, real great, thanks,...

I keyed the program. My results are:
If I key F1 Prog: error, I have always to key RS F1(Prog) -> I can see the program.

Pressing F1 *runs* the program. It errors because it expects its input from the stack but you didn't pre-load the input on the stack. Key the input, press ENTER to put it on the stack, and then run the program. That's the spirit of RPN: you key the input first, then execute the function, e.g. to get the square root of 9, you key 9 first and then press the square root button.

As you discovered, RS F1 is a shortcut for ['] [F1] [RCL].

(08-30-2015 11:46 AM)tigger Wrote:  If I key F1 Prog.S: I can see the program imediately.

Executing a string merely puts it on the stack, so executing 'PROG.S' has the same effect as recalling 'PROG.S'.

(08-30-2015 11:46 AM)tigger Wrote:  I understand, what the program is for, but I do not know where to put line breaks and strings because I do not understand the way the HP50g works.

The 50g doesn't care AT ALL where you put line breaks; there are none in the actual program. The whole reason for creating a string version was to enable YOU to put line breaks where YOU wanted them, because you said you wanted them. Put them wherever you wish. The 50g doesn't care, not even a little.

(08-30-2015 11:46 AM)tigger Wrote:  << 2 - 1 5 √ + 2 / → N H
<< H N 2 + ^ 1 H - N 2 + ^ - 5 √ / EVAL >> >>

I debugged the program (in exact mode) and I started with A in the stack. To a certain point I had fraction. In the midst of the program the HP switched to appr. mode. (Why?) I got a long answer (with real numbers), which I could neither read on the display nor understand. I got three lines with VIEW -> TEXT.

Do any of the numbers in the program have a decimal point on them? If so, remove the points by editing the program in exact mode. Decimal points cause the math to flip into approximate mode at that point (no pun intended). The program will only work as intended if all of the numbers in it are exact integers (with no decimal point), AND if the input is an exact integer, AND if the program is run in exact mode.

Three lines?!? Sounds like there's a typo in your program. Please give an example of an input and the resulting output.

(08-30-2015 11:46 AM)tigger Wrote:  questions:
1. I do not know. what EDITB does.

It means "EDIT with the Best editor for the type of object being edited." For example, put the array [ 1 2 3 ] on the stack. Press either down-cursor or TOOL EDIT. You'll see the array get loaded into the MatrixWriter, which is the "best editor" for arrays, because down-cursor and TOOL EDIT both execute the EDITB command (which is also a programmable command). But if instead of pressing down-cursor, you press [left-shift] [down-cursor], or TOOL [either shift] [EDIT], you'll see the array echoed directly into the command line editor, because those key sequences execute the EDIT command (not EDITB). The EDIT command always uses the command line editor... but beware the misleading of the "EDIT" menu key in the TOOL menu! It *says* "EDIT" but it performs EDITB if pressed without pressing shift first.

Other object types have different "best" editors. For example, put the algebraic object '1+2' on the stack and then execute EDITB (by pressing down-cursor or TOOL EDIT). As you see, the EquationWriter is considered the "best" editor for algebraics. I personally prefer the command line editor for algebraics (usually), so I press left-shift before pressing down-cursor to edit algebraics.

(08-30-2015 11:46 AM)tigger Wrote:  2. Is it possible to see long results on the display. Sometimes there is not enough space for the long result on the display and I can only see parts of the result there.

Yes: TOOL VIEW, then scroll using the cursor keys.

Alternative: Large algebraics sometimes don't all fit on the screen at once in Textbook Mode. Turning off Textbook mode makes algebraics ugly, but at least they usually fit on the screen all at once. (Toggling Textbook mode can be done either in the MODE DISP screen, or by setting/clearing flag -79).

(08-30-2015 11:46 AM)tigger Wrote:  3. Could help me to show the line breaks, or the begin and the end of a command. How do I know where a command starts and ends.

Commands are always separated by a space. No command contains a space.

One mistake often made by beginners is typing "→ A" (which means "create a local variable called 'A' and store what's on the stack into it") as "→A" (with no space between the arrow and the "A"). If there is supposed to be a space between the arrow and the variable, then there MUST be a space there. Otherwise the 50g will think you want the →A command, which is a single command, which has nothing to do with local variables and is totally different from "→ A".

(08-30-2015 11:46 AM)tigger Wrote:  4. Why does the HP switch from exact to appr mode while executing the program. (Probably it was not this program. Before I had problems with other programs.)

Already discussed above.

(08-30-2015 11:46 AM)tigger Wrote:  5. Every three month I have to change batteries. Is this usual?

Yes. It depends on how you are using it, of course. If you run a lot of long-running programs, you'll even have to change the batteries every few days. Suggestion: plug it into a live USB outlet via a standard mini USB cable; then your batteries will last forever because the 50g will be powered by the USB instead of by the batteries.

(08-30-2015 11:46 AM)tigger Wrote:  PS: Could you recomand a page, which teaches programming in C?
Are you experienced with wolfram alpha (wolframalpha.com)?

Let's stick to 50g programming in this thread.

<0|ɸ|0>
-Joe-
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
line breaks with HP50g - tigger - 08-25-2015, 05:19 PM
RE: Paragraphs - Allen - 08-28-2015, 02:03 AM
RE: Paragraphs - tigger - 08-28-2015, 05:24 PM
RE: Paragraphs - Joe Horn - 08-28-2015, 08:04 PM
RE: Paragraphs - Allen - 08-28-2015, 10:41 PM
RE: line breaks with HP50g - tigger - 08-29-2015, 09:39 AM
RE: line breaks with HP50g - tigger - 08-29-2015, 09:18 AM
RE: line breaks with HP50g - Joe Horn - 08-30-2015, 07:30 AM
RE: line breaks with HP50g - tigger - 08-30-2015, 11:46 AM
RE: line breaks with HP50g - Joe Horn - 08-30-2015 12:48 PM



User(s) browsing this thread: 1 Guest(s)