I'm trying to perform a numerical integral with an integrand that should not be manipulated with any symbolic preprocessing whatsoever. Consider the following simple test :
test[a_]:=If[NumericQ[a],a*a,Abort[] (*Meaning the parameter a is not numerical*)]
So if the parameter of test
is numerical, this function should only return a*a
. Now if I try to integrate this as follows:
NIntegrate[test[a],{a,-0.5,0.5},Method -> {Automatic, "SymbolicProcessing" -> 0}]
this does not work (it will be aborted). Is there any way around this ? I.e. some option I haven't considered for NIntegrate ?
Note that an easy way to fix this would be to use:
test[a_?NumericQ]:=If[NumericQ[a],a*a,Abort[]]
But I want to avoid using ?NumericQ
since this slows down your numerical integration by a lot...
?NumericQ
speeds up integration a lot. (In your case it may slow it down, but it does not always do so.) $\endgroup$