Skip to main content
2 of 2
added 37 characters in body
MarcoB
  • 67.7k
  • 18
  • 96
  • 198

Getting Part::partd and Part::partw messages in the following example

sol1[t_?NumericQ] := FindRoot[{a + b - t == 0, a - b - 1 == 0}, 
   {{a, 0.80, 0.95}, {b, 0.95, 2}}];

a0[t_] := sol1[t][[1, 2]]; 
b0[t_] := sol1[t][[2, 2]];
f[t_] := 5 + a0[t] - b0[t]^2;

Print[sol1[1][[1, 2]]];

max0 := NMaximize[f[t], t];
Print[max0];

max1 := FindMaximum[f[t], {t, 2}];
Print[max1];

Plot[f[t], {t, 0, 5}]