Post Reply 
Help With Using the Math Module
04-23-2018, 09:41 AM
Post: #7
RE: Help With Using the Math Module
(04-23-2018 01:16 AM)ID_girl Wrote:  So I got myself a math module "MATH 1" p/n 5061-5261 "1C" module for my HP41-CX.

That's the early, original version. Later the math and statistics module were combined and labelled MATH/STAT. The box then included one module and two individual manuals.

(04-23-2018 01:16 AM)ID_girl Wrote:  Using the example in the manual for the Math Pac, I will run SINZ to calculate sin(2 + 3i). The output in quick succession with no pausing is:
U = 9.145
V =-4.169

The problem is that the first answer goes by so quickly I cannot read it fast enough to remember easily.

OK, the issue seems to be resolved now, but maybe some additional info will explain why this happened.

The HP41 series has VIEW and AVIEW commands that display X or Alpha while the program continues. This is a nice feature that allows for instance displaying successive approximations during an iteration loop while the calculation continues.

This means that if a VIEW or AVIEW directly follows another it will immediately clear the first message and show the second one:

"FIRST"
AVIEW
"SECOND"
AVIEW

...will produce a very brief, hardly visible display of "FIRST" which then is immediately overwritten by "SECOND".

This is what you described above. The "U=..:" message was directly overwritten by the "V=..." message.

But then, if a printer is attached and ready, VIEW and AVIEW also print X or Alpha. This way the quickly changing display is no problem because you can read the results in the printout. If a printer is enabled, flag 21 is set. But you can also set flag 21 manually. If you do so while there actually is no printer (!) – the calculator can detect this via flag 55 – your '41 knows that there will be no printout and... it will stop (!) at each VIEW or AVIEW. And this feature is what it's all about here.

So setting flag 21 will lead to the following result for VIEW and AVIEW:
- printer attached and ready: display content is printed, program continues.
- no printer: message is displayed, program stops, waiting for you to read the message. Continue with R/S.

This feature is used in the complex program. Take a look at the output routine starting at line 14:

Code:
14 LBL 00
15 FS? 04
16 RTN
17 SF 21
18 "U="
19 ARCL X
20 AVIEW
21 "V="
22 ARCL Y
23 AVIEW
24 RTN

The program first checks if flag 04 is set. If the user has done so this means that no labelled output is wanted and instead the program simply returns with the real and imaginary parts in X and Y.

Then flag 21 is set. So the following "U=..." and "V=..." output will be printed if a printer is attached, or else (without a printer) both messages will be displayed and the program will stop, waiting for you to read the two results, one after another.

That's why the above posts recommended checking flag 21 first. Actually this is not required since the program sets it by itself directly before the output starts. So with flag 21 set the program should have stopped after each of the two messages. But it didn't because your '41 was configured with an activated printer! So the calculator assumed that the results are printed and did not stop. So deactivating the printer fixed it.

You may also set flag 04 (SHIFT SF 04) so that the "4" annunciator in the display comes on. This causes the program to simply return the result in X and Y without the "U=..." and "V=..." message. This way you can use the various complex functions as subroutines in your own programs. So setting flag 04 does make a difference as it generates a different output. Press X<>Y to switch between the real and imaginary part of the result.

Dieter
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
Help With Using the Math Module - ID_girl - 04-23-2018, 01:16 AM
RE: Help With Using the Math Module - Gene - 04-23-2018, 01:19 AM
RE: Help With Using the Math Module - Gene - 04-23-2018, 01:40 AM
RE: Help With Using the Math Module - Dieter - 04-23-2018 09:41 AM



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