[R] How to do this simple integration?

Jianing Di jianing at math.bu.edu
Thu Jun 8 05:41:17 CEST 2006


Hello,

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.

Jianing


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

                                        -------Benjamin Disraeli



More information about the R-help mailing list