Re: [R] Integrate two function in R

2010-12-16 Thread Jonathan P Daily
still a room when its empty? Does the room, the thing itself have purpose? Or do we, what's the word... imbue it." - Jubal Early, Firefly r-help-boun...@r-project.org wrote on 12/16/2010 09:11:33 AM: > [image removed] > > Re: [R] Integrate two function in R >

Re: [R] Integrate two function in R

2010-12-16 Thread Kjetil Halvorsen
see inline. On Thu, Dec 16, 2010 at 10:11 AM, Ben Bolker wrote: > Alaios yahoo.com> writes: > >> >> Hello I have two function in R >> like >> g(x)=2x-3 >> and s(x)=5x^2+2 >> >> and I want to find the integrafl of the g(x)*s(x) inside the interval of >> [a,b] >> > >  Analytically or numerically?

Re: [R] Integrate two function in R

2010-12-16 Thread Eduardo de Oliveira Horta
I guess what you have is g <- function(x){ 2*x-3 } s <- function(x){ 5*x^2+2 } and what you want is f<-function(x){ g(x)*s(x) } integrate(f,a,b) Try that and see if it works. If not (that is, if your actual g and s are not as in the example), maybe you'll have to do this: integrate(Vectorize(

Re: [R] Integrate two function in R

2010-12-16 Thread David Winsemius
On Dec 16, 2010, at 7:27 AM, Alaios wrote: Hello I have two function in R like g(x)=2x-3 and s(x)=5x^2+2 and I want to find the integrafl of the g(x)*s(x) inside the interval of [a,b] Could you please help me find the proper function? It depends on what you are doing: None of what appea

Re: [R] Integrate two function in R

2010-12-16 Thread Ben Bolker
Ben Bolker gmail.com> writes: > Analytically or numerically? > It sounds like you want the answer analytically, in which case R > can't do it, but it is an easy integral > > g(x)*s(x) = 10*x^3-15*x^2+4*x-6 > indefinite integral = 10/3*x^4 -15/3*x^3 + 4/2*x^2 - 6*x + C oops, the first

Re: [R] Integrate two function in R

2010-12-16 Thread Ben Bolker
Alaios yahoo.com> writes: > > Hello I have two function in R > like > g(x)=2x-3 > and s(x)=5x^2+2 > > and I want to find the integrafl of the g(x)*s(x) inside the interval of [a,b] > Analytically or numerically? It sounds like you want the answer analytically, in which case R can't do it

[R] Integrate two function in R

2010-12-16 Thread Alaios
Hello I have two function in R like g(x)=2x-3 and s(x)=5x^2+2 and I want to find the integrafl of the g(x)*s(x) inside the interval of [a,b] Could you please help me find the proper function? I would like to thank you in advance for your help Regards Alex [[alternative HTML ve