In \cite{gilyen2019optimizing}, Gily\'{e}n, Arunachalam and Wiebe proposed a quantum algorithm for computing the gradient of real-valued smooth functions $f:\mathbb{R}^d \rightarrow \mathbb{R}$. The algorithm is optimal for a class of smooth functions with query complexity $\widetilde{O}(\sqrt{d}/\varepsilon)$.
In this work, we consider the same problem but for complex-valued analytic functions $f:\mathbb{C}^d \rightarrow \mathbb{C}$. Assuming that $f(\x) \in \mathbb{R}$ for all $\x\in \mathbb{R}^d$, we propose a quantum algorithm of complexity $\widetilde{O}(1/\varepsilon)$, which is only polylogarithmic in dimension. As $f$ is complex-valued, we assume an oracle in the form $|\x\rangle |0\rangle \rightarrow |\x\rangle |f_1(\x)\rangle|f_2(\x)\rangle$, where $f_1(\x), f_2(\x)$ are respectively the real and imaginary parts of $f(\x)$. In addition, we assume that $\x=\x_1+ i \x_2 \in \mathbb{C}^d$ is stored as $|\x_1\rangle |\x_2\rangle$ in quantum registers. These settings differ from those in \cite{gilyen2019optimizing}, explaining why our algorithm does not contradict the optimality of their result. As an application, we provide a new quantum algorithm for estimating multiple expectation values. Under certain conditions, our algorithm uses exponentially fewer resources than the one given in \cite{huggins2022nearly}. Finally, as a generalisation, we gave two quantum algorithms for computing the Hessian of $f$.