I notice that both Rosetta Code scripts - yours and Ric's - pull out the coefficients (1 2 2 1) from the equation for "Yn+1". From what I can understand of the Wikipedia page on RK, these are based on a Simpson's Rule approximation for this "fourth-order" method. Is there any useful generalization that might proceed from this, say to a higher-order method, or something? Or are the error terms thought to be sufficiently small that such a generalization is not considered useful?
I'd like to find some way to emphasize the generality of the solution which treats these coefficients as a distinct vector rather than embedding them into the code the way the other ones do, but I don't understand the problem domain well enough to know a useful direction in which to go. On Fri, May 11, 2012 at 5:04 AM, Aai <agroeneveld...@gmail.com> wrote: > Because rk4M started also with an accumulating fold, the next version > will be: > > 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 > ) > >> >> (*x&,@{:) >> >> was used in an earlier attempt with an accumulating fold. It can be >> simplified (because of using the faster scan fold) to >> >> (*x&,) >> > > -- > Met vriendelijke groet, > @@i = Arie Groeneveld > > ---------------------------------------------------------------------- > 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