Lösungen / Statistik 2/02

Remove["Global`*"]

1.

<< Statistics`DiscreteDistributions`

bdist[n_] := BinomialDistribution[n, 1/6]

pdf[n_, x_] := PDF[bdist[n], x];
cdf[n_, x_] := CDF[bdist[n], x];

lpPDF[n_] := 
        ListPlot[Table[{x, pdf[n, x]}, {x, 0, n}], 
          PlotStyle -> {PointSize[0.03]}];
lpCDF[n_] := 
        ListPlot[Table[{x, cdf[n, x]}, {x, 0, n}], 
          PlotStyle -> {PointSize[0.03]}];

Table[lpPDF[n], {n, 1, 20}];

Table[lpCDF[n], {n, 1, 20}];

2.

p = 0.002;  μ[n_] :=  n* p; 
f[x_, n_] := (μ[n]^x)/(x!)* 
        E^(-μ[n])

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

f[0, 100]

f[0, 1000]

Plot[f[0, n], {n, 0, 5}];

Plot[f[0, n], {n, 0, 2000}];

pD100[x_] := PDF[PoissonDistribution[μ[100]], x]

{pD100[0], f[0, 100]}

{pD100[3], f[3, 100]}

Table[{k, pD100[k]}, {k, 0, 5}]

g1 = 
        ListPlot[Evaluate[Table[{k, pD100[k]}, {k, 0, 5}]], 
          PlotStyle -> {PointSize[0.03]}];

g2 = 
        Plot[f[x, 100], {x, 0, 5}, PlotRange -> {0, 1}];

Plot[f[x, 100], {x, 0, 5}, PlotRange -> {0, 1}, 
        Epilog -> {PointSize[0.03], 
            Map[Point, Table[{k, pD100[k]}, {k, 0, 5}]]}];

3.

a

n = 2000; p = 1/365;   μ[n_] :=  n* p;  
    f[x_, n_] := (μ[n]^x)/(x!)* 
        E^(-μ[n]);
Plot[f[x, n], {x, 0, 15}];

Table[f[x, n], {x, 0, 15}] // N

f[2, n] // N

b

1 - f[1, n] - f[0, n] // N

4.

t1 = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 
          11, 12, 13};

    t = {57, 203, 383, 525, 532, 408, 273, 139, 45, 27, 10, 4, 2, 
        0}

t2 = Transpose[{t1, t}]

s = Apply[Plus, t]

μ4 = 
      Sum[t1[[k]] t[[k]], {k, 1, Length[t]}]/s  // N

f4[x_] := (μ4^x)/(x!)* 
          E^(-μ4);

Plot[f4[x], {x, 0, 15}];

t3 = t/s

t4 = Transpose[{t1, t3}] // N

Plot[f4[x], {x, 0, 15}, 
        Epilog -> {PointSize[0.03], Map[Point, t4]}];

5.

f5[Nn_, M_, n_, x_] := 
      Binomial[M, x] Binomial[Nn - M, n - x]/Binomial[Nn, n]

Table[f5[11 + 3, 11, 4, x], {x, 0, 4}] // N

6.

Nn = 1000; M = 20; n = 100; p = M/Nn;

bdist[n_, p_] := 
        BinomialDistribution[n, p];
pdf[n_, x_, p_] := PDF[bdist[n, p], x];

ListPlot[Table[{x, pdf[n, x, p]}, {x, 0, n}], 
        PlotStyle -> {PointSize[0.03]}];

p1 = 
        ListPlot[Table[{x, pdf[n, x, p]}, {x, 0, 10}], 
          PlotStyle -> {PointSize[0.03]}];

ListPlot[Table[{x, f5[Nn, M, n, x]}, {x, 0, 10}], 
        PlotStyle -> {PointSize[0.03]}];

p2 = 
        ListPlot[Table[{x, pdf[n, x, p] - f5[Nn, M, n, x]}, {x, 0, 10}], 
          PlotStyle -> {PointSize[0.03]}];

Show[p1, p2];

7.

Nn = 100; M = 100*0.1; n = 10;

f5[Nn, M, n, 0] // N

1 - f5[Nn, M, n, 0] // N

1 - f5[Nn, 100*(0.1 - 0.01), n, 0] // N

1 - f5[Nn, 100*(0.1 - 0.05), n, 0] // N

1 - f5[Nn, 100*(0), n, 0] // N

Plot[1 - f5[Nn, k, n, 0], {k, 0, M}];

8.

Remove["Global`*"]

Konvention: 2 cm +/- 0.02 cm = 2.00 cm +/- 0.02 cm

d1 = 2.00;  Δd1 = 0.02;
p1 = 11.2;  Δp1 = 0.1;
VpSec1 = 5.00;  ΔVpSec1 = 
      0.01;
ρ1 = 0.83;  Δρ1 = 
      0.01;

d2 = 1.20;  Δd2 = 0.02;
p2                ;  Δp2              ;
VpSec2 = 
      VpSec1;  ΔVpSec2 = ΔVpSec1;
ρ2 = 0.83; Δρ2 = 
      0.01;

solv1 = Solve[v1 d1^2/4 Pi == VpSec1, {v1}] // Flatten

v1 = v1 /. solv1

v[VpSec_, d_] := VpSec/d^2 4/Pi

Δv1 = (Abs[
                D[v[VpSec, d], VpSec]] ΔVpSec1 + 
            Abs[D[v[VpSec, d], d]] Δd1) /. {VpSec -> VpSec1, 
          d -> d1}

solv2 = Solve[v2 d2^2/4 Pi == VpSec2, {v2}] // Flatten

v2 = v2 /. solv2

Δv2 = (Abs[
                D[v[VpSec, d], VpSec]] ΔVpSec2 + 
            Abs[D[v[VpSec, d], d]] Δd2) /. {VpSec -> VpSec2, 
          d -> d2}

solv3 = 
      Solve[p1/ρ1 + (v1^2)/2 == p2/ρ2 + (v2^2)/2, {p2}] // 
        Flatten

p2 = p2 /. solv3

solv3 = 
      Solve[p[1]/ρ[1] + (v[1]^2)/2 == 
            p[2]/ρ[2] + (v[2]^2)/2, {p[2]}] // Flatten

pN[p_, v_, ρ_, 
        vN_, ρN_] := (((2 p + (v^2) ρ - (vN^2) ρ) ρN)/(2 ρ))

Δp2 = 
      Abs[D[pN[p, v, ρ, vN, ρN], 
              p]] Δp1 + 
Abs[
            D[pN[p, v, ρ, vN, ρN], 
              v]] Δv1 + 
Abs[
            D[pN[p, v, ρ, 
                vN, ρN], ρ]] Δρ1 + 
Abs[
            D[pN[p, v, ρ, vN, ρN], 
              vN]] Δv2 + 
Abs[
            D[pN[p, v, ρ, 
                vN, ρN], ρN]] Δρ2

Δp2 /. {p -> p1, 
        v -> v1, ρ -> ρ1, 
        vN -> v2, ρN -> ρ2}

Interessant: 
Bei p1=11.2 ist Δp1=0.1.  
Bei p2=4.14 hingegen ist Δp2=0.90.