This question is a follow-up of another one I asked a few days ago. I followed the instructions given in the answer provided by the user that responded. I modified that answer to solve another problem.
The issue now, is with FindMinimum
claiming that the functional value is not a real number when evaluating.
What I intend to do, is to minimize the following functional $$v^T\mathbf A v$$
where $\mathbf A$ is a matrix calculated like this :
phi[t_, k_, h_] := (1/h)^3*
Piecewise[{{(h (1 - k) + t)^2 (h (1 + 2 k) - 2 t), (k - 1) h <= t <=
k*h}, {(h (1 + k) - t)^2 (h (1 - 2 k) + 2 t),
k*h <= t <= (k + 1) h}}];
psi[t_, k_, h_] := (1/h)^3*
Piecewise[{{(t - k*h) (h + t - k*h)^2, (k - 1) h <= t <=
k*h}, {(t - k*h) (h - t + k*h)^2, k *h <= t <= (k + 1)*h}}] ;
phipp[t_, k_, h_] := (1/h)^3*
Piecewise[{{2 (h (1 + 2 k) - 2 t) - 8 (h (1 - k) + t), (k - 1) h <=
t <= k*h}, {-8 (h (1 + k) - t) + 2 (h (1 - 2 k) + 2 t),
k*h <= t <= (k + 1) h}}];
psipp[t_, k_, h_] := (1/h)^3*
Piecewise[{{2 (-h k + t) + 4 (h - h k + t), (k - 1) h <= t <=
k*h}, {-4 (h + h k - t) + 2 (-h k + t),
k*h <= t <= (k + 1) h}}];
alpha[t_, k_, h_] := phi[t, k, h] + phipp[t, k, h];
beta[t_, k_, h_] := psi[t, k, h] + psipp[t, k, h];
T = Pi;
n = 2;
h = T/n;
petitAligne[t_] :=
Table[## &[alpha[t, j, h], h*beta[t, j, h]], {i, 1}, {j, 0, n}];
petitAcolonne[t_] := Transpose@petitAligne[t];
A[t_] = petitAcolonne[t].petitAligne[t]; (*The A matrix*)
and $v$ is the vector I intend to minimize using FindMinimum
. So I tried the following :
ClearAll[fn];
fn[ab_?(VectorQ[#, NumericQ] &)] := {ab}.Integrate[A[t], {t, 0, T}].ab;
FindMinimum[fn[ab], {ab, {0, 1, 0.8, 0.2, 0, -1}},
Method -> {"ConjugateGradient", Method -> "PolakRibiere"}]
which returns the warning
FindMinimum::nrnum: "The function value {0.359283} is not a real number at {ab} = {{0.,1.,0.8,0.2,0.,-1.}}."
note that the value {0.359283}
has no imaginary parts.
This optimization problem is the same as in the previous question, only written in another manner...
The correct answer is $$v=(0,\,1,\,1,\,0,\,0,\,-1)^T$$
What is wrong with this usage of FindMinimum
?
FindMinimum
is for local optimization, constraining the problem was never the intention from the beginning. Maybe the answer to my questions are trivial, unfortunately I fail to see it... – jrojasqu Apr 2 at 13:28