'Normalize complex eigenvectors with Sympy
I'm solving a time dependent complex eigenvalue problem where my matrix is hermitian. My problem is that for some reason I can't normalize the eigenvectors. This is one example using one of the eigenvectors (where r_1 is an real function of t)
import sympy as sp
from sympy.physics.quantum.dagger import Dagger
t= sp.symbols(r't , real=True)
r = sp.symbols(r'r_1, real=True)
v = ...
print(repr(v))
The eigenvector is:
Matrix([
[ 0],
[r_1**2/(4*t**3 - 8*t**2 + 4*t) - 1/t],
[ -r_1/(2*t - 2)],
[ 0],
[ 1],
[ 0],
[ 0],
[ 0]])
Calculating the norm:
a = Dagger(v)*v
a[0]
gives
So the normalized vector is:
v_N = v/sp.sqrt(a[0])
v_N
Testing the normalization gives:
Dagger(v_N)*v_N
Or :
sp.simplify(Dagger(v_N)*v_N)
That is different than 1
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|




