[SciPy-User] characteristic functions of probability distributions
Thu Nov 5 22:19:56 CST 2009
2009/11/5 David Goldsmith <firstname.lastname@example.org>:
> On Mon, Nov 2, 2009 at 12:51 PM, nicky van foreest <email@example.com>
>> Hi Josef,
>> > Second related question, since I'm not good with complex numbers.
>> > scipy.integrate.quad of a complex function returns the absolute value.
>> > Is there a numerical integration function in scipy that returns the
>> > complex integral or do I have to integrate the real and imaginary
>> > parts separately?
>> You want to compute \int_w^z f(t) dt? When f is analytic (i.e.,
>> satisfies the Cauchy Riemann equations) this integral is path
>> independent. Otherwise the path from w to z is of importance. You
>> might like the book Visual Complex Analysis by Needham for intuition.
> Furthermore, if f is analytic in an (open) region R homotopic to an (open)
> disc, then the integral (an integer number of times) around *any* _closed_
> path wholly in R is identically equal to zero; there's a similar statement
> (though the end value is a multiple of 2ipi) if f has only poles of finite
> order in R. (Indeed, these properties should be used to unit test any
> numerical complex path integration routine.) Are any of your paths closed?
This may well be a red herring. It happens fairly often (to me at
least) that I want to integrate or otherwise manipulate a function
whose values are complex but whose independent variable is real.
Such a function can arise by substituting a path into an analytic
function, but there are potentially many other ways to get such a
thing - for example you might choose to represent some random function
R -> R2 as R -> C instead. Even if it's obtained by feeding a path
into some function from C -> C, it happens very often that that
function isn't analytic - say it involves an absolute value, or
involves the complex conjugate.
There are definitely situations in which all the clever machinery of
analytic functions can be applied to integration problems (or for that
matter, contour integration may be the best way available to evaluate
some complex function), but there are also plenty of situations where
what you want is just a real function whose values happen to be
complex numbers. (Or vectors of length n for that matter.) But I don't
think that any of the adaptive quadrature gizmos can handle such a
case, so you might be stuck integrating the real and imaginary parts
If you *are* in a situation where you're dealing with an analytic
function, then as long as you're well away from its poles and your
path is nice enough, you may find that it's very well approximated by
a polynomial of high degree, which will let you use Gaussian
quadrature, which can very easily work with complex-valued functions.
The Romberg integration might even work unmodified.
>> > Thanks,
>> > Josef
>> > _______________________________________________
>> > SciPy-User mailing list
>> > SciPy-User@scipy.org
>> > http://mail.scipy.org/mailman/listinfo/scipy-user
>> SciPy-User mailing list
> SciPy-User mailing list
More information about the SciPy-User