Lösungen

1

Remove["Global`*"]

f[t_] := 
        t^2  /; (-Pi/2  ≤   t  &&  
              t  ≤  Pi/2);
f[t_] := 
        f[Pi/2]  /; (Pi/2  <   t  &&  
              t  ≤  3 Pi/2);
f[t_] := 
        f[t + 2  Pi]  /; (-5 Pi/2  ≤   t  &&  
              t  <  -Pi/2);
f[t_] := 
        f[t - 2  Pi]  /; (3  Pi/2  <   t  &&  
              t  ≤  7  Pi/2);
f1[t_] := t^2;
f2[t_] := f1[Pi/2];

Plot[f[t], {t, -Pi/2, 3  Pi/2}];

Plot[f[t], {t, -5 Pi/2, 7  Pi/2}];

a Koeffizienten

T = 2 Pi;
cc  = -Pi/2;
ω  =  2 Pi/T;
a[0] := 
        2/T NIntegrate[f[t], {t, cc, cc + T}];
a[k_] := 
        2/T NIntegrate[
            f[t] Cos[k ω t], {t, cc, 
              cc + T}];
b[k_] := 
        2/T NIntegrate[
            f[t] Sin[k ω t], {t, cc, 
              cc + T}];
  
ff[t_] := 
        a[0]/2 + 
          Sum[a[n] Cos[n ω t] + b[n] Sin[n ω t], {n, 1, 
              Infinity}];
ff[t_, h_] := 
        a[0]/2 + 
            Sum[a[n] Cos[n ω t] + b[n] Sin[n ω t], {n, 1, 
                h}]  // Chop;
  
  
g[t_] := (ff[u, 4] /. u -> t) // Simplify;  g[t]

a1[0] := 
        2/T (Integrate[f1[t], {t, cc, cc + T/2}] + 
              Integrate[
                f2[t], {t, cc + T/2, 
                  cc + T}]);
a1[k_] := 
        2/T (Integrate[f1[t] Cos[k ω t], {t, cc, cc + T/2}] + 
              Integrate[
                f2[t] Cos[k ω t], {t, cc + T/2, 
                  cc + T}]);
b1[k_] := 
        2/T ( Integrate[f1[t] Sin[k ω t], {t, cc, cc + T/2}] + 
              Integrate[
                f2[t] Sin[k ω t], {t, cc + T/2, 
                  cc + T}]);

ff1[u_, h_] := 
        a1[0]/2 + 
            Sum[a1[n] Cos[n ω  u] + 
                b1[n] Sin[n ω  u], {n, 1, h}]  // 
          Chop;
g1[
          t_] := (ff1[u, 4] /. u -> t);
g1[t] // Simplify

g1[t_] := (ff1[u, 4] /. u -> t) // 
          N;
g1[t]

a1[0]

{1.6449340668482262`,  
      2 1.6449340668482262`}

