By the way, this method (differentiating with respect to a parameter) was often used by the physicist Richard Feynman. In fact, he once made a bet (see Needham's book "Visual Complex Analysis") that he could use this method so solve any integral that other people can do by contour integration. He lost his bet but this seems to be an example of a situation where contour integration does not work (or at least I can't see how to make it work). In fact, I myself thought about using Feynman's method to obtain an elementary expression for this integral, but I forgot to use partial fractions first, so never got anywhere.

However, I doubt that this is how the "other program" does it. I would be interested in seeing what expression the "other program" gives for the indefinite integral. In my opinion, one of the weaknesses of Mathematica's integration is that it does not allow one to choose the method of indefinite integration. Mathematica has an implementation of the Risch algorithm (which always returns an indefinite integral in terms of elementary functions, if such an answer exists) but it often returns answers in terms of special functions. If properly implemented these can have advantages over "elementary" solutions, but the fact that Mathematica does not allow us to choose which method to use means that we can't tell if an elementary antiderivative exists or not. This is also the situation in this case. So, concerning how the "other program" gets the answer, there seem to be two most likely possibilities. One is that it also computes a primitive function (indefinite integral) in terms of special functions (MeierG?) but gets the limits right. The other possibility is that it uses the Risch algorithm to get an elementary anti-derivative.

Andrzej Kozlowski

On 13 Jun 2013, at 08:38, Dr. Wolfgang Hintze <weh@snafu.de> wrote:

> On 11 Jun., 08:23, Andrzej Kozlowski <akozlow...@gmail.com> wrote:>> No, it's similar to:>>>> Integrate[(1 ->> Cos[x])/(x^2*(x^2 - 4*Pi^2)^2), {x, -Infinity, Infinity}]>>>> 3/(32*Pi^3)>>>> On 10 Jun 2013, at 10:11, djmpark <djmp...@comcast.net> wrote:>>>>>>>>> Doesn't this have a singularity at 2 Pi that produces non-convergence? It's>>> similar to:>>>>> Integrate[1/x^2, {x, \[Epsilon], \[Infinity]},>>> Assumptions -> \[Epsilon] > 0]>>>>> 1/\[Epsilon]>>>>> That diverges as epsilon -> 0.>>>>> Are you sure you copied the integral correctly?>>>>> David Park>>> djmp...@comcast.net>>> http://home.comcast.net/~djmpark/index.html>>>>> From: dsmirno...@gmail.com [mailto:dsmirno...@gmail.com]>>>>> If there is a way to calculate with Mathematica the following integral:>>>>> in = -((-1 + Cos[kz])/(kz^2 (kr^2 + kz^2)^2 (kz^2 - 4 \[Pi]^2)^2))>>> Integrate[in, {kz, -Infinity, Infinity}, Assumptions -> kr > 0]>>>>> Another system calculates the same integral instantly. :)>>>>> Thanks for any suggestions.>> Sorry, but I made indeed a calculation error!> Correcting it the partial fraction decomposition leads to Dmitry's> result.> Furthermore, calculating first the indefinite integral and then taking> limits leads to a false result.> Direct calculation of the integral leads to MeierG functions which are> useless because we cannot enter any numerical value.> So, rather than provding the correct result Mathematica comes up with> different false result depending on the method used, and we cannot tel> which one is correct without "research" work.> Summarizing, I need to restate my criticism of Mathematica with> respect to integration (I'm using version 8).>> Regards,> Wolfgang>