for the HP 42S
OST - SOLVE alternative, numerical solution of a lenear equation using Ostrowski's method.


Input

Resources to be used

Output



Program list for the HP 42S

OST - Rev 2.93: Aug. 26 2011 - Copyright(c) 1998-2011 Takayuki HOSODA, All rights reserved.

00 { 492-Byte Prgm }
01 LBL "OST"
02 RCL "REGS"
03 STO "RSLV"
04 R↓
05 STO 01
06 0.1
07 STO 00
08 1E-12
09 STO 10
10 0.03
11 STO 11
12 0
13 STO 12
14 RCL "SOLVE"
15 STO 08
16 RCL "PSLV"
17 STO 09
18 RCL 01
19 RCL IND 08 
20 X≠Y?
21 GTO 00
22 1.01
23 ×
24 X≠0?
25 GTO 00
26 0.01
27 LBL 00
28 STO 02
29 STO IND 08
30 XEQ IND 09
31 STO 05
32 X=0?
33 GTO 12
34 ABS
35 RCL- 10
36 X>0?
37 GTO 01
38 1
39 GTO 13
40 LBL 01
41 RCL 01
42 STO IND 08 

43 XEQ IND 09
44 STO 04
45 X=0?
46 GTO 11
47 ABS
48 RCL- 10
49 X>0?
50 GTO 02
51 1
52 GTO 13
53 LBL 02
54 RCL 01
55 RCL+ 02
56 0.5
57 ×
58 GTO 04
59 LBL 03
60 1
61 RAN
62 14
63 ×
64 +
65 16
66 ÷
67 RCL 02
68 RCL- 01
69 ×
70 RCL+ 01
71 LBL 04
72 STO 03
73 STO IND 08 
74 XEQ IND 09
75 STO 06
76 LBL 05
77 RCL 06
78 X=0?
79 GTO 13
80 ABS
81 STO 07
82 RCL- 10
83 X>0?
84 GTO 20
85 1

86 GTO 13
87 LBL 20
88 RCL 06
89 RCL- 05
90 RCL 06
91 RCL- 04
92 ×
93 X≠0?
94 GTO 06
95 ISG 11
96 GTO 21
97 7
98 BEEP
99 GTO 13
100 LBL 21
101 RCL 02
102 RCL- 01
103 RCL 12
104 X=0?
105 X<>Y
106 STO 12
107 RCL 06
108 RCL+ 06
109 RCL- 05
110 RCL- 04
111 ABS
112 1E-8
113 X≤Y?
114 GTO 25
115 -1.5
116 RCL× 12
117 STO 12
118 RCL+ 01
119 STO 02
120 STO IND 08 
121 XEQ IND 09
122 STO 05
123 GTO 03
124 LBL 25
125 0
126 STO 12
127 GTO 03
128 LBL 06

129 RCL 03
130 RCL- 01
131 X≠0?
132 GTO 07
133 ISG 11
134 GTO 03
135 2
136 GTO 13
137 LBL 07     
138 RCL 06
139 RCL÷ 05
140 ABS
141 1
142 -
143 ABS
144 10
145 RCL× 10
146 -
147 X≥0?
148 GTO 08
149 ISG 11
150 GTO 03
151 3
152 GTO 13
153 LBL 08
154 RCL 06
155 ABS
156 RCL 05
157 ABS
158 X≥Y?
159 GTO 09
160 1E-8
161 X<Y?
162 GTO 09
163 3
164 RCL+ 11
165 RCL- 00
166 X≤0?
167 GTO 09
168 4
169 GTO 12
170 LBL 09
171 RCL 03

172 RCL- 02
173 RCL 06
174 RCL- 04
175 ×
176 RCL× 05
177 RCL 03
178 RCL- 01
179 RCL 06
180 RCL- 05
181 ×
182 RCL× 04
183 ÷
184 STO 07
185 5
186 RCL- 00
187 X<0?
188 GTO 23
189 RCL 06
190 ABS
191 10
192 RCL× 05
193 ABS
194 X>Y?
195 GTO 23
196 ISG 11
197 GTO 22
198 3
199 GTO 13
200 LBL 22
201 RCL 04
202 ABS
203 X≤Y?
204 GTO 01
205 RCL 01
206 RCL+ 02
207 0.5
208 ×
209 STO 01
210 STO IND 08 
211 XEQ IND 09
212 STO 04
213 GTO 03
214 LBL 23

215 1
216 RCL- 07
217 X≠0?
218 GTO 10
219 6
220 BEEP
221 GTO 12
222 LBL 10
223 RCL 02
224 RCL 07
225 RCL× 01
226 -
227 X<>Y
228 ÷
229 STO IND 08 
230 X<> 03
231 X<> 02
232 STO 01
233 XEQ IND 09
234 X<> 06
235 X<> 05
236 STO 04
237 ISG 00
238 GTO 05
239 5
240 LBL 13
241 RCL 06
242 RCL 03
243 GTO 14
244 LBL 12
245 RCL 05
246 RCL 02
247 GTO 14
248 LBL 11
249 RCL 04
250 RCL 01
251 LBL 14
252 STO IND 08 
253 RCL "RSLV"
254 X<> "REGS"
255 R↓
256 RTN
257 END
*Note1: 'epsilon' is hard coded to 2E-12 for HP 42S and 1E-16 for Free42 at line # 08, however,
it can be replaced by a command to use external variable e.g. RCL "EPS".

Download

'OST' (ost-2.93.raw, 495 byte, raw program file for the Free42)

Example

Test function to be solved
f(x) = eX - 3X2 plot
00 { 19-Byte Prgm }
01 LBL "Test"
02 RCL X
03 E↑X
04 LASTX
05 X↑2
06 3
07 ×
08 -
09 RTN
10 .END.


Operation
preparation 1st root 2nd root 3rd root
"Test"
ASTO "PSLV"
"X"
ASTO "SOLVE"
0
STO "X"
1
XEQ "OST"
0
STO "X"
-1
XEQ "OST"
3
STO "X"
4
XEQ "OST"
Results 0.91000757249 -0.458962267536 3.73307902863

SEE ALSO

Ostrowski's method - a root-finding method
Rational interpolation program for the HP 42S
Online calculator - Synthesize/Analize microstrip transmission line

EXTERNAL LINKS

MoHPC, HP Articles Forum
556 : Karl Schneider, 2005, HP SOLVE/INTEG on all RPN-based models, Karl Schneider
MoHPC, HP Forum Archive
190798 : question for lyuka and the Ostrowski method
191098 : Lyuka and the Ostrowski method's for Root Seeking
191462 : Results of new root-seeking methods

www.finetune.co.jp [Mail] © 2000 Takayuki HOSODA.
Powered by
 Finetune