Lösungen/Solutions/F2S1Ue/Ex7

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

<< Statistics`DescriptiveStatistics`;
<< Statistics`DataManipulation`;
<< Graphics`Graphics`;

Ueb/Ex 1

t1 = Table[{n, 1/6}, {n, 1, 6}]

t11 = t1 /. {x1_, x2_} -> {x2, x1}

ListPlot[t1];

ListPlot[t1, PlotStyle -> PointSize[0.02]];

BarChart[t1];

Falsch !/ Faux!

BarChart[t11];

sum1[x_] := 
        Sum[t1[[Floor[x]]][[2]], {n, 1, Floor[x]}] /; 
          x ≤ 6;
sum1[x_] := 1 /; x > 6;

{sum1[-2.5], sum1[-1], sum1[0], sum1[0.5], sum1[1], sum1[1.5], 
      sum1[2], sum1[6], sum1[7]}

Plot[sum1[x], {x, -2, 8}];

Ueb/Ex 2

t2 = Table[a + b, {a, 1, 6}, {b, 1, 6}] // Flatten

t21 = Frequencies[t2]

t22 = t21 /. {x1_, x2_} -> {x2, x1/(6^2)}

ListPlot[t22, PlotStyle -> PointSize[0.02]];

sum2[x_] := 
        Sum[t22[[Floor[n - 1]]][[2]], {n, 2, Floor[x]}] /; 
          x ≤ 12;
sum2[x_] := 1 /; x > 12;

Plot[sum2[x], {x, -2, 14}];

Ueb/Ex 3

t3 = 
      Table[a + b + c, {a, 1, 6}, {b, 1, 6}, {c, 1, 6}] // Flatten

t31 = Frequencies[t3]

t32 = t31 /. {x1_, x2_} -> {x2, x1/(6^3)}

ListPlot[t32, PlotStyle -> PointSize[0.02]];

sum3[x_] := 
        Sum[t32[[Floor[n - 2]]][[2]], {n, 3, Floor[x]}] /; 
          x ≤ 18;
sum3[x_] := 1 /; x > 18;

Plot[sum3[x], {x, -2, 20}];

Ueb/Ex 4

max = 30;

t4 = Table[1/2^k, {k, 1, max}]

ListPlot[t4, PlotStyle -> PointSize[0.02]];

sum4[x_] := 
        Sum[t4[[n]], {n, 1, Floor[x]}] /; x ≤ max;
sum4[x_] := 1.000 /; x > max;

Plot[sum4[x], {x, -2, max + 3}];

Ueb/Ex 5

t5 = 
      Table[a + b + c + d, {a, 1, 2}, {b, 1, 2}, {c, 1, 2}, {d, 1, 2}] // 
        Flatten

t51 = Frequencies[t5]

t52 = t51 /. {x1_, x2_} -> {x2, x1/(2^4)}

ListPlot[t52, PlotStyle -> PointSize[0.02]];

sum5[x_] := 
        Sum[t52[[Floor[n - 3]]][[2]], {n, 4, Floor[x]}] /; 
          x ≤ 8;
sum5[x_] := 1 /; x > 8;

Plot[sum5[x], {x, -2, 10}];

Ueb/Ex 6

d = 4; o = 6; t = d + o;

p1d = d/t; 
p1o = o/t;
p2dd = p1d* (d - 1)/(t - 1);
p2od =  p1o*d/(t - 1);
p2do = p1d*o/(t - 1);
p2oo = p1o*(o - 1)/(t - 1);

p1d + p1o

p2dd + p2od + p2do + p2oo

X[0] = p1o*p2oo;
X[1] = p1o*p2od  +  p1d*p2do;
X[2] = p1d*p2dd;

t6 = {X[0], X[1], X[2]}

ListPlot[t6, PlotStyle -> PointSize[0.02]]

sum6[x_] := 
        Sum[t6[[Floor[n + 1]]], {n, 0, Floor[x]}] /; 
          x ≤ 2;
sum6[x_] := t6 . {1, 1, 1} /; x > 2;

Plot[sum6[x], {x, -2, 4}];