I have an application in which I am using the power function to undertake an
iterative solution to an equation but only if one of the inputs is above a
specific value (10). 

 

Here is the verb:

 

   ITERATE        =:         4 : 0

s          =. p*y

y*x%(+/w*(s%z)*n*1-^-z)

)

 

p, w, z and n are all fixed outside the function while x and y are of course
the dyadic input. 

 

Now, I want to execute 

s                       =.         p * q (ITERATE ^:_) 2

 

if q is > 10 while I want to execute 

 

p * q otherwise.

 

I thought of using p * q ITERATE ^: (q>10)^:_  2 but the problem I am
encountering is that 2, not q, is the result when q <:10. Now if I reverse q
and 2 (and the terms in ITERATE), the function fixes 2 and changes q! I am
obviously missing something in all this. Any help would be appreciated.

 

Bob

 

 

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

Reply via email to