Post Reply 
integral competition HP50g vs. DM42
08-24-2020, 04:28 PM
Post: #21
RE: integral competition HP50g vs. DM42
(08-24-2020 10:30 AM)peacecalc Wrote:  The algorithmus can be a kind of gaussian quadrature, because that one doesn't use the limits on the left and right side.

Romberg and other method use the limits of the integration aera.

Free42 uses are modified Romberg method that doesn't use the endpoints. The code was originally written by Hugh Steers; this comment is from core_math1.cc:

Code:

/* approximate integral of `f' between `a' and `b' subject to a given
 * error. Use Romberg method with refinement substitution, x = (3u-u^3)/2
 * which prevents endpoint evaluation and causes non-uniform sampling.
 */
Visit this user's website Find all posts by this user
Quote this message in a reply
08-24-2020, 04:56 PM
Post: #22
RE: integral competition HP50g vs. DM42
(08-24-2020 04:28 PM)Thomas Okken Wrote:  Free42 uses are modified Romberg method that doesn't use the endpoints.

That sounds familiar: http://holyjoe.net/HP71/integral.htm

<0|ɸ|0>
-Joe-
Visit this user's website Find all posts by this user
Quote this message in a reply
08-24-2020, 06:35 PM
Post: #23
RE: integral competition HP50g vs. DM42
Hello all,

Thank you: @Joe Horn, @John Keith and @Thomas Okken!

It is known, why the algorithmus was not switched through the generations of calculators?

It is a kind of "never change a running system"?

Most interesting was for me the transformation from x to u avoiding misleading results for periodic functions.
Find all posts by this user
Quote this message in a reply
08-24-2020, 08:03 PM
Post: #24
RE: integral competition HP50g vs. DM42
Hi !
here is an HP41 version that employs an ascending series for small x
and a complex continued fraction otherwise:

01 LBL "CSX"
02 STO 01
03 ABS
04 PI
05 SQRT
06 X>Y?
07 GTO 04
08 DEG
09 *
10 24
11 STO 02
12 CLX
13 2
14 /
15 STO 03
16 ENTER
17 LBL 01
18 X<>Y
19 CHS
20 STO Z
21 X^2
22 RCL Y
23 X^2
24 +
25 DSE 02
26 X<0?
27 GTO 02
28 RCL 02
29 X<>Y
30 ST+ X
31 /
32 ST* Z
33 *
34 RCL 03
35 ST+ Z
36 +
37 GTO 01
38 LBL 02
39 PI
40 SQRT
41 *
42 ST/ Z
43 /
44 R-P
45 RCL 01
46 X^2
47 90
48 *
49 R^
50 -
51 X<>Y
52 CHS
53 P-R
54 1
55 +
56 STO Z
57 X<>Y
58 ST+ Z
59 -
60 2
61 ST/ Z
62 /
63 GTO 05
64 LBL 03
65 X<> 00
66 PI
67 2
68 ST+ 02
69 /
70 RCL 01
71 X^2
72 *
73 X^2
74 *
75 RCL 02
76 ENTER
77 DSE X
78 *
79 /
80 CHS
81 STO 00
82 RCL 02
83 ST+ X
84 ISG X
85 CLX
86 /
87 X<>Y
88 ST+ Y
89 X#Y?
90 GTO 03
91 RTN
92 LBL 04
93 CLX
94 STO 02
95 X<>Y
96 STO 00
97 ENTER
98 XEQ 03
99 STO 03
100 1
101 STO 02
102 RCL 01
103 ABS
104 3
105 Y^X
106 PI
107 *
108 2
109 /
110 STO 00
111 3
112 /
113 ENTER
114 XEQ 03
115 RCL 03
116 LBL 05
117 RCL 01
118 SIGN
119 ST* Y
120 ST* Z
121 RDN
122 END

Example:

1.2 XEQ "CSX" >>>> C(x) = 0.715437723
X<>Y S(x) = 0.623400918

3.9 R/S >>>> C(x) = 0.422332710
X<>Y S(x) = 0.475202402

