Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Request: better user interface for integration over a non-unit cube #7

Open
xiaoweiz opened this issue Mar 6, 2017 · 2 comments
Open

Comments

@xiaoweiz
Copy link

xiaoweiz commented Mar 6, 2017

I think the interface would be much more intuitive if the users can directly specify the integration range, e.g. cuhre(f::Function, xmin, xmax), similar as the interface in Cubature.jl

@giordano
Copy link
Owner

giordano commented Mar 6, 2017

While I agree that it would be nice to have this feature, you should consider that Cubature library works with arbitrary bounds, but Cuba doesn't (see http://www.feynarts.de/cuba/). This is why the Julia wrappers Cubature.jl and Cuba.jl behave differently in this regard: Cubature.jl simply passes the xmin and xmax arguments to the library functions, instead Cuba.jl should first rearrange the integrand function (and I don't think it's feasible).

I won't try to address this problem, but I'll leave this issue open just in case someone will come up with a simple and elegant solution.

@giordano
Copy link
Owner

One possibility for users is to use this package (not yet registered, though): https://github.com/tpapp/ContinuousTransformations.jl Following the example in the README.md, with this code you can compute the integral of a Gaussian-like function over the infinite domain (0, Inf), without having to write down the explicit transformation:

julia> using Cuba, ContinuousTransformations

julia> f, dom = integral_substitution(INVODDSRATIO, x->exp(-x^2), 0..Inf)
(ContinuousTransformations.#27, (0.0..1.0))

julia> cuhre((x,y) -> y[1] = f(x[1]))[1][1]  sqrt(pi)/2
true

giordano referenced this issue in tpapp/ContinuousTransformations.jl Mar 31, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants