![]() ![]() This is common: mathematics often forces Mathematica to express a real result in terms of complex numbers. The symbolic indefinite integral is quite a beast, and includes imaginary terms. In any case, I doubt that a straight-up integrator would never return a result with an imaginary component. The help page for NIntegrate indicates that it looks for singularities at the boundaries. It seems that possibly Mathematica has gotten itself into a bit of trouble by relying on its symbolics here. Its the best I can think of.įinally: Dont quadrature packages usually have ways of dealing with infinities? A quick look at my old copy of Numerical Recipes, as well as my even older copy of the HP-15C Advanced Functions Handbook (now theres a reference for you) indicate that this is true. My approach for that is to compute the characteristic functions at discrete points, then inverse DFT. Apparently my only hope is to get some plots of the first few PDFs, say, for up to six summed sines. I had thought that there would be a small chance to avoid that problem, at least on the numerical side, by defining my fSine function using 2 when doing the inverse Fourier transform, attempting to get the PDF for sums of more than two sines. ![]() One trouble here is that the underlying 1/(*Sqrt) has Integrate tries to give you a symbolic solution, but it doesn't really apply a particular definition of "integration" to a particular definition of "function". However, using operations like Convolve and FourierTransform in place of explicit integrals, you'd push it harder in that direction. By feeding HeavisidePi to Integrate, you're hinting that's what you want. That kind of problem often works better in the domain of "generalized functions". I have a fallback method that doesnt do the convolutions. Sometimes those will be wrong.įWIW this example comes out of finding the PDF for a sum of random sine variablesconvolution. I'd guess that the branch cut issue that apparently troubles the symbolic calculation must seem like a whack-a-mole game to the Mathematica developers: I don't believe there is any known algorithm here, so it must involve a lot of heuristics. I just to be sure that further processing does not assume that the imaginary part is guaranteed to be zero. So, even if the cancellation seems perfect, Mathematica throws in a 0. And then, the numerical approximation itself involves complex numbers. If you ask for an approximate result, it's very hard to automatically deduce that the very large imaginary values just beyond the branch points don't matter. ![]() One trouble here is that the underlying 1/(\*Sqrt) has branch points at ☑. Ill send a bug reportat least the symbolic version should get fixed. Seems like Mathematica should clean up after itself better, wrt the small imaginary part. Finance, Statistics
0 Comments
Leave a Reply. |