JuliaMath / JuliaMath/Cubature.jl

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

Open
#41 0 comments 4 reactions 0 assignees View on GitHub
Dominant language
Julia
Stars
133
Forks
20
PR merge metrics
No merged PRs in 30d

Description

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.
```julia
# ORIGINAL example
hcubature(x -> begin println(x[1],",",x[2]); x[1]^3*x[2]; end, [0,0],[1,1])
```

```julia
# 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])
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.