Thanks!! Bob
-----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of R.E. Boss Sent: September 22, 2008 6:07 PM To: 'Programming forum' Subject: RE: [Jprogramming] Power and selection q=:12 q ITERATE ^: (q>10)^:_ [2 1.0865679 q([`(ITERATE ^:_)@.(10<[))2 1.0865679 q=:5 q ITERATE ^: (q>10)^:_ [2 2 q([`(ITERATE ^:_)@.(10<[))2 5 R.E. Boss -----Oorspronkelijk bericht----- Van: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Namens Robert O'Boyle Verzonden: maandag 22 september 2008 22:29 Aan: [email protected] Onderwerp: [Jprogramming] Power and selection 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 ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
