Problem Set 6 Individual

I6-1

a.) Trigonometric Series

Let's take the period to be 2λ - (i.e. f(x) = f(x + 2λ)).  These equations are right from the text.  Note that the limits of the definite integral are supposed to be the period length boundaries.  However, since the integral of the function is 0 at every place outside of Abs(L/2), the simplified integral is presented here.  If this were not the case, the integrals would have to be taken over the limits (-λ, λ).

Clear["Global`*"]

a0[
          L_, λ_] := (1/(2 λ)) (∫_(-L/2)^(L/2))(1/
                  L) \[DifferentialD]x;
an[L_, λ_] := (1/λ) (∫_(-L/2)^(L/2))(1/
                L) Cos[((n π x)/λ)] \[DifferentialD]x
bn[L_, λ_] := (1/λ) (∫_(-L/2)^(L/2))(1/
                L) Sin[((n π x)/λ)] \[DifferentialD]x

Because this is an even function, the bn terms = 0.  Also the following direct integration shows a0 = the inverse of the period, here 2λ.

(1/(2 λ)) (∫_(-L/2)^(L/2))(1/
              L) \[DifferentialD]x

Therefore our final Fourier series will only be made up of cosine, or an, terms.

FSeries[L_, λ_, 
        end_]  :=  (1/(2  λ)) +  (∑_(n = 1)^end) an[
              L, λ] Cos[n Pi x/λ]

Example = FSeries[2, 3, 10]

Plot[Example, {x, -10, 10}];

A few things to note and to "check".  In this plot L =2, λ = 3.  It's a good idea to check that the height of the spikes should be the function itself, 1/L.  Secondly, the period should be 2λ, as I stated at the outset.  Indeed it is.  The easiest way to check periods is to find the distance between the middle of two consecutive peaks or the middle of two consecutive valleys.

Another way to solve the problem without the use of user-defined functions.

Another way to solve this could be without using user-defined functions.

Clear["Global`*"]

a02 = (1/(2 λ)) (∫_(-L/2)^(L/2))(1/
                L) \[DifferentialD]x
an2 = (1/λ) (∫_(-L/2)^(L/2))(1/
                L) Cos[((n π x)/λ)] \[DifferentialD]x

ToBeSummedUp  =  an2 Cos[n Pi x/λ]

MostofSum  =  Sum[ToBeSummedUp,  {n, 1, 10}]

The total sum is a0 and the summed series.

TotalFSum  =  a02  +  MostofSum

Let's choose our values as we did in the first solution.  Then we'll plot.

L = 2;
λ = 3;
Plot[TotalFSum, {x, -10, 10}];

This is exactly what we got the first way.  Congratulations to us!

b.) Complex Series

See Part A for the explanation behind the integral limits.

cn[L_, λ_] := (1/(2 λ)) (∫_(-L/2)^(L/2))(1/
                L) Exp[-I n Pi x/λ] \[DifferentialD]x

ComplexFSeries[L_, λ_, 
        end_]  :=   (∑_(n = -end)^end) cn[
            L, λ] Exp[I n Pi x/λ]

ComplexExample = ComplexFSeries[2, 3, 10]

Plot[ComplexExample, {x, -10, 10}];

Looks the same as in Part A.

Another way to solve the problem without the use of user-defined functions.

Here's an alternate way to solve this problem without the use of user-defined functions.

Clear[L, λ]

cn2  =  (1/(2 λ)) (∫_(-L/2)^(L/2))(1/
                L) Exp[-I n Pi x/λ] \[DifferentialD]x

ToBeSummed  =  
      cn2 Exp[(I n Pi x)/λ]

Because n≠0 in the denominator, I split up the summed terms to "MinusPlot" for negative values of n and "PlusPlot" for positive values.  To find the value at 0, take a limit.

MinusPlot  =  Sum[ToBeSummed, {n, -10, -1}]

PlusPlot  =  Sum[ToBeSummed, {n, 1, 10}]

NEqualsZero  =  Limit[ToBeSummed,  n ->  0]

Now we'll call L and λ the same values as our first solution and we'll add the two partial series together with the case where n=0.

L = 2;
λ = 3;

TotalPlot  =  NEqualsZero  +  MinusPlot  +  PlusPlot

Perfect, now let's graph it again.

Plot[TotalPlot, {x, -10, 10}];

So there are two ways to solve this problem.  And a final check is that this plot looks like the plot in Part A, since we're graphing the same function.  They are the same plot!

I6-2

Again, since this is an even function, we simply find the Fourier cosine transform.  The book gives the following equation, and since the integral is 0 everywhere except between -L/2 and L/2, we have:

Clear["Global`*"]

\(Autobot[
        L_] := \((\((2/Pi)\)\^ .5)\)\ \(∫\_0\%\(L/2\)\ \((1/
                L)\)\ Cos[w\ x] \[DifferentialD]x\)\)

Autobot[L]

To check our Fourier cosing transform, let's solve by way of the standard Fourier transform.

\(Testing\  = \ \((1/\((2\ Pi)\))\)\^ .5\ \(∫\_\(\(-L\)/2\)\%\(L/2\)\((1/
                L)\)\ Exp[\(-I\)\ w\ x] \[DifferentialD]x\)\)

Great!  Now, we'll make an arbitrary L of 3:

OptimusPrime  =  Autobot[3]

Plot[OptimusPrime, {w, -50, 50},  
        PlotRange -> {- .2, 1.2}];

To check, let's find the inverse Fourier transform which should bring us back to the original function.  L will be set again to 3.

\(Decepticon[
        L_] := \((2/Pi)\)\^ .5\ \(∫\_0\%30 Autobot[L]\ Cos[
              w\ x]\ \[DifferentialD]w\)\)

Megatron = Decepticon[3]

Plot[Megatron, {x, -10, 10}, 
        PlotRange -> {-0.2, 1.2}];

Looks like the original function.  L = 3, so 1/L = 1/3, the value of the function between -L/2 and L/2 .