microsoft/qdk

Public

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

CodeCommitsIssuesPull requestsActionsInsightsSecurity
copilot/replace-qsharp-with-qdk-python-tests

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

13lines · modecode

1namespace Kata {
2 import Std.Math.*;
3
4 function ComplexExpReal(r : Double, x : Complex) : Complex {
5 if AbsD(r) < 1e-9 {
6 return Complex(0., 0.);
7 }
8
9 let ra = r^x.Real;
10 let lnr = Log(r);
11 return Complex(ra * Cos(x.Imag * lnr), ra * Sin(x.Imag * lnr));
12 }
13}
14