-
Notifications
You must be signed in to change notification settings - Fork 48
Mistake in numerical differentiation #297
Copy link
Copy link
Open
Labels
coreIssue relates to the mizer coreIssue relates to the mizer corediscussionAn idea that needs discussion before becoming a proposalAn idea that needs discussion before becoming a proposalmajor effortResolving this issue will involve a major effortResolving this issue will involve a major effort
Metadata
Metadata
Assignees
Labels
coreIssue relates to the mizer coreIssue relates to the mizer corediscussionAn idea that needs discussion before becoming a proposalAn idea that needs discussion before becoming a proposalmajor effortResolving this issue will involve a major effortResolving 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})}{\Delta w_i}$$
$$\Delta w_i = w_{i}-w_{i-1}.$$
$$\Delta 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.