[R] How to do this simple integration?

From: Jianing Di <jianing_at_math.bu.edu>
Date: Thu 08 Jun 2006 - 13:41:17 EST


I have a simple function in the form as follows:

> f<-function(x){sum(v^x)}

where v is a vector. I was trying to integrate f using the command

> I<-integrate(f,0,1)

However, this will not work and seems that the reason is to use "integrate", the f must be a function that with input and output of same length. Anyone can point out which command should I use in order to compute this type of integration(such as a function involve sum(), prod(), etc.)?

Thank you.


There are three kinds of lies: lies, damned lies, and Statistics.

                                        -------Benjamin Disraeli

R-help@stat.math.ethz.ch mailing list
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Received on Thu Jun 08 13:49:12 2006

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.1.8, at Fri 09 Jun 2006 - 14:10:51 EST.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.