# Evaluating the rhs of ODE

Hi!

I am a beginner with Julia, just a week since I started learning Julia. I am having an issue with evaluating the rhs of a big ODE with 46 variables and more than a hundred parameters. The ODE was originally written in Mathematica and I translated it in Python, I am ending up having a numerical issue with the integration. So to debug the code I want to compare rhs of Python vs Julia. Indeed the Mathematica version was quickly translated in Julia and the integration works just fine.

Here is the link for the code

That all sounds pretty good up to this point, whatâ€™s the issue?

1 Like

The issue is that I donâ€™t know how to pass the vector of the variables to the rhs of the ODE to evaluate it.

Isnâ€™t it possible to come up with some (really) minimal working example (MWE)? Perhaps it is possible to describe your problem with something as simple as a solution to the â€śhello-worldâ€ť differential equation \dot x(t) = -5x(t).

Here is the code Chilperic Armel Foko / Model Julia Â· GitLab

Whatever is flagging your posts is a false positive. Iâ€™ll say sorry for the community and the mods should help this out.

It looks like youâ€™re using ModelingToolkit.jl. What youâ€™re looking for is:

https://mtk.sciml.ai/dev/systems/ODESystem/#SciMLBase.ODEFunction

Itâ€™ll create the standard DifferentialEquations.jl functions f(u,p,t) and f(du,u,p,t) where u follows the variable order of states(sys) and p follows the order of parameters(sys) (and as it shows, you can override the order if you please). Hopefully that helps.

Exactly it was I am using. The constructor does not allow me to evaluate the rhs

If you use ODEFunction(sys) youâ€™ll get the function.

2 Likes