HP Forums
Sanmath-5 ? - Printable Version

+- HP Forums (https://archived.hpcalc.org/museumforum)
+-- Forum: HP Museum Forums (https://archived.hpcalc.org/museumforum/forum-1.html)
+--- Forum: Old HP Forum Archives (https://archived.hpcalc.org/museumforum/forum-2.html)
+--- Thread: Sanmath-5 ? (/thread-153190.html)

Sanmath-5 ? - Geir Isene - 07-18-2009

Over at TOS, Angel Martin has released Sandmath-5. But still with manuals from Sandmath-III.

Angel; What is the changes in 5?

Re: SandMath-5 ? - Ángel Martin - 07-19-2009

Good things happen to those who wait...

My personal contribution to the 30th. anniversary (say celebrate?) is this updated version of the SandMath Module.

More changes still happening, rather wait until the final version is posted on July 21st...

What's different:-

a.- 4 new MCODE functions replace the FOCAL programs from previous versions (GCD, LCM, nPr, nCr)

b.- Error handling added to GAMMA, BETA, and other MCODE functions likely to get beyond range.

c.- corrected a bug in KNBS (Bessel K) and added support for negative integer indexes to all of them (In, Jn, Kn, Yn).

d.- lots of small code improvements and code compacting, allowing more functions to be staffed into the ROM.

An updated version of the QRG, as well as new blueprints will also be posted on July 21st.


Edited: 19 July 2009, 1:35 a.m.

Re: SandMath-5 ? - PeterP - 07-19-2009

Awesome! Based on Egan's last challenge I started to work on a nPn and nCn mcode function, glad I did not finish them!

Thanks a lot angel, I still have. Virtually all of the calcs I use at home, office, iPhone etc with sandbox/sandmath configurations!



Re: SandMath-5 ? - Ángel Martin - 07-21-2009

Hi Peter,

Well, today's the day... 30th. anniversary of the 41 launch, 40th. aniversary of the Moon landing, and 50th. anniversary of your's truly (I rather say that version 5.0 of the OS is just installed :-). [ Let's see, 30-40-50... isn't that a natural series of some kind?)

To whet your appetite here's the listing of nPr and nCr, I'm sure you can improve on them so go ahead and send feedback. Enjoy!


092	"R"	
003 "C" nPr = PROD{n-k} ,
00E "N" k=0,1,…,(r-2),(r-1)
108 SETF 8 nCr entry point
02B JNC +05
092 "R"
010 "P" nCr= nPr / r!
00E "N"
104 CLRF 8 nPr entry point
0B8 READ 2(Y) n
2FE ?C#0 MS Carry Set if Negative
04F JC +09
2EE ?C#0 ALL Carry set if NOT Zero
03B JNC +07
0F8 READ 3(X) r
2FE ?C#0 MS Carry Set if Negative
01F JC +03
2EE ?C#0 ALL Carry set if NOT Zero
01F JC +03
30D ?NC GO
062 ->18C3 [ERR0]
351 ?NC XQ (includes SETDEC)
050 ->14D4 [CHK_NO_S1]
04E C=0 ALL
35C PT= 12 builds "1" in C
050 LD@PT- 1
268 WRIT 9(Q) initial product
0F8 READ 3(X) r
088 SETF 5 Take Integer part
064 ->193B [INTFRC]
10E A=C ALL Int(r)
04E C=0 ALL
2DC PT= 13 Builds "-1" in C
250 LD@PT- 9 -
050 LD@PT- 1 1
01D ?NC XQ Adds normalized A and C
060 ->1807 [AD2_10]
070 N=C ALL (r-k)-1
2BE C=-C-1 MS -[(r-k)-1]
3C4 ST=0 Clears Carry if set
0B8 READ 2(Y) n
01D ?NC XQ Adds normalized A and C
060 ->1807 [AD2_10]
10E A=C ALL n-[(r-k)-1]
278 READ 9(Q) partial product PP
135 ?NC XQ it *uses* M !!
060 ->184D [MP2_10]
2F6 ?C#0 XS See if we overflow?
289 ?C GO "Out of Range"
003 ->00A2 [ERROF]
268 WRIT 9(Q) PP*{n-[(r-k)-1)]}
0B0 C=N ALL (r-k)-1
2EE ?C#0 ALL
33F JC -19 loop back
278 READ 9(Q)
10C ?FSET 8
04B JNC +09
0F8 READ 3(X) r
3B1 ?NC XQ Calculates Factorial
060 ->18EC [XFT100]
278 READ 9(Q)
261 ?NC XQ Divides A over C
060 ->1898 [DV2_10]
0EE B<>C ALL final solution
391 ?NC GO (REQUIRES Value in B)
002 ->00E4 [DROPST]

Edited: 21 July 2009, 1:36 a.m.

Re: SandMath-5 ? - Egan Ford - 07-21-2009

a.- 4 new MCODE functions replace the FOCAL programs from previous versions (GCD, LCM, nPr, nCr)

I get NONEXITENT with NPR and NCR.

Re: SandMath-5 ? - Ángel Martin - 07-21-2009

Weird. Such an error message isn´t part of the error handling of the routine. I suggest you download the module (when posted) and check the code from there.