WP34S: Valentin Albillo's Polynomial Root Finder Message #1 Posted by Miguel Toro on 17 Nov 2011, 12:56 p.m.
Hi,
Here is a version for the WP 34s of Albillo's original program for the HP 41. I would like to thank Ángel Martin for helping me with lot of information, documentation and his own version for the 41z. Porting the program was very straightforward. The only real difference I found between commands was with the SIGN function that behaves like it does in the 3Xs family rather than it does in the 41 and 42 calculators, so I have to replace it in my code.
The program has been tested with version 2.2 rev. 1782. Just copy it in a file and assemble it to try in the emulator and the calculator
Testing the examples from the article on the calculator, I obtained the same results, with the following time:
Example 1) 5 seconds – original on HP 41: 8 minutes :
(2+8i)z^6 + (3+0i)z^5 + (-1+2i)z^4 + (0+2i)z^3 + (-3-3i)z^2 + (1+2i)z + (-2+3i) =0
Example 2) 3,5 seconds – original on HP 41: 5 minutes :
5x^6 – 4x^5 – 3x^4 + 8x^3 + 8x^2 – 2x + 7 = 0
Note: You can delete the STOP in line 34. It is there just for testing.
Enjoy!
Miguel
001 LBL'PRT'
002 SSIZE4
003 FIX 00
004 CL[alpha]
005 [alpha]'N?'
006 PROMPT
007 STO 00
008 STO 03
009 STO+ X
010 9
011 .
012 0
013 0
014 8
015 0
016 2
017 +
018 STO 01
019 STO 05
020 CLx
021 LBL 05
022 CL[alpha]
023 [alpha]'IM'
024 [alpha] [^]
025 [alpha]'RE[space]'
026 [alpha]IP 03
027 [alpha] ?
028 PROMPT
029 [cmplx]STO[->]05
030 DEC 03
031 DSE 05
032 GTO 05
033 RCL 03
034 STOP
035 LBL 06
036 CF A
037 +/-
038 STO 04
039 FIX 02
040 ROUND
041 FIX 06
042 x[!=]0?
043 GTO 01
044 EEX
045 STO 04
046 LBL 01
047 RCL 00
048 STO 08
049 SF 01
050 XEQ 11
051 [->]POL
052 1/x
053 STO 07
054 x[<->] Y
055 +/-
056 STO 08
057 CF 01
058 XEQ 11
059 [cmplx]ENTER
060 [cmplx]RCL 07
061 [->]REC
062 [cmplx][times]
063 [cmplx]STO- 03
064 [cmplx]ROUND
065 [cmplx]x[!=]0?
066 GTO 01
067 SF A
068 XEQ 11
069 2
070 STO+ 05
071 EEX
072 3
073 +/-
074 [times]
075 STO+ 01
076 RCL 04
077 RCL 03
078 [cmplx]STO[->]05
079 x[<->] Y
080 DSE 00
081 GTO 06
082 RCL 01
083 IP
084 1
085 0
086 -
087 EEX
088 3
089 /
090 STO- 05
091 FIX 07
092 LBL 10
093 INC 00
094 CL[alpha]
095 [alpha]'RT[space]'
096 [alpha]IP 00
097 [alpha]VIEW
098 PSE 15
099 CL[alpha]
100 [alpha]'RE'
101 [cmplx]RCL[->]05
102 PROMPT
103 CL[alpha]
104 [alpha]'IM'
105 x[<->] Y
106 PROMPT
107 DSE 05
108 GTO 10
109 CLx
110 CF A
111 RTN
112 LBL 11
113 RCL 01
114 STO 05
115 FC? 01
116 GTO 13
117 EEX
118 3
119 +/-
120 ENTER[^]
121 2
122 [times]
123 STO+ 05
124 LBL 13
125 [cmplx]RCL[->]05
126 FC? 01
127 GTO 02
128 RCL 08
129 STO[times] Z
130 [times]
131 DSE 08
132 GTO 02
133 RTN
134 LBL 00
135 [cmplx]ENTER
136 [cmplx]RCL 03
137 [cmplx][times]
138 RCL[->]05
139 FS? 01
140 RCL 08
141 FS? 01
142 [times]
143 +
144 FS? A
145 STO[->]05
146 x[<->] Y
147 INC 05
148 RCL[->]05
149 FS? 01
150 RCL 08
151 FS? 01
152 [times]
153 +
154 FS? A
155 STO[->]05
156 DEC 05
157 x[<->] Y
158 FS? 01
159 DSE 08
160 LBL 02
161 DSE 05
162 GTO 00
163 RTN
Edited: 17 Nov 2011, 1:06 p.m.
|