microsoft/qdk

Public

mirrored fromhttps://github.com/microsoft/qdkAvailable

CodeCommitsIssuesPull requestsActionsInsightsSecurity
v1.3.0

Branches

Tags

  • No tags available.
0Branches0Tags
Go to file
Add file
Code

Clone

HTTPS

Download ZIP

katas/content/complex_arithmetic/complex_powers_real/Solution.qs

14lines · modecode

1namespace Kata {
2 open Microsoft.Quantum.Math;
3
4 function ComplexExpReal(r : Double, x : Complex) : Complex {
5 if AbsD(r) < 1e-9 {
6 return Complex(0.0, 0.0);
7 }
8
9 let (a, b) = x!;
10 let ra = r ^ a;
11 let lnr = Log(r);
12 return Complex(ra * Cos(b * lnr), ra * Sin(b * lnr));
13 }
14}
15