An RY gate is a single-qubit rotation around the Y axis of the Bloch sphere. Its rotation angle is specified in radians and determines the prepared state. For amplitudes α and β, a practical state-preparation pattern computes θ = 2·ArcTan2(β, α) and applies RY(θ) to the qubit. section 2.1.3 section 4.4.1
A Q# implementation follows this sequence:
- Allocate a qubit with use q = Qubit(). section 2.1.3
- Set the amplitudes, compute the rotation angle with ArcTan2, and apply Ry(theta, q). section 2.1.3
- Reset the qubit before release so it returns to |0⟩. section 2.1.3
Listing 2.2 Q# code to prepare a single-qubit state
import Std.Math.ArcTan2; #1
@EntryPoint() #2
operation SingleQubitDemo() : Unit { #3
use q = Qubit(); #4
let (alpha, beta) = (0.6, 0.8);
let theta = 2.0 * ArcTan2(beta, alpha); #5
Ry(theta, q); #6
Reset(q); #7
}
Inspect the complete Q# example, including amplitude values, angle calculation, RY application, and qubit reset. section 2.1.3

