How to calculate a double integral inside the domain of intersection of two functions?
6 views (last 30 days)
I want to calculate a double integral of an arbitrary function (f) inside the region of intersection of two other functions. Please suggest a fast and convenient approach.
JJ = 5;
II = 5;
W = rand(II, JJ);
syms x y
w = sym('0');
f = sym('0');
w =w+W(i, j)*legendreP(i-1, x)*legendreP(j-1, y);
f =f+(legendreP(i-1, x)*legendreP(j-1, y))^2;
H = 0.5*(1+tanh(w));
%F = double integral of f inside the domain of intersection of two functions as
%the region showed in pic
Bjorn Gustavsson on 17 Jan 2023
Edited: Bjorn Gustavsson on 17 Jan 2023
Perhaps you can use Green's theorem (you'd be very lucky if you could - but if you were to be that lucky in this case it would be a shame to miss it). That would take you from a sum of integrals over rather complicated regions to perhaps simpler integrals around the boundaries of the region. That would be nice. Given the shape of your function it doesn't seem entirely improbable.
For the case where you actually have to perform the calculations you would use the steps suggested in @Torsten's comment.