Message Boards Message Boards

0
|
6929 Views
|
6 Replies
|
5 Total Likes
View groups...
Share
Share this post:

Numerical integration of double integral with two variables

Posted 3 years ago

I am trying to numerically integrate the following double integral in MATHEMATICA. This question has also been asked at Mathematica Stackexchange

mathematica_expression

where $Im$ is the imaginary part of the expression, $i$ is the imaginary number, $x$ and $y$ are variables while $a$, $b$, $c$ and $Q$ are constants greater than $0$.

Here is my attempt to solve this.

a = 3
b = 0.0137
c = 0.0023
Q = 6
NIntegrate[Im[Exp[-I x c + b (i x y/(y^a - I x))]]/x, {x, 0, \[Infinity]}, {y, 0, Q}, AccuracyGoal -> 10]

Is this the correct way of applying numerical integration with more than one variable? I am getting an error when I run this expression which reads as "evaluated to non-numerical values for all sampling points in the \region with boundaries {{[Infinity],0.},{0,6}}.

Can anyone please guide me to correct the implementation of the expression given above.

6 Replies
Posted 3 years ago

Since x and y are Real, ComplexExpand may be able to help

a=3;b=0.0137;c=0.0023;Q=6;
NIntegrate[ComplexExpand[Im[Exp[-I x c+b (I x y/(y^a-I x))]]/x], {x,0,Infinity},{y,0,Q},AccuracyGoal->10]

returns

 -8.79547

but warns it was not able to obtain 10 digits of accuracy near x==0.

Dividing the integral into two parts

a=3;b=0.0137;c=0.0023;Q=6;
NIntegrate[ComplexExpand[Im[Exp[-I x c+b(I x y/(y^a-I x))]]/x],{x,1/10,Infinity},{y,0,Q},AccuracyGoal->10]+
NIntegrate[Im[Exp[-I x c+b(I x y/(y^a-I x))]]/x,{x,0,1/10},{y,0,Q},AccuracyGoal->10]

returns

-8.79548+0. I

with no warning, but I would study the accuracy of that carefully

POSTED BY: Bill Nelson
Posted 3 years ago

Bill, That is very nice. I will remember that!

POSTED BY: David Keith
Posted 3 years ago

When you simultaneously cross-post the same question (https://mathematica.stackexchange.com/questions/229514/numerical-integration-of-double-integral-with-two-variables), you should mention that in both posts.

POSTED BY: Jim Baldwin

Thank you for your response, I have incorporated the changes recommended. However, I still am not getting an error when I run this script which reads as "evaluated to non-numerical values for all sampling points in the \region with boundaries {{[Infinity],0.},{0,6}}.

a = 3
b = 0.0137
c = 0.0023
Q = 6
NIntegrate[
 Im[Exp[-I x c + b (I x y/(y^a - I x))]]/x, {x, 0, \[Infinity]}, {y, 
  0, Q}, AccuracyGoal -> 10]
Posted 3 years ago

With the code change above, I do not get the non-numerical error. However, the NIntegrate reports the integral as not converging. Dealing with convergence of multidimensional integrals is tricky. It could be that the integrand is oscillatory or contains singularities, or that it in fact does not converge.

POSTED BY: David Keith
Posted 3 years ago

exp should be Exp and i should be I. Mathematica is case sensitive. Also make sure there is a space between two variables which are being multiplied.

POSTED BY: David Keith
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract