Uebungen in Mathematica

WIR93

Fourier etc.

"Putzmaschine" einsetzen

Remove["Global`*"];

Potenzreihen

Funktion definieren

?Series

f[x_, n_] := Normal[Series[Cos[x], {x, 0, n}]];

Table[f[x, n], {n, 1, 20}]

Animation

Do[
        Plot[Evaluate[{f[x, n], Cos[x]}], {x, -4 Pi, 4  Pi}, 
          PlotRange -> {-4, 4}], {n, 1, 30}];

Fourierreihe an der Geraden

Remove["Global`*"] ;

Beispiel

<< Calculus`FourierTransform`

f1[t_] := t;
f2[t_, n_] := 
        FourierTrigSeries[f1[t], t, n];
f2[t, 4]

f3[x_, n_] := 
        2  Pi f2[t, n] /. 
          t -> x/(2  Pi);
f3[x, 4]

Animation

Do[
        Plot[Evaluate[{f3[x, n], x}], {x, -2 Pi, 2  Pi}, 
          PlotRange -> {-2 Pi, 2  Pi}], {n, 1, 
          30}];

Fourierreihe am Rechteck

Remove["Global`*"] ;

<< Calculus`FourierTransform`

f[x_ /; 0 < x < Pi] := 1 ;
f[x_ /; Pi < x < 2  Pi] := -1 ;
f[x_ /; x == Pi] := 0 ;
f[x_ /; x == 2  Pi] := 0 ;

Plot[f[x], {x, 0, 2  Pi}];

a1[0] = 
        1/(2  Pi) (Integrate[f[x], {x, 0, Pi}] + 
                Integrate[f[x], {x, Pi, 2  Pi}]) // N;

a[0] = 
        1/(2  Pi) (Integrate[1, {x, 0, Pi}] + 
              Integrate[-1, {x, Pi, 2  Pi}]);

a1[k_] := 
      1/Pi (Integrate[f[x] Cos[k x], {x, 0, Pi}] + 
              Integrate[f[x] Cos[k x], {x, Pi, 2  Pi}]) // N; 
    a1[4]

a[k_] := 
      1/Pi (Integrate[1  Cos[k x], {x, 0, Pi}] + 
            Integrate[-1 Cos[k x], {x, Pi, 2  Pi}]); a[6]

b1[k_] := 
      1/Pi (Integrate[f[x] Sin[k x], {x, 0, Pi}] + 
              Integrate[f[x] Sin[k x], {x, Pi, 2  Pi}]) // N; 
    b1[4]

b[k_] := 
      1/Pi (Integrate[1  Sin[k x], {x, 0, Pi}] + 
            Integrate[-1 Sin[k x], {x, Pi, 2  Pi}]); b[7]

Table[a[k], {k, 1, 10}]

Table[b[k], {k, 1, 10}]

myFourier[x_, n_] := 
        a[0] + Sum[
            a[k] Cos[k x] +  b[k] Sin[k x], {k, 1, 
              n}];
myFourier[x, 10]

Animation

Do[
        Plot[Evaluate[{myFourier[x, n], f[x]}], {x, 0, 2  Pi}, 
          PlotRange -> {-2, 2}], {n, 1, 30}];

ani2 = 
        Table[Plot[f[t, c], {t, 0, 2  Pi}, PlotRange -> {-1.5, 1.5}, 
            Ticks -> False], {c, 0, 4  Pi, 2  Pi/4 0.1}];