Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I'm having trouble solving this integral numerically:

Integrand2 :=  I/λ Holo[ξ, η] E^(I (2 π)/λ r)/r
ResultsTable2 = Table[NIntegrate[Integrand2, {ξ, -20, 20}, {η, -20, 20},
      Method -> "MultidimensionalRule"], {x, -15, 15, 5}, {y, -15, 15, 5}]

The function called Holo is modelling an aperture that looks like this:

enter image description here

To put it simply: I'm trying to do Fresnel diffraction with this as the aperture.

My goal is to get a 2D inverse Fourier transform by summing over the entire Holo term (a function of ξ and η). As you can see from the image, it oscillates rapidly, so unless I integrate over a very small area of ξ and η, I get the following error:

NIntegrate::slwcon: Numerical integration converging too slowly; suspect one of the following: singularity, value of the integration is 0, highly oscillatory integrand, or WorkingPrecision too small.

To get a good 2D inverse Fourier transform, I need to have a larger area. Ideally, integrating over 100 by 100 would be good. Is there some kind of method or work around that can make this happen?

I can provide more details if needed. I'm new to Mathematica and to this site, so any answer is appreciated. I can learn from any comments or suggestions you have :)


I guess to make my question a bit clearer: how can I numerically integrate a 2D oscillating function?

share|improve this question

closed as off-topic by Michael E2, m_goldberg, MarcoB, Öskå, Jens Aug 18 at 18:24

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question cannot be answered without additional information. Questions on problems in code must describe the specific problem and include valid code to reproduce it. Any data used for programming examples should be embedded in the question or code to generate the (fake) data must be included." – Michael E2, m_goldberg, MarcoB, Öskå, Jens
If this question can be reworded to fit the rules in the help center, please edit the question.

I'm afraid I can't help with this but providing code for Holo may help you get answers. –  Mr.Wizard Jul 22 '14 at 14:26
You can try to increase the WorkingPrecision by adding the option WorkingPrecision->50 (with 50 just as an example). Some general information about numerical integration, their warning messages, and potential solutions can be found here‌​. Sufficent code to reproduce your problem seems to be necessary to give a more specific answer. –  Karsten 7. Jul 22 '14 at 15:02