# ODE solver with too many function calls

**URL:** <https://discourse.julialang.org/t/ode-solver-with-too-many-function-calls/90686>\
**Category:** Performance\
**Tags:** differentialequation\
**Created:** [November 23, 2022, 7:10am UTC](https://discourse.julialang.org/t/ode-solver-with-too-many-function-calls/90686 "2022-11-23T07:10:05Z")\
**Posts on this page:** 4\
**Page:** 2

<div class="post-metadata">

**Author:** ![c\_sell](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/c_sell/32/38854_2.png) [@c\_sell](https://discourse.julialang.org/u/c_sell)\
**Post date:** [November 28, 2022, 4:41pm UTC](https://discourse.julialang.org/t/ode-solver-with-too-many-function-calls/90686/21 "2022-11-28T16:41:17Z")

</div>

I did not use autodiff. I would have needed to many dual types in my code.  
All my values are real. The values are exactly the same for the ode\_functions and the jacobian in Matlab and Julia.

---

<div class="post-metadata">

**Author:** ![ChrisRackauckas](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chrisrackauckas/32/77_2.png) [@ChrisRackauckas](https://discourse.julialang.org/u/ChrisRackauckas)\
**Post date:** [November 28, 2022, 4:48pm UTC](https://discourse.julialang.org/t/ode-solver-with-too-many-function-calls/90686/22 "2022-11-28T16:48:45Z")

</div>

From here I don’t know if we can help any more without seeing code that reproduces the issue.

---

<div class="post-metadata">

**Author:** ![c\_sell](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/c_sell/32/38854_2.png) [@c\_sell](https://discourse.julialang.org/u/c_sell)\
**Post date:** [November 28, 2022, 6:40pm UTC](https://discourse.julialang.org/t/ode-solver-with-too-many-function-calls/90686/23 "2022-11-28T18:40:49Z")

</div>

Understandable. Thanks for your time anyway :).

---

<div class="post-metadata">

**Author:** ![c\_sell](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/c_sell/32/38854_2.png) [@c\_sell](https://discourse.julialang.org/u/c_sell)\
**Post date:** [November 28, 2022, 7:48pm UTC](https://discourse.julialang.org/t/ode-solver-with-too-many-function-calls/90686/24 "2022-11-28T19:48:40Z")

</div>

A small update.  
I think I found the problem:  
In the function of the nonlinear force, a certain variable is set to a very small value if its drops below 0.  
In Matlab this never occurs. I think the solver steps are small enought. So this jumps never occur.  
In Julia this value drops below 0, so the solver has to handle the jumps. I think this leads to so many function calls.

[Previous page](https://discourse.julialang.org/t/ode-solver-with-too-many-function-calls/90686.md?page=1)
