microsoft/qdk
Publicmirrored fromhttps://github.com/microsoft/qdkAvailable
katas/content/complex_arithmetic/complex_powers_real/index.md
13lines · modecode
| 1 | **Inputs:** |
| 2 | |
| 3 | 1. A non-negative real number $r$. |
| 4 | 2. A complex number $x = a + bi$. |
| 5 | |
| 6 | **Goal:** Return the complex number $r^x = r^{a + bi}$. |
| 7 | |
| 8 | <details> |
| 9 | <summary><b>Need a hint?</b></summary> |
| 10 | You can use the fact that $r = e^{\ln r}$ to convert exponent bases. Remember though, $\ln r$ is only defined for positive numbers - make sure to check for $r = 0$ separately! |
| 11 | |
| 12 | Q# namespace `Microsoft.Quantum.Math` includes useful functions `Log()`, `Sin()`, and `Cos()`. |
| 13 | </details> |
| 14 | |