Lösungen / Solutions

1

f[x_] := 
        E^x - 1/5 ;a = -2 ;b = -1 ;x[1] = a ;c = (a + b)/2 ;x[2] = 
        c ;

{f[x], a, b, c, x[1], x[2]}

Plot[f[x], {x, -2, -1}];

a

a1: Testprogramm für Schlaufe

For[n = 1, n <= 5, ++n, Print[n]; Print["Hallo"]]

a2: Handlösung

Remove[x, f, a, b, c]

f[x_] := 
      E^x - 1/5; a = -2 ; b = -1 ; x[1] = 
        a ; c = (a + b)/2 ; x[2] = c ;  
    x[1] = -2; 
    x[n_] := x[n - 1] - 
        f[x[n - 1]]/E^(x[n - 1]);
{x[1], Table[x[n], {n, 2, 5}]} // N // Flatten

a3: Loop

Remove[x, a, b, c, n]

f[x_] := E^x - 1/5; a = -2 ; b = -1 ; x[1] = a; 
    x[1] = -2; x[2] = -1; a = x[1]; b = x[2]; 
    c = (a + b)/2;
Print[N[{0, x[n], x[n + 1], a, b, c}]]; 
    For[n = 1, n ≤ 14, ++n, 
      If[f[a] *f[c] < 0, 
x[n] = a; 
        x[n + 1] = c, 
x[n] = c; x[n + 1] = b;]; 
      c = (x[n] + x[n + 1])/2; a = x[n]; b = x[n + 1]; 
      Print[N[{n, x[n], x[n + 1], a, b, c}]]]

a4: Exakt

FindRoot[f[x] == 0, {x, -2}]

b

Remove[x, a, b, f]

f[x_] := E^x - 1/5;
x[1] = -2; 
    x[n_] := x[n - 1] - f[x[n - 1]]/E^(x[n - 1]); {x[1], 
        Table[x[n], {n, 2, 6}]} // N

c

c2: Handlösung

Remove[x, a, b, f]

x[1] = -2; x[2] = -1; f[x_] := E^x - 1/5; 
    y[a_, b_] := (f[a] b - f[b] a)/(f[a] - f[b] ) // N

x[3] = y[x[1], x[2]]

x[4] = y[x[2], x[3]]

x[5] = y[x[2], x[4]]

x[6] = y[x[2], x[5]]

c2: Loop

Remove[x, a, b, f, c]

f[x_] := E^x - 1/5;
x[1] = -2; x[2] = -1;
a = x[1]; b = x[2]; 
    c = (a f[b] - b f[a])/(f[b] - f[a]);
y[a_, b_] := (f[a] b - f[b] a)/(f[a] - f[b] ) // 
          N;
Print[N[{0, x[1], x[2], a, b, c}]];
For[n = 1, n ≤ 10, ++n, 
      If[f[a] *f[c] < 0, 
x[n] = a; 
        x[n + 1] = c, 
x[n] = c; x[n + 1] = b;]; 
      c = y[x[n], x[n + 1]]; 
a = x[n]; b = x[n + 1]; 
      Print[N[{n, x[n], x[n + 1], a, b, c}]]]

d

Remove[x, a, b, f, c]

f[x_] := E^x - 1/5;
g[x_] := f[x] + x;
Plot[g[x], {x, -2, 2}];

x[1] = -2;
For[n = 1, n ≤ 30, ++n, x[n + 1] = N[g[x[n]]]; 
      Print[{x[n], x[n + 1]}]]

2

a

a i

Remove[f, a, b, c, x, p, a1, a2, a3, b1, b2, b3]

a[1] = 0; a[2] = Pi/6; a[3] = Pi/4; a[4] = Pi/3; 
    a[5] = Pi/2;

f[x_] := Sin[x];
Table[{a[k], f[a[k]]}, {k, 1, 5}]

N[%]

p[x_] := c[4] x^4+c[3] x^3+c[2] x^2+c[
            1] x+c[0]

Table[c[k], {k, 1, 5}]

Table[p[a[k]] == f[a[k]], {k, 1, 5}]

solv = 
      Solve[Table[p[a[k]] == f[a[k]], {k, 1, 5}], 
        Table[c[r], {r, 0, 5}]]

N[%]

p[x_] := 
      c[4] x^4 + c[3] x^3 + c[2] x^2 + c[1] x + c[0]  /. solv

