[R] Area between 2 curves

R. Michael Weylandt michael.weylandt at gmail.com
Mon Apr 30 17:47:49 CEST 2012


You can't just decide a command exists and try to use it by your
arbitrarily chosen name .... did you look at the function integrate()
which does exist? It uses a smarter algorithm than Simpson's rule.

Alternatively, Simpson's rule is very easy to code with vectorization
-- you should be able to implement it yourself in just a few lines
after reading "An Introduction to R".

Michael

On Mon, Apr 30, 2012 at 6:17 AM, sappy <robert.wittkopf at gmx.de> wrote:
> Hello,
>
> i have a question calculating the shaped area between the two curves (see
> image).
>
> http://r.789695.n4.nabble.com/file/n4597813/test.png
>
> I try to use a Simpson-Integral but it doesn't work. "R" doesn't know the
> command!
> It is possible, that i need a library?
>
> Curve 1: y
> Curve 2: z
>
> q<-abs(y-z); est<-sintegral(x,z)
>
> Greetings
>
> --
> View this message in context: http://r.789695.n4.nabble.com/Area-between-2-curves-tp4597813.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> 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