I find it interesting that N-R works for vectors and complex functions (and mixes of both). Just replace all those scalar functions by their vector equivalents:
vn=: 1 : '- n * u %. u D.1' I added a scaling factor; it makes the convergence slower, but it fixes problems due to precision-loss. It works reasonably well: f=: ^&0 1 - 1 2 ^~ {. f vn 0.1^:1e3 ] 0 0 1 1 Louis > On 10 Aug 2017, at 13:07, Martin <d...@famic.de> wrote: > > Hi there, > > J looks very interesting. I have no previous experience with array > languages and, being curious, started to experiment. Now, I would > like to solve a system of non-linear equations. I could only examples > solving single equations like this one: > > N=: 1 : '- u % u d. 1' NB. Adverb implementing Newton-Raphson iteration. > (_2 + *:) N^:_ ]1 NB. Find root of “0 = _2+x^2”, starting guess of > “1”. > > Is it also possible to solve a system of equation like the following > one in a similar elegant manner? > > f1(x) = a*(1-x1) > f2(x) = b*(x2-x1^2) > > Example from > https://www.gnu.org/software/gsl/doc/html/multiroots.html#examples > > Thanks for any ideas! > -Martin > > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm