This expression is sufficiently dense that it might merit being broken
into a few more lines on which you define some meaningful auxiliary
verbs to be used in the top-level routine.  I'm not familiar with the
algorithm, so I can't suggest what these might be.

Looking at the one that's there, I'm a bit annoyed by its use of
"adverb define" which means it doesn't run if I cut and paste it into
a J session unless I have those "helpers" defined.

On Thu, May 10, 2012 at 4:12 PM, Raul Miller <rauldmil...@gmail.com> wrote:
> On Thu, May 10, 2012 at 1:46 PM, Aai <agroeneveld...@gmail.com> wrote:
>> The J contribution on Rosetta Code
>> http://rosettacode.org/wiki/Runge-Kutta_method#J for subject is a loopy
>> one. My goal is to change that into a more functional and J-ish one.
>>
>> Here's my attempt for that particular task:
>>
>> p4=: 1 :(':';'({:y)+6%~+/1 2 2 1*(x*[: u y+(*x&,@{:))/\.1 0.5 0.5,x*u y')
>>
>> rk4M=: 1 :0
>>  'Y0 a b h'=. 4{. y
>>  (,.[:h&(u p4)@(,{:)/\.Y0,~}.)&.|. a+i.@>:&.(%&h) b-a
>> )
>>
>>    (fyp rk4 -: fyp rk4M) 1 0 10 0.001
>> 1
>
> As a minor point, I think I would change the definition of p4
> to use the same definition format as rk4M
>
> p4=: 1 :0
> :
>  ({:y)+6%~+/1 2 2 1*(x*[: u y+(*x&,@{:))/\.1 0.5 0.5,x*u y
> )
>
> But I do not have the time to focus on this one.
>
> I hope I'm not overlooking anything important.
> (I wonder if the parenthesized expressions deserve names?)
>
> Thanks for tackling this!
>
> --
> Raul
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm



-- 
Devon McCormick, CFA
^me^ at acm.
org is my
preferred e-mail
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to