Best regards.
Visit this user's website Find all posts by this user
Quote this message in a reply
08-24-2020, 08:15 PM
Post: #25
RE: integral competition HP50g vs. DM42
On my Prime G1 rev C I defined C(X) and S(X) with the Define key, and created two small programs looping on C(3.9) or S(3.9) and counting the TICKS difference.

The results:
Average C(3.9) time: 74.05ms
Average S(3.9) time: 73.67ms

Thibault - not collector but in love with the few HP models I own - Also musician : http://walruspark.co
Find all posts by this user
Quote this message in a reply
08-30-2020, 10:51 AM
Post: #26
RE: integral competition HP50g vs. DM42
Hello JMBaillard,

I converted your program "CSX" so, that's working for the DM42 (maybe for the HP42, too, but I've not this calc).

Code:

00 { 166-Byte Prgm }
01▸LBL "CSX"
02 STO 01
03 ABS
04 PI
05 SQRT
06 X>Y?
07 GTO 04
08 DEG
09 ×
10 24
11 STO 02
12 CLX
13 2
14 ÷
15 STO 03
16 ENTER
17▸LBL 01
18 X<>Y
19 +/-
20 STO ST Z
21 X↑2
22 RCL ST Y
23 X↑2
24 +
25 DSE 02
26 X<0?
27 GTO 02
28 RCL 02
29 X<>Y
30 STO+ ST X
31 ÷
32 STO× ST Z
33 ×
34 RCL 03
35 STO+ ST Z
36 +
37 GTO 01
38▸LBL 02
39 PI
40 SQRT
41 ×
42 STO÷ ST Z
43 ÷
44 →POL
45 RCL 01
46 X↑2
47 90
48 ×
49 R↑
50 -
51 X<>Y
52 +/-
53 →REC
54 1
55 +
56 STO ST Z
57 X<>Y
58 STO+ ST Z
59 -
60 2
61 STO÷ ST Z
62 ÷
63 GTO 05
64▸LBL 03
65 X<> 00
66 PI
67 2
68 STO+ 02
69 ÷
70 RCL 01
71 X↑2
72 ×
73 X↑2
74 ×
75 RCL 02
76 ENTER
77 DSE ST X
78 ×
79 ÷
80 +/-
81 STO 00
82 RCL 02
83 STO+ ST X
84 ISG ST X
85 CLX
86 ÷
87 X<>Y
88 STO+ ST Y
89 X≠Y?
90 GTO 03
91 RTN
92▸LBL 04
93 CLX
94 STO 02
95 X<>Y
96 STO 00
97 ENTER
98 XEQ 03
99 STO 03
100 1
101 STO 02
102 RCL 01
103 ABS
104 3
105 Y↑X
106 PI
107 ×
108 2
109 ÷
110 STO 00
111 3
112 ÷
113 ENTER
114 XEQ 03
115 RCL 03
116▸LBL 05
117 RCL 01
118 SIGN
119 STO× ST Y
120 STO× ST Z
121 R↓
122 END

Some commands are different: f. i. STO+ X is replaced by STO+ ST X;
Have fun!
Find all posts by this user
Quote this message in a reply
08-30-2020, 01:16 PM
Post: #27
RE: integral competition HP50g vs. DM42
(08-30-2020 10:51 AM)peacecalc Wrote:  I converted your program "CSX" so, that's working for the DM42 (maybe for the HP42, too, but I've not this calc).

Actually, the encoder over on the SwissMicros website accepts both syntaxes but converts to HP-42S syntax. Quoting from https://www.swissmicros.com/dm42/decoder/#tabs-2

Quote:Many of the characters used in HP-42S/DM42 programs cannot be entered directly with a keyboard. In order to help with this, we provide several special "codes" that you can use and there are also easy-to-type mnemonics for instructions that use them. This encoder also accepts HP-41 style instructions, eg. you can type "ST/ 10" instead of "STO÷ 10" or "RCL T" instead of "RCL ST T".

There are only 10 types of people in this world. Those who understand binary and those who don't.
Find all posts by this user
Quote this message in a reply
08-30-2020, 11:27 PM
Post: #28
RE: integral competition HP50g vs. DM42
Hi !
The HP41 works with 10 digits,
but to get 12-digit precision,
it's preferable to replace line 10 by
50 ( instead of 24 ).
Best regards.
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 




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