# Definition of an integral function whose argument is the upper limit of integration

**URL:** <https://discourse.julialang.org/t/definition-of-an-integral-function-whose-argument-is-the-upper-limit-of-integration/103946>\
**Category:** Numerics\
**Tags:** question, calculus, integral\
**Created:** [September 17, 2023, 11:34am UTC](https://discourse.julialang.org/t/definition-of-an-integral-function-whose-argument-is-the-upper-limit-of-integration/103946 "2023-09-17T11:34:11Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![aburousan](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/aburousan/32/28525_2.png) [@aburousan](https://discourse.julialang.org/u/aburousan)\
**Post date:** [September 17, 2023, 11:34am UTC](https://discourse.julialang.org/t/definition-of-an-integral-function-whose-argument-is-the-upper-limit-of-integration/103946/1 "2023-09-17T11:34:11Z")

</div>

Hi, I want to define a function let’s say,  
$$ f(x) = \int\_0^x u^2 du /(e^{u^2+16} +1)^{\frac{3/2}}$$  
How can I do this?, A naive approach is to use a loop and just each time calculate the whole thing.  
But is there any other way?

---

<div class="post-metadata">

**Author:** ![frylock](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/frylock/32/50213_2.png) [@frylock](https://discourse.julialang.org/u/frylock)\
**Post date:** [September 18, 2023, 12:18pm UTC](https://discourse.julialang.org/t/definition-of-an-integral-function-whose-argument-is-the-upper-limit-of-integration/103946/2 "2023-09-18T12:18:01Z")

</div>

Just for the sake of clarity, _this_ integral?

f(x) = \int\_0^x \frac{u^2 du}{(e^{u^2 + 16} + 1)^{3/2}}

If so, note that in Markdown, the `$$` syntax must be like a paragraph mark on a line above and below the LaTeX. I’ll also take a stab at solving it (never used [Integrals.jl](https://docs.sciml.ai/Integrals/stable/tutorials/numerical_integrals/) before):

```julia
using Integrals
f(u, p) = u^2 / (exp(u^2 + 16) + 1)^(3/2)
prb(from, to) = solve(IntegralProblem(f, from, to), QuadGKJL()).u
9.105638710911127e-12

```

Or, you could compute a few representative points in your range of interest and interpolate between them?

---

<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:** [September 18, 2023, 2:01pm UTC](https://discourse.julialang.org/t/definition-of-an-integral-function-whose-argument-is-the-upper-limit-of-integration/103946/3 "2023-09-18T14:01:55Z")

</div>

> [@aburousan](#):
>
> A naive approach is to use a loop and just each time calculate the whole thing.  
> But is there any other way?

See [Evaluate integral on many points (Cubature.jl ?)](https://discourse.julialang.org/t/evaluate-integral-on-many-points-cubature-jl/1723)
