# Hankel transform from paper works only for certain functions

I implemented an algorithm for solving the Hankel transformation based on a paper. My problem is: It works very good for the functions suggested in the paper (as test functions), it works pretty ok for certain other test functions, but for other functions with known result it just produces garbage (result is far away from the expected result).

What does that mean for my implementation?

• My implementation is garbage, and I have to redo it.
• I choose a wrong data input for the function, and I have to change the parameters for it
• The algorithm is garbage, and I have to choose another one
• My programming is bad, and I should check that

What would be the best, i.e. most successfull approach for that situation?

Something to note: The algorithm provides a transformation method ($g=HT(f)$) and a backtransformation ($f2=IHT(g)$) method. When comparing $f$ and $f2$, they are equal. But $g$ and the expected function from theory are not.

I am using the following paper as source: https://www.osapublishing.org/josaa/abstract.cfm?uri=josaa-21-1-53 (unfortunately behind paywall), but calculate the Hankel transformation in the zeroth order. As languages I implemented the method both in python and in C/C++. The examples from the paper work, also such examples as $f=1/r, HT(f)=1/k$, but for example $f=r, HT(f)=1/(k^3)$ does not (produces oscillations).

And this is one of the implementations of it (same limitations): https://se.mathworks.com/matlabcentral/fileexchange/15623-hankel-transform?requestedDomain=www.mathworks.com

• Right now, it's going to be hard for anyone to answer this because 1) You don't tell us which paper you're looking at, 2) You don't tell us which test functions you're using, 3) you haven't shown (or provided access to) your implementation, and 4) your definition of "garbage". It seems like if $f_2 = IHT(HT(f)) == f$, as you indicate, then perhaps the transform is represented in a way that you're not expecting, and the results are not bad at all. – Tyler Olsen Apr 10 '17 at 15:45
• What order is your transformation? Some libraries might have problems with high or non-integer orders Bessel functions. What leads to: what is your programming language and library for Bessel functions. You might want to check with radially symmetric functions, where you can easily rewrite the transform as a Fourier transform. – nicoguaro Apr 10 '17 at 16:52
• You'll really need to tell us what paper you're referring to. Some methods for computing Hankel transforms use approximations that work well only for particular ranges of the transform variable. – Brian Borchers Apr 10 '17 at 17:50
• @BrianBorchers: I added the paper and more details. – arc_lupus Apr 10 '17 at 19:35
• After reading the paper, there are following things which you can easily check. 1.) The properties of your transformation matrix: is T unitary, real, square symmetric? 2.) Is T*T-I sufficiently small and does it converge with increasing N, 3.) Are your test functions sufficiently bounded in radii and frequencies? – Bort Apr 11 '17 at 8:47