GithubHelp home page GithubHelp logo

Comments (3)

ChrisRackauckas avatar ChrisRackauckas commented on June 14, 2024

Transferred from docs to DelayDiffEq.jl. @devmotion do you think it might be a weird instability issue related to #67 ?

from delaydiffeq.jl.

devmotion avatar devmotion commented on June 14, 2024

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.

PeterXiaoGuo avatar PeterXiaoGuo commented on June 14, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.