# [R] Integrate two function in R

Jonathan P Daily jdaily at usgs.gov
Thu Dec 16 15:18:23 CET 2010

```As a minor plug for my favorite non stat-based mathematics software,
sagemath also has a rudimentary R interface built-in
--------------------------------------
Jonathan P. Daily
Technician - USGS Leetown Science Center
Kearneysville WV, 25430
(304) 724-4480
"Is the room 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-bounces at r-project.org wrote on 12/16/2010 09:11:33 AM:

> [image removed]
>
> Re: [R] Integrate two function in R
>
> Kjetil Halvorsen
>
> to:
>
> Ben Bolker
>
> 12/16/2010 09:13 AM
>
> Sent by:
>
> r-help-bounces at r-project.org
>
> Cc:
>
> r-help
>
> 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
http://www.R-project.org/posting-guide.html
> > and provide commented, minimal, self-contained, reproducible code.
> >
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help