[R] Integrate two function in R
Ben Bolker
bbolker at gmail.com
Thu Dec 16 14:11:35 CET 2010
Alaios <alaios <at> 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, 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
evaluate between a and b
or if you can't do this (although this is a very basic integral)
you can try it on Wolfram alpha/the Mathematica integrator (google
for it)
use ?integrate (surprisingly enough) for 1-D numerical integration
More information about the R-help
mailing list