@article{oai:ipsj.ixsq.nii.ac.jp:00214576, author = {Shaowen, Li and Hiroyuki, Sato and Shaowen, Li and Hiroyuki, Sato}, issue = {1}, journal = {情報処理学会論文誌プログラミング(PRO)}, month = {Jan}, note = {Derivatives are the central pillar for solving many computational problems including the training of neural networks, the development of artificial intelligence tools, and physical simulations. Various methods for computing derivatives exist, and they can be classified into four categories: (1) manual derivation; (2) numerical differentiation; (3) symbolic differentiation; and (4) automatic differentiation. Using complex numbers for computing derivatives can be considered as a numerical method, and it avoids the cancellation error inherent to the finite difference method. It possesses advantages from numerical differentiation including better efficiency and easy implementation. Implemented properly, it also achieves comparable accuracy with symbolic and automatic differentiation. Generalizing complex number to higher dimensions further enables us to calculate derivatives of any order, which is hard to obtain using other approaches. In this work, the knowledge of multicomplex algebra is first described and a C++ multicomplex class is constructed. The efficiency and accuracy of potential implementations are compared. Furthermore, a source code transformer that automatically embeds the multicomplex data type into the original program is implemented. The transformer augments this approach with the advantage that programmers can focus solely on building the computation and only a minimum code rewriting is needed. We evaluate the performance and productivity of our library and the transformer in two applications: poisoning attack and mass-spring simulation., Derivatives are the central pillar for solving many computational problems including the training of neural networks, the development of artificial intelligence tools, and physical simulations. Various methods for computing derivatives exist, and they can be classified into four categories: (1) manual derivation; (2) numerical differentiation; (3) symbolic differentiation; and (4) automatic differentiation. Using complex numbers for computing derivatives can be considered as a numerical method, and it avoids the cancellation error inherent to the finite difference method. It possesses advantages from numerical differentiation including better efficiency and easy implementation. Implemented properly, it also achieves comparable accuracy with symbolic and automatic differentiation. Generalizing complex number to higher dimensions further enables us to calculate derivatives of any order, which is hard to obtain using other approaches. In this work, the knowledge of multicomplex algebra is first described and a C++ multicomplex class is constructed. The efficiency and accuracy of potential implementations are compared. Furthermore, a source code transformer that automatically embeds the multicomplex data type into the original program is implemented. The transformer augments this approach with the advantage that programmers can focus solely on building the computation and only a minimum code rewriting is needed. We evaluate the performance and productivity of our library and the transformer in two applications: poisoning attack and mass-spring simulation.}, pages = {17--17}, title = {Design and Implementation of a Multicomplex Number Library for Computing any Order of Derivatives}, volume = {15}, year = {2022} }