See http://www.jsoftware.com/pipermail/programming/2007-December/009055.html Basically, for extended precision arguments,
x=: 1000 [EMAIL PROTECTED] 100x ts=: 6!:2 , 7!:[EMAIL PROTECTED] ts '+/\ x' 0.599717 154240 ts '+/\.x' 0.000962413 217536 Fixed for the next J6.02 beta. ----- Original Message ----- From: "R.E. Boss" <[EMAIL PROTECTED]> Date: Wednesday, December 19, 2007 10:46 Subject: RE: [Jprogramming] Bell numbers To: 'Programming forum' <[email protected]> > In my exploration of the Bell numbers I hit on something strange. > > ptr=: [:+/\ {:, ] > PTR=: [:+/\. ], {. > > are two verbs which produce the Pierce numbers > http://www.research.att.com/~njas/sequences/A011971 > > ptr^:(i.`(x:@1:))5 > 1 0 0 0 0 > 1 2 0 0 0 > 2 3 5 0 0 > 5 7 10 15 0 > 15 20 27 37 52 > > PTR^:(i.`(x:@1:))5 > 1 0 0 0 0 > 2 1 0 0 0 > 5 3 2 0 0 > 15 10 7 5 0 > 52 37 27 20 15 > > Notice the row wise relation between the two: > (ptr^:(i.`(x:@1:)) (-:|.)&{: PTR^:(i.`(x:@1:)))120 > 1 > > But look at the amazing difference in performance: > > 5 ts'ptr^:(i.`(x:@1:))120' > 0.40665763 1604992 > 5 ts'PTR^:(i.`(x:@1:))120' > 0.014059384 1604992 > > Same amount of space, but almost 30 times as fast!! > > Any explanation ??? > > > BTW, this leads to a (1.6 times) faster verb for Bell numbers: > > 5 ts'Bn2 120' > 0.014777791 1594880 > > (Bn1-:1,Bn2) 120 > 1 > > although 10 times more space is used > > > R.E. Boss ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
