如果我正确地将要计算的表达式转换为数学符号,那么我们正在处理的是减去的幂级数展开中(对应于的扩展)。这将导致相减抵消,从而放大舍入误差相对于差值的大小。mln(1−z−1)ln(1+z)
ln(1−z−1)=∑k=1∞z−kk
The difference between this power series and its truncation at the k=m index is then scaled by zm. But multiplying by zm for |z|≈1 should not have substantial impact on the relative error of the final result.
My suggestion is to implement a summation of the tail of the power series, the portion left after the leading terms are subtracted off:
∑k=m+1∞zm−kk
I will turn my hand to implementing this for complex z in a neighborhood of 1, but note that the Question asks for something different: a computation valid for z in a neighborhood of the unit circle!
Here lies a serious difficulty, in that the natural logarithm is a multi-valued function in the complex plane, and any valid branch cut will intersect the unit circle.
The principal branch of the natural logarithm is formed to agree with the real natural logarithm on the positive real axis. The branch cut is then chosen (as a matter of convention) to be the origin and the negative real axis (in the complex plane).
Therefore some clarification is needed of where in the neighborhood of the unit circle (annulus) the computation is expected to be valid (which branch of the natural logarithm are we going to compare to for accuracy).