# Numeric antiderivative for a noncontinuous function using ODEProblem

**URL:** <https://discourse.julialang.org/t/numeric-antiderivative-for-a-noncontinuous-function-using-odeproblem/126751>\
**Category:** Numerics\
**Created:** [March 10, 2025, 9:00am UTC](https://discourse.julialang.org/t/numeric-antiderivative-for-a-noncontinuous-function-using-odeproblem/126751 "2025-03-10T09:00:07Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![stevengj](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stevengj/32/71_2.png) [@stevengj](https://discourse.julialang.org/u/stevengj)\
**Post date:** [March 10, 2025, 12:17pm UTC](https://discourse.julialang.org/t/numeric-antiderivative-for-a-noncontinuous-function-using-odeproblem/126751/2 "2025-03-10T12:17:15Z")

</div>

> [@nilsbecker](#):
>
> Can I just use another solver? Or is there a better way to do this that I did not think about?

1. If you know where the discontinuity is, you should tell the solver where it is; otherwise the problem is _much_ harder (and you should probably specify a larger error tolerance). This is true for _any_ numerical method — integration methods are usually designed for smooth functions.
2. In general, you almost never want to evaluate definite integrals by solving ODEs — specialized integration routines are _much_ more efficient (and simpler to use), because they exploit the fact that you have “random access” to your integrand values at any point in the domain (rather than having to build it up from “left to right” as in a general ODE). To be able to evaluate the integral at arbitrary points in a given interval, see [How do I do a fast cumulative integration - #6 by stevengj](https://discourse.julialang.org/t/how-do-i-do-a-fast-cumulative-integration/85574/6)

---

_[View the full topic](https://discourse.julialang.org/t/numeric-antiderivative-for-a-noncontinuous-function-using-odeproblem/126751)._
