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

Integration on general domains #20

Closed
arbenede opened this issue Nov 2, 2018 · 6 comments
Closed

Integration on general domains #20

arbenede opened this issue Nov 2, 2018 · 6 comments

Comments

@arbenede
Copy link

arbenede commented Nov 2, 2018

I am wondering if it possible to integrate an n-dimensional function on a set that is not an n-dimensional box in a way similar to the Monte Carlo integration routines in Numerical Recipes. If the function returns 0 when x is not in the set maybe this will just work in the current implementation of Cuba.jl?

@giordano
Copy link
Owner

giordano commented Nov 2, 2018

I'm not sure I understand what you mean, could you please provide an example of what you would like to do? If you're asking for a way to integrate a domain different from the n-dimensional hypercube, then read the first "tip" box in the documentation: https://giordano.github.io/Cuba.jl/stable/

@arbenede
Copy link
Author

arbenede commented Nov 2, 2018

Say that I want to integrate on a domain A that is not a hyper-rectangle (in my case A is a n-dimensional convex polytope but that does not really matter here). What I would do is to compute the smallest hyper-rectangle B such that A \in B and pass the bounds defined by B to Cuba. The function to be integrated would just return f(x) = 0 if x \in (B \ A). Do you think this would work?

@giordano
Copy link
Owner

giordano commented Nov 2, 2018

If you are going to integrate a function on a domain larger than what you want, and define the integrand such that it returns zero outside the domain on which you actually want to integrate, yes, that would do the trick.

@giordano
Copy link
Owner

@arbenede did it solve your issue?

@arbenede
Copy link
Author

Mose`, I did not have a chance to try this yet however I think that you can close this issue for now.

@giordano
Copy link
Owner

I'm going to close this issue, then. Feel free to ping me here if you come across the same problem again

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants