The problem with Mathematica intensified. It seems that recursion is not working properly with Mathematica. The question has been submitted in the forum. It should be seen, what others understand for it.
But IDL is working OK. I have found the error with the understanding that if “nang” has been taken for granted for “q” wasn’t a good idea, since algorithm relies heavily on value of “cos(theta)” which has reflective values on either side of 90 degrees. So now the conversion from q to angle has been introduced. Product of which can be seen next time. No intense involvment has been on my side due to time constraints.