Can anyone from The Mathworks weigh in on this? Thanks.

# Accuracy of eig in support of complex step differentation: Derivative estimate accuracy degrades when step gets too small

조회 수: 8(최근 30일)

표시 이전 댓글

Consider the uses of complex step differentiation to estimate the derivative of an eigenvalue of a real non-symmetric matrix, using eig in MATLAB double precision, for the calculation. The traditional recommendation is to use step = 1e-20 * 1i. But perhaps extended precision calculation of eig is needed to support this?

I noticed that for steps smaller than perhaps about 1e-14 *1i (or maybe even less), the accuracy of the complex step differentiation estimate seems to degrade, and become unstable. Is this due to accuracy limitation in eig in MATLAB double precision? The matrix in question has various norms in the ballpark of 1. Furthermore, the same calculation showed greater degradation in MATLAB R2013A WIN32 than in R2014A WIN 64. Is there any reason to think the accuracy of eig should be different between these configurations?

The calculation is carried out as d = step length (say 1e-14 or 1e-20 or whatever). For simplicity, I'll show this for the maximum eigenvalue. Consider a real matrix A. Then to compute the (i,j) component of the gradient of the maximum eigenvalue with respect to A,

B = A;

B(i,j) = A(i,j) + d*1i;

derivative_estimate = imag(max(eig(B))/d)

Complex step differentiation is not "supposed to" have a problem with small step size, and in fact, that's supposed to be its advantage over forward or central differences, whose accuracy is limited by a step size below which accuracy degrades.

Thanks.

### 채택된 답변

Cleve Moler
2015년 5월 19일

##### 댓글 수: 0

### 추가 답변(3개)

Cleve Moler
2015년 5월 19일

Cleve Moler
2015년 5월 20일

Matt J
2015년 5월 15일

### 참고 항목

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!