Comments (3)
Transferred from docs to DelayDiffEq.jl. @devmotion do you think it might be a weird instability issue related to #67 ?
from delaydiffeq.jl.
Hmm.... It seems the provided example errors since S(t)S(t-tau_ext)
becomes negative and hence it's not possible to compute the square root of this term anymore. I guess that's also the reason for the lines you commented out (BTW they are not correct since you try to write complex values to a vector of real numbers)?
First of all, it would be interesting to see your MATLAB implementation, if that's possible. Did you consider possibly negative values of S(t)S(t-tau_ext)
therein (e.g. by specifying that S
should be non-negative)? Or did you just constrain the step size?
Actually, a bit more than one year ago I worked with a DDE that was also not defined for negative values. You can find a Julia implementation of it here, and you can also have a look at simulations with different solvers. As you can see in the Julia implementation, I set the derivatives of variables that should be non-negative to max(0, dxdt)
, following Shampine's advice. In my case, this implementation together with a suitable algorithm such as Rodas5
was sufficient to be able to compute simulations of my model reliably. However, you might want to have a look at isoutofdomain
and the PositiveDomain
callback, which are explained in the documentation. Another approach (which might be a bit more elegant) could be to enforce the positivity of S
by considering the dynamics of a new variable T = f(S)
instead of the dynamics of S
, where f
is a bijective function and T
is unconstrained, contrary to S
.
from delaydiffeq.jl.
Thanks for your reply! @devmotion
Actually, S(t) has a physical meaning - it's photon density. Therefore, it cannot be negative.
the lines you commented out is an naive attempt to let program runs and it fails.
I will try your advice and update how 's it going in Julia.
Thanks,
Peter
from delaydiffeq.jl.
Related Issues (20)
- Cache tests fail on master HOT 1
- behavior of step! with tstop HOT 6
- Discontinuity tracking can miss discontinuity at 0
- TagBot trigger issue HOT 58
- DDE too stiff? radau method required? HOT 6
- SavingCallback does not seem to save the right values HOT 1
- In DDEs constant_lags break PresetTimeCallback
- Performance regressions since Julia v1.4 HOT 1
- More efficient evaluation of the history function for multiple time points
- Significant allocations in DDE interpolation for multiple time points HOT 3
- Call to HistoryFunction gets replaced by call to ODEFunction HOT 5
- initial conditions not decaying according to dynamics function HOT 1
- missing cache.alg causing runtime dispatch in LinearSolve HOT 7
- Incorrect jacobian with Zygote + ReverseDiffAdjoint HOT 4
- Precompilation issue (DelayDiffEq v5.40.6) HOT 2
- `Dopri5` solver doesn't work for DDEs
- JuliaCon Proceedings Review: Example fails HOT 3
- DDE does not provide any solution (example from docs) HOT 6
- constant_lags contains 0.0 HOT 3
- Cannot resize DDE problem using resize! HOT 8
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from delaydiffeq.jl.