Displaying 2 results from an estimated 2 matches for "quadgk".
Did you mean:
quadgt
2011 Nov 10
2
performance of adaptIntegrate vs. integrate
Dear list,
[cross-posting from Stack Overflow where this question has remained
unanswered for two weeks]
I'd like to perform a numerical integration in one dimension,
I = int_a^b f(x) dx
where the integrand f: x in IR -> f(x) in IR^p is vector-valued.
integrate() only allows scalar integrands, thus I would need to call
it many (p=200 typically) times, which sounds suboptimal. The
2012 Oct 17
1
for loop output
...ry much in
advance.
d<-matrix(c(1,1,0,0,0,0,0,0,2,1,0,0,1,1,0,1,2,2,1,0),nrow=10,ncol=2)
h<-matrix(runif(20,0,1),10)
int<-matrix(c(0),nrow=10, ncol=2)
for (k in 1:2){
for(s in 1:10){
integrand<-function(x) x^d[s,k]*exp(-x*gamma(1+1/1.6))^1.6*exp(-x*h[s,k])
integ[s,k]<-quadgk(integrand,0,1000)
}
print(int)
}
[,1] [,2]
[1,] 0.1700065 0
[2,] 0.3080273 0
[3,] 0.4844886 0
[4,] 0.5062987 0
[5,] 0.5846982 0
[6,] 0.4332621 0
[7,] 0.4391985 0
[8,] 0.4242643 0
[9,] 0.3274367 0
[10,] 0.1937940 0
[,1]...