0
$\begingroup$

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}] 
$\endgroup$

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

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • $\begingroup$ change the definitions of f and g to include the PatternTest: i.e., f[x_?NumericQ, y_?NumericQ] := ... $\endgroup$ – kglr Feb 6 '15 at 14:22
  • 1
    $\begingroup$ Check out support.wolfram.com/kb/12502 and this $\endgroup$ – Szabolcs Feb 6 '15 at 15:48

Browse other questions tagged or ask your own question.