# subtlety of self-defined function and its evaluation [duplicate]

I wrote a simple code as follows

f[x_,y_]:=NIntegrate[x+z,{z,0,1}];
g[x_,y_]:=NIntegrate[y+z,{z,0,1}];
VectorPlot[{f[x,y],g[x,y]},{x,0,1},{y,0,1}]


then Mathematica shall give the right result of the vector field. But it also gives extra warning messages which puzzle me so much. They are of the same type as follows

NIntegrate::inumr: The integrand x+z has evaluated to non-numerical values for all sampling points in the region with boundaries {{0,1}}. >>


It seems that NIntegrare cannot calculate an expression with some un-specific symbol.
But I just think that VectorPlot, just like other command, such as Plot, shall hold the expression of NIntegrate un-evaluate until it get the specific values of variables x and y. Such warning message shall not appear.
In fact, the command DensityPlot or Plot has no such problems. For example,

DensityPlot[{f[x,y],g[x,y]},{x,-1,1},{y,-1,1}]


## marked as duplicate by bbgodfrey, Kuba♦, C. E., Szabolcs, Mr.Wizard♦Feb 6 '15 at 15:54

• change the definitions of f and g to include the PatternTest: i.e., f[x_?NumericQ, y_?NumericQ] := ... – kglr Feb 6 '15 at 14:22