16 Point Gaussian Quadrature for the HP-41C/CV/CX (updated)
|
11-15-2023, 03:14 AM
(This post was last modified: 11-15-2023 03:18 AM by Valentin Albillo.)
Post: #25
|
|||
|
|||
RE: 16 Point Gaussian Quadrature for the HP-41C/CV/CX (updated)
.
Hi, Namir, Apart from the 5 wrong coefficients which I pointed out and you already corrected, there's another error in your program, namely (the ► are cosmetic): Your program begins: 01 LBL "A-B" 02 LBL A 03 XEQ 00 ► 04 FIX 05 ... where the XEQ 00 at line 03 calls this subroutine, which stores the 16 coefficients needed to compute the integral: 117 ►LBL 00 118 FS? 01 119 RTN 120 2.715245941E-2 121 STO 03 ... 152 SF 01 153 RTN Your idea seems to be to use flag 01 in the very first run of your program to signal that the coefficients have already been stored by setting it at line 152 SF 01 so that the next times subroutine 00 is called, flag 01 is checked at line 118 FS? 01, and if set then the subroutine returns immediately without storing the coefficients, as they are assumed to have been already stored. So far so good. The problem is that if for whatever reason (perhaps as a side effect of previously running another program) flag 01 is already set when you execute this integration program for the first time, then the XEQ 00 will return immediately without storing tha coefficients at all, proceeding to compute the integral without them and thus leaving the user thoroughly perplexed when he gets the thoroughly wrong result. In short: you're assuming that flag 01 isn't set when you first execute your program, but that's an unsupported assumption and should it be already set, your program will never store the coefficients and thus will fail. A program should never rely on unsupported assumptions, but in this case the solution is to simply clear flag 01 before calling subroutine 00, end of story. Regards. V. All My Articles & other Materials here: Valentin Albillo's HP Collection |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)