Re: [R] R's integrate function

2008-09-30 Thread Susanne Pfeifer
Hi, sorry, I was a bit confused and my function looked slightly different from the one I posted before: Susanne Pfeifer schrieb: >>> integrate(function(y,z){ >> + sapply(y, function(y,z){ >> + integrate(function(x,z) >> + >> 1/x*dbeta(0.01,x/(0.005/1.

Re: [R] R's integrate function

2008-09-30 Thread Susanne Pfeifer
Hi Charles, hi Victor Charles C. Berry schrieb: > What verson of R? > > Works for me: > >> integrate(function(y,z){ > + sapply(y, function(y,z){ > + integrate(function(x,z) > + > 1/x*dbeta(0.01,x/(0.005/1.005),(1-x)/(0.005/1.005))*dbeta(y,x/(0.005/1.005),(1-x)/(0.005/1.005))*(1-y)^z,

[R] R's integrate function

2008-09-30 Thread Susanne Pfeifer
Hello, I am trying to use R's integrate function to calculate the following integral for z=423: integrate(function(y,z){ sapply(y, function(y,z){ integrate(function(x,z) 1/x*dbeta(0.01,x/(0.005/1.005),(1-x)/(0.005/1.005))*dbeta(y,x/(0.005/1.005),(1-x)/(0.005/1.005))*(1-y)^z,0,1,423)$value }) },0,

[R] R's integrate function

2008-09-30 Thread Susanne Pfeifer
Hello, I am trying to use R's integrate function to calculate the following integral for z=423: integrate(function(y,z){ sapply(y, function(y,z){ integrate(function(x,z) 1/x*dbeta(0.01,x/(0.005/1.005),(1-x)/(0.005/1.005))*dbeta(y,x/(0.005/1.005),(1-x)/(0.005/1.005))*(1-y)^z,0,1,423)$value }) },0,

[R] Double integration - Gauss Quadrature

2008-09-27 Thread Susanne Pfeifer
Hi, I would like to solve a double integral of the form \int_0^1 \int_0^1 x*y dx dy using Gauss Quadrature. I know that I can use R's integrate function to calculate it: integrate(function(y) { sapply(y, function(y) { integrate(function(x) x*y, 0, 1)$value }) }, 0, 1) but I would like to use

[R] Double integration - Gauss Quadrature

2008-09-27 Thread Susanne Pfeifer
Hi, I would like to solve a double integral of the form \int_0^1 \int_0^1 x*y dx dy using Gauss Quadrature. I know that I can use R's integrate function to calculate it: integrate(function(y) { sapply(y, function(y) { integrate(function(x) x*y, 0, 1)$value }) }, 0, 1) but I would like to use