Converting the conjunction to an adverb and using u for x seems to work,

integrate=: 1 :0
'lower upper sd'=. 3{.y,8
in=. 5
len=. 2^i.in
diff=. upper-lower
int=. 3 : ',(_1 1*r*3^_0.5)+/+/\r,}:y#+:r=.%+:y'
scale=. [: lower&+ diff&*
f=. diff&*@(+/)@:u@scale@int % +:
g=. f"0 len
whilst. 1 do.
  r=. g
  whilst. 1<#r do.
    t0=. _2}.iv=. r
    t1=. }.}:iv
    t2=. 2}.iv
    s=. t2+t0-+:t1
    r=. t2-(-.b)*(*:t2-t1)%s+b=. 0=s
  end.
  t=. <.-10^.1e_14>.(|-/_2{.iv)%{:iv
  if. (10<in) +. sd <: t do. r,t return. end.
  g=. g,f"0 [ 2^in,in+1
  in=. in+2
end.
)

   fn integrate 0 10 12
9.86111e7 14

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

Reply via email to