I greatly enjoyed seeing your do-while technique for this inversion. Thanks
for posting it. The efficiency gains were also worth seeing.

--T

On Dec 26, 2010 7:22 PM, "bob therriault" <bobtherria...@mac.com> wrote:

A bit more elegant solution:

  g2=:((>:@:])^:([>f@:])^:_)~

A do while loop. The trick here is that the ~ adverb allows me to use two
arguments (x) and (y) when I only supply (y). The (x) can be used as a
reference and I just increment  and test until f(x) > y

  ts 'g2 6037'
0.106917    371328


g=: i.~ f"0@:i.@:+:
  ts 'g 6037'
12.5618      869376

Cheers, bob


On 2010-12-26, at 3:38 PM, bob therriault wrote:

> Whoops, too much turkey!!
>
> I meant to say t...
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to