# DifferentialEquations sanity check

Hello,
I have been using DifferentialEquations to try and model microbial interactions. In the first approach, I give some absolute concentrations of bacteria and phages (viruses of bacteria) and I get this figure:
bacteria = 50000
viruses = 80

In a second approach, I give relative quantifications:
bacteria = 1
viruses = 0.0016

I obtain the same identical figure (the difference in label position is due from changing loc=“best” to loc=“lower right”). So my question is: is there a way to assess the sanity of the result? How can be that both figures have the same y-axis values? The plots are slightly different on the x-axis, but is there a trick to be sure of the result?

I think a MWE would help but it just looks like you are just running two simulations with different initial values. The plots somewhat show a similar convergence but are different at the start (for time < 100 h), right?

1 Like

Yes, it is the same simulation with different starting values. Does it make sense to have the same Y scale? How can I be sure that there is no flaw somewhere that I overlooked?.. Or simply the initial conditions are no so important as long as their ratio is maintained (as in this case). The difference between 50 000 and 1 is just a constant k and k*0.0016=80, as expected.

I’m not sure but nothing here seems crazy to me. I don’t think that DifferentialEquations.jl has a bug that would manifest in your simulation. If you are scared that your simulation is not realistic then I can’t really help you without a minimal working example of code and explanation

3 Likes

I did not think of a bug in DifferentialEquations, just wanted to know if there is a way to implement a sanity check on the results.

Well, you can probably do that but I cannot help you further without more information! Maybe check that the convergence equilibrium is a (unique?) steady-state solution? Or try to do normalize/nondimensionalize your equations on paper?

1 Like

Best way to get a sanity check is to simulate a similar differential equation that has an analytic solution. Then compare the numerical answer to the analytic solution. If the two match and the numerical solution converges toward the analytic as dt -> 0, then at least you know the library code is correct and you’re using and interpreting it correctly,. Your system looks like a 2d linear ODE with complex eigenvalues with negative real parts.

1 Like