Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

I have a system of ODEs whose time courses I'd like to numerically integrate. One of these should have a continuous strictly decreasing term and a discontinuous increasing term. It looks something like this:

d[A]/dt = -k*A over the whole interval

and additionally

d[A]/dt = c for t in every 10 steps (if t%10 == 0)

I have encoded the first one as ODE in SBML, the 2nd one as discrete event. Using numerical solvers like LSODE or CVODE fail to integrate this, however, with a root finding error.

What is the best way to encode such an ODE in a way that the solvers above can handle?


Ok I found the issue:

d[A]/dt = c for t in every 10 steps (if t%10 == 0)

does not work because t does not need to be divisible by 10 at any point. The following works:

d[A]/dt = c for t in every 10 steps (if t%10 < 0.01)
share|improve this question

1 Answer 1

For what it's worth: usually for ODEs with discontinuous functions involved, it is a good idea to ensure that the routine/function in your computing environment supports "event detection"; Mathematica has the Method -> {"EventLocator", (*sub-options*)} for NDSolve[], and the FORTRAN routines by Hairer and Wanner support this capability as well.

share|improve this answer
    
CVODE is supposed to support it as well. –  user538603 Jul 1 '11 at 18:33

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.