User:Noah/Segment9

From Computational Statistics (CSE383M and CS395T)
Jump to navigation Jump to search

Segment 9 (6 February 2013)

Comment on Segment

With sufficient assumptions, Mathematica is able to compute the characteristic function of the Cauchy distribution:

In[27]:= $Assumptions = (*$Assumptions &&*) (sig > 0) && (mu \[Element] Reals)

Out[27]= sig > 0 && mu \[Element] Reals

In[28]:= p = 1/(Pi sig) (1 + ((x - mu)/sig)^2)^(-1)

Out[28]= 1/(\[Pi] sig (1 + (-mu + x)^2/sig^2))

In[29]:= Integrate[p, {x, -Infinity, Infinity}]

Out[29]= 1

In[30]:= Integrate[p Exp[I t x], {x, -Infinity, Infinity}]

Out[30]= ConditionalExpression[(
 E^(I mu t) \[Pi] Cosh[sig t] Sign[
    t] - \[Pi] (Cos[mu t] + I Sign[t]^2 Sin[mu t]) Sinh[
    sig t])/(\[Pi] Sign[t]), t \[Element] Reals]

-- it is, however, much less pretty.

Maple can do it too:

> assume(sigma > 0, mu::real, t::real);
> p := 1/(Pi*sigma)*(1 + ((x - mu)/sigma)^2)^(-1);
> int(p,x=-infinity..infinity);
                                      1
> int(p*exp(I*t*x),x=-infinity..infinity);
       1                                                             
       - exp(-sigma t + I t mu) signum(t) (signum(t) - exp(2 sigma t)
       2                                                             

          + exp(2 sigma t) signum(t) + 1)

although if the assumption t::real is ommitted, Maple seems to think the integral is zero, which does not inspire confidence in the answer. (This seems to be true only of Maple 13; Maple 16 simply fails to do the integral without the additional assumption.)

Computation Problems

1. <math>\phi_\mathrm{Normal}(t)=e^{i\mu t-\sigma^2t^2/2}</math>, so if <math>\phi_X(t)=e^{i\mu_X t-\sigma_X^2t^2/2}</math> and <math>\phi_Y(t)=e^{i\mu_Y t-\sigma_Y^2t^2/2}</math>, then <math>\phi_X(t)\phi_Y(t)=e^{i\mu_X t-\sigma_X^2t^2/2+i\mu_Y t-\sigma_Y^2t^2/2}=e^{i(\mu_X+\mu_Y)t-(\sigma_X^2+\sigma_Y^2)t^2/2}</math>

so the sum of normal variables is normal, with mean <math>\mu_X+\mu_Y</math> and variance <math>\sigma_X^2+\sigma_Y^2</math>.

2. <math>p(x)=\beta e^{-\beta x}</math>, so <math>\phi(t)=\int_0^\infty e^{itx}\beta e^{-beta x}\,dx=\beta\int_0^\infty e^{(it-\beta)x}dx</math>

In[62]:= b*Integrate[Exp[(I t - b) x], {x, 0, Infinity}]
Out[62]= ConditionalExpression[b/(b - I t), Im[t] + Re[b] > 0]

<math>=\frac{\beta}{\beta-it}</math> with <math>\Im(t)+\Re(b)>0</math>.

In-class Problems

Team 2, with User:Kai, User:Tameem, Keerthana Kumar's Solution, User:Jzhang, User:Trettels. Won small diamond.