[R] Integrate two function in R
Kjetil Halvorsen
kjetilbrinchmannhalvorsen at gmail.com
Thu Dec 16 15:11:33 CET 2010
see inline.
On Thu, Dec 16, 2010 at 10:11 AM, Ben Bolker <bbolker at gmail.com> wrote:
> 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)
Or a free software alternative: sage
http://www.sagemath.org/
kjetil
>
> use ?integrate (surprisingly enough) for 1-D numerical integration
>
> ______________________________________________
> R-help at 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.
>
More information about the R-help
mailing list