# An Early Investigation of the HHL Quantum Linear Solver for Scientific Applications
## 5 Scientific Applications and Evaluation
### Power Flow Problem in Power Grid  
The use of quantum algorithms has drawn much attention in recent research on power system applications, especially the areas where quantum linear system solver can be deployed, including power flow, contingency analysis, state estimation, and transient simulation [60, 61, 62, 63, 64, 65]. The specific problem type we illustrated in this section is an alternating current power flow problem. The power flow equations are essential to analyzing the steady-state behavior of power systems by describing the relationship between bus voltages (magnitude and phase angles), currents, and power injections in a power system. The basic power flow equations are as follows:  
\[P_{k} =\sum_{j=1}^{n}\left(|V_{k}||V_{j}|\text{Re}(Y_{kj}^{*})\cos( \theta_{kj})+|V_{k}||V_{j}|\text{Im}(Y_{kj}^{*})\sin(\theta_{kj})\right)\] \[Q_{k} =\sum_{j=1}^{n}\left(|V_{k}||V_{j}|\text{Re}(Y_{kj}^{*})\sin( \theta_{kj})-|V_{k}||V_{j}|\text{Im}(Y_{kj}^{*})\cos(\theta_{kj})\right)\] \begin{table}
\begin{tabular}{l l} \hline \hline
**Factors of Interest** & **Description** \\ \hline Number of logical qubits pre- and after layout & Under the nearest-neighbor constraint, extra logical qubits could be required to satisfy the \\  & connectivity needed in the algorithm (circuit); the relation is \(n_{\text{after}}=2n_{\text{alg}}+\left[\sqrt{8n_{\text{alg}}}\right]+1\), where \\  & \(n_{\text{alg}}\) is the number of logical qubits pre-layout and \(n_{\text{after}}\) is the number of qubits after layout \\ \hline Number of physical qubits for the algorithm & The product of the number of logical qubits after layout and the number of physical qubits needed \\  & to encode one logical qubit \\ \hline Number of physical qubits for \(T\) factories & \(T\) factories produce \(T\) states to implement non-Clifford operations in a circuit \\ \hline Number of physical qubits & The sum of the number of physical qubits for the algorithm and the number of physical qubits \\  & for \(T\) factories \\ \hline Number of \(T\) states & The estimator requires \(1\)\(T\) state for each of the \(T\) gates in a circuit, \(4\)\(T\) states for each of \\  & the \(CCZ\) and \(CCIX\) gates, and \(18\)\(T\) states for each of the arbitrary single-qubit rotation gates \\ \hline Number of \(T\) factories & Determined from algorithm runtime, \(T\) state per \(T\) factory, the number of \(T\) states, and \(T\) factor \\  & duration through the equation \(\left[\dfrac{T\text{ state}\cdot T}{T\text{ state per }T}\text{ factor}\cdot\text{algorithm runtime}\right]\) \\ \hline Number of logical cycles for the algorithm & The logical depth of the algorithm \\ \hline Min. logical qubit error rate required to run & logical error probability \\  & Number of logical qubits - Number of logical cycles \\ \hline Min. \(T\) state error rate required for distilled & \(T\) distillation error probability \\ \(T\) states & Total number of \(T\) states \\ \hline \hline \end{tabular}
\end{table} 
Table 4: Factors of interest in QEC. where  
* \(P_{k}\): real power injection at bus \(k\). * \(Q_{k}\): reactive power injection at bus \(k\). * \(|V_{k}|\): voltage magnitude at bus \(k\). * \(\theta_{kj}\): phase angle difference between bus \(k\) and bus \(j\). * \(Y_{kj}\): admittance between bus \(k\) and bus \(j\). For a power flow problem with \(B\) buses and \(G\) generators, there are \(2(B-1)-(G-1)\) unknowns representing voltage magnitudes, \(|V_{k}|\), and phase angles, \(\theta_{k}\), for load buses and voltage phase angles for generator buses. With the knowledge of the admittance matrix of the system that represents the nodal admittance of the buses, we can use the Newton-Raphson (N-R) method to solve power flow equation iteratively: after an initial guess for the voltages at all buses, in each N-R iteration, we solve  
\[