MathGroup Archive 2004

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Trouble : simple stuffs for beginner

In article <c8f236$d3l$1 at>,
 Julien MARY <julien.mary at> wrote:

>    I am defining :
> 	g[x_] := Sum[
>      Integrate[(-1)^k(2k - t)(2k - 1 < x <= 2k + 1)E[-(t - x)^2/2],
>        t], {k, -Infinity, Infinity}]

Mathematica is not yet smart enough to understand such a syntax for 
piecewise functions. 

> To be clear, it the convolution of  arcsin(sin(x))/2Pi with exp(-x²/2)

I obtain

  ArcSin[Sin[t]] = (-1)^k (t - k Pi)

for (k - 1/2) Pi <= t <= (k + 1/2) Pi. Hence the piecewise integral is

  int[k_][x_] = Integrate[(-1)^k (t - k Pi) Exp[-(t - x)^2 / 2],   
    {t, (k - 1/2) Pi, (k + 1/2) Pi}]

which Mathematica can compute in closed-form. Then, you need to sum over 
all the pieces. Here is the (symmetric) partial sum:

  g[n_][x_] := Sum[int[k][x], {k, -n, n}]

Mathematica cannot compute the infinite sum in closed-form (and I 
suspect no simple closed-form exists).

> 	The I want to plot g[x] with Plot[g[x],{x,-10,10}] and Mathematica is 
> insulting me. 

Is it really insulting you? Anyway,

  Plot[Evaluate[g[15][x]], {x,-10,10}]

does what you want (you will see little change as you increase the 
number of terms in the partial sum). Note the use of Evaluate to compute 
the sum _once_ prior to plotting. Also, observe that the result is "very 
close" to 1.94 Sin[x] (i.e., other Fourier components are very small).

An alternative derivation uses the Fourier Sin expansion of 

  ArcSin[Sin[t]] ==
    Sum[(-1)^(k+1) Sin[(2k-1) t]/(k-1/2)^2,{k,1,Infinity}]/Pi 

Then the convolution integral can be obtained by computing

  SetOptions[Integrate, GenerateConditions -> False];

  Integrate[Exp[I (2k-1) t] Exp[-(t-x)^2 / 2], {t,-Infinity,Infinity}]

and taking the imaginary part of the result

  Simplify[ComplexExpand[Im[%]], k > 0]


  Sqrt[2 Pi] Sin[(2k-1) x] Exp[-(2k-1)^2 / 2]

Hence the (partial sums of the) convolution are

  h[n_][x_] := Sqrt[2/Pi] Sum[(-1)^(k+1)/(k-1/2)^2 Sin[(2k-1) x] * 
                    Exp[-(2k-1)^2 / 2],{k,1,n}]

which we plot as

  Plot[Evaluate[h[15][x]], {x,-10,10}]


Paul Abbott                                   Phone: +61 8 9380 2734
School of Physics, M013                         Fax: +61 8 9380 1014
The University of Western Australia      (CRICOS Provider No 00126G)         
35 Stirling Highway
Crawley WA 6009                      mailto:paul at 

  • Prev by Date: Re: RE : Bug in O[x]
  • Next by Date: Filename in notebook windows limited to 8 chars
  • Previous by thread: Re: Trouble : simple stuffs for beginner
  • Next by thread: Re: From C/C++ to Mathematica?--> 5.0 documentaion?