Hello,

I'm trying to perform an integration on a function that contains a sum. 
Similarly I'm hoping whatever acts as a fix will be good enough to aid in
a 2nd case as well but I've already put in a work-around for that
situation.

My code example is here:

watermelon=c(0,1,2,3)

w<-function(x){
sum(sin(x-watermelon))}

integrate(function(x){w(x)},0,2)

integrate(function(x){sin(x)+sin(x-1)+sin(x-2)+sin(x-3)},0,2)

the first integral gives an error... the 2nd is what I should get for an
answer for the first.  Is there a way to get this to work the way that I
desire?

Any help is appreciated.

Sincerely,
Patrick Joyce

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to