2

As a following one of my previous question, I have a function about Z and take an InverseFourierTransform of it as:

K1[Z_] = (3 (1 - 4 Z^2))/(2 (1 + Z^2)^(7/2))
K2[t_] = InverseFourierCosTransform[K1[Z], Z, t] // Simplify

Then, I take K2[t_] back by using FourierCosTransform as:

K3[Z_] = FourierCosTransform[K2[t], t, Z] // Simplify

I also test an alternative way by using FourierCosTransform definition as:

Sqrt[2/Pi]*NIntegrate[K2[t]*Cos[0.1*t], {t, 0, Infinity}, PrecisionGoal -> 3, Method -> {"LocalAdaptive"}, MinRecursion -> 5, MaxRecursion -> 10]

Here I set Z=0.l in Cos[] as a test case.

My question is K3[0.1] gives a value of 1.39071, while the numerical integration is not successful, why and how to handle this situation? My overall goal is to get K2[t_] and carry out numerical integration at any point I need. Many thanks to all your help!

J. M.'s missing motivation
  • 124,525
  • 11
  • 401
  • 574
Fredrich
  • 31
  • 1
  • Maybe: Sqrt[2/Pi]* NIntegrate[K2[t]*Cos[0.1*t], {t, 0, 20}, Method -> {"Trapezoidal", "SymbolicProcessing" -> 0}] ? – Mariusz Iwaniuk May 03 '23 at 11:58
  • Thank you very much for your reply. The basic idea is to truncate the integration domain from Infinity to a "large" number. Is there a mathematically-stringent way without changing Infinity? I notice my originial numerical integration can also get final value by the same truncation, as: Sqrt[2/Pi]* NIntegrate[K2[t]Cos[0.1t], {t, 0, 20}, PrecisionGoal -> 3, Method -> {"LocalAdaptive"}, MinRecursion -> 5, MaxRecursion -> 10] – Fredrich May 03 '23 at 12:37
  • Likely a bug in InverseFourierCosTransform[K1[Z], Z, t]. The integral clearly diverges. The command of Maple 2023 (the analog of InverseFourierCosTransform in Maple) inttrans:-fouriercos(3*(-4*Z^2 + 1)/(2*(Z^2 + 1)^(7/2)), Z, t) results in $$ \frac{\sqrt{2}, t^{2} \left(t \mathrm{BesselK}! \left(3,t\right)+4 \mathrm{BesselK}! \left(1,t\right) t-4 \mathrm{BesselK}! \left(2,t\right)\right)}{10 \sqrt{\pi}}.$$ – user64494 May 03 '23 at 15:40
  • 1
    Checking asymptotics at the endpoints of integration shows that the integral converges. `In[272]:= k1 = (3 (1 - 4 z^2))/(2 (1 + z^2)^(7/2))Cos[tz]; n0 = Normal[Series[k1, {z, 0, 2}, Assumptions -> z > 0]] ninf = Normal[Series[k1, {z, Infinity, 8}, Assumptions -> z > 1000]]

    Out[273]= 3/2 - 3/4 (15 + t^2) z^2

    Out[274]= (45/(2 z^7) - 6/z^5) Cos[t z]`

    – Daniel Lichtblau May 03 '23 at 16:15
  • @DanielLichtblau; There is K2[t] , not K1[t] in the integrand. Look at the results of Plot[1/(5 Sqrt[ 2 \[Pi]]) (t^3 BesselK[3, t] - 16 MeijerG[{{-(1/2)}, {}}, {{0, 2}, {1/2}}, t^2/4])* Cos[0.1*t], {t, 0, 50}] and NIntegrate[(1/(5 Sqrt[2 \[Pi]])) (t^3 BesselK[3, t] - 16 MeijerG[{{-(1/2)}, {}}, {{0, 2}, {1/2}}, t^2/4])* Cos[0.1*t], {t, 0, 500}]. – user64494 May 03 '23 at 16:37
  • @user64494. For Me works fine, It's NOT a Bug. K2 = (t^3 BesselK[3, t])/(5 Sqrt[2 \[Pi]]) - InverseMellinTransform[ MellinTransform[ 8/5 Sqrt[2/\[Pi]] MeijerG[{{-(1/2)}, {}}, {{0, 2}, {1/2}}, t^2/4], t, s], s, t] // FullSimplify; FourierCosTransform[K2, t, Z]. – Mariusz Iwaniuk May 03 '23 at 17:18
  • 1
    @user64494 {Plot[K2*Cos[1/10*t], {t, 0, 50}, PlotRange -> All], Sqrt[2/Pi]*NIntegrate[K2*Cos[1/10*t], {t, 0, Infinity}]} :P – Mariusz Iwaniuk May 03 '23 at 17:23
  • @MariuszIwaniuk: Can you ground InverseMellinTransform@MellinTransform? In other case that is built on the sand as other speculations of you. – user64494 May 03 '23 at 17:37
  • 1
    @user64494 You stated that the integral form of the IFCT of K1 (not K2) is divergent. This would be an integral involving K1 (again, not K2). So what integral are you actually stating is divergent? (Clarity. It's a good thing. Use it.) – Daniel Lichtblau May 03 '23 at 18:53
  • @DanielLichtblau: I have had in mind NIntegrate[K2[t]*Cos[0.1*t], {t, 0, Infinity}]. – user64494 May 04 '23 at 10:54
  • @user64494 That one appears to be an absolutely convergent integrand. Unless there's a pole on the path it's fine. `In[18]:= k1 = (3 (1 - 4 z^2))/(2 (1 + z^2)^(7/2)); k2 = InverseFourierCosTransform[k1, z, t]; {Normal[Series[k2, {t, 0, 2}, Assumptions -> t > 0]], Normal[Series[k2, {t, Infinity, 2}, Assumptions -> t > 1000]]}

    Out[20]= {t^2/Sqrt[2 [Pi]], E^-t (-(9009/(65536 t^(3/2))) + 693/(2048 Sqrt[t]) + (189 Sqrt[t])/ 256 + (7 t^(3/2))/16 + t^(5/2)/10) + E^-t (-(((1/4 - I/4) (-1)^(1/4) t^(3/2))/Sqrt[ 2]) + (1/5 - I/5) (-1)^(1/4) Sqrt[2] t^(5/2))}`...

    – Daniel Lichtblau May 04 '23 at 14:40
  • 1
    ...and there is no pole on the path. – Daniel Lichtblau May 04 '23 at 14:42

1 Answers1

0

With respect to code effiency: In vs 6 the FourierCosTransform have timings of 4 s and 0.2 s. Try vs 13: 7s and 104 s, on a 4* faster machine.

NIntegrate on FourierTransform is a misunderstanding of the idea.

FourierTransform is a concept to generate distributions, multiply them by the FourierTransorm of some smooth functions, with compact support eg, so that the back transformation works, and transform back the product.

If the distribution formally solves an equation, involving only linear combinations of derivatives and integrals, then this object solves the equation and, by definition, at t=0 has the given start value.

Or one multiplies the Fourier transform by a filter and manipulates each color or audio frequency. This is linear invertible filtering by modes.

NIntegrate is never used practically for this purpose, it's to slow.

It is orders of magnitude faster, to transform, on a lattice of Length/2^n, back and forth in real time.

NIntegrate does the same but has not that effective method of Fourier: reducing in fact the algebra to a recursion of calculating differences and sus of next neighbors x_i +- x_i+1 only.

But there is another reason never to use NIntegrate: 99,9999% of all Fourier transforms are calculated by projecting it on the Riemann sphere map of the complex plane (the sphere standing with south pole at z=0 with radius 2, map by rays from the north pole to the plane).

The integral goes over the poles along the image of the real line. If one succeds to find another meridian, yilding an integral of exact zero, one has a closed path, that can be deformed as long as the integrand is analytic.

Finally there remain integrals around poles (z-z_k)^-1, higher order poles don't contibute.

Or there are branch cuts as for square roots of polynomials, than the path will be contracted to encircle the cuts between the zeros under the square root.

In any case, one finally gets a sum over residues, thats the value at the simple poles divided by the jump of the argument from -1 to -1, but on a circle giving 2 pi I as Length independent of the radius.

No NIntegrate can pull out these values from the haystack, if the path is R.

The numerical reason is, that Nintegrate cannot catch up with fast oscillating functions in general.

But the abstract Fourier transforn is exactly doing this by using the Lebesgue integral.

The Lebesgue integral has no problems as long the summed values within a partition, eg in rectangles, of the target complex plane of values, times the volume of thats rectangles pre-images converge.

Roland F
  • 3,534
  • 1
  • 2
  • 10
  • K1[Z_] = (3 (1 - 4 Z^2))/(2 (1 + Z^2)^(7/2)); InverseFourierCosTransform[K1[Z], Z, t] is a usual Fourier transform which does not deal with distributions at all. – user64494 May 04 '23 at 14:38
  • 1
    In the context of integral transfoms, everything is a distribution. Absolute integrable kernels generate regular distributions. Since the english wikipedia article is unreadable one cites from the origin https://fr.wikipedia.org/wiki/Distribution_(math%C3%A9matiques)#Exemples – Roland F May 04 '23 at 18:14