external functions
Posted: Tue Apr 08, 2014 8:54 pm
Dear all,
I'm a novice at using Dynare and I'd greatly appreciate any suggestions you might have regarding this possibly simple problem. I'd like to use a standard matlab function (nthroot), but Dynare doesn't support it. I want to calculate an odd number root of a negative number (for example (-1)^(1/3)), but typing (-1)^(1/3) gives 0.5+0.0866i. To get -1, I need to use the nthroot function. So I can I use it in Dynare?
I tried following the instructions in the Dynare guide by creating a function called root which uses nthroot to do the calculation, and declared root in the mod file with "external_function(name = root,nargs = 3);" before using the function in one of the model equations. However I got this error "terminate called after throwing an instance of 'ExternalFunctionNode::UnknownFunctionNameAndArgs'".
Attached are the mod and m files. The function is declared after the block of parameters, and it's the last model equation (taud = root((d(-1)/(p_N^(1-gamma))),(k1/k2),tau);) that uses the root function.
Thank you in advance for your help!
I'm a novice at using Dynare and I'd greatly appreciate any suggestions you might have regarding this possibly simple problem. I'd like to use a standard matlab function (nthroot), but Dynare doesn't support it. I want to calculate an odd number root of a negative number (for example (-1)^(1/3)), but typing (-1)^(1/3) gives 0.5+0.0866i. To get -1, I need to use the nthroot function. So I can I use it in Dynare?
I tried following the instructions in the Dynare guide by creating a function called root which uses nthroot to do the calculation, and declared root in the mod file with "external_function(name = root,nargs = 3);" before using the function in one of the model equations. However I got this error "terminate called after throwing an instance of 'ExternalFunctionNode::UnknownFunctionNameAndArgs'".
Attached are the mod and m files. The function is declared after the block of parameters, and it's the last model equation (taud = root((d(-1)/(p_N^(1-gamma))),(k1/k2),tau);) that uses the root function.
Thank you in advance for your help!