Question: How does this divergent series get evaluated?

I asked an LLM to provide an expansion of the MacDonald function of arbitrary order (a modified Bessel function of the second kind with purely imaginary order and positive argument), K(I*y,r), as a weighted sum of MacDonald functions of integer order. It came back with

         K(I*y,z)=2*sinh(Pi*y)/Pi* [K(0,r)/2*y+sum( (-1)^n*y*BesselK(0,r)/(y^2+n^2),n=1..infinity)]

(see below for more readable text)

I evaluated the LHS and RHS using Maple 2026 for various choices of y and r and found numerical agreement using both "sum" and "Sum".  I was very pleased until I realized that the RHS isn't a convergent series!

Can anyone explain to me how Maple pulls this off! 

(I asked Maplesoft Tech Support but they said it is above their pay grade... I suspect that Maple is using Borel summability to evaluate the RHS but I haven't been able to verify that)

I apologize, but I can't see how to attach a .mw file, so I've cut and pasted the code below

Please Wait...