SandMath incomplete beta function broken?
01-16-2016, 07:25 PM
Post: #1
 quantalume Member Posts: 101 Joined: Dec 2015
SandMath incomplete beta function broken?
When trying to evaluate incomplete beta (ICBT) on the two versions of SandMath I'm using (SM9F and SM9G), the calculator just displays "RUNNING..." for a long time and never converges on an answer. ICBT is a FOCAL program, so I decided to have a look at it. It has an inauspicious beginning...

Code:
01 ST* 01 02 STO 00 03 STO 00 ...

...and continues on for some 66 lines, eventually attempting to find the answer via the generalized hypergeometric function, HGF+. I tried calculating incomplete beta manually using SandMath's HGF+ function, and I get the right answer, with HGF+ converging reasonably quickly.

I don't have room in my NoV64 for the 32K monster that the latest SandMath has become, so I was wondering if someone with a 41CL could see if the function has been fixed. You can use the example from the manual:

Code:
PI 1 E^X 0.7 XEQ “ICBT“
->0.029623046

Thanks.

David Brunell
Houston, Texas
01-16-2016, 07:47 PM (This post was last modified: 01-16-2016 07:55 PM by Ángel Martin.)
Post: #2
 Ángel Martin Senior Member Posts: 1,134 Joined: Dec 2013
RE: SandMath incomplete beta function broken?
(01-16-2016 07:25 PM)quantalume Wrote:  I don't have room in my NoV64 for the 32K monster that the latest SandMath has become, so I was wondering if someone with a 41CL could see if the function has been fixed. You can use the example from the manual:

Code:
PI 1 E^X 0.7 XEQ “ICBT“
->0.029623046

Thanks.

Works for me ;-? I just sent you the latest MOD files, you may have a version mismatch somewhere...?
01-17-2016, 01:34 AM
Post: #3
 quantalume Member Posts: 101 Joined: Dec 2015
RE: SandMath incomplete beta function broken?
(01-16-2016 07:47 PM)Ángel Martin Wrote:  Works for me ;-? I just sent you the latest MOD files, you may have a version mismatch somewhere...?

OK, it looks like it was fixed somewhere between versions 9G and 9L. Since I'd like to continue to use the earlier 8K versions, what would be the easiest way to patch the ROM images? Here is, for example what the function looks like in version 9G:

Code:
 _XR_002.19  B028 00B 050      .FATFUN     ICBT          BB50          ; MCode XROM 00.19  "ICBT" ...             BB4F 009 003 002  .FNAME      "ICBT"                      ; 009 003 002 094   ICBT        BB50 1B9 100      ?NC XQ      406E                       BB52 130 175      LDI         175                        BB54 132          A=A+B       P-Q            LB_BB55     BB55 171 192      ?NC GO      645C                       BB57 002          A=0         @R                         BB58 133          JNC  +26    LB_BB7E       BB7E             BB59 134          UNDEF134                   LB_BB5A     BB5A 174          UNDEF174                               BB5B 171 153      ?C GO       545C                       BB5D 11B          JNC  +23    LB_BB80       BB80             BB5E 131 192      ?NC GO      644C           LB_BB60     BB60 003          JNC  +00    LB_BB60       BB60             BB61 1A0          A=B=C=0                                BB62 0FD 174      ?NC XQ      5D3F           LB_BB64     BB64 153          JNC  +2A    LB_BB8E       BB8E             BB65 142          A=A+C       @R                         BB66 124          SELPF       4                           ; Peripheral 4: HP-IL             BB67 143          JNC  +28    LB_BB8F       BB8F             BB68 134          UNDEF134                               BB69 120          ?P=Q                                   BB6A 1E0          GOTOADR                    LB_BB6B     BB6B 007          JC   +00    LB_BB6B       BB6B             BB6C 080          UNDEF080                               BB6D 124          SELPF       4                           ; Peripheral 4: HP-IL             BB6E 142          A=A+C       @R                         BB6F 17F          JC   +2F    LB_BB9E       BB9E LB_BB70     BB70 185 101      ?C XQ       4061                       BB72 11B          JNC  +23    LB_BB95       BB95             BB73 171 166      ?NC GO      595C                       BB75 1B6          A=A-1       XS                         BB76 087          JC   +10    LB_BB86       BB86 LB_BB77     BB77 171 112      ?NC GO      445C                       BB79 1CE          A=A-C       ALL                        BB7A 071 1A0      ?NC XQ      681C                       BB7C 08D 185      ?C XQ       6123           LB_BB7E     BB7E 106          A=C         S&X                        BB7F 130 177      LDI         177                        BB81 123          JNC  +24    LB_BBA5       BBA5             BB82 122          A=A+B       @R                         BB83 191 070      ?NC XQ      MSGNO         1C64          ; HP41 SYSTEM ROM 1             BB85 141 132      ?NC GO      4C50                       BB87 177          JC   +2E    LB_BBB5       BBB5             BB88 120          ?P=Q                                   BB89 11B          JNC  +23    LB_BBAC       BBAC             BB8A 193          JNC  +32    LB_BBBC       BBBC             BB8B 000          NOP                                    BB8C 177          JC   +2E    LB_BBBA       BBBA             BB8D 120          ?P=Q                       LB_BB8E     BB8E 143          JNC  +28    LB_BBB6       BBB6 LB_BB8F     BB8F 112          A=C         P-Q                        BB90 1CE          A=A-C       ALL                        BB91 071 171      ?C XQ       5C1C                       BB93 1A0          A=B=C=0                                BB94 08D 174      ?NC XQ      5D23                       BB96 132          A=A+B       P-Q                        BB97 177          JC   +2E    LB_BBC5       BBC5             BB98 120          ?P=Q                                   BB99 154          ?R=         6                          BB9A 121 153      ?C GO       5448                       BB9C 143          JNC  +28    LB_BBC4       BBC4             BB9D 1CC          UNDEF1CC                   LB_BB9E     BB9E 00B          JNC  +01    LB_BB9F       BB9F LB_BB9F     BB9F 22F          JC   -3B    LB_BB64       BB64             BBA0 000          NOP                                    BBA6 012 007 013  .FNAME      "RGSORT"                    ; 012 007 013 00F 012 094   RGSORT      BBA7 21D 122      ?NC GO      4887           ...