(* 
      ak *)  {-1.2732395447351628, -0.5`, +0.047157020175376325`, 0.125`}

{0, 0, 0, 0}

b

Abs[g[Pi/2] - f[Pi/2]]

Abs[g1[Pi/2] - f[Pi/2]]

Abs[g[3  Pi/2] - f[3  Pi/2]]

Abs[g1[3  Pi/2] - f[3  Pi/2]]

c:   Gute Näherung schon mit wenigen Koeffizienten

Plot[Evaluate[{f[t], g[t]}], {t, -Pi/2, 3  Pi/2}];

Plot[Evaluate[{f[t], g1[t]}], {t, -Pi/2, 3  Pi/2}];

d

f[Pi/2]

N[%]

a1[0]

{Cos[Pi/2], Cos[2 Pi/2], Cos[3 Pi/2], Cos[4 Pi/2]}

\(\(In\ π\^2\/4 == π\^2\/6 + \(\((\(-\(π\^2\/2\)\) + 1\/2\ \((\(-8\) + π\^2)\))\)\ *0\)\/π - 
              1\/2\ *\((\(-1\))\) + \(\((π\^2\/6 + 1\/54\ \((8 - 9\ π\^2)\))\)*0\)\/π + 
              1\/8*1 +  ... \) . 
lässt\ sich\ π\ auf\ eine\ Seite\ der\ Gleichung\ bringen\ und\ so\ isolieren, \ 
    also\ berechnen\)

ff1[u, Infinity]

2

Remove["Global`*"]

g1[t_] := -t;

a Koeffizienten

T = 2;
cc  = -1;
ω  =  2 Pi/T;
a[0] := 
        2/T Integrate[g1[t], {t, cc, cc + T}];
a[k_] := 
        2/T Integrate[
            g1[t] Cos[k ω t], {t, cc, 
              cc + T}];
b[k_] := 
        2/T Integrate[
            g1[t] Sin[k ω t], {t, cc, 
              cc + T}];
  
gg[t_] := 
        a[0]/2 + 
          Sum[a[n] Cos[n ω t] + b[n] Sin[n ω t], {n, 1, 
              Infinity}];
gg[t_, h_] := 
        a[0]/2 + 
            Sum[a[n] Cos[n ω t] + b[n] Sin[n ω t], {n, 1, 
                h}]  // Chop;
  
  
h4[t_] := (gg[u, 4] /. u -> t) // Simplify;  
    ExpandAll[h4[t]]

h20[t_] := (gg[u, 20] /. u -> t) // 
          Simplify;

ω  =  2 Pi/T

h4N[t_] := h4[t] // N // Simplify; h4N[t]

{-0.6366197723675814`, +0.3183098861837907`, -0.2122065907891938` , +0.15915494309189535`}

Plot[Evaluate[{g1[t], h4N[t]}], {t, -1, 1}];

b

3 h4[t] + 2 //  ExpandAll

g2[t_] := 3 g1[t] + 2;
h2[t_] := 3 h4N[t] + 2 // Simplify;   {g2[t], h2[t]}

{2.`, -1.909859317102744`, +0.954929658551372`, -0.6366197723675814`, +0.477464829275686`}

Plot[Evaluate[{g2[t], h2[t]}], {t, -1, 1}];

c   Integration der Fourierreihe!

Expand[h4[u]]

Integrate[Evaluate[Expand[h4[u]]], {u, 0, t}] // TrigReduce // 
      Expand

g3[t_] := Integrate[g1[u], {u, 0, t}];  g3[t]

g31[t_] := Integrate[h4N[u], {u, 0, t}];  g31[t]

{-0.16183244609540065`, +0.20264236728467558` , -0.050660591821168895` , +0.022515818587186175` , -0.012665147955292224`}

Plot[Evaluate[{g3[t], g31[t]}], {t, -1, 1}];

d   Differentiation führt zu keiner Konstante: Oszillation, Gibbs!

g1'[t]

h4N'[t]

Plot[
        Evaluate[{ g1'[t], h4N'[t]}], {t, -1, 1}];

Plot[
        Evaluate[{ g1'[t], h20'[t]}], {t, -1, 1}];

3

Remove["Global`*"];

a

Wir verwenden zuerst die Skalierung nach der Periode 2 Pi. Das vereinfacht die Rechung etwas.

n=6; w = 2 Pi/n;
{x[0],y[0]}={0 w,2};
{x[1],y[1]}={1 w,2};
{x[2],y[2]}={2 w,3};
{x[3],y[3]}={3 w,2};
{x[4],y[4]}={4 w,3.5};
{x[5],y[5]}={5 w,7};
{x[6],y[6]}={6 w,2};
{x[-1],y[-1]}={-1 w,7};
{x[-2],y[-2]}={-2 w,3.5};
{x[-3],y[-3]}={-3 w,2};
{x[-4],y[-4]}={-4 w,3};
{x[-5],y[-5]}={-5 w,2};
{x[-6],y[-6]}={-6 w,2};

p[k_]:= {x[k],y[k]};
Table[p[k],{k,-(n-1),(n-1)}]

epi=Prepend[Map[Point,Table[p[k],{k,0,n}]],PointSize[0.03]]

epi1 = 
      Prepend[Map[Point, Table[{k, y[k]}, {k, 0, n}]], 
        PointSize[0.03]]

r = E^(-I 2 Pi/n);
c[s_]:= 1/n Sum[y[k] r^(s k),{k,-Floor[(n-1)/2],n-1-Floor[(n-1)/2]}];
Table[c[s],{s,0,10}]//N

a   c[s]

{3.25`, 0.20833333333333373` + 
        0.7938566201357355` I, -0.6249999999999993` + 
        0.649519052838329` I, -0.41666666666666663`, -0.6249999999999993` - 
        0.649519052838329` I, 0.20833333333333373` - 0.7938566201357355` I, 
      3.25`, 0.20833333333333373` + 
        0.7938566201357355` I, -0.6249999999999993` + 
        0.649519052838329` I, -0.41666666666666663`, -0.6249999999999993` - 0.649519052838329` I}

fS[t_]:=Sum[c[k] E^(I k t),{k,-Floor[(n-1)/2],n-1-Floor[(n-1)/2]}];
fS[t]

% // ExpandAll

fS1[s_] := fS[s 2  Pi/n];
fS1[s]

% // ExpandAll

% // N // Simplify

fS[t]//ExpToTrig

% // ExpandAll

% // N

fS1[s] // ExpToTrig

% // ExpandAll

% // N

fS1[s] // ExpToTrig // Chop

{3.25`, {0.41666666666666746` , -1.2499999999999987`}, {-0.41666666666666663` , -1.587713240271471` , -1.299038105676658`} , {-0.41666666666666663`}}

b

Plot[Re[fS[t]],{t,0,2Pi}];

Plot[Im[fS[t]],{t,0,2Pi}];

Man beachte im letzten Plot die Grösse der Amplitude.

Plot[{Re[fS[t]],Sin[t/2]},{t,0,2Pi},Epilog->epi];

Wie man sieht, liegen die verwendeten Punkte auf der Linie von Sin[t/2]. Der Fehler (z.B. grosser Imaginäranteil stammt vermutlich davon, dass so nur wenige Koeffizienten berechnet werden können.)

Plot[{Re[fS1[s]]}, {s, 0, n}, Epilog -> epi1];

c

Re[fS1[3.5]]

d

linInt[t_] := 
        2 + (t - 3) (3.5 - 2);
Plot[linInt[t], {t, 2, 5}];

linInt[3.5] - Re[fS1[3.5]]

4

Remove["Global`*"];

a  Skizze

f[t_] := 
        Cos[2 t/3]  + Sin[0.4 t - 1];
Plot[f[t], {t, 0, 100}];

b

{2 t/3,  2 t/3 + 2  Pi}

{2 t/3,  2 t/3 + 2  Pi} 3/2  // ExpandAll

{4/10 t,  4/10 t + 2  Pi}

{4/10 t,  4/10 t + 2  Pi} 5/2  // ExpandAll

T = LCM[5 , 3 ] π

?GCD

0 == Simplify[f[t + 15 Pi] - f[t]] // Chop

T = 15 Pi;

c

cc  = 0;

ω  =  2 Pi/T;
a[0] := 
        2/T Integrate[f[t], {t, cc, cc + T}];
a[k_] := 
        2/T Integrate[
            f[t] Cos[k ω t], {t, cc, 
              cc + T}];
b[k_] := 
        2/T Integrate[
            f[t] Sin[k ω t], {t, cc, 
              cc + T}];
c[k_] := 
        1/T Integrate[
            f[t] E^(-I k ω t), {t, cc, 
              cc + T}];
ff[t_] := 
        a[0]/2 + 
          Sum[a[n] Cos[n ω t] + b[n] Sin[n ω t], {n, 1, 
              Infinity}];
ff[t_, h_] := 
        a[0]/2 + 
          Sum[a[n] Cos[n ω t] + b[n] Sin[n ω t], {n, 1, 
              h}];
ffk[t_] := 
        Sum[c[n] E^(I n ω t), {n, -Infinity, 
            Infinity}];
ffk[t_, h_] := 
        Sum[c[n] E^(I n ω t), {n, -h, 
            h}];
ff[t, 6] // Chop

Abs[f[10] - ff[10, 6]]

d

Plot[Evaluate[{f[t],  ff[t, 6] // Chop}], {t, 0, T}];

Die Genauigkeit der beiden Funktionen f und ff6 ist anhand der Skizze nicht mehr unterscheidbar.

Plot[
        Evaluate[{f[t],  ff[t, 6] // Chop}], {t, 0, 2  T}];

e

ff2[t_, h_] := 
        a[0]^2/2 + 
          Sum[a[n]^2 Cos[n ω t] + b[n]^2 Sin[n ω t], {n, 
              1, h}];

Plot[
        Evaluate[{f[t],  ff2[t, 6] // Chop}], {t, 0, 30  Pi}];

Plot[
        Evaluate[{f[t]^2,  ff[t, 6] // Chop}], {t, 0, 30  Pi}];

Evaluate[(f[t]^2 -  ff[t, 6])/ff[t, 6] // Chop] /. 
      t -> 15.

Plot[
        Evaluate[(f[t]^2 -  ff[t, 6])/ff[t, 6] // Chop], {t, 0, 
          T}];

Der Ausdruck schwanktje nach t. Die maximale absolute relative Differenz ist etwa 3.

5  Varianten!

a

Remove["Global`*"];

f[x_] := Cos[2  x] + I Sin[2  x]

FourierTransform[f[x], x, ω] // Simplify

1/ (Sqrt[2 π]) FourierTransform[f[x], x, ω] // 
      Simplify

(Sqrt[2 π]) FourierTransform[f[x], x, ω] // 
      Simplify

b

Remove["Global`*"];

f[x_] := Sin[2  x] + I Cos[2  x]

FourierTransform[f[x], x, ω] // Simplify

1/ (Sqrt[2 π]) FourierTransform[f[x], x, ω] // 
      Simplify

(Sqrt[2 π]) FourierTransform[f[x], x, ω] // 
      Simplify

c

Remove["Global`*"];

fHat[x_] := Cos[2  ω] + I Sin[2  ω]

InverseFourierTransform[fHat[x], ω, x] // Simplify

(Sqrt[2 π]) InverseFourierTransform[fHat[x], ω, x] // 
      Simplify

1/(Sqrt[2 π]) InverseFourierTransform[fHat[x], ω, x] // 
      Simplify

1/ (Sqrt[2 π]) FourierTransform[(Sqrt[2 π]) InverseFourierTransform[fHat[x], ω, x], x, ω] // 
      Simplify

(E^(2 I ω))  //  
      ExpToTrig

6  Varianten!

Remove["Global`*"];

a

H[x_] := UnitStep[x];
Plot[H[x], {x, -3, 3}];

f[x_] := Pi (H[x + Pi] - H[x - Pi]);
Plot[f[x], {x, -5, 5}];

FourierTransform[f[x], x, ω] // Simplify

1/ (Sqrt[2 π]) FourierTransform[f[x], x, ω] // 
      Simplify

(Sqrt[2 π]) FourierTransform[f[x], x, ω] // 
      Simplify