Singular Value

17 views
Skip to first unread message

Trevor Hutchinson

unread,
Nov 1, 2015, 6:47:52 PM11/1/15
to sympy
Hello,

I have what I think is a simple problem but I am struggling. I seek the non-trivial solution to a homogenous linear system of equations given by Ax = b, where A is matrix of symbolic variables, x is coefficients, and b is zero vector.

I have been trying the following code:
***********************************************
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

**********************************

But the result is a null matrix. I know the matrix is not singular so it should have a non-trivial solution. This is obviously solvable with pen and paper but being able to do this for arbitrary dimension would save time. Does anyone have any suggestions for why this is failing? 

I tried using svd in matlab but it will not work for symbolic (non-numerically-expressible) variables nor complex valued functions so that's out. 

Kalevi Suominen

unread,
Nov 2, 2015, 7:35:17 AM11/2/15
to sympy

It seems that the matrix is too complicated for  SymPy to find its ``singular_values``. But even if it did, I suspect that those would not be of much use for finding non-trivial solutions of the homogeneous equation ``Ax = 0``. In fact, there are none when ``A`` is non-singular.
Reply all
Reply to author
Forward
0 new messages