search for: cubature

Displaying 20 results from an estimated 29 matches for "cubature".

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...
2011 Nov 10
2
performance of adaptIntegrate vs. integrate
...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 cubature package seems well suited, as illustrated below, library(cubature) Nmax <- 1e3 tolerance <- 1e-4 integrand <- function(x, a=0.01) c(exp(-x^2/a^2), cos(x)) adaptIntegrate(integrand, -1, 1, tolerance, 2, max=Nmax)$integral [1] 0.01772454 1.68294197 However, adaptIntegrate appears to perfor...
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(...
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 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
2013 Mar 21
1
"adaptIntegrate" function
...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 <-(1-rho)*diag(3)+matrix(rho,3,3) f <- dmnorm(x, mu, Sigma) f } adaptIntegrate(ff, lower=c(-10, -10, -10), upper=c(3,2,1), rho=0.1, maxEval=10000)...
2013 Feb 16
3
two dimensional integration
Dear R-users, I'm wondering how to calculate this double integral in R: int_a^b int_c^y g(x, y) dx dy where g(x,y) = exp(- alpha (y - x)) * b Thanks for answering! Cheers, Alui [[alternative HTML version deleted]]
2012 Mar 23
3
R numerical integration
...45074 and sigma=17535.26 It stopped working. On the other hand, Maple gives me a value of 0.5005299403. It is an important line of the coding that I am doing and I am looking for some package that is able to do numerical integration efficiently (fast and accurate to a tol=1e-4). I have tried 'cubature', which does not give me anything even after 10 minutes. Thanks. casper ----- ################################################### PhD candidate in Statistics School of Mathematics, Statistics and Actuarial Science, University of Kent ################################################### --...
2012 Oct 02
3
Integration in R
...s 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. ------------------------------------------------------------------------------------------------------------------------------------ library(cubature) dose<-c(2,3,5) y0<-c(2,1,0) y1<-c(1,1,1) y2<-c(0,1,2) lf<-function (x) { v<-1 for (i in 1:length(dose)) { psi0<-1/((1+exp(x[1]+x[2]*dose[i]))*(1+exp(x[3]+x[4]*dose[i]))) psi1<-exp(x[1]+x[2]*dose[i])/((1+exp(x[1]+x[2]*dose[i]))*(1+exp(x[3]+x[4]*dose[i])))...
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]]
2024 Jun 13
1
Integration of functions with a vector argument
...op (produced by Vectorize() and mapply() or manually with vapply()) may be not very fast. If you rewrite your function f to accept matrices containing values of (x, y) for many evaluations of the function and to return vectors of the resulting values, you'll be able to use the CRAN package 'cubature' <https://CRAN.R-project.org/package=cubature> to integrate it over multiple variables at once. -- Best regards, Ivan
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
2010 Jan 14
1
adapt package missing because of licensing issue: fix?
...handy link to the archives). https://stat.ethz.ch/pipermail/r-sig-fedora/2009-June/000078.html http://packages.debian.org/changelogs/pool/main/a/adapt/adapt_1.0-4-3/r-cran-adapt.copyright give a little more information. library(findFn); sos("multidimensional+integration") found the cubature package for me, which looks like a pretty good replacement but which I haven't tried out yet. My real question: has anyone actually tried to contact the authors and find out if they are willing to put the code under a suitably redistributable license? I can't find anything that suggests...
2010 Oct 24
1
140 packages in R Commander!!
...#39;Rglpk' 'snowFT' 'rlecuyer' 'rsprng' 'nws' 'tweedie' 'gtools' 'gdata' 'caTools' 'Ecdat' 'ergm' 'latentnet' 'degreenet' 'shapes' 'snow' 'RColorBrewer' 'statmod' 'cubature' 'kinship' 'gam' 'tripack' 'akima' 'logspline' 'gplots' 'maxLik' 'miscTools' 'sem' 'rgdal' 'network' 'numDeriv' 'statnet' 'rgenoud' 'hexbin' 'ellipse' 'gclus'...
2024 Jun 12
2
Integration of functions with a vector argument
? Tue, 11 Jun 2024 18:44:08 +0000 "Levine, Michael" <mlevins at purdue.edu> ?????: > Let us say we have a function > > F <- function(x){ body of the function} > > Where x is, in general, a d by 1 vector with d>1. Now I want to > integrate out some of the coordinates of x, e.g. x[1] or x[2] or both > of them etc. I'm well aware of how to integrate
2019 Apr 12
2
integrate over an infinite region produces wrong results depending on scaling
Dear all, This is the first time I am posting to the r-devel list. On StackOverflow, they suggested that the strange behaviour of integrate() was more bug-like. I am providing a short version of the question (full one with plots: https://stackoverflow.com/q/55639401). Suppose one wants integrate a function that is just a product of two density functions (like gamma). The support of the
2002 Jan 30
0
adapt may "cheat"
...ced by the gaussq.f function from netlib to calculate the univariate integral then squared it, and the result differ from the adapt number in the 4th or 5th digit. Forcing adapt to use more points doesn't seem to have any effect. We were led to this experiment when we were testing the smolyak cubature in SMOLPACK by Knut Petras, which gave the same number as the squared Legendre. Chong Gu -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un...
2010 Jun 18
2
double integral
Sir, I want to calculate double integral in R. Is there any function to do this? Regards, Suman Dhara [[alternative HTML version deleted]]
2011 Jun 18
1
double integral calculation
a=[0.1,0.2,0.1,0.3,0.4] b=[0.2,0.3,0.1,0.2,0.5] c=[1,1,1,1,1] log(c+a-x*b) where x=unknown scale variable. int=$$log(c+a-x*b)dadb, where $ denotes integral sign. Actually, how could I calculate the integral's approximation? double summation? best, moohwan
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