Skip to main content
replaced http://mathematica.stackexchange.com/ with https://mathematica.stackexchange.com/
Source Link

NIntegrate owns the attribute HoldAll:

Attributes@NIntegrate
(* {HoldAll, Protected} *)

However, when reading this answerthis answer, I surprisingly noticed that at least in the following case the 1st argument of NIntegrate is actually evaluated!:

NIntegrate[BesselJ[9/2, x], {x, 1, 2}] // Trace

enter image description here

So my question is, does NIntegrate always evaluates its 1st argument? If the answer is Yes, what's the meaning of this design, why not simply use HoldRest?

NIntegrate owns the attribute HoldAll:

Attributes@NIntegrate
(* {HoldAll, Protected} *)

However, when reading this answer, I surprisingly noticed that at least in the following case the 1st argument of NIntegrate is actually evaluated!:

NIntegrate[BesselJ[9/2, x], {x, 1, 2}] // Trace

enter image description here

So my question is, does NIntegrate always evaluates its 1st argument? If the answer is Yes, what's the meaning of this design, why not simply use HoldRest?

NIntegrate owns the attribute HoldAll:

Attributes@NIntegrate
(* {HoldAll, Protected} *)

However, when reading this answer, I surprisingly noticed that at least in the following case the 1st argument of NIntegrate is actually evaluated!:

NIntegrate[BesselJ[9/2, x], {x, 1, 2}] // Trace

enter image description here

So my question is, does NIntegrate always evaluates its 1st argument? If the answer is Yes, what's the meaning of this design, why not simply use HoldRest?

Source Link
xzczd
  • 68.4k
  • 9
  • 174
  • 489

NIntegrate evaluates its 1st argument while it has the attribute HoldAll?

NIntegrate owns the attribute HoldAll:

Attributes@NIntegrate
(* {HoldAll, Protected} *)

However, when reading this answer, I surprisingly noticed that at least in the following case the 1st argument of NIntegrate is actually evaluated!:

NIntegrate[BesselJ[9/2, x], {x, 1, 2}] // Trace

enter image description here

So my question is, does NIntegrate always evaluates its 1st argument? If the answer is Yes, what's the meaning of this design, why not simply use HoldRest?