You list this as a FOCAL function in the SandMath manual, but does it have some sort of MCODE launcher? How would I replace this with a straight FOCAL function? I think there is enough room without breaking the downstream addresses.

David Brunell
Houston, Texas
01-17-2016, 07:56 AM
Post: #4
 Ángel Martin Senior Member Posts: 1,134 Joined: Dec 2013
RE: SandMath incomplete beta function broken?
(01-17-2016 01:34 AM)quantalume Wrote:  You list this as a FOCAL function in the SandMath manual, but does it have some sort of MCODE launcher? How would I replace this with a straight FOCAL function? I think there is enough room without breaking the downstream addresses.

This may not be as simple as it should, many versions have happened since and I have archived those older source files...

For a 'straight" FOCAL program I'd suggest you use JM Baillard's, which is the same I used in the SandMath. It is posted at the bottom of this page: http://hp41programs.yolasite.com/gamma.php
01-17-2016, 08:49 AM
Post: #5
 quantalume Member Posts: 101 Joined: Dec 2015
RE: SandMath incomplete beta function broken?
(01-17-2016 07:56 AM)Ángel Martin Wrote:  This may not be as simple as it should, many versions have happened since and I have archived those older source files...

Ok, perhaps the easiest thing to do is put a FOCAL program of the same name in user memory or HEPAX memory, which sits below the first ROM. This way it will find the replacement program first.

Do you ever break backwards compatibility with Library4 updates? For example, might I have a problem if I'm using an old SandMath44 with the latest Library4?

David Brunell
Houston, Texas
01-17-2016, 03:10 PM (This post was last modified: 01-17-2016 03:11 PM by Ángel Martin.)
Post: #6
 Ángel Martin Senior Member Posts: 1,134 Joined: Dec 2013
RE: SandMath incomplete beta function broken?
(01-17-2016 08:49 AM)quantalume Wrote:
(01-17-2016 07:56 AM)Ángel Martin Wrote:  This may not be as simple as it should, many versions have happened since and I have archived those older source files...

Ok, perhaps the easiest thing to do is put a FOCAL program of the same name in user memory or HEPAX memory, which sits below the first ROM. This way it will find the replacement program first.

Do you ever break backwards compatibility with Library4 updates? For example, might I have a problem if I'm using an old SandMath44 with the latest Library4?

In very rare instances that may occur, but not likely. The Lib#4 code has been more or less frozen for a couple of years except a couple of tweaks for the 16C Emulator and the GJM Modules. . It's hard to say 100% since there are so many inter-dependencies.
 « Next Oldest | Next Newest »

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