similar to: Error from using adaptIntegrate within a function that is then integrated

Displaying 20 results from an estimated 1000 matches similar to: "Error from using adaptIntegrate within a function that is then integrated"

2011 Jan 27
0
adaptIntegral takes too much time
Hello Dear List members, as you can see (and guess) from the code below adaptIntegrate(f,lowerLimit=c(-1,-1),upperLimit=c(.9999,.9999)) $integral [1] 9.997e-09 $error [1] 1.665168e-16 $functionEvaluations [1] 17 $returnCode [1] 0 > adaptIntegrate(f,lowerLimit=c(-1,-1),upperLimit=c(1,1)) the last command runs for 45 mins now. -this one takes only less than sec:
2012 Mar 25
1
cubature
Hi, I am using adaptIntegrate from Cubature to do numerical integration on a double integral with a 1 x 2 vector x. Say the function is something simple to start like f(x)=x1*x2 and I wish to integrate x1 over (0,365-x2) and x2 over (0,365) f <- function(x) {(x[2])*(x[1])} # "x" is vector int1<-adaptIntegrate(f, lowerLimit = c(0, 0), upperLimit = c(365-x[2], 365)) I recieve
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
2013 Jan 08
2
Integration in R
Hi R-users. I'm having difficulty with an integration in R via the package "cubature". I'm putting it with a simple example here. I wish to integrate a function like: f(x1,x2)=2/3*(x1+x2) in the interval 0<x1<x2<7. To be sure I tried it by hand and got 114.33, but the following R code is giving me 102.6667.
2011 Dec 02
1
R2Cuba package, failed with message ‘Dimension out of range’
Hi All, I get the message failed with message ‘Dimension out of range’ when using cuhre in package R2Cuba. Does anyone know what this mean? Or would I need to email the package author? The funny thing is it does give a result and comparing it to "adaptIntegrate" in package cubature, the two numbers are very close. Thanks, Sachin [[alternative HTML version deleted]]
2012 Oct 02
3
Integration in R
Dear R-users, I am facing problem with integrating in R a likelihood function which is a function of four parameters. It's giving me the result at the end but taking more than half an hour to run. I'm wondering is there any other efficient way deal with. The following is my code. I am ready to provide any other description of my function if you need to move forward.
2010 Sep 21
3
bivariate vector numerical integration with infinite range
Dear list, I'm seeking some advice regarding a particular numerical integration I wish to perform. The integrand f takes two real arguments x and y and returns a vector of constant length N. The range of integration is [0, infty) for x and [a,b] (finite) for y. Since the integrand has values in R^N I did not find a built-in function to perform numerical quadrature, so I wrote my own after
2011 Oct 05
2
cuhre usage ?? multidimensional integration
my=function(x){ len=1 for(i in 1:len){ y[i]=x[i] } g=1 w=NULL t=NULL for(i in 1:len)w[i]=x[i+len] for(i in 1:len)t[i]=x[i+2*len] for(i in 1:len)g=g*dnorm(y[i])*dnorm(w[i])*dnorm(z[i]) return(g) } cuhre(6,1,my,rep(-100,6),rep(100,6)) Error in crff(match.call(), integrand, "cuhre", libargs, ...) : Additional argument not expected in the integrand function function change to
2011 May 03
2
adaptIntegrate - how to pass additional parameters to the integrand
Hello, I am trying to use adaptIntegrate function but I need to pass on a few additional parameters to the integrand. However, this function seems not to have the flexibility of passing on such additional parameters. Am I missing something or this is a known limitation. Is there a good alternative to such restrictions, if there at all are? Many thanks for your time. HC -- View this message in
2011 Nov 28
0
function manipulation for integration
Hi All, I'm trying to use one of the (2D) numerical integration functions, which is not where the problem is. The function definition is as follows: adaptIntegrate(f, lowerLimit, upperLimit, ...) The problem is that I want to integrate a 3D function which has been parametrised such that it is a 2D function: eg. I want to integrate f(x_start+gradient_x*t1, y_start+gradient_y*t2) for t1 in
2011 Mar 29
5
Integration with variable bounds
If this is posted elsewhere I cannot find it. I need to perform multiple integration where some of the variables are in the bounds of the other variables. I was trying to use R2Cuba function but cannot set the upper and lower bounds. My code so far is : int <- function(y){ u2 = y[1] z2 = y[2] u1 =y[3] z1 = y[4] ff <- u1*(z1-u1)*u2*(z2-u2)*exp(-0.027*(12-z2)) return(ff) }
2012 May 21
0
Erratic error with adaptIntegrate in cubature package
Hi everyone, I have been using adaptIntegrate from the cubature package for a multidimensional integral that has infinite variance (and so not appropriate for Monte Carlo techniques). Most of the time it works but sometimes (though not always) when I slightly increase the accuracy I want, or increase the bounds of integration I get the following error: REAL() can only be applied to a
2012 Mar 13
1
Two dimensional integration
Dear R Members, I want to know a fast R function to do multidimensional integration. I used the function 'cuhre' in R2cuba library. But it takes painful time to get the answer. I would be thankful if anyone could help me out to solve this problem Thanks Niroshan -- View this message in context: http://r.789695.n4.nabble.com/Two-dimensional-integration-tp4468282p4468282.html Sent
2011 Dec 06
2
configuring a package for own personal needs
Hi All, There is a function in package "R2Cuba" called Cuhre that I need to use. It keeps spitting out a new-line which I really dont want it to do. So I was wondering what is the best way of configuring the package. I tried copying and pasting the code into Cuhre2 and getting rid of the newline command BUT that didn't work since it seems to have some private functions which I do
2013 Mar 21
1
"adaptIntegrate" function
Hi all, it seems that there is problem with function "adaptIntegrate", when the integration limits is infinity. Please see the code below. The second integration does not seem to work. Can anyone familiar with this give some help? Thank you with much. Hanna library(mnormt) library(cubature) ff <- function(x, rho){ mu <- rep(0,3) Sigma
2013 Mar 05
2
Error message
Dear all, I got an error message when running the following code. Can anyone give any suggestions on fixing this type of error? Thank you very much in advance. Hanna > integrand <- function(x, rho, a, b, z){ + x1 <- x[1] + x2 <- x[2] + Sigma <- matrix(c(1, rho, rho, 1), 2,2) + mu <- rep(0,2) + f <-
2008 Feb 15
0
Behaviour of integrate (was 'Poisson-lognormal probability calcul ations')
Hi again, Adding further information to my own query, this function gets to the core of the problem, which I think lies in the behaviour of 'integrate'. ------------------------------------- function (x, meanlog = 0, sdlog = 1, ...) { require(stats) integrand <- function(t, x, meanlog, sdlog) dpois(x,t)*dlnorm(t, meanlog, sdlog) mapply(function(x, meanlog, sdlog, ...) #
2008 Feb 18
0
Solved (??) Behaviour of integrate (was 'Poisson-lognormal probab ility calculations')
Hi Again, I think I've solved my problem, but please tell me if you think I'm wrong, or you can see a better way! A plot of the integrand showed a very sharp peak, so I was running into the integrand "feature" mentioned in the note. I resolved it by limiting the range of integration as shown here: -------------------------------------------------- function (x, meanlog = 0,
2008 Feb 15
0
Poisson-lognormal probability calculations
Hi, just for the record, although I don't think it's relevant (!) ------------------------------------- > sessionInfo() R version 2.6.0 (2007-10-03) i386-pc-mingw32 locale: LC_COLLATE=English_United Kingdom.1252;LC_CTYPE=English_United Kingdom.1252;LC_MONETARY=English_United Kingdom.1252;LC_NUMERIC=C;LC_TIME=English_United Kingdom.1252 attached base packages: [1] stats4 splines
2020 May 20
0
About Libvirt Setmem&dommemstat Function
I have sent a similar email about this problem. But I did not describe carefully, so I would like to explain it in more details. I am using 'virsh setmem' to ajust vm memory online. However, I don't know what is the lowerlimit that can be set to. And I try to use 'virsh dommemstat' to get 'unused' memory so that I can calculate the lowerlimit memory with this value, but