Qutip quantum state

From XuShuwenn/RedAct · View interactive version

Qutip quantum state is an AI agent skill from the GitHub repository XuShuwenn/RedAct. Compute Pauli matrix expectation values for quantum states represented as Bloch sphere coordinates using QuTiP.

How to use this skill

Skill file

Quantum State Expectation Values

When to Use

Input Format

File /root/input.txt:

theta phi

Read /root/input.txt first and confirm it contains exactly two whitespace-separated numbers in the order theta phi.

Calculations

Using QuTiP:

import qutip as qt

# Create state from Bloch angles
state = qt.QubitStates([theta, phi])

# Compute expectation values
<sigma_x> = qt.expect(qt.sigmax(), state)
<sigma_y> = qt.expect(qt.sigmay(), state)
<sigma_z> = qt.expect(qt.sigmaz(), state)

Output Format

To /root/output.txt:

Sigma X: +0.XXX
Sigma Y: +0.XXX
Sigma Z: +0.XXX

Round to 3 decimal places, always include the sign, and preserve the exact labels shown above, e.g. {value:+.3f}. If QuTiP returns a complex number with only negligible imaginary numerical noise, confirm the imaginary part is ~0 and write only the real part.

For example:

with open('/root/output.txt', 'w') as f:
    f.write(f"Sigma X: {sigma_x:+.3f}\n")
    f.write(f"Sigma Y: {sigma_y:+.3f}\n")
    f.write(f"Sigma Z: {sigma_z:+.3f}\n")

After writing, read /root/output.txt back to confirm the labels, order, newline-separated lines, signs, rounding, and formatting are exact.

Tips

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.