Qubit bloch expectations

From XuShuwenn/RedAct · View interactive version

Qubit bloch expectations is an AI agent skill from the GitHub repository XuShuwenn/RedAct. Compute Pauli expectation values for a qubit given Bloch-sphere angles using QuTiP, with analytic cross-checks and strict output formatting.

How to use this skill

Skill file

Qubit Expectation Values from Bloch Angles

Compute expectation values of the Pauli matrices (σx, σy, σz) for a single-qubit pure state specified by Bloch-sphere angles (theta, phi). Uses QuTiP operators for the primary result and verifies against the closed-form Bloch-vector expressions.

When to Use

Activate this skill when the task is to:

Core Workflow

  1. Parse inputs
  1. Construct the qubit state |ψ⟩ from Bloch angles

|ψ⟩ = cos(th/2) |0⟩ + e^{i·ph} sin(th/2) |1⟩

ket = cos(th/2) * basis(2, 0) + np.exp(1j * ph) * sin(th/2) * basis(2, 1)

  1. Define Pauli operators and compute expectations
  1. Format output
  1. Write results

Verification

Perform these checks before finalizing:

Common Pitfalls

Success Criteria

Optional Script Usage

You can use the provided helper script to compute and verify expectations.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.