Function defined as multidimensional integral

Hi, I’m trying to define a new function as follows:

Screenshot 2021-12-23 at 17.11.46

meaning, I’d like to integrate over x and y, leaving z as a variable. I thought maybe to integrate z over (0,z) and then differentiate the function with respect to z, but it seems to me quite intricate. Any ideas?

Thanks a lot

h(z) = hcubature((x,y)->f(x,y,z),…). It’s called a closure.

1 Like

That’s interesting! I’m still learning Julia, so this is something new for me.
Trying to implement this closure, I got the following method matching error: how can it be? Those #9#10 aren’t so clear to me

Oh it’s giving you an SVector instead of two arguments, so it’s x[1] etc. You can write that all out, or use the simpler syntax h(z) = hcubature((x)->f(x…,z),…) to splat it

4 Likes

I love this syntax!
Thank you a lot

Welcome! For the future: please share code as text instead of images. Makes it easier to read, copy and run. You can use a triple backtick fence to get monospace font and syntax highlighting.