Bug in getPowerDeriv.m
Dear all, There is a bug in getPowerDeriv. In rare cases such as entering x^(alppha-1) with x=0 in steady state and alpha=2 the derivative is wrong. The reason is that the first condition in getPowerDeriv checks whether x=0 and then sets the derivative to 0 as the derivative is p*0^(p-1) which is 0 if p~=1. But this is wrong if the exponent is p=1 as it then is 1*0^0=1. I pushed a fix to git where the first condition checks whether p=1. This also affects the 4.2 branch. Best, Johannes -------- Johannes Pfeifer Haußerstr. 29 72076 Tübingen Tel.: +49-(0)7071-6396184 Mobil: +49-(0)170-6936820 jpfeifer@gmx.de
"Johannes Pfeifer" <jpfeifer@gmx.de> writes:
There is a bug in getPowerDeriv. In rare cases such as entering x^(alppha-1) with x=0 in steady state and alpha=2 the derivative is wrong. The reason is that the first condition in getPowerDeriv checks whether x=0 and then sets the derivative to 0 as the derivative is p*0^(p-1) which is 0 if p~=1. But this is wrong if the exponent is p=1 as it then is 1*0^0= 1.
I pushed a fix to git where the first condition checks whether p=1. This also affects the 4.2 branch.
Thanks I pushed your fix and another commit which fixes the same issue in various places of the C++ code. I did not backport the fix to the 4.2 branch: I have stopped backporting fixes to that branch, since there will be no more 4.2 release. We are now focused towards the release of Dynare 4.3.0. Thanks for your contribution, -- Sébastien Villemot Researcher in Economics & Debian Maintainer http://www.dynare.org/sebastien Phone: +33-1-40-77-84-04 - GPG Key: 4096R/381A7594
participants (2)
-
Johannes Pfeifer -
Sébastien Villemot