# Double integration inside a function

Hi

I want to perform a double integration.

``````using HCubature
f(x,y) = x^2 + y^2;
I, e = hcubature(f, (0, 0), (1, 2))
``````

But, why is there an error when I write it like this? could you help me solving this? thanks

``````function fx(a,b)
f(x,y) = a*x^2 + b*y^2;
a0, b0 = 0, 1;
a1, b1 = 0, 2;
I, e = hcubature(f, (a0, a1), (b0, b1));
return I
end
fx(1,1)
``````

error message

``````MethodError: no method matching (::var"#f#55"{Int64, Int64})(::StaticArrays.SVector{2, Float64})
Closest candidates are:
(::var"#f#55")(::Any, ::Any) at In[104]:2

Stacktrace:
[1] (::HCubature.GenzMalik{2, Float64})(f::var"#f#55"{Int64, Int64}, a::StaticArrays.SVector{2, Float64}, b::StaticArrays.SVector{2, Float64}, norm::typeof(LinearAlgebra.norm))
@ HCubature ~/.julia/packages/HCubature/MepxP/src/genz-malik.jl:121
[2] hcubature_(f::Function, a::StaticArrays.SVector{2, Float64}, b::StaticArrays.SVector{2, Float64}, norm::typeof(LinearAlgebra.norm), rtol_::Int64, atol::Int64, maxevals::Int64, initdiv::Int64)
@ HCubature ~/.julia/packages/HCubature/MepxP/src/HCubature.jl:60
[3] hcubature_
@ ~/.julia/packages/HCubature/MepxP/src/HCubature.jl:131 [inlined]
[4] #hcubature#3
@ ~/.julia/packages/HCubature/MepxP/src/HCubature.jl:178 [inlined]
[5] hcubature(f::Function, a::Tuple{Int64, Int64}, b::Tuple{Int64, Int64})
@ HCubature ~/.julia/packages/HCubature/MepxP/src/HCubature.jl:178
[6] fx(a::Int64, b::Int64)
@ Main ./In[104]:5
[7] top-level scope
@ In[105]:1
[8] eval
@ ./boot.jl:373 [inlined]
[9] include_string(mapexpr::typeof(REPL.softscope), mod::Module, code::String, filename::String)
``````    f(x) = a*x[1]^2 + b*x[2]^2