# Using ApproxFun.jl to solve a Volterra equation of the second kind

**URL:** <https://discourse.julialang.org/t/using-approxfun-jl-to-solve-a-volterra-equation-of-the-second-kind/40203>\
**Category:** Numerics\
**Created:** [May 26, 2020, 3:25pm UTC](https://discourse.julialang.org/t/using-approxfun-jl-to-solve-a-volterra-equation-of-the-second-kind/40203 "2020-05-26T15:25:39Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![chisquared](https://avatars.discourse-cdn.com/v4/letter/c/87869e/32.png) [@chisquared](https://discourse.julialang.org/u/chisquared)\
**Post date:** [May 26, 2020, 3:25pm UTC](https://discourse.julialang.org/t/using-approxfun-jl-to-solve-a-volterra-equation-of-the-second-kind/40203/1 "2020-05-26T15:25:39Z")

</div>

I’m trying to learn how to solve Volterra equations of the second kind using `ApproxFun.jl`.

For example, consider the following equation, where `u` is an unknown function on `[0,1/2]`.

![volteq](https://global.discourse-cdn.com/julialang/original/3X/d/3/d3ace2fcd1ad9d710757644c195dd14604ffa8e3.png)

The closest similar example I could find was [this](https://github.com/JuliaApproximation/ApproxFun.jl/issues/570), but I don’t know how to include the information regarding the different limits of integration, so `ApproxFun.jl` is giving me a `u` that is different from the solution that I can solve for analytically.

Can anyone help? I’ve tried the [documentation](https://juliaapproximation.github.io/ApproxFun.jl/stable/), but I don’t quite yet see how to adapt the examples there to the equation I have.

---

<div class="post-metadata">

**Author:** ![dlfivefifty](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dlfivefifty/32/1959_2.png) [@dlfivefifty](https://discourse.julialang.org/u/dlfivefifty)\
**Post date:** [May 28, 2020, 12:19pm UTC](https://discourse.julialang.org/t/using-approxfun-jl-to-solve-a-volterra-equation-of-the-second-kind/40203/2 "2020-05-28T12:19:52Z")

</div>

I’ll have a look and get back to you

---

<div class="post-metadata">

**Author:** ![dlfivefifty](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/dlfivefifty/32/1959_2.png) [@dlfivefifty](https://discourse.julialang.org/u/dlfivefifty)\
**Post date:** [May 29, 2020, 3:52pm UTC](https://discourse.julialang.org/t/using-approxfun-jl-to-solve-a-volterra-equation-of-the-second-kind/40203/3 "2020-05-29T15:52:16Z")

</div>

Just to confirm: it’s `1/(1-x)` and not `1/(1-t)`, correct? So that the term can be pulled out? I think this works:

```julia
d = Segment(0.5,0)
x = Fun(d)
V = Volterra(Legendre(d))
u = (I - 1/(1-x) * V) \ 1

```

If you meant `1/(1-t)` just put it to the right of the `V`, (using a bracket so it knows you don’t want to apply the operator to the function `1/(1-x)`):

```julia
u = (I - V[1/(1-x)]) \ 1

```

---

<div class="post-metadata">

**Author:** ![chisquared](https://avatars.discourse-cdn.com/v4/letter/c/87869e/32.png) [@chisquared](https://discourse.julialang.org/u/chisquared)\
**Post date:** [May 29, 2020, 4:24pm UTC](https://discourse.julialang.org/t/using-approxfun-jl-to-solve-a-volterra-equation-of-the-second-kind/40203/4 "2020-05-29T16:24:13Z")

</div>

Yes, my original post was correct, but the last line is good to know for more general versions of the problem I’m considering.

Thank you so much!

---

<div class="post-metadata">

**Author:** ![rveltz](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/rveltz/32/2707_2.png) [@rveltz](https://discourse.julialang.org/u/rveltz)\
**Post date:** [February 21, 2025, 5:35pm UTC](https://discourse.julialang.org/t/using-approxfun-jl-to-solve-a-volterra-equation-of-the-second-kind/40203/6 "2025-02-21T17:35:00Z")

</div>

Coming back to this, I am wondering what is the best way to represent

\int\_0^1\exp(-|t-s|)u(s)ds

Indeed, if using a definite integral, the kernel is not smooth. We can cut it in two volterra kernels but the second one is \int\_t^1 \exp(-s)u(s)ds et I dont know how to reverse `Volterra`
