Table of Contents
Numerical Methods
Numerical methods in scqubits compute eigenvalues and eigenvectors, matrix elements, and other properties. Main methods:
Diagonalization: construct the Hamiltonian matrix, compute eigendecomposition via LAPACK/scipy. Works for systems up to ~1000×1000.
Sparse diagonalization: for larger matrices, use sparse solvers (Arnoldi, Lanczos) to find only lowest eigenvalues.
Time evolution: solve the Schrödinger equation numerically (RK45, etc.) to compute transient behavior.
from scqubits import Transmon import numpy as np transmon = Transmon(EJ=15.0, EC=0.3, ncut=30) # Eigenvalues via numpy/scipy evals = transmon.eigenvals(n=10) # Matrix elements n_op = transmon.n_operator() matrix_elem = (transmon.eigenvecs(n=2)[0].dag() * n_op * transmon.eigenvecs(n=2)[1]).full()[0, 0] # Time evolution (for driven systems) H_drive = lambda t, args: 0.1 * transmon.n_operator() # Driven Hamiltonian times = np.linspace(0, 10, 100) # (Would use scqubits.ParameterSweep or integrate manually)
scqubits uses scipy, numpy, and numpy.linalg for standard operations. For custom problems, extract the Hamiltonian matrix and use any numerical solver.
Numerical accuracy is governed by floating-point precision and convergence of ODE solvers. Check convergence by varying tolerances or step sizes.
