HP Forums
(Updated) Edited port of HP-67 Gaussian Quadrature - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Software Libraries (/forum-10.html)
+--- Forum: HP-41C Software Library (/forum-11.html)
+--- Thread: (Updated) Edited port of HP-67 Gaussian Quadrature (/thread-20810.html)



(Updated) Edited port of HP-67 Gaussian Quadrature - Namir - 11-09-2023 02:57 PM

This is an edited program for the HP-41C program port from the HP-67 Gaussian-Quadrature program in the HP-67 Math Pac. The original HP-41C port was done by Tony Duell (found here). I further edited the program and removed the need for the Card Reader ROM and the special HP-67 emulation commands like 7P<>S, 7PRTX, and 7ISZ.

You can download the .raw file by clicking here.

To use the program:

1) Press [B] to perform a regular integration between A and B. The program prompts you for the values of A and B. Enter these values and press [R/S] to calculate the integral.

2) Press [C] to perform a special integration between A and infinity. The program prompts you for the value of A. Enter the value and press [R/S] to calculate the integral.

Notes:

1) Label E is where you enter the statements to evaluate the integrated function.
2) You need not press the button [A] to initialize the quadrature nodes and weights. The code after labels B and C invokes subroutine A to perform this initialization for you.

Here is the updated lisiting:

Code:
01 LBL "GQAD67"
02 LBL 10
03 LBL A 
04 0.238619186
05 STO 10
06 0.467913935
07 STO 11
08 0.661209387
09 STO 12
10 0.360761573
11 STO 13
12 0.932469514
13 STO 14
14 0.171324492
15 STO 15
16 RTN
17 LBL 11
18 LBL B
19 XEQ A
20 A^B?
21 PROMPT
22 STO 21
23 X<>Y
24 STO 22
25 -
26 2
27 /
28 STO 20
29 RCL 22
30 RCL 21
31 +
32 2
33 /
34 STO 21
35 0
36 STO 00
37 10.1
38 STO 25
39 XEQ 16
40 XEQ 16
41 XEQ 16
42 RCL 00
43 RCL 20
44 *
45 RTN
46 LBL 16
47 LBL b
48 RCL IND 25
49 ISG 25
50 STO 22
51 CHS
52 RCL 20
53 *
54 RCL 21
55 +
56 XEQ 14
57 RCL IND 25
58 *
59 ST+ 00
60 RCL 22
61 RCL 20
62 *
63 RCL 21
64 +
65 XEQ 14
66 RCL IND 25
67 *
68 ST+ 00
69 ISG 25
70 RTN
71 LBL 12
72 LBL C
73 XEQ A
74 A?
75 PROMPT
76 STO 20
77 0
78 STO 00
79 10.1
80 STO 25
81 XEQ 17
82 XEQ 17
83 XEQ 17
84 RCL 00
85 2
86 *
87 RTN
88 LBL 17
89 LBL c
90 RCL IND 25
91 ISG 25
92 STO 22
93 CHS
94 XEQ 09
95 XEQ 14
96 XEQ 08
97 RCL 22
98 XEQ 09
99 XEQ 14
100 XEQ 08
101 ISG 25
102 RTN
103 LBL 09
104 1
105 +
106 STO 21
107 2
108 X<>Y
109 /
110 RCL 20
111 +
112 1
113 -
114 RTN
115 LBL 08
116 RCL IND 25
117 *
118 RCL 21
119 X^2
120 /
121 ST+ 00
122 RTN
123 LBL 14
124 LBL E
125 RTN

Example 1
=========

To calculate the integral of 1/x from 1 to 2 (which is equal to ln(2)):

1. In program mode insert the command 1/x after LBL E and make sure it is followed by RTN.
2. In run mode (user mode on) key in 1, press [ENTER], and key in 2.
3. The Press the [B] key.
4. The program displays 0.69315 as the value of the integral.

Example 2
========

To calculate the integral of exp(-x)*x^0.8 from 0 to inifinity (which is equal to gamma(1.8)):

1. In program mode insert the commands CHS, EXP, LASTX, CHS, 0.8, Y^X and, * after LBL E and make sure it is followed by RTN.
2. In run mode (user mode on) key in 0.
3. The Press the [C] key.
4. The program displays 0.92410 as the value of the integral.