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

Suggest a example, which is easy to understand, of function 'hcubature'. #41

Open
a2468834 opened this issue May 1, 2019 · 0 comments

Comments

@a2468834
Copy link

a2468834 commented May 1, 2019

The integrand in the example now is written in the form of inline function.

But, I believe it's easier to understand how to use 'hcubature' when the integrand is written in "caller" style. Because it's more often using multi-dimensional integrals of more complex function than f(x, y)=(x^3)*y.

I mean that maybe the example of 'hcubature' could use the following codes.

# ORIGINAL example
hcubature(x -> begin println(x[1],",",x[2]); x[1]^3*x[2]; end, [0,0],[1,1])
# SUGGESTION example
function f( x::Vector{Float64} ) # the integrand i.e., f(x, y)=x^3 y
    println(x[1], ",", x[2])
    return (x[1]^3) * x[2]
end
hcubature(f, [0,0],[1,1])
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

1 participant