# Difference between tstops and d\_discontinuities

**URL:** <https://discourse.julialang.org/t/difference-between-tstops-and-d-discontinuities/126847>\
**Category:** Modelling & Simulations\
**Tags:** differentialequation\
**Created:** [March 12, 2025, 6:28am UTC](https://discourse.julialang.org/t/difference-between-tstops-and-d-discontinuities/126847 "2025-03-12T06:28:31Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![cstjean](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cstjean/32/1444_2.png) [@cstjean](https://discourse.julialang.org/u/cstjean)\
**Post date:** [March 12, 2025, 6:28am UTC](https://discourse.julialang.org/t/difference-between-tstops-and-d-discontinuities/126847/1 "2025-03-12T06:28:31Z")

</div>

The docstring says:

```julia
    • tstops: Denotes extra times that the timestepping algorithm must step to. This should be used
       to help the solver deal with discontinuities and singularities, since stepping exactly at the
       time of the discontinuity will improve accuracy. If a method cannot change timesteps (fixed
       timestep multistep methods), then tstops will use an interpolation, matching the behavior of
       saveat. If a method cannot change timesteps and also cannot interpolate, then tstops must be a
       multiple of dt or else an error will be thrown. tstops may also be a function tstops(p,
       tspan), accepting the parameter object and tspan, returning the vector of time points to stop
       at. Default is [].

    • d_discontinuities: Denotes locations of discontinuities in low order derivatives. This will
       force FSAL algorithms which assume derivative continuity to re-evaluate the derivatives at the
       point of discontinuity. The default is [].

```

My brain wants to read this as `tstops is for discontinuities in f, while d_discontinuities is for discontinuities in f', f''`. But the name of the kwargs makes me skeptical. How should I think about those? If `f` is a step function, should I specify the discontinuity points in `tstops` or `d_discontinuities`?

EDIT: just realized that `d_` probably stands for “derivative”, so my interpretation was likely correct.

---

<div class="post-metadata">

**Author:** ![ChrisRackauckas](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chrisrackauckas/32/77_2.png) [@ChrisRackauckas](https://discourse.julialang.org/u/ChrisRackauckas)\
**Post date:** [March 12, 2025, 8:53am UTC](https://discourse.julialang.org/t/difference-between-tstops-and-d-discontinuities/126847/2 "2025-03-12T08:53:16Z")

</div>

> [@cstjean](#):
>
> EDIT: just realized that `d_` probably stands for “derivative”, so my interpretation was likely correct.

yes

> [@cstjean](#):
>
> tstops is for discontinuities in f, while d\_discontinuities is for discontinuities in f’, f’’

Kind of, but not entirely. `tstops` just tells the solver where to stop, `d_discontinuities` tells it to stop there and drop cache. The reason to drop cache is think for example a multistep method, where `f(u_{n-1})` is stored from the previous step to be reused in the next. The multistep method needs to realize there is a discontinuity in the `f`, and thus a discontinuity in `u'`, and thus it cannot just slap a polynomial over it. For something like FBDF, this would mean it would throw out history, drop dt a bit, and do the next step with implicit Euler since that has no history. Or for example, FSAL methods like Tsit5 cache an `f` call from the previous evaluation, but if you then have a discontinuity you want to re-resolve that so you get the right continuous derivative.

---

<div class="post-metadata">

**Author:** ![cstjean](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/cstjean/32/1444_2.png) [@cstjean](https://discourse.julialang.org/u/cstjean)\
**Post date:** [January 13, 2026, 2:35am UTC](https://discourse.julialang.org/t/difference-between-tstops-and-d-discontinuities/126847/3 "2026-01-13T02:35:14Z")

</div>

Sorry, I’ve read and reread that explanation and it’s still above my head. If I have a step function (eg. a `ParametrizedInterpolation(ConstantInterpolation)`), should I use `d_discontinuities`? I would guess so, that the solver must throw away whatever information it had before?

In MTK, I can have a component that is discontinuous set `System(; tstops=...)`, and it becomes a `tstop` of the whole system, but there is no corresponding `System(; d_discontinuities)` kwarg. I guess I have to manually track it?

---

<div class="post-metadata">

**Author:** ![ChrisRackauckas](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/chrisrackauckas/32/77_2.png) [@ChrisRackauckas](https://discourse.julialang.org/u/ChrisRackauckas)\
**Post date:** [January 13, 2026, 2:30pm UTC](https://discourse.julialang.org/t/difference-between-tstops-and-d-discontinuities/126847/4 "2026-01-13T14:30:38Z")

</div>

> [@cstjean](#):
>
> If I have a step function (eg. a `ParametrizedInterpolation(ConstantInterpolation)`), should I use `d_discontinuities`? I would guess so, that the solver must throw away whatever information it had before?

Yes, it’s not great but I plan on improving it in a few weeks for specifically this case.
