# [R] Non-Linear Optimization - Query

Berend Hasselman bhh at xs4all.nl
Wed Mar 18 17:46:20 CET 2009

```

Paul Smith wrote:
>
> On Tue, Mar 17, 2009 at 7:55 PM, Berend Hasselman <bhh at xs4all.nl> wrote:
>> You can also try my package "nleqslv" for solving systems of non linear
>> equations (using Broyden or Newton with a selection of global
>> strategies).
>>
>> library(nleqslv)
>>
>> xinit <- rep(1,3)               # or rep(0,3) for a singular start
>> nleqslv(xinit,f2,control=list(trace=1))  # f2 defined as above
>>
>> (You don't need the trace=1; but especially when doing first explorations
>> of
>> a system it can come in handy).
>
> Is your package also able to deal with large systems, Berend?
>
>

There is no built-in size limit.
It uses dense linear algebra; it isn't made for (very) large sparse systems
but then what is large?
For largish systems the calculation of numerical jacobians will probably
become the bottleneck since
for every column R will be called to evaluate the function.

So if your system has a special structure then forging a specialised
function for calculating the jacobian taking into account the special
structure may speed things considerably.

I have just experimented with three functions from the More, Garbow and
Hillstrom set   of systems
(trigonometric with N=100, Broyden banded and tridiagonal both with
N=250)(numerical jacobians),
on my Imac (2.16Ghz, 3Gb memory) and R 2.8.1 this took 4 seconds for solving
the three cases.
I'm quite sure that I could reduce this if I made the R code for evaluating
the functions more efficient
(more vectorisation and such).

Berend

--
View this message in context: http://www.nabble.com/Non-Linear-Optimization---Query-tp22550273p22583339.html
Sent from the R help mailing list archive at Nabble.com.

```