Regression

Solve[{Y == m*X + b, Cov[x, y] == m*Var[x] + b*X}, {m, 
        b}]

daten = {{0, 0}, {4, 0.1}, {7, 0.3}, {8, 0.8}, {9, 2}, {10, 
          10}}

X = (1/6) (∑_(k = 1)^6) daten[[k, 1]]

Y = (1/6) (∑_(k = 1)^6) daten[[k, 2]]

Var[
        x] = (1/6) (∑_(k = 1)^6) daten[[k, 1]]^2

Cov[x, 
        y] = (1/6) (∑_(k = 1)^6) daten[[k, 1]]*
            daten[[k, 2]]

Solve[{Y == m*X + b, Cov[x, y] == m*Var[x] + b*X}, {m, 
        b}]

f = Fit[daten, {1, x}, x]

Tabelle = 
      Table[{daten[[k, 1]], daten[[k, 2]], daten[[k, 1]]^2, 
          daten[[k, 1]]*daten[[k, 2]]}, {k, 6}]

Map[Apply[Plus, #] &, Transpose[Tabelle]]

Map[Apply[Plus, #]/6 &, Transpose[Tabelle]]

plot1 = Graphics[{PointSize[0.03], Map[Point, daten]}]

plot2 = 
      Plot[f, {x, Min[Transpose[daten][[1]]], 
          Max[Transpose[daten][[1]]]}]

Show[plot2, plot1]

Approximation im quadratischen Mittel

f = ((x^4)/(1 + (x^2)))

{a = -1, b = 1}

Plot[f, {x, a, b}, PlotRange -> All]

Gesucht: Beste quadratische Approximation im quadratischen Mittel

ϕ = (∑_(k = 0)^2) c[k] (x^k)

F = (∫_a^b)(((f - ϕ))^2) \[DifferentialD]x

F = FullSimplify[F]

D[F, c[0]]

D[F, c[1]]

D[F, c[2]]

gleichungen = Table[D[F, c[k]], {k, 0, 2}]

sol = 
      Solve[gleichungen == 0, Table[c[k ], {k, 0, 2}]] // 
        FullSimplify

ϕ /. sol

ϕ /. sol // N

Plot[Evaluate[{f, ϕ /. sol}], {x, a, b}, 
      PlotRange -> All]

Gesucht: Beste biquadratische Approximation im quadratischen Mittel

ϕ = (∑_(k = 0)^4) c[k] (x^k)

F = 
      FullSimplify[(∫_a^b)(((f - ϕ))^2) \[DifferentialD]x]

gleichungen = Table[D[F, c[k]], {k, 0, 4}]

sol = 
      Solve[gleichungen == 0, Table[c[k ], {k, 0, 4}]] // 
        FullSimplify

Plot[Evaluate[{f, ϕ /. sol}], {x, a, b}, 
      PlotRange -> All]

Die Taylorreihe hat einen Konvergenzradius1 und kann im Intervall [-1,1] die Funktion nicht gut approximieren:

tay = Normal[Series[f, {x, 0, 4}]]

Plot[{f, tay}, {x, -1, 1}, PlotRange -> All]