# Integration over a (non-parametric) curve defined by indicator function

I want to integrate the real function myFun defined on a 2D plane over the line locus, defined as the solution of a set of equality and inequalities. For instance, let's define

myFun[x_,y_]:= Exp[-(x^2+y^2)]/\[Pi]
locus[x_,y_]:= x>0 && y==0


This is just a simplified version of the general problem, in general we may not be able to esplicitate the line locus in a parametric form (and solve the integral, as in this case, with an appropriate substitution). Consider we can find it implicitly as the intersection of a region (defined by inequalities) with an equality (as given above).

How do I integrate myFun over the set locus? It should be something like

Integrate[
Exp[-(x^2 +
y^2)]/\[Pi] Ind[x,y], {x, -\[Infinity], +\[Infinity]}, {y, \
-\[Infinity], +\[Infinity]}]


with Ind[x,y] an indicator function which restrict the integration on the correct set. This function probably involves Boole and DiracDelta function. For example, in this case it works

Integrate[
Integrate[
Exp[-(x^2 + y^2)] Boole[
x > 0] DiracDelta[
y]/\[Pi], {y, -\[Infinity], +\[Infinity]}], {x, -\[Infinity], +\
\[Infinity]}]


but it is just because we could "solve" the line locus. (NOTE the order of the variable - if swapped it does not work.)

But what about the general case? For example, what if the 2D plane is the complex plane and I have the (not necessarily straight) line

locus[x_,y_]:= Re[(x + I y)^2+(3 + I 5)]>0 && Im[(x + I y)^2+(3 + I 5)]==0

• In version 10 you can integrate over a region. Have a look at ImplicitRegion. – b.gates.you.know.what Oct 27 '14 at 11:52
• I see that Integrate[ Exp[-(Abs[z]^2)]/[Pi], {z} [Element] ImplicitRegion[Re[z] > 0 && Im[z] == 0, {z}]] works, but not Integrate[ Exp[-(Abs[z]^2)]/[Pi], {z} [Element] ImplicitRegion[ Re[(3 + I 5) z^2] > 0 && Im[(3 + I 5) z^2] == 0, {z}]] Any hint? – Nicola Oct 27 '14 at 12:14
• In principle this question is a duplicate of Finding length of intersection of two surfaces – Artes Oct 27 '14 at 12:14
• I really don't get it why Integrate[ Exp[-(Abs[z]^2)]/[Pi], {z} [Element] ImplicitRegion[Re[(3 + I 5) + z] > 0 && Im[(3 + I 5) + z] == 0, z]] can't be solved. – Nicola Oct 27 '14 at 12:41
• A first comment is that ImplicitRegion expects real variables. – b.gates.you.know.what Oct 27 '14 at 13:12

Your second example is still simple enough :

Reduce[(3 + x^2 - y^2 > 0) && (5 + 2 x y == 0), {x, y}, Reals] // ToRadicals
(* (x < -Sqrt[-(3/2) + Sqrt[17/2]] || x > Sqrt[-(3/2) + Sqrt[17/2]]) && y == -(5/(2 x)) *)


therefore the integral is

Integrate[myFun[x, -(5/(2 x))], {x, -Infinity, -Sqrt[-(3/2) + Sqrt[17/2]]}] +
Integrate[myFun[x, -(5/(2 x))], {x, Sqrt[-(3/2) + Sqrt[17/2]], Infinity}]
(* (1 + Erf[Sqrt[-5 + Sqrt]] + E^10 Erfc[Sqrt[5 + Sqrt]])/(2 E^5 Sqrt[\[Pi]]) *)

• I appreciate the help, but the point is to not solve locus, but to put it implicicly. Locus and myFun are just MWE. – Nicola Oct 27 '14 at 12:16

One needs to use ComplexExpand to constrain the variables x,y to be Real in the expression of locus[x+I y] -- for some unknown reasons the conditions && x \[Element] Reals && y \[Element] Reals are not enough.

Here's the final code

myFun[z_] := Exp[-(Abs[z]^2)]/\[Pi]
locus[z_] := Re[z^2 (3 + I 5)] > 0 && Im[z^2 (3 + I 5)] == 0
Integrate[myFun[x + I y], {x, y} \[Element] ImplicitRegion[ComplexExpand[locus[x + I y]], {x, y}]]