Items tagged with double-integral

Feed

This post is the answer to this question.

The procedure named  IntOverDomain  finds a double integral over an arbitrary domain bounded by a non-selfintersecting piecewise smooth curve. The code of the procedure uses the well-known Green's theorem.

Each section in the border should be specified by a list in the following formats :    
1. If a section is given parametrically, then  [[f(t), g(t)], t=t1..t2]    
2. If several consecutive sections of the border or the entire border is a broken line, then it is sufficient to set vertices of this broken line  [ [x1,y1], [x2,y2], .., [xn,yn] ] (for the entire border should be  [xn,yn]=[x1,y1] ).

Required parameters of the procedure:  f  is an expression in variables  x  and  y , L  is the list of all the sections. The sublists of the list  L  must follow in the positive direction (counterclockwise).

The code of the procedure:

restart;
IntOverDomain := proc(f, L) 
local n, i, j, m, yk, yb, xk, xb, Q, p, P, var;
n:=nops(L);
Q:=int(f,x);  
for i from 1 to n do 
if type(L[i], listlist(algebraic)) then
m:=nops(L[i]);
for j from 1 to m-1 do
yk:=L[i,j+1,2]-L[i,j,2]; yb:=L[i,j,2];
xk:=L[i,j+1,1]-L[i,j,1]; xb:=L[i,j,1];
p[j]:=int(eval(Q*yk,[y=yk*t+yb,x=xk*t+xb]),t=0..1);
od;
P[i]:=add(p[j],j=1..m-1) else
var := lhs(L[i, 2]);
P[i]:=int(eval(Q*diff(L[i,1,2],var),[x=L[i,1,1],y=L[i,1,2]]),L[i,2]) fi;
od; 
add(P[i], i = 1 .. n); 
end proc:

 

Examples of use.

1. In the first example, we integrate over a quadrilateral:

with(plottools): with(plots):
f:=x^2+y^2:
display(polygon([[0,0],[3,0],[0,3],[1,1]], color="LightBlue"));  
# Visualization of the domain of integration
IntOverDomain(x^2+y^2, [[[0,0],[3,0],[0,3],[1,1],[0,0]]]);  # The value of integral

 

2. In the second example, some sections of the boundary of the domain are curved lines:

display(inequal({{y<=sqrt(x),y>=sin(Pi*x/3)/2,y<=3-x}, {y>=-2*x+3,y>=sqrt(x),y<=3-x}}, x=0..3,y=0..3, color="LightGreen", nolines), plot([[t,sqrt(t),t=0..1],[t,-2*t+3,t=0..1],[t,3-t,t=0..3],[t,sin(Pi*t/3)/2,t=0..3]], color=black, thickness=2));
f:=x^2+y^2: L:=[[[t,sin(Pi*t/3)/2],t=0..3],[[3,0],[0,3],[1,1]], [[t,sqrt(t)],t=1..0]]:
IntOverDomain(f, L);

 

3. If  f=1  then the procedure returns the area of the domain:

IntOverDomain(1, L);  # The area of the above domain
evalf(%);

 

IntOverDomain.mw

Edit.

Dear all,

I would like to evaluate a double integral numerically. The integrand is a complicated function of the variables beta and s, with complex values. The computation lasts for decades without obtaining a result.

I was wondering whether there exists subroutines / methods / tricks that could be helpful to accelerate the integration process. I have attached a Maple script of the double integral of interest. Rough precision would be fine (4 or 5 digits).

Any help would be highly appreciated.

Thanks

Federiko

Question.mw

How to find the double integral of sin(x^2)*cos(y^2) over the disk of radius R which is centered at the origin? 

Here is my try 

restart; evalf(VectorCalculus:-int(sin(x^2)*cos(y^2), [x, y] = Circle(`<,>`(0, 0), 1), inert), 15);
                       0.722091449378409
identify(%);
                       0.722091449378409

 

Hi, 

I'm solving a 2D grid with some finite-diference methods. The result is a surface, i.e f(x,y) = z. Where X and Y and points on a grid. 

 

