Hi all,
I have a question regarding numerical integration in mata. My problem is something of this sort. I am trying to integrate f(x,y,z) = x+2y+2z over the range of x from 0 to 1, fixing the value of y and z. However I am struggling to implement this in mata. Here are my codes
real rowvector fxy2(real rowvector x, real rowvector y, real rowvector z)
{
return(x:+(2:*y)+(2:*z))
}
real rowvector f_inner2(real rowvector y,real rowvector z)
{
f = integrate(&fxy2(),0,1,40,(y,z))
return (f)
}
: f_inner2(3,3)
fxy2(): 3001 expected 3 arguments but received 2
integrate_main(): - function returned error
integrate(): - function returned error
f_inner2(): - function returned error
<istmt>: - function returned error
The correct solution should be 12.5, but I am not getting that. Can someone please point out where is the problem in my code and how can I fix it? Thanks.
I have a question regarding numerical integration in mata. My problem is something of this sort. I am trying to integrate f(x,y,z) = x+2y+2z over the range of x from 0 to 1, fixing the value of y and z. However I am struggling to implement this in mata. Here are my codes
real rowvector fxy2(real rowvector x, real rowvector y, real rowvector z)
{
return(x:+(2:*y)+(2:*z))
}
real rowvector f_inner2(real rowvector y,real rowvector z)
{
f = integrate(&fxy2(),0,1,40,(y,z))
return (f)
}
: f_inner2(3,3)
fxy2(): 3001 expected 3 arguments but received 2
integrate_main(): - function returned error
integrate(): - function returned error
f_inner2(): - function returned error
<istmt>: - function returned error
The correct solution should be 12.5, but I am not getting that. Can someone please point out where is the problem in my code and how can I fix it? Thanks.
Comment