Mistake in numerical differentiation #297
Labels
core
Issue relates to the mizer core
discussion
An idea that needs discussion before becoming a proposal
major effort
Resolving this issue will involve a major effort
Mizer is based on the PDE
$$\frac{\partial N}{\partial t} = -\frac{\partial}{\partial w}(g,N)-\mu,N$$ $w$ with the backwards difference formula
$$\frac{\partial}{\partial w}f(w_i)\approx \frac{f(w_{i})-f(w_{i-1})}{dw_i}$$
$$w_i = w_{i}-w_{i-1}.$$
$$w_i = w_{i+1}-w_{i}.$$ $w_i$ , where $w_{i+1}/w_i=10^{dx}$ is a constant, this means that the derivative in mizer is too small by this factor. Given the way the derivative enters the PDE, this is equivalent to mizer working with a growth rate that is too big by this constant. It also means that the dynamics in mizer currently change as one changes the step size $dx$ .
that it solves numerically by approximating the derivatives with first-order finite-difference approximations. In particular it approximates the derivative with respect to
which is correct to first order if
Unfortunately mizer is using
Given mizer's logarithmically-spaced
To give a feel for the size of this error: if fish sizes in the model range from 1mg to 10kg then the factor is about 1.18 when using 100 size bins and 1.08 when using 200 size bins.
When we switch to the correct scheme, we should automatically update all old-version params objects in such a way that their growth rates are increased by the factor$10^{dx}$ so that they continue to have the same dynamics as in the past. This would be easiest to do by registering a modified
mizerEGrowth()
function for them.Alternatively we could set a flag in the old-version params objects that tells mizer to continue to use the wrong scheme for them.
The text was updated successfully, but these errors were encountered: