DM42 has an integration function that is not recursive. If you want to integrate a function that includes an integral you get an error message. So it is not able to compute double integrals.

The program INT2 computes double integrals using Gaussian method. The program uses a solution given by Thomas Klemm in the Museum of HP calculators for the HP 11C (https://www.hpmuseum.org/forum/thread-3 ... t=Integral).

How to use it:

1. Put the function you want to integrate under label "FU". The function must take Y from Y register and X from X register and deliver f(X,Y) in X-register. The example given is the function e^(-X²-Y²/2).

2. Put the number of subintervals in register 00. The more subintervals you use the more precise the result will be.

3. Put the limits of the integral in the stack: Lower limit of Y in register T, upper limit in Z, lower limit of X in Y, upper limit in X

4. Execute INT2

Example: The example with the limits of 0 and 1 for Y and 1 and 2 for X delivers in about 1 second 0.11572940947. HP Prime delivers 0.11572940908. So these results have 9 digits in common.

Best

Raimund Wildner

Code: Select all

```
00 { 186-Byte Prgm }
01▸LBL "INT2"
02 STO 11
03 -
04 RCL 00
05 ÷
06 STO 10
07 2
08 ÷
09 STO+ 11
10 0.6
11 SQRT
12 ×
13 STO 13
14 R↓
15 STO 21
16 -
17 RCL 00
18 ÷
19 STO 15
20 CLX
21 STO 12
22 RCL 00
23 1ᴇ3
24 ÷
25 1
26 +
27 STO 14
28▸LBL 00
29 RCL 11
30 RCL 13
31 +
32 XEQ 01
33 5
34 ×
35 STO- 12
36 RCL 11
37 RCL 13
38 -
39 XEQ 01
40 5
41 ×
42 STO- 12
43 RCL 11
44 XEQ 01
45 8
46 ×
47 STO- 12
48 RCL 10
49 STO+ 11
50 ISG 14
51 GTO 00
52 RCL 12
53 ×
54 18
55 ÷
56 RTN
57▸LBL 01
58 STO 20
59 RCL 21
60 STO 16
61 RCL 15
62 2
63 ÷
64 STO+ 16
65 0.6
66 SQRT
67 ×
68 STO 18
69 CLX
70 STO 17
71 RCL 00
72 1ᴇ3
73 ÷
74 1
75 +
76 STO 19
77▸LBL 02
78 RCL 16
79 RCL 18
80 +
81 RCL 20
82 XEQ "FU"
83 5
84 ×
85 STO- 17
86 RCL 16
87 RCL 18
88 -
89 RCL 20
90 XEQ "FU"
91 5
92 ×
93 STO- 17
94 RCL 16
95 RCL 20
96 XEQ "FU"
97 8
98 ×
99 STO- 17
100 RCL 15
101 STO+ 16
102 ISG 19
103 GTO 02
104 RCL 17
105 ×
106 18
107 ÷
108 RTN
109 END
00 { 17-Byte Prgm }
01▸LBL "FU"
02 X↑2
03 +/-
04 X<>Y
05 X↑2
06 +/-
07 2
08 ÷
09 +
10 E↑X
11 RTN
12 END
```