# DifferentialEquation solvers not giving desired output

I have a model for which i already have fits in r language. Now i’m implementing same in Julia where i’m not getting any fits. Upon checking different solvers with my posterior from r, I can see none of solvers is giving fit plot that I obtained in r. I can see oscillation in solution. My system is stiff.

Solvers I have used are :

``````alg = [BS3(), Tsit5() , Rodas4(autodiff=false), Vern7(),QNDF() , TRBDF2(), AutoTsit5(Rosenbrock23()),  AutoVern7(Rodas5()), CVODE_BDF(), Rodas5(), Rodas5P()]
``````

Sorry but I cant share plots here. Is there any other solver that I can hope to give stable solution?

have you run the function separately from the integrator to make sure it gives the same results?

you mean something like this `integrator = init(prob, Tsit5(); dt = 1 // 2^(4), tstops = [0.5])` rather than solve?

It’s not really possible to give specific advise without a more definite problem description, i.e. a complete but minimal working example that exhibits a clear-cut error. Generally speaking, rather than checking the Julia’s output against R’s output, it would be better to find a closely related problem with known closed-form solution, and check whether the Julia solution converges towards the closed-form solution at the expected rate.

1 Like

no, I mean just call `f(u, p, t)` with random `u` and `t` values (the same random values for Julia and R). The most common reason for this type of error is that you made a typo when porting the function.

2 Likes

I will try that and post here the output.

See this video for some help:

Note that you can use deSolve.jl to call exactly the same solvers from R. If they aren’t giving the exact same solution then, you can be certain that your `f` function is implemented differently.

As @Oscar_Smith said, the first step of debugging a model translation from another language is to run the `f` call on the same random values in both languages and see that they give exactly the same results. Like 99% of the time someone reports a translation issue, this is the diagnostic that fails and identifies the bug.

1 Like