I then need to integrate over this grid, i.e

int(f(x,y),[x=0..10, y=0..10]) 

I have tried interpolating the grid. I've used CurveFitting:-ArrayInterpolation() to interpolate points in this 2D space and then integrate over them. 

I'm using a 30x30 grid, but this interpolation scheme takes far too long. The function generated from the ArrayInterpolation creates an interpolation every time a point is evaluated, which I assume is why the integral is very computationally expensive. 

I would like to create a piecewise analytic function from the 2-D grid, perhaps using CurveFitting:-Spline(), however from my understanding this only works for 1D objects? 

Is there any better solution for integrating a 2D numeric grid?

Thanks in advance

How to find the integral
,

assuming k and n  integer?
It is known (McCrea W. H., Whipple F. J. W.Random paths in two and three dimensions, Proc. Roy. Soc. Edinburgh. 1940. V. 60. P. 281–298) that

G(n,n)=2/Pi*sum(1/(2*k-1),k=1..n).

The general case is reduced to the case k=n.
This is not a creature of pure reason: the one appears in electric circuits
(see M. Skopenkov, A. Paharev, A. Ustinov, Through resistor net, Mat. pros. Issue 18 (2014), 33-65, in Russian, http://www.mccme.ru/free-books/matpros/pdf/mp-18.pdf).
I found G(8,8) = 182144/(45045*Pi) in 657.797 s and G(9,9) = 3186538/(765765*Pi) in 4157.687 s on my comp by

restart; s := time():(1/2)*VectorCalculus:-int((1-cos(9*Pi*x)*cos(9*Pi*y))/(sin((1/2)*Pi*x)^2+sin((1/2)*Pi*y)^2), [x, y] = Rectangle(0 .. 1, 0 .. 1)); time()-s;
Mathematica 10.3.0 does G(9,9) in 250.391 s on my comp.

 

I would like integrate and plot the following double integral:

 

I enclosed tryingdf.mw

I've got the following double integral over a region A:

e^(1/x*y)/(y^2)*(x+1)^2 where A={(x,y):1/2<=x*y<=2,1<=x<=3}

to evaluate this:

I've tried :

int6:=int(int(e^(1/x*y)/((y^2)*(x+1)^2),x=1..3),y=(1/2)..(2/3));

since the largest lower bound and smallest upper bound for y based on 1/2<=xy<=2 are 1/2 and 2/3 respectively.

This statement however, only evaluates the inner integral; is my approach correct?

Hello everyone, I am having problem while trying to evaluate the double integral written in the file attached double_inegral.mw. Please help me out.
Many thanks in advance.

Hi,

I am trying to solve following expression

int(int((1-exp(-5.5/cos(x)))*sin(x), x = 0 .. arctan(300*cos(y)+sqrt(12.25-90000*sin(y)^2))), y = 0 .. Pi)

But I am not getting results.

Please help me!!!

Thanks

hi.i am a problem for solve analytic double integration as blow,plese help me....Thanks alot

int(int((2*gamma*cos(psi)/(D-r*sin(theta)*sin(phi))-2*gamma*cos(psi)/(D+r*sin(theta)*sin(phi)))*r^2*cos(theta)*sin(phi), r = 0 .. L), phi = 0 .. Pi)

 

I UPLOAD THIS INTEGRAL AS FOLLOW;;;;;int.mw

int(int((2*gamma*cos(psi)/(D-r*sin(theta)*sin(phi))-2*gamma*cos(psi)/(D+r*sin(theta)*sin(phi)))*r^2*cos(theta)*sin(phi), r = 0 .. L), phi = 0 .. Pi)

``


Download int.mw

How to find the integral

1/(4*Pi)*int((cos(t)-sin(s)-cos(t)*sin(s))/(3+2*(cos(t) - sin(s) - cos(t)*sin(s)))^(3/2),[t=0..2*Pi,s=0..2*Pi])?

Its geometric interpretation suggests the answer is -1. Maple finds the inner integrals both over t and s, but Maple cannot directly find the iterated integrals.

Page 1 of 1