I am trying to use this model for later use in FindFit:
model[x0_?NumberQ, r_?NumberQ, k_?NumberQ, n_?NumberQ] := model[x0, r, k, n] =
First[x /. NDSolve[{x'[t] == r x[t] (1 - x[t]/k)^n, x[0] == x0}, x, {t, 0, 61}]]
Assume now that those parameters are sought within the following ranges:
x0: 10^-50..10^-10;
n: 0.1..5.0;
r: 1..10;
k: 1..1000.
Depending on the specific choice of the parameter combination I will get various NDSolve numeric errors. So what would be a good choice of MachinePrecision, AccuracyGoal and PrecisionGoal that would work for that parameter space?
n >= 1
, the optionsPrecisionGoal -> 10, AccuracyGoal -> Infinity, WorkingPrecision -> 100
seem to take care of everything I tried. AWorkingPrecision
around100
seems to be needed forx0
as small as10^-50
-- the smallerx0
, the greater the precision needed. Second, I think forn < 1
,x
reachesk
in finite time. I haven't figured out a graceful way to stop the integration at the right time. Alson = 1.01
behaves liken < 1
-- not sure why exactly. $\endgroup$NDSolve::precw
can be ignored. Ideally you would pass parametersx0
,r
,k
, andn
with a precision at least as great as theWorkingPrecision
-- then you should not get the message. $\endgroup$