p[x] // N

a ii

Integrate[f[x], {x, 0, Pi/2}]

Integrate[p[x], {x, 0, Pi/2}]

Integrate[p[x], {x, 0, Pi/2}] // N

Integrate[f[x] - p[x], {x, 0, Pi/2}]

Integrate[f[x] - p[x], {x, 0, Pi/2}] // N

a iii

Integrate[(f[x] - p[x])^2, {x, 0, Pi/2}] // N

a iv

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

Gut!

b

b i

p1[x_] := a2 x^2 + a1 x  +  a0; 
    p2[x_] := b2 x^2 + b1 x  + b0;
Solve[{p1[a[1]] == f[a[1]], p1[a[2]] == f[a[2]], 
        p1[a[3]] == f[a[3]], p2[a[3]] == f[a[3]], 
        p2[a[4]] == f[a[4]], p2[a[5]] == f[a[5]]}, {a1, a2, a3, 
        b1, b2, b3} ]

solv1 = 
      Solve[{p1[a[1]] == f[a[1]], p1[a[2]] == f[a[2]], 
            p1[a[3]] == f[a[3]]}, {a0, a1, a2} ] // Flatten

N[%]

solv2 = 
      Solve[{p2[a[3]] == f[a[3]], p2[a[4]] == f[a[4]], 
            p2[a[5]] == f[a[5]]}, {b0, b1, b2} ] // Flatten

N[%]

{p1[a[1]] == f[a[1]], p1[a[2]] == f[a[2]], 
      p1[a[3]] == f[a[3]], p2[a[3]] == f[a[3]], 
      p2[a[4]] == f[a[4]], p2[a[5]] == f[a[5]]}

p1[x_] := a2 x^2 + a1 x  +  a0 /. solv1; Print[p1[x]]; 
    p2[x_] := b2 x^2 + b1 x  + b0 /. solv2; Print[p2[x]];

b ii

Integrate[p1[x], {x, 0, Pi/4}] + Integrate[p2[x], {x, Pi/4, Pi/2}] // 
      N

Integrate[f[x] - p1[x], {x, 0, Pi/4}] + 
      Integrate[f[x] - p2[x], {x, Pi/4, Pi/2}]

b iii

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

c

c i

h0[x_] = 2  x^3 - 3  x^2 + 1;
h1[x_] = x^3 - 2  x^2 + x;
h2[x_] = x^3 - x^2;
h3[x_] = 1 - h0[x];

y0 = f[0];  
    y1 = f[Pi/2]; (m0 = D[f[x], x] /. x -> 0); (m1 = 
        D[f[x], x] /. x -> Pi/2);
pH[x_] := y0 h0[x] + m0 h1[x] + m1 h2[x] + y1 h3[x];  
    pH[x]

{y0, y1, m0, m1}

c ii

Integrate[pH[2 x/Pi], {x, 0, Pi/2}] // N

c iii

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

3

Remove[n, k, s]

s[n_] := Sum[(k - 2) (k^2 - 1), {k, 1, n}];   s[n]

% // Expand

s[100]

4

a

Remove[k, n]

Sum[1/((k - 4) (k - 5)), {k, 1, n}]

Merkt er die Definitionslücken?

Limit[Sum[1/((k - 4) (k - 5)), {k, 1, n}], 
      n -> Infinity]

Limit[Sum[1/((k - 4) (k - 5)), {k, 6, n}], 
      n -> Infinity]

1/((k - 4) (k - 5)) /. k -> 4

1/((k - 4) (k - 5)) /. k -> 5

Sum[1/((k - 4) (k - 5)), {k, 1, n}]

Merkt er die Definitionslücken?

abs.konv. ohne Definitionslücken

b

Remove[k, n]

Sum[(3  k^2 - 2  k + 1)/(2 k^3.5 - 2  k + 2), {k, 1, 
        n}]

Limit[
      Sum[(3  k^2 - 2  k + 1)/(2 k^3.5 - 2  k + 2), {k, 1, n}], 
      n -> Infinity]

Abort!!!   Konv. nach Majorantenkriterium, p-Reihe, abs. konv.

c

Sum[(Sin[x + k Pi] - Cos[x + k Pi])/k, {k, 1, n}]

Konv. nach Abel gleichm.