分析一盎司...
你可以得到一個確切的答案,完全避免了數值積分的重任,只要Mathematica可以做克符號積分[T, x] wrt x然後符號分化wrt噸。具有更復雜克以下簡單的例子[T,X],包括多項式的產品在x和T:
g[t_, x_] := t^2 + (7*t*x - (x^3)/13)^2;
xMax = 1; xMin = -1; f[t_?NumericQ] := NIntegrate[g[t, x], {x, xMin, xMax}];
tMin = 0; tMax = 1;Plot[f[t], {t, tMin, tMax}];
tNumericAtMin = t /. FindMinimum[f[t], {t, tMax}][[2]];
dig[t_, x_] := D[Integrate[g[t, x], x], t];
Print["Differentiated integral is ", dig[t, x]];
digAtXMax = dig[t, x] /. x -> xMax; digAtXMin = dig[t, x] /. x -> xMin;
tSymbolicAtMin = Resolve[digAtXMax - digAtXMin == 0 && tMin ≤ t ≤ tMax, {t}];
Print["Exact: ", tSymbolicAtMin[[2]]];
Print["Numeric: ", tNumericAtMin];
Print["Difference: ", tSymbolicAtMin [[2]] - tNumericAtMin // N];
其結果:
⁃Graphics⁃
Differentiated integral is 2 t x + 98 t x^3/3 - 14 x^5/65
Exact: 21/3380
Numeric: 0.00621302
Difference: -3.01143 x 10^-9
請參見[this](http://stackoverflow.com/questions/6990285/mathematica-evaluation-order-during-numerical-optimisation-of-black-box-function/7020539#7020539)答案指針文檔頁面,解釋這種行爲。 – 2011-08-17 08:53:03