I need to find the minimum of a function f(t) = int g(t,x) dx over [0,1]. What I did in mathematica is as follows:

f[t_] = NIntegrate[g[t,x],{x,-1,1}]
FindMinimum[f[t],{t,t0}]

However mathematica halts at the first try, because NIntegrate does not work with the symbolic t. It needs a specific value to evaluate. Although Plot[f[t],{t,0,1}] works perferctly, FindMinimum stops at the initial point.

I cannot replace NIntegrate by Integrate, because the function g is a bit complicated and if you type Integrate, mathematica just keep running...

You can get an exact answer and completely avoid the heavy lifting of the numerical integration, as long as Mathematica can do symbolic integration of g[t,x] w.r.t x and then symbolic differentiation w.r.t. t. A less trivial example with a more complicated g[t,x] including polynomial products in x and t:

-1, @phadej, my apologies for this late comment, but I just ran across this. Unfortunately, your mathematics are incorrect as g[x,t]==0 most likely will not occur where f[t]==0. A simple counter example is Sin[x+t], and plotting ContourPlot[Evaluate[{# == 0, D[Integrate[#, {x, 0, 1}], t]==0}], {x, 0, 1}, {t, -5, 5}] & @ Sin[x + t] shows that there are regions in {x,t} space where g[t,x]!= D[Integrate[g[t,x]],t]. So, while it may work in special circumstances, e.g. g[x,t]==T[t]X[x] or g[x,t]==T[t]+X[x], it cannot be generally applied.
–
rcollyerNov 10 '10 at 15:30