https://github.com/cran/nleqslv
Tip revision: b291c257929a6544b37be66339a91c35b2479479 authored by Berend Hasselman on 21 April 2009, 00:00:00 UTC
version 1.4
version 1.4
Tip revision: b291c25
chquad.Rout.save
R version 2.8.1 (2008-12-22)
Copyright (C) 2008 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
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.
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.
>
> # Chebyquad functions (no solution for n=8)
>
> library("nleqslv")
>
> chebyquad <- function(x) {
+ n <- length(x)
+ y <- numeric(n)
+
+ for(j in 1:n) {
+ t1 <- 1.0
+ t2 <- 2.0*x[j] - 1.0
+ tmp <- 2.0*t2
+
+ for(i in 1:n) {
+ y[i] <- y[i] + t2
+ t3 <- tmp * t2 - t1
+ t1 <- t2
+ t2 <- t3
+ }
+ }
+
+ y = y / n
+
+ for(i in 1:n) {
+ if ( i%%2 == 0 ) {
+ y[i] = y[i] + 1.0 / (i * i - 1)
+ }
+ }
+
+ y
+ }
>
> chebyinit <- function(n) {
+ x <- (1:n) / (n + 1)
+ }
>
> for (k in 1:9) {
+ n <- k
+ if( k != 8 ) {
+ xstart <- chebyinit(n)
+ fstart <- chebyquad(xstart)
+
+ zz <- nleqslv(xstart, chebyquad, global="dbldog",
+ control=list(ftol=1e-8,xtol=1e-8,trace=1,btol=.01,delta=-2))
+ print(zz)
+ }
+ }
Algorithm parameters
--------------------
Method: Broyden Global strategy: double dogleg (initial trust region = -2)
Maximum stepsize = 1000
Scaling: fixed
ftol = 1e-08 xtol = 1e-08 btol = 0.01
Iteration report
----------------
$x
[1] 0.5
$fvec
[1] 0
$termcd
[1] 1
$message
[1] "Function criterion near zero"
$scalex
[1] 1
$nfcnt
[1] 0
$njcnt
[1] 0
Algorithm parameters
--------------------
Method: Broyden Global strategy: double dogleg (initial trust region = -2)
Maximum stepsize = 1000
Scaling: fixed
ftol = 1e-08 xtol = 1e-08 btol = 0.01
Iteration report
----------------
Iter Jac Lambda Gamma Eta Dlt0 Dltn Fnorm Largest |f|
0 9.876543e-02 4.444444e-01
1 N(6.6e-01) N 1.0000 1.0000 0.2357 0.4714 2.469136e-02 2.222222e-01
2 B(4.3e-01) N 1.0000 1.0000 0.0786 0.1571 1.219326e-03 4.938271e-02
3 B(2.9e-01) N 1.0000 1.0000 0.0143 0.0286 6.745811e-06 3.673094e-03
4 B(3.8e-01) N 1.0000 1.0000 0.0011 0.0023 2.510688e-09 7.086167e-05
5 B(3.8e-01) N 1.0000 1.0000 0.0000 0.0000 4.789289e-15 9.787021e-08
6 B(3.8e-01) N 1.0000 1.0000 0.0000 0.0000 3.381525e-24 2.600586e-12
$x
[1] 0.2113249 0.7886751
$fvec
[1] 5.551115e-17 -2.600586e-12
$termcd
[1] 1
$message
[1] "Function criterion near zero"
$scalex
[1] 1 1
$nfcnt
[1] 6
$njcnt
[1] 1
Algorithm parameters
--------------------
Method: Broyden Global strategy: double dogleg (initial trust region = -2)
Maximum stepsize = 1000
Scaling: fixed
ftol = 1e-08 xtol = 1e-08 btol = 0.01
Iteration report
----------------
Iter Jac Lambda Gamma Eta Dlt0 Dltn Fnorm Largest |f|
0 5.555556e-02 3.333333e-01
1 N(6.2e-01) N 1.0000 1.0000 0.1768 0.3536 3.472222e-03 8.333333e-02
2 B(2.2e-01) N 1.0000 1.0000 0.0354 0.0707 8.888888e-05 1.333333e-02
3 B(1.9e-01) N 1.0000 1.0000 0.0049 0.0098 7.854805e-08 3.963535e-04
4 B(1.9e-01) N 1.0000 1.0000 0.0001 0.0003 2.006852e-12 2.002435e-06
5 B(1.9e-01) N 0.9998 0.9998 0.0000 0.0000 1.941897e-15 6.231937e-08
6 B(2.0e-01) N 0.8982 0.9186 0.0000 0.0000 1.920709e-15 6.197918e-08
7 B(1.8e-01) N 0.9874 0.9900 0.0000 0.0000 1.204460e-23 4.908074e-12
$x
[1] 0.1464466 0.5000000 0.8535534
$fvec
[1] 0.000000e+00 -1.054712e-15 -4.908074e-12
$termcd
[1] 1
$message
[1] "Function criterion near zero"
$scalex
[1] 1 1 1
$nfcnt
[1] 7
$njcnt
[1] 1
Algorithm parameters
--------------------
Method: Broyden Global strategy: double dogleg (initial trust region = -2)
Maximum stepsize = 1000
Scaling: fixed
ftol = 1e-08 xtol = 1e-08 btol = 0.01
Iteration report
----------------
Iter Jac Lambda Gamma Eta Dlt0 Dltn Fnorm Largest |f|
0 3.559196e-02 2.666667e-01
1 N(1.5e-01) N 0.3219 0.4576 0.3113 0.0587 1.531799e-01 5.184503e-01
1 W 0.1841 0.3219 0.4576 0.0587 0.1174 1.591463e-02 1.640140e-01
2 B(2.6e-01) P 0.5030 0.6024 0.1174 0.1174 8.916142e-03 1.333963e-01
3 B(2.9e-01) N 0.9778 0.9822 0.0452 0.0904 2.085137e-03 6.456062e-02
4 B(3.2e-01) N 0.7903 0.8322 0.0429 0.0859 4.491210e-04 2.907485e-02
5 B(2.0e-01) N 0.9490 0.9592 0.0129 0.0258 8.121345e-06 3.835690e-03
6 B(3.8e-01) N 0.8440 0.8752 0.0025 0.0025 5.467441e-06 3.291123e-03
7 B(3.3e-01) N 0.9839 0.9872 0.0011 0.0022 7.929583e-08 3.975658e-04
8 B(3.6e-01) N 0.9801 0.9841 0.0001 0.0003 1.650647e-10 1.809980e-05
9 B(3.7e-01) N 0.9726 0.9781 0.0000 0.0000 1.799429e-13 5.987361e-07
10 B(3.6e-01) N 0.9785 0.9828 0.0000 0.0000 1.400008e-16 1.586812e-08
11 B(3.7e-01) N 0.9577 0.9662 0.0000 0.0000 1.136984e-17 4.768072e-09
$x
[1] 0.1026728 0.4062038 0.5937962 0.8973272
$fvec
[1] 2.775558e-17 4.718503e-12 -4.768072e-09 7.176022e-11
$termcd
[1] 1
$message
[1] "Function criterion near zero"
$scalex
[1] 1 1 1 1
$nfcnt
[1] 12
$njcnt
[1] 1
Algorithm parameters
--------------------
Method: Broyden Global strategy: double dogleg (initial trust region = -2)
Maximum stepsize = 1000
Scaling: fixed
ftol = 1e-08 xtol = 1e-08 btol = 0.01
Iteration report
----------------
Iter Jac Lambda Gamma Eta Dlt0 Dltn Fnorm Largest |f|
0 2.547173e-02 2.222222e-01
1 N(3.4e-02) N 0.4770 0.5816 0.1943 0.0328 1.253747e-01 4.970955e-01
1 C 0.4770 0.5816 0.0328 0.0656 1.615362e-02 1.665803e-01
2 B(3.4e-02) C 0.8141 0.8513 0.0656 0.1312 1.949505e-03 6.000229e-02
3 B(3.1e-02) N 0.9438 0.9551 0.0327 0.0327 9.506728e-04 4.335219e-02
4 B(2.9e-02) N 0.9302 0.9442 0.0171 0.0343 1.859215e-04 1.927822e-02
5 B(2.8e-02) N 0.9660 0.9728 0.0055 0.0109 1.164102e-07 4.636408e-04
6 B(2.8e-02) N 0.9999 0.9999 0.0001 0.0003 1.455617e-10 1.652031e-05
7 B(2.8e-02) N 0.9998 0.9999 0.0000 0.0000 5.024639e-14 3.098588e-07
8 B(2.8e-02) N 0.7233 0.7787 0.0000 0.0000 1.310706e-13 5.050849e-07
9 N(1.2e-01) N 0.8734 0.8987 0.0000 0.0000 1.683207e-27 4.952982e-14
$x
[1] 0.08375126 0.31272930 0.50000000 0.68727070 0.91624874
$fvec
[1] 2.220446e-16 2.886580e-14 -8.348877e-15 -4.952982e-14 -3.197442e-15
$termcd
[1] 1
$message
[1] "Function criterion near zero"
$scalex
[1] 1 1 1 1 1
$nfcnt
[1] 10
$njcnt
[1] 2
Algorithm parameters
--------------------
Method: Broyden Global strategy: double dogleg (initial trust region = -2)
Maximum stepsize = 1000
Scaling: fixed
ftol = 1e-08 xtol = 1e-08 btol = 0.01
Iteration report
----------------
Iter Jac Lambda Gamma Eta Dlt0 Dltn Fnorm Largest |f|
0 2.321409e-02 1.904762e-01
1 N(2.0e-02) N 0.3829 0.5063 0.6403 0.0640 4.026097e-01 6.801793e-01
1 W 0.1768 0.3829 0.5063 0.0640 0.1281 1.070473e-02 1.429390e-01
2 B(3.4e-02) P 0.2469 0.3976 0.1281 0.2561 3.483563e-03 5.223273e-02
2 P 0.2469 0.3976 0.2561 0.1281 3.483563e-03 5.223273e-02
3 B(4.8e-02) N 0.5577 0.6462 0.0986 0.0986 1.413497e-03 3.553200e-02
4 B(3.1e-02) N 0.5820 0.6656 0.0388 0.0775 8.832579e-06 3.026860e-03
5 B(3.0e-02) N 0.7101 0.7681 0.0022 0.0022 6.027928e-06 2.968564e-03
6 B(3.8e-02) N 0.6465 0.7172 0.0013 0.0013 1.264252e-05 4.085266e-03
7 N(1.1e-01) N 0.6560 0.7248 0.0032 0.0063 1.625019e-09 5.426159e-05
8 B(6.9e-02) N 0.4113 0.5290 0.0001 0.0001 8.446441e-13 1.243621e-06
9 B(7.0e-02) N 0.4460 0.5568 0.0000 0.0000 1.696865e-18 1.820433e-09
$x
[1] 0.06687659 0.36668230 0.28874067 0.71125933 0.63331770 0.93312341
$fvec
[1] 7.401487e-17 -8.218598e-11 2.136809e-13 2.701828e-10 -7.247721e-13
[6] 1.820433e-09
$termcd
[1] 1
$message
[1] "Function criterion near zero"
$scalex
[1] 1 1 1 1 1 1
$nfcnt
[1] 11
$njcnt
[1] 2
Algorithm parameters
--------------------
Method: Broyden Global strategy: double dogleg (initial trust region = -2)
Maximum stepsize = 1000
Scaling: fixed
ftol = 1e-08 xtol = 1e-08 btol = 0.01
Iteration report
----------------
Iter Jac Lambda Gamma Eta Dlt0 Dltn Fnorm Largest |f|
0 1.688532e-02 1.666667e-01
1 N(6.2e-03) N 0.3115 0.4492 0.3176 0.0318 1.637167e-01 4.007329e-01
1 W 0.1365 0.3115 0.4492 0.0318 0.0635 9.589743e-03 1.327628e-01
2 B(5.7e-03) W 0.4640 0.3592 0.4874 0.0635 0.1270 2.078664e-03 6.116033e-02
3 B(5.7e-03) N 0.3138 0.4511 0.0485 0.0124 6.030862e-03 9.884848e-02
3 W 0.3005 0.3138 0.4511 0.0124 0.0248 9.875376e-04 4.243127e-02
4 B(6.4e-03) P 0.5605 0.6484 0.0248 0.0248 3.103245e-04 2.145349e-02
5 B(6.5e-03) N 0.5958 0.6767 0.0152 0.0304 1.920260e-05 5.852412e-03
6 B(6.5e-03) N 0.8258 0.8606 0.0025 0.0025 1.271411e-05 4.648403e-03
7 B(6.2e-03) N 0.9645 0.9716 0.0015 0.0030 1.370759e-06 1.448646e-03
8 B(6.3e-03) N 0.8892 0.9114 0.0007 0.0015 3.070567e-09 6.122675e-05
9 B(6.3e-03) N 0.7329 0.7863 0.0000 0.0000 1.121116e-09 4.659021e-05
10 B(1.4e-02) N 0.9312 0.9450 0.0000 0.0001 1.972581e-10 1.951967e-05
11 B(1.9e-02) N 0.9277 0.9422 0.0000 0.0000 1.127291e-13 4.687153e-07
12 B(1.9e-02) N 0.9351 0.9480 0.0000 0.0000 3.234732e-17 7.194626e-09
$x
[1] 0.05806915 0.23517161 0.33804409 0.50000000 0.66195590 0.76482839 0.94193085
$fvec
[1] 3.172066e-17 2.513934e-12 -1.518235e-09 -3.537588e-10 3.150633e-09
[6] -7.584909e-10 -7.194626e-09
$termcd
[1] 1
$message
[1] "Function criterion near zero"
$scalex
[1] 1 1 1 1 1 1 1
$nfcnt
[1] 14
$njcnt
[1] 1
Algorithm parameters
--------------------
Method: Broyden Global strategy: double dogleg (initial trust region = -2)
Maximum stepsize = 1000
Scaling: fixed
ftol = 1e-08 xtol = 1e-08 btol = 0.01
Iteration report
----------------
Iter Jac Lambda Gamma Eta Dlt0 Dltn Fnorm Largest |f|
0 1.444149e-02 1.333333e-01
1 N(1.7e-03) N 0.4540 0.5632 0.7124 0.0712 2.432181e+01 6.262290e+00
1 W 0.1690 0.4540 0.5632 0.0712 0.1425 5.676012e-03 1.033924e-01
2 B(1.4e-03) P 0.1128 0.2902 0.1425 0.0152 2.468746e-02 1.671788e-01
2 W 0.1103 0.1128 0.2902 0.0152 0.0304 4.238132e-03 8.727709e-02
3 B(1.4e-03) W 0.6716 0.2107 0.3685 0.0304 0.0304 2.878634e-03 5.896533e-02
4 B(1.4e-03) W 0.7540 0.2833 0.4267 0.0304 0.0607 1.506291e-03 3.756848e-02
5 B(1.4e-03) N 0.4117 0.5293 0.0447 0.0220 1.549006e-03 4.567568e-02
5 W 0.9222 0.4117 0.5293 0.0220 0.0220 9.854438e-04 2.999437e-02
6 B(1.4e-03) P 0.6509 0.7208 0.0220 0.0441 1.274643e-04 1.244720e-02
7 B(1.4e-03) N 0.7602 0.8082 0.0055 0.0110 1.761815e-06 1.661531e-03
8 B(1.4e-03) N 0.6780 0.7424 0.0010 0.0010 2.890591e-06 2.237297e-03
9 N(9.7e-03) N 0.4290 0.5432 0.0022 0.0043 9.801871e-10 4.214575e-05
10 B(6.8e-03) N 0.2044 0.3635 0.0001 0.0001 1.123954e-12 1.425304e-06
11 B(6.8e-03) N 0.2119 0.3695 0.0000 0.0000 3.293231e-18 1.838171e-09
$x
[1] 0.04420535 0.23561911 0.19949067 0.41604691 0.50000000 0.58395309 0.80050933
[8] 0.76438089 0.95579465
$fvec
[1] 0.000000e+00 -1.062749e-10 -3.258543e-10 -1.721074e-10 2.572347e-10
[6] 7.349079e-10 1.268005e-09 9.199986e-10 -1.838171e-09
$termcd
[1] 1
$message
[1] "Function criterion near zero"
$scalex
[1] 1 1 1 1 1 1 1 1 1
$nfcnt
[1] 14
$njcnt
[1] 2
>