neurophysik / jitcdde

Just-in-time compilation for delay differential equations
Other
56 stars 14 forks source link

Using a delay as a control parameter #28

Closed AlexSlow94 closed 4 years ago

AlexSlow94 commented 4 years ago

Hello,

First of all, I would like to thank you for this package, it's really amazing (even a beginner in programming like me can appreciate the lot of features and the way they are implemented).

I would like also to ask you a really quick question: can a delay parameter become a "control" parameter in the sense specified in the docs? I would like to sweep over it and try different delays.

(Actually, i would like to minimise the difference between my model and some data, fitting the model to them with a minimisation of residuals, but if it's possible to sweep over the delay parameter, I should do it).

I am talking about a "constant" delay, not a state-dependent delay nor a time-dependent delay.

Wrzlprmft commented 4 years ago

Yes, you can use control parameters as delays (or part of delays). However, be aware that:

Actually, i would like to minimise the difference between my model and some data, fitting the model to them with a minimisation of residuals, but if it's possible to sweep over the delay parameter, I should do it

Note, that to find local minima, you can write a function that:

Then you can use this function as an argument for some minimiser like scipy.optimize.minimize. These do not care what happens into the function passed as an argument and are usually designed to reduce the number of calls to that function because it is typically the bottleneck.