- #1

member 428835

Hi PF!

I'm numerically integrating over a Green's function along with a few very odd functions. What I have looks like this

but Mathematica throws a "numerical integration converging too slowly" error. How would you treat this?

I can send you the full notebook if you're interested, though that would have to be private. Thanks so much!

EDIT: For completeness the following technique worked in Mathematica and agrees with MCI method outlined in python below, though Mathematica is much much faster: redefine ##G## as a piecewise function, since after all it is (my technique above was to split the integration of ##G## over two separate domaines, one where ##x>y## and one where ##y>x##). Then run NIntegrate over the full square domain. However, under Method specify LocalAdaptive. After much research I decided to use this technique, and no more errors or holdups, all is well.

I'm numerically integrating over a Green's function along with a few very odd functions. What I have looks like this

Code:

```
NIntegrate[-(1/((-1.` + x)^2 (1.` + x)^2 (1.` + y)^2))
3.9787262092516675`*^14 (3.9999999999999907` +
x (-14.99999999999903` +
x (20.00000000000097` - 9.999999999999515` x +
1.` x^3))) (-1.` + y)^2 (4.` + y) BesselJ[4,
304.6888201459785` Sqrt[1 - x^2]] BesselJ[4,
304.6888201459785` Sqrt[1 - y^2]] Cosh[
310.00637327206255` - 304.6888201459785` x] Cosh[
310.00637327206255` - 304.6888201459785` y] /. {x -> xx,
y -> yy}, {xx, yy} \[Element]
ImplicitRegion[
Cos[Cos[\[Alpha]] Cos[\[Pi]/180]] < xx < yy < 1, {xx, yy}]]
```

I can send you the full notebook if you're interested, though that would have to be private. Thanks so much!

EDIT: For completeness the following technique worked in Mathematica and agrees with MCI method outlined in python below, though Mathematica is much much faster: redefine ##G## as a piecewise function, since after all it is (my technique above was to split the integration of ##G## over two separate domaines, one where ##x>y## and one where ##y>x##). Then run NIntegrate over the full square domain. However, under Method specify LocalAdaptive. After much research I decided to use this technique, and no more errors or holdups, all is well.

Last edited by a moderator: