# What is the best way to manipulete with the fourier images of the functions

**URL:** <https://discourse.julialang.org/t/what-is-the-best-way-to-manipulete-with-the-fourier-images-of-the-functions/36976>\
**Category:** General Usage\
**Tags:** math\
**Created:** [April 3, 2020, 4:46pm UTC](https://discourse.julialang.org/t/what-is-the-best-way-to-manipulete-with-the-fourier-images-of-the-functions/36976 "2020-04-03T16:46:35Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![misha\_mikhasenko](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/misha_mikhasenko/32/5060_2.png) [@misha\_mikhasenko](https://discourse.julialang.org/u/misha_mikhasenko)\
**Post date:** [April 3, 2020, 4:46pm UTC](https://discourse.julialang.org/t/what-is-the-best-way-to-manipulete-with-the-fourier-images-of-the-functions/36976/1 "2020-04-03T16:46:35Z")

</div>

I would like to calculate a combined probability density function from components using their Fourier images,

g(x) = \int\_{-\infty}^{\infty} \mathrm{d}t \, f(t)^N\, e^{-ixt}, \qquad N=100

f(t) = \int\_{-1}^{1} \rho\_0(x)\,\exp(i\,t\,(\log I\_1(x) - \log I\_1(x)) 

The `f(t)` integral works nicely with `QuadGK` package, then I tried `Ìnterpolate(f)` and used `quadgk` again.

```julia
using QuadGK
using Interpolations

I1(x) = 0.4
I2(x) = 2/5-3/10*(1-x^2)
#
ρ(x) = 1/2
const N = 50
#
f(t) = quadgk(x->ρ(x)*exp(1im*t*(log(I1(x))-log(I2(x)))), -1, 1)[1]
#
itp = let tv = range(-5,5,length=100)
    interpolate((tv, ), f.(tv), Gridded(Linear()))
end
#
g(v) = quadgk(t->real(itp(t)^N*exp(-1im*v*t)), -2, 2)[1] # range is cut to speed up the calculations

```

I am looking for is a better way of doing the same thing.  
Can someone point me in the right direction (not sure if FFTW can be used here)?
