# Numerical Integration with Variable Parameters

So I want to numerically compute the integral of a long complicated expression over a specified domain (in this case an ellipse). I know how to use a Boole function to sample within the ellipse, but I want to pass a list of points within this ellipse into the function and have the integral be evaluated at each of these specific points. An example would be:

$\frac{1}{(x \cos(\theta)+y \sin(\theta))^\frac{5}{2}}$

So I want to integrate over θ from 0 to 2 π and I want to use different points (x, y) within the specified domain when integrating. Can anyone help me with this?

Humm... This integral is zero. So the answer to your question is zero for any x, y

$$\frac{1}{(x \cos(\theta)+y \sin(\theta))^\frac{5}{2}}$$

Clear[theta, x, y];
f = 1/(x Cos[theta] + y Sin[theta])^(5/2);
int = Integrate[f, theta];

int /. theta -> 2 Pi int /. theta -> 0 (int /. theta -> 2 Pi) - (int /. theta -> 0)
(* 0  *)


Update

From comment below that the function used was just an example, here is one way to make a function to use NIntegrate for different x,y values. Changed the original function a little bit

ClearAll[theta, x, y, f];
f[{x_?NumericQ, y_?NumericQ}, theta_?NumericQ]:= 1/(x Cos[theta]^2+y Sin[theta])^(5/2);

pts = RandomReal[{0, 1}, {5, 2}];(*10 points*)

int = NIntegrate[Evaluate@f[#, theta], {theta, 0, 2 Pi}] & /@ pts This is a made up function just for illustration. Replace your actual function by f above. If this still not what is being asked, please feel free to follow up.

• Or divergent... Feb 11, 2014 at 4:33
• I'm sorry if I was unclear, but that isn't the actual function. The actual function is honestly too long to type, how did you get mathematica output directly into your post? Once I know that I can just post the result directly Feb 11, 2014 at 4:55
• @Nasser Cool, that is helpful. Thank you. So does random real just choose a random set of ten points in your example? What if I want to create a grid of a specified resolution in the plane, and then evaluate the integral at each of these grid points? Feb 11, 2014 at 15:19
• Let me comment that the approach depends strongly on the concrete form of the expression to be integrated. The one above, for example, admits passing to a single parameter: (x Sin[t]+y Cos[t])^5/2==x^5/2*(Sin[t]+z*Cos[t])^5/2where z=y/x. If this (or at least, something like this) is the case, the problem becomes especially simple. Aug 29, 2014 at 20:02