Closed elliot-brown closed 5 years ago
Your problem are the curly braces in the definition of func
. This makes it a set instead of a list, tuple, or other iterable which preserves order. Due to the different order of equations (elements of func
), you have been integrating a completely different differential equation, which probably was escalating or otherwise problematic.
A few asides on your code:
I.set_integration_parameters()
when there are no parameters.I.t
instead of 0
, i.e., change the respective line to for time in I.t+np.linspace(0,2):
. Results before I.t
will be extrapolated and may thus be grossly inaccurate.tolist()
(without underscore, by the way) on the integration result.That makes sense. Some examples had curly braces while others didn't, and I didn't realize there was a significant difference. That fixed everything perfectly. The other oddities were left from my previous experiments. Thanks again for you prompt response!
Some examples had curly braces while others didn't, and I didn't realize there was a significant difference.
Depending on what you put inside, curly braces can define a dictionary or set. Dictionaries are fine; sets aren’t.
Also, in the future, users will get an explicit error when using a set here.
First of all, I have to admit that I don't have much experience with DDEs. That being said I get the concept behind them, and JiTCDDE seems like the best Python package out there for solving them. (I am using version 1.3.3.) I think my code is almost there, but I'm getting an error that I believe is related to step size. Here is a working (or not-quite-working) example. (My actual code uses 6 different equations, but this example with 4 is sufficient to raise the error.)
It seemingly works for early iterations. (In this example, the first 35 or so steps take less than 3 seconds collectively.) But then the speed of each iteration rapidly slow down so that a few iterations later, it takes 40 seconds for a single iteration. The iteration after that takes a very long time (a couple minutes) before raising the following error:
I've tried playing the a_tol, r_tol, and min_step, but that doesn't seem to help. I'm not sure how else to address the initial discontinuities besides
I.step_on_discontinuities()
. Finally, I don't believe there is a problem with the DDE itself since it has been successfully solved with MatLab's dde23.Though I realize this is almost certainly a user issue rather than a package issue, any help and understanding would be greatly appreciated!