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.
Area between 2 curves
3 messages · sappy, R. Michael Weylandt, Keith Jewell
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.
A quick Google suggests that sintegral is in the Bolstad2 package: http://cran.r-project.org/web/packages/Bolstad2/ "R. Michael Weylandt" <michael.weylandt at gmail.com> wrote in message news:CAAmySGOCtNxWNHJDka=68CRiphxNPpWAp6fm7uFkHTx7XSZVTw at mail.gmail.com...
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.