Question: numerical instability

 Hello, everyone,
I have two problems in my worksheet.
First, when I specified the value of "s1" for a smaller number, for example 1e-5 or 1e-6, the imaginary part of "an" tends to infinity or -infinity, however, it should be finite.
Second, the value of "an" is instable when specific value of "s1" is choosen. For example, in the attached worksheet, s1=1.9e-4, the value of "an" will be changed when you click "!!!" button several times(that means execute the entire worksheet).
Even though I increase the Digits,these two problems still exist.
Can you help me,please?
Thank you in advance.

calculation.mw

Please Wait...