BlochSphereCoordinates function

Warning

This documentation refers to the Classic QDK, which has been replaced by the Modern QDK.

Please see https://aka.ms/qdk.api for the API documentation for the Modern QDK.

Namespace: Microsoft.Quantum.Preparation

Package: Microsoft.Quantum.Standard

Computes the Bloch sphere coordinates for a single-qubit state.

Given two complex numbers $a0, a1$ that represent the qubit state, computes coordinates on the Bloch sphere such that $a0 \ket{0} + a1 \ket{1} = r e^{it}(e^{-i \phi /2}\cos{(\theta/2)}\ket{0}+e^{i \phi /2}\sin{(\theta/2)}\ket{1})$.

function BlochSphereCoordinates (a0 : Microsoft.Quantum.Math.ComplexPolar, a1 : Microsoft.Quantum.Math.ComplexPolar) : (Microsoft.Quantum.Math.ComplexPolar, Double, Double)

Input

a0 : ComplexPolar

Complex coefficient of state $\ket{0}$.

a1 : ComplexPolar

Complex coefficient of state $\ket{1}$.

Output : (ComplexPolar,Double,Double)

A tuple containing (ComplexPolar(r, t), phi, theta).