Lösungen/Solutions/F2S1Ue/Ex14

L = Lektion/ Leçon   -- Sprechstunde / heures de consultation
W = Work / Arbeit / Travail
A=Anhang/Annexe/Appendice

Ueb/Ex 1      W

<< Graphics`Graphics`

<< Statistics`DescriptiveStatistics`

tb = {{153, 1}, {154, 1}, {155, 2}, {156, 3}, {157, 3}, {158, 5}, {159, 
          6}, {160, 4}, {161, 5}, {162, 7}, {163, 5}, {164, 5}, {165, 
          6}, {166, 7}, {167, 5}, {168, 5}, {169, 6}, {170, 5}, {171, 
          6}, {172, 4}, {173, 3}, {174, 2}, {175, 3}, {176, 1}, {177, 
          1}, {178, 1}}

s = Sum[tb[[n]][[2]], {n, 1, Length[tb]}]

tb1 = 
      Table[{tb[[k]][[2]], tb[[k]][[1]]}, {k, 1, 
          Length[tb]}]

BarChart[tb1];

tb2 = 
      Table[{tb[[k]][[2]]/s // N, tb[[k]][[1]]}, {k, 
          1, Length[tb]}]

BarChart[tb2];

Remove[p]

p[n_] := 0;
p[n_] := tb2[[n]][[1]]  /; IntegerQ[
            n] &&  0 < n <  178 - 152

{p[0], p[0.5], p[1], p[2], p[3.1]}

plotTab = 
      Table[{tb2[[n]][[2]], p[n]}, {n, 1, 
          Length[tb2]}]

ListPlot[plotTab];

Remove[F]

F[x_] := 0;
F[x_] := 
      Sum[p[n - 152], {n, 153, Floor[x]}] /; Floor[x] > 152

{F[-1], F[1], F[152], F[153], F[154], F[200]}

Plot[F[x], {x, 150, 180}];

2

Remove[u, v, w]

tab21 = 
      Table[u + v + w, {u, 1, 6}, {v, 1, 6}, {w, 1, 6}] // Flatten

<< Statistics`DataManipulation`

freq = Frequencies[tab21]

s = Sum[freq[[n]][[1]], {n, 1, Length[freq]}]

BarChart[freq];

freq2 = 
      Table[{freq[[k]][[1]]/s // 
            N, freq[[k]][[2]]}, {k, 1, Length[freq]}]

BarChart[freq2];

Remove[p, F]

p[n_] := 0;
p[n_] := freq2[[n]][[1]]  /; IntegerQ[
            n] &&  0 < n <  18 - 2

{p[0], p[0.5], p[1], p[2], p[3.1]}

plotTab = 
      Table[{freq2[[n]][[2]], p[n]}, {n, 1, 
          Length[freq2]}]

ListPlot[plotTab];

F[x_] := 0;
F[x_] := Sum[p[n - 2], {n, 3, Floor[x]}] /; Floor[x] > 2

{F[-1], F[1], F[2], F[3], F[4], F[200]}

Plot[F[x], {x, 0, 20}];