Hello,
I was curious that how to approach this problem with unstable solution. I have already tried different solver such as TRBDF2()
, Rodas5()
, Rosenbrock23()
but it didn’t worked.
using DifferentialEquations
using NaNMath; nm=NaNMath
function ab_model(du, u, p, t)
k_1, k_2, n = p
A, B, ab = u
nA = 1e2
du[1] = -(k_1 * A * nA * max(0,nm.pow((B / nA), n)) )+ (k_2 * ab)
du[2] = -(k_1 * A * nA * max(0,nm.pow((B / nA), n))) + (k_2 * ab)
du[3] = (k_1 * A * nA * max(0,nm.pow((B / nA), n))) - (k_2 * ab)
end
A_ = [1e-3, 1e-2, 1e-1, 1e0, 1e1, 1e2, 1e3]
u0 = [A_[6], 1e-2, 1e-6]
p = [1, 0.00001, 0.07]
prob = ODEProblem(ab_model ,u0 , (0.0, 10), p )
sol = solve(prob, Rodas4(), saveat= 1)
┌ Warning: At t=2.0489651529636236e-6, dt was forced below floating point epsilon 4.235164736271502e-22, and step error estimate = NaN. Aborting. There is either an error in your model specification or the true solution is unstable (or the true solution can not be represented in the precision of Float64).
└ @ SciMLBase ~/.julia/packages/SciMLBase/7BHQj/src/integrator_interface.jl:623
retcode: Unstable
Interpolation: 1st order linear
t: 1-element Vector{Float64}:
0.0
u: 1-element Vector{Vector{Float64}}:
[100.0, 0.01, 1.0e-6]