Say I would like to do the integral using quadgk. There are 2 caveats, however. Quoting from the Julia manual "These quadrature rules work best for smooth functions within each interval, so if your function has a known discontinuity or other singularity, it is best to subdivide your interval to put the singularity at an endpoint." My function does have singularities (i.e. poles) inside of the integration contour, and it is not clear to me how I should split the interval. Am I missinterpreting this? The other issue is that quadgk seems to only accept function of one variable, wheres mine are 2-variable functions.
On Thursday, July 17, 2014 7:53:38 PM UTC+2, Steven G. Johnson wrote: > > > > On Thursday, July 17, 2014 9:19:04 AM UTC-4, Andrei Berceanu wrote: >> >> I should perhaps mention that this is part of a bigger scheme, to first >> find all the poles of G(x,y)/F(x,y) and then use the residue theorem for >> solving a complex integral of the type >> integral( G(x,y)/F(x,y), (x,y)) >> > > Unless F(x,y) is very special (e.g. a polynomial), I suspect that it would > be much faster to just do the integral. Since you have analytic > functions, 1d/contour integration is very efficient (with an appropriate > algorithm, e.g. the built-in quadgk function) unless you have poles lying > very close to your integration contour (and even then it is not too bad > with an adaptive scheme like quadgk.) > > In contrast, finding *all* the zeros of an arbitrary analytic function is > hard, usually harder than integrating it unless you have a good idea of > where the zeros are. In general, it's not practical to guarantee that you > have found all the zeros unless you can restrict your search to some finite > portion of the complex plane. For finding the roots of analytic functions > inside a given contour, some of the best algorithms actually involve doing > a sequence of integrals ( > http://www.chebfun.org/examples/roots/ComplexRoots.html) that are just as > hard as your original integral above. So, you might as well just do the > integral to begin with. > >
