▼
Posts: 8
Threads: 2
Joined: Jan 1970
Hi again,
I was wondering if anyone out there knows how to write a program for the hp42s that mimics the xcord, ycord, R and angle program from the hp27s. I often use this program on the hp27s because it is very convenient and useful but would rather use the hp42s for everything else.
So is there anyone who knows how to do this or has such a program that they have written and would like to share.
Regards
Tom
1234
▼
Posts: 4,027
Threads: 172
Joined: Aug 2005
Hi, Tom;
I don't have the HP27S (the two of a kind: HP27 and HP27S, each one in its time), but I'd guess it is coordinate conversion, right? Would that be (xcord,ycord) the rectangular form and (angle,R) the polar form? If so, the HP42S alerady has it in, at least, two forms.
If you want straight convertions, set angular mode (DEG, RAD or GRAD in MODES menu) and select one of both: ([SHIFT] stands for the 'golden', orange shift key)
(ycord) [ENTER] (xcord) [SHIFT][CONVERT][>POL]
for rectangular to polar convertion, or:
(angle) [ENTER] (radius) [SHIFT][CONVERT][>REC]
for converting conversely. You can also use complex mode and convert the whole complex number in the Xregister at once. But first let me know: is taht what you want? Just in case I'm explaining something you don't actualy need .. d8)
Let us know if this is enough and if you want complexnumber convertion as well.
Cheers.
Luiz (Brazil)
Edited: 24 Aug 2004, 3:34 a.m.
▼
Posts: 8
Threads: 2
Joined: Jan 1970
Hi Luiz,
I did know about the polar and rectangular conversion, but was more thinking about how to put it into a program so you see the variable on the screen (like the dia, area and circ program from last week) and input the ycord and xcord and then press the corresponding keys for the radius or/and the angle OR input the raduis and the angle and press the corresponding keys to get the xcord and/or ycord.
But, I would be interested to know how to use the complex mode and convert the whole complex number in the Xregister at once.
Thanks
▼
Posts: 4,027
Threads: 172
Joined: Aug 2005
Hi, Tom;
in another post dealing with a closer subject, I wrote: I consider that the conversion itself is only needed for a few purposes, like seeing one or other representation. Either rectangular or polar are a pair of numbers referring to an entity: a coordinate, a complex number, etc. As you may have already seen, the HP42S deals with complex numbers almost the same way the HP15C does. You can convert two real numbers in the Y and Xregister into a complex number in Xregister. The complex number can be either a rectangular (Yvalue + iXvalue) or a polar (Yvalue _Xvalue) representation, and you can choose which of them any time you want to. Also, all I wrote below can be found in the HP42S Owner's Manual, first part, chapter 6.
Please, find the [STO] key in your HP42S and you'll see a [COMPLEX] as a second function over it. Found? Now let's see the representation modes. If you want to work with complex numbers in polar representation, you should also set the angle mode. Whatever you choose, use the MODES menu to set: DEG, RAD or GRAD for angle mode, and RECT or POL for complex representation. The current mode defines either how complex numbers are shown and how Y and Xregister contents are used to compose the new number.
[SHIFT][COMPLEX] works in one of two ways: create in Xregister a complex number with Y and Xregister contents (both must have real numbers) or decompose an existing complex number in the Xregister into two real numbers in Y and Xregister. What operation is performed depends on what you have in Xregister when [SHIFT][COMPLEX] is pressed. Try this: (consider four decimal places, or [FIX] 04)
[SHIFT][MODES][DEG][SHIFT][MODES][POL]
12 [ENTER] 60 [SHIFT][COMPLEX]
And the display shows: (please, take _ as an angle sign)
X: 12.0000 _60.0000
This is a polar representation. Now try the rectangular representation:
[SHIFT][MODES][RECT]
and the display shows:
X: 6.0000 i10.3923
At this point, you can handle the complex number in any representation, because the current complex mode does not need to be changed in order to use a complex number. Try:
3[+] 2 [ENTER] 5 [SHIFT][COMPLEX] []
and you have:
X: 7.0000 i5.3923
If you want to use both real and imaginary parts separately:
[SHIFT][COMPLEX]
and you'll have:
Y: 7.0000
X: 5.3923
To rebuild the complex number:
[SHIFT][COMPLEX]
To "see" it in polar mode:
[SHIFT][MODES][POL]
and then you have:
X: 8.8361 _37.6081
You can also directly add to (or perform any valid operation for a complex number) this complex number a polar representation without the need of setting rectangular mode back:
4 [ENTER] 60 [SHIFT][COMPLEX] [+]
and you have:
X: 12.6268 _44.5393
If you decompose the number at this point with [SHIFT][COMPLEX], the numbers in Y and Xregister will be the argument (12.6268) and the angle (44.5393), respectively. I guess you can go ahead from here and try your own examples, right? Anyway, have you found another issue, please, post. If not I, others will promptly answer you.
Best regards.
Luiz (Brazil)
Edited: 25 Aug 2004, 1:30 a.m.
Posts: 4,027
Threads: 172
Joined: Aug 2005
Hi, Tom;
I was wondering about building an expression (program) relating xcord, ycord, R and angle that could be used with the SOLVE application. Would this be handy as well?
Let us know.
Cheers.
Luiz (Brazil)
▼
Posts: 8
Threads: 2
Joined: Jan 1970
Hi Luiz,
I had a play with the complex mode last night and had a read of chapter 6, I must admit it was a little "complex" for me , excuse the pun but I suppose if I used it more often I would probably become more familiar with it.
I like your idea of using the solve application and I have used the solve application before but only when there is one unknown, I wouldn't know how to go about it in this case so any help would be appreciated.
Thanks
▼
Posts: 7
Threads: 0
Joined: Jan 1970
Hi Tom,
The Solver on the 42s is brilliant but you're right, it finds only one "missing" unknown of an equation. I played with a VARMENU version of your "CAD" program and I'll post it if you're interested. It finds the missing items and places them in a menu but they're not immediately displayed, they have to be recalled using RCL and the menu keys. A deluxe version, instantly showing everything could involve appending values into the alpha register...rather like the "ITFOS" program I posted a few days ago.
I have found that for programs that I use repeatedly, minimizing input keystrokes is important. For occasionally used ones, more prompts and better labelling are important...so I can remember how they work and what the results are. Mercifully, I no longer have to keyin manually recorded surveying field data...hundreds and hundreds of angles and distances...or write down or plot (x,y,z) results. The calculator remains in my bag to be used only when things go wrong! I probably should add some more prompts to the old "production" programs now that they are just occasionally used for troubleshooting...and, of course, that would make them better for teaching.
I'm glad you started this thread to celebrate the 42s!
Richard
▼
Posts: 8
Threads: 2
Joined: Jan 1970
Hi Richard,
Yes I would be most interested in seeing your VARMENU version of the "CAD" program, and yes your right, minimizing key strokes is important but I like to add prompts and labels in most cases anyway.
So to all the many hp42s owners out there I urge you all to post your custom written programs no matter how simple they seem to you as they will probably help others (me) learn how to program better.
Thanks
▼
Posts: 7
Threads: 0
Joined: Jan 1970
Hi Tom,
Here is your CircumferenceAreaDiameter program done using the 42s VARMENU system. A Variable Menu is created with all three variables set to zero and you are prompted to enter the ONE known value, entering it in DIA, CIRC or AREA, whichever one it is. The calculator then tests for whichever one doesn't equal zero and proceeds accordingly. The two missing values are calculated and stored in the menu variables, and the menu is displayed again at the end. Unfortunately, you must press RCL and a menu key to see any of the calculated results or to remind yourself of the input datum. When R/S is pressed again, the program goes back to the top with all three variables set again to zero.
If you had to do this all of the time, it would be pretty tedious...but it's OK occasionally or as a learning exercise.
It would stretch me a bit now to do a welllabeled, alpharegister version and there would be very little space for results if the input were also to be displayed...which would be nice. Probably, the 44 characters available would not be enough to do the job and the byte count would soar (for something so simple).
Sadly, the Olympics are over...when will the next good baseball game be played in Athens?
Richard
00 { 194Byte Prgm }
01 LBL "C.A.D"
02 MVAR "CIRC"
03 MVAR "AREA"
04 MVAR "DIA"
05 VARMENU "C.A.D"
06 "Enter ONE Known"
07 (append)" Datum"
08 0
09 STO "CIRC"
10 STO "AREA"
11 STO "DIA"
12 PROMPT"
13 RCL "DIA"
14 X=0?"
15 GTO 01
16 ENTER
17 X (squared)
18 PI
19 x
20 4
21 (divide)
22 STO "AREA"
23 R (down)
24 PI
24 x
26 STO "CIRC"
27 GTO 03
28 LBL 01
29 RCL "AREA"
30 X=0?
31 GTO 02
32 4
33 x
34 PI
35 (divide)
36 SQRT
37 STO "DIA"
38 PI
39 x
40 STO "CIRC"
41 GTO 03
42 LBL 02
43 RCL "CIRC"
44 PI
45 (divide)
46 STO "DIA"
47 X (squared)
48 PI
49 x
50 4
51 (divide)
52 STO "AREA"
53 LBL 03
54 VARMENU "C.A.D"
55 "RCL Results"
56 PROMPT
57 GTO "C.A.D"
58 END
▼
Posts: 8
Threads: 2
Joined: Jan 1970
Hi Richard,
Thanks for the program, I'll have a play and try and get some ideas from it.
Didn't Australia play well in the baseball?
Posts: 4,027
Threads: 172
Joined: Aug 2005
Hi Tom, Richard, all;
First of all, thank you, guys. And let me admit that SOLVE is actually not the way to solve the case. But let me get acquainted with the HP27S way to deal with coordinate conversion; would you follow me and let me know where my reasonings and the actual HP27S conversion split?
The following lines contain my reasoning over the subject itself. This is a firstshot reasoning, and I am sure others will give other analysis. I'd like to read others and enhance my own reasoning, so, please, go ahead with yours.
There are many ways to relate Xcoord (X for shortening), Ycoord (Y for shortening), angle (Ø for shortening) and R. I think that one of them might be: X/(RcosØ) = Y/(RsenØ) = 1
mostly because each side of the equation equals to 1. Anyone dealing with polar and rectangular coordinates knows that knowing any two variables allows the other two to be calculated. That was my main reason of suggesting the use of SOLVE. The problem is that for each unknown variable, three possible relations exist, given that any two of the other three variables are know. As a single example (for those who are following but did not get my point because of any reason), to calculate Ø we may have one of the following three possibilities:
Ø = cos^{1}(X/R) or
Ø = sen^{1}(Y/R) or
Ø = tan^{1}(Y/X).
The chosen one depends on which are the other two known variables. As a consequence, after finding Ø, the fourth unknown can also be calculated.
At first I thought about four menu labels and detecting number input by testing flag 22 in each of them. After each input data, pressing a key would cause the input data to be stored and the other two unknowns are computed (which ones is also a crytical issue, but using flags would be not too hard). If no data is entered, pressing the key shows the corresponding variable's current value. Of course, after the first single one there is no way to compute the other three, but the program would start with a standard (X,Y) = (1,1), leading to (R_Ø) = (sqrt(2),45º). After that, keying in any new vlue would lead to compute others with existing values. To solve this, four routines (LBL 01, 02, 03 and 04) associated with KEY nn XEQ nn and MENU would give us a program with some generous byte count. I thought that SOLV would do that better, but I confess I did not find a practical way to implement my idea. IF to compute R or Ø it's expected to have X and Y and conversely, two PGMSLV "name" and SOLVE "var" are enough, but I think that the HP27S conversion application goes beyond this unjustified limitations, right?
Thoughts? Comments? Suggestions? CORRECTIONS? (this is too much more important!) All welcome, please!
My 1¢.
Luiz (Brazil)
Edited: 28 Aug 2004, 2:07 a.m.
▼
Posts: 8
Threads: 2
Joined: Jan 1970
Yes I agree that the hp27s conversion application goes alittle deeper. I am however at a loss on how to precede so I guess I'll just use the P>R or R>P when I need to in the future, thanks for everyones help.
Tom
