Example1

Question 1.6.7. from Matrix Analysis & Applied Linear Algebra




f[x_] := Sin[Pi*x]
f[x]

myList[x_, x0_, x1_, x2_, x3_] := x0 + x x1 + x^2*x2 + x^3*x3
myList[x, x0, x1, x2, x3]


rExpandedVars[x_, x0_, x1_, x2_, x3_] := Integrate[(f[x] - myList[x, x0, x1, x2, x3])^2, {x, 0, 1}]
rExpandedVars[x, x0, x1, x2, x3]

dX0[x_, x0_, x1_, x2_, x3_] := D[rExpandedVars[x, x0, x1, x2, x3], x0]
dX1[x_, x0_, x1_, x2_, x3_] := D[rExpandedVars[x, x0, x1, x2, x3], x1]
dX2[x_, x0_, x1_, x2_, x3_] := D[rExpandedVars[x, x0, x1, x2, x3], x2]
dX3[x_, x0_, x1_, x2_, x3_] := D[rExpandedVars[x, x0, x1, x2, x3], x3]

dX0[x, x0, x1, x2, x3]
dX1[x, x0, x1, x2, x3]
dX2[x, x0, x1, x2, x3]
dX3[x, x0, x1, x2, x3]

Expand[dX0[x, x0, x1, x2, x3]]
Expand[dX1[x, x0, x1, x2, x3]]
Expand[dX2[x, x0, x1, x2, x3]]
Expand[dX3[x, x0, x1, x2, x3]]




set the results eual to 0 and it gives the extremum. That we are looking for.


Comments