算法艺术创作
algorithmic-art
通过代码和可调参数创作生成艺术与交互式视觉效果。
skill-147【设计与创意】A skill for visualizing quantum states and dynamics using QuTiP's advanced plotting capabilities. Perfect for researchers who want to create intuitive visual representations of quantum systems and their behavior over time.
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
QuTiP provides powerful visualization tools to help researchers and educators illustrate quantum phenomena. This skill focuses on generating graphs and plots for quantum states, operators, and dynamics.
uv pip install qutip
from qutip import *
import numpy as np
# Create a quantum state
psi = basis(2, 0) # Ground state |0⟩
# Visualize the state on the Bloch sphere
plot_bloch(psi) # Interactive Bloch sphere
Visualize quantum states on the Bloch sphere:
# Generate a superposition state
psi = (basis(2, 0) + basis(2, 1)).unit() # |0⟩ + |1⟩
# Plot the state on the Bloch sphere
plot_bloch(psi)
Plot time evolution of observables:
H = sigmax() # Hamiltonian
psi0 = basis(2, 0) # Initial state
tlist = np.linspace(0, 10, 100)
result = sesolve(H, psi0, tlist, e_ops=[sigmaz()])
# Plot the expectation value over time
plt.plot(tlist, result.expect[0])
plt.xlabel('Time')
plt.ylabel('⟨σz⟩')
plt.title('Time Evolution of ⟨σz⟩')
plt.show()
Use advanced techniques to visualize correlation functions and more:
# Visualize Wigner function for a coherent state
alpha = 1.0
rho_coherent = coherent_dm(10, alpha)
plot_wigner(rho_coherent)
plt.title('Wigner Function of Coherent State')
plt.show()
Create custom plots for specific needs:
# Custom plot function
def custom_plot(result, title):
plt.figure()
plt.plot(result.times, result.expect[0])
plt.title(title)
plt.xlabel('Time')
plt.ylabel('Expectation Value')
plt.grid()
plt.show()
custom_plot(result, 'Custom Expectation Value Plot')
The visualization tools offered by QuTiP enhance the understanding of quantum mechanics by providing intuitive graphical representations. This skill empowers researchers to communicate their findings effectively.