Here's how I might implement this.  Note that where I've provided
two implementations for a name, I think the second is better.

A=: (1 % 1 + [ + (*>:)@+ % 2:)"0/[EMAIL PROTECTED]@#

X=: +/ .*

XA=: A X ]

XAt=: |:@A X ]
XAt=: ] X A

XAtA=: [EMAIL PROTECTED]
XAtA=: A (X X [) ]

iter=: XAtA^:20 19 19
iter=: A (X X [)^:20 19 19 ]


approx=:13 :'%: %/ 2 X/\ iter u y'

u=: #&1

On my machine:

  6!:2'0j9":approx 5500'
73.3913
  0j9": approx 5500
1.274224153

Though, practically speaking, I get the same displayed result for
  0j9": approx 3000
and that only takes about 22 seconds on my machine.

--
Raul
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to