Numerical tools for geoscience computations: Semiautomatic differentiation-SD
This paper presents a differentiation method [referred to here as semiautomatic differentiation (SD)] based on generalization and extension of the Squire and Trapp formula for complex differentiation of real-valued functions. The performance of the generalized formulas for first-order derivatives is tested and compared with manual, automatic (AD), and finite difference (FD) techniques. My results show that, in terms of accuracy, the SD technique is competitive with AD, and in terms of implementation simplicity, it is identical to the FD method with the added advantage of being step-size insensitive and, hence, free from the step-size dilemma that plagues FD. Using central differencing in the complex plane, I extend the SD method to second-order derivatives, thus enabling approximation of the Hessians. Performance of the extension formulas is evaluated and compared with AD and FD methods. The results indicate that the differencing operation reduces the accuracy of the extension formulas by four to five orders of magnitude below that of the original Squire and Trapp formula. Nonetheless, compared to FD schemes, the SD method is six to seven orders of magnitude more accurate in all tests conducted. In addition, the extension formulas exhibit step-size (h) insensitive behavior over the entire h-range of the tests (1-10(-30)), indicating high numerical stability of the schemes. I show by examples that SD provides a complete differentiation system that is computationally stable, efficient, highly accurate, and easy to implement.
complex differentiation numerical derivatives optimization inversion sensitivity analysis