library(minqa) # rm(list=ls()) cyq.f <- function (x) { rv<-cyq.res(x) f<-sum(rv*rv) } cyq.res <- function (x) { # Fletcher's chebyquad function m = n -- residuals n<-length(x) res<-rep(0,n) # initialize for (i in 1:n) { #loop over resids rr<-0.0 for (k in 1:n) { z7<-1.0 z2<-2.0*x[k]-1.0 z8<-z2 j<-1 while (j