Thanks Sundar what you suggested worked fine > You will see that "x" is a vector and "tt[i]^x" returns a vector of the > same length. You are trying to place this vector into "a[i]" which is > length 1. Try the following *untested* code instead: > > <untested> > integrandtotest <- function(x) { > sum(sapply(x, function(xi) sum(tt^xi))) > }
except you are summing twice so it should be......... integrandtotest <- function(x) {(sapply(x, function(xi) sum(tt^xi))) Alan Brennan Director of Health Economics and Decision Science http://www.shef.ac.uk/scharr/sections/heds ScHARR School of Health and Related Research University of Sheffield Regent Ct 30 Regent St Sheffield S1 4DA Tel:+44 (0)114 2220684 Fax:+44 (0)114 2724095 e-mail:[EMAIL PROTECTED] ______________________________________________ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html