
R version 3.1.3 (2015-03-09) -- "Smooth Sidewalk"
Copyright (C) 2015 The R Foundation for Statistical Computing
Platform: x86_64-apple-darwin10.8.0 (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

  Natural language support but running in an English locale

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> # Dennis & Schnabel,1996,"Numerical methods for unconstrained optimization and nonlinear equations", SIAM
> # example 6.5.1 page 149
> 
> library(nleqslv)
> packageVersion("nleqslv")
[1] '2.8'
> .libPaths()
[1] "/Users/berendhasselman/Documents/Programming/R/Packages/NonLinearEq.Package/nleqslv.Rcheck"
[2] "/Users/berendhasselman/Library/R/3.1/library"                                              
[3] "/Library/Frameworks/R.framework/Versions/3.1/Resources/library"                            
> 
> dslnex <- function(x) {
+     y <- numeric(2)
+     y[1] <- x[1]^2 + x[2]^2 - 2
+     y[2] <- exp(x[1]-1) + x[2]^3 - 2
+     y
+ }
> 
> jacdsln <- function(x) {
+     n <- length(x)
+     Df <- matrix(numeric(n*n),n,n)
+     Df[1,1] <- 2*x[1]
+     Df[1,2] <- 2*x[2]
+     Df[2,1] <- exp(x[1]-1)
+     Df[2,2] <- 3*x[2]^2
+ 
+     Df
+ }
> 
> xstart <- c(2,0.5)
> 
> # \section{Report for the single (Powell) dogleg global method}
> nleqslv(xstart,dslnex, global="pwldog", jacobian=TRUE, control=list(trace=1,delta="cauchy"))
  Algorithm parameters
  --------------------
  Method: Broyden  Global strategy: single dogleg (initial trust region = -1)
  Maximum stepsize = 1.79769e+308
  Scaling: fixed
  ftol = 1e-08 xtol = 1e-08 btol = 0.001 cndtol = 1e-12

  Iteration report
  ----------------
  Iter         Jac     Lambda     Dlt0     Dltn         Fnorm   Largest |f|
     0                                           2.886812e+00  2.250000e+00
     1  N(9.6e-03) C            0.4671   0.9343* 1.699715e-01  5.421673e-01
     1             W   0.0794   0.9343   0.4671  1.699715e-01  5.421673e-01
     2  B(1.1e-02) W   0.0559   0.4671   0.4671  1.205661e-01  4.890487e-01
     3  B(7.3e-02) W   0.5662   0.4671   0.0960  4.119560e-01  7.254441e-01
     3             W   0.0237   0.0960   0.1921  4.426507e-02  2.139252e-01
     4  B(8.8e-02) W   0.2306   0.1921   0.3842* 2.303135e-02  2.143943e-01
     4             W   0.4769   0.3842   0.1921  2.303135e-02  2.143943e-01
     5  B(1.9e-01) N            0.1375   0.2750  8.014508e-04  3.681498e-02
     6  B(1.7e-01) N            0.0162   0.0325  1.355741e-05  5.084627e-03
     7  B(1.3e-01) N            0.0070   0.0035  1.282776e-05  4.920962e-03
     8  B(1.8e-01) N            0.0028   0.0056  3.678140e-08  2.643592e-04
     9  B(1.9e-01) N            0.0001   0.0003  1.689182e-12  1.747622e-06
    10  B(1.9e-01) N            0.0000   0.0000  9.568768e-16  4.288618e-08
    11  B(1.9e-01) N            0.0000   0.0000  1.051357e-18  1.422036e-09
$x
[1] 1 1

$fvec
[1] 2.837748e-10 1.422036e-09

$termcd
[1] 1

$message
[1] "Function criterion near zero"

$scalex
[1] 1 1

$nfcnt
[1] 14

$njcnt
[1] 1

$iter
[1] 11

$jac
          [,1]     [,2]
[1,] 1.9128580 1.932369
[2,] 0.5633352 2.661106

> 
