Reputation: 31
I am trying to solve what I thought was a simple problem. I seek the non-trivial solution to Ax = b, where b is the zero vector and A is a known matrix of symbolic elements (non-singular). Matlab does not permit non-numerical inputs to its svd function so I installed the sympy module and have tried the following code to solve my problem.
from numpy import *
from sympy import *
import sympy.matrices.matrices
a2, a3, k2_prime, rho2, rho2_prime_prime = symbols('a2 a3 k2_prime rho2 rho2_prime_prime', real=True)
A = Matrix([[exp(rho2*a2) , -exp(1j*k2_prime*a2), -exp(-1j*k2_prime*a2) , 0],
[rho2*exp(rho2*a2), -1j*k2_prime*exp(1j*k2_prime*a2), -1j*k2_prime*exp(-1j*k2_prime*a2), 0],
[0, exp(1j*k2_prime*a3), exp(-1j*k2_prime*a3), exp(-rho2_prime_prime*a3)],
[0, 1j*k2_prime*exp(1j*k2_prime*a3), -1j*k2_prime*exp(-1j*k2_prime*a3), -rho2_prime_prime*exp(-rho2_prime_prime*a3)]])
g = MatrixBase.singular_values(A)
print g
The result is a null matrix, which clearly isn't correct. Does anyone know what I'm doing wrong? Is there a better way to go about this?
Upvotes: 3
Views: 3747