Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I would like to calculate the distribution function from the characteristic function. There is a formula given as

$$F_X(x)=\frac{1}{2}+\frac{1}{2\pi}\int_{0}^\infty \frac{e^{i w x}\phi(-w)-e^{-i w x}\phi(w)}{i w}\mbox{d}w$$ Actually, I want to evaluate $F_X(x)$ at some real number $b<0$. I wrote some codes in Mathematica with unfortunately no success. The codes give some results but they seem to be incorrect.

Here are my codes:

opts = {Method -> {Automatic, "SymbolicProcessing" -> None}, AccuracyGoal -> 8}
b = -2;
f1[x_] := PDF[NormalDistribution[2, 2], x]
ff1[\[Omega]_] := InverseFourierTransform[f1[x], x, \[Omega]]
qn1 =1/2 + 1/(2*Pi) NIntegrate[(Exp[I \[Omega] b]*ff1[-\[Omega]] -Exp[-I \[Omega] b]*ff1[\[Omega]])/(I \[Omega]), {\[Omega], 0,Infinity}, Evaluate@opts]
NIntegrate[f1[x], {x, -Infinity, b}]

What I expect is $qn1$ to be equal to the last line of my code. But it just $0$. I cannot see the problem. Perhaps someone can?

Thanks in advance

share|improve this question
up vote 6 down vote accepted

This is already bult into Mathematica

$Assumptions = {s > 0};

dist = NormalDistribution[m, s];

pdf[x_] = PDF[dist, x];

cf[w_] = CharacteristicFunction[dist, w];

pdf[x] == InverseFourierTransform[cf[w], w, x,
   FourierParameters -> {1, 1}] // Simplify


cf[w] == FourierTransform[pdf[x], x, w,
   FourierParameters -> {1, 1}] == 
  Expectation[Exp[I w x], x \[Distributed] dist] //



(cdf[x_] = Integrate[pdf[t], {t, -Infinity, x}]) ==
  CDF[dist, x] // Simplify


For a specific example of deriving the PDF from the characteristic function

dist = NormalDistribution[2, 2];

cf[w_] = CharacteristicFunction[dist, w];

(pdf[x_] = 
    InverseFourierTransform[cf[w], w, x, FourierParameters -> {1, 1}]) == 
  PDF[dist, x] //


(cdf[x_] = Integrate[pdf[t], {t, -Infinity, x}]) ==
  CDF[dist, x] // FullSimplify


pdf /@ Range[-4., 8., 2.]

{0.00221592, 0.0269955, 0.120985, 0.199471, 0.120985, 0.0269955, 0.00221592}

Plot[pdf[x], {x, -4, 8}]

enter image description here

cdf /@ Range[-4., 8., 2.]

{0.0013499, 0.0227501, 0.158655, 0.5, 0.841345, 0.97725, 0.99865}

Plot[cdf[x], {x, -4, 8}]

enter image description here

share|improve this answer
It seems I get $1/2$ for all $x$ not only for $x=-2$. I tried to draw $F_X$ for the given formula and mathematica gave me a constant line on $y=0.5$. – Seyhmus Güngören Jun 21 '14 at 21:52
Specific example added above to demonstrate clearly that this works. – Bob Hanlon Jun 22 '14 at 5:25
Thank you. The problem was about the Fourier parameters, which should have been chosen as $(1,1)$. – Seyhmus Güngören Jun 22 '14 at 11:11
b = -2;
f1[x_] := Evaluate@PDF[NormalDistribution[2, 2], x];
ff1[\[Omega]_] := Evaluate@InverseFourierTransform[f1[x], x, \[Omega]];
(Exp[I \[Omega] b]*ff1[-\[Omega]] - 
   Exp[-I \[Omega] b]*ff1[\[Omega]])/(I \[Omega]) // Simplify

enter image description here

share|improve this answer
Thank you very much for the answer. I used "Evaluate@" so that I can draw a figure out of this formulation. – Seyhmus Güngören Jun 22 '14 at 11:11

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.