I am trying to just do some stress calculations that match an example problem I found in a textbook.
The eigenvalue method for a sympy Matrix is giving me an answer that I am not expecting. It is including imaginary numbers. Not sure what I am doing wrong. ANy help would be greatly appreciated
I have looked through the documentation, tried rounding it, or seeing if there were any additional keywords I was missing
from sympy import Matrix
def stressMatrix(x=0,y=0,z=0,xy=0,xz=0,yz=0):
sigma_x, sigma_y, sigma_z, tau_xy, tau_xz, tau_yz =sympy.var('sigma_x, sigma_y, sigma_z, tau_xy, tau_xz, tau_yz')
stressVars = {sigma_x: x, sigma_y: y, sigma_z: z, tau_xy:xy, tau_xz: xz, tau_yz: yz}
stressTensor = sympy.Matrix([[sigma_x,tau_xy,tau_xz],[tau_xy,sigma_y,tau_yz],[tau_xz,tau_yz,sigma_z]])
return stressTensor.subs(stressVars)
t = stressMatrix(x=-19,y=4.6,z=-8.3,xy=-4.7,xz=6.45,yz=11.8)
eigenValues = t.eigenvals()
I expect an output of 11.618, -9.001, -25.316
But I am getting:
{-227/30 + 411091/(3600*(52767683/216000 + sqrt(7409803141670898)*I/72000)**(1/3)) + (52767683/216000 + sqrt(7409803141670898)*I/72000)**(1/3): 1, -227/30 + 411091/(3600*(-1/2 + sqrt(3)*I/2)*(52767683/216000 + sqrt(7409803141670898)*I/72000)**(1/3)) + (-1/2 + sqrt(3)*I/2)*(52767683/216000 + sqrt(7409803141670898)*I/72000)**(1/3): 1, -227/30 + (-1/2 - sqrt(3)*I/2)*(52767683/216000 + sqrt(7409803141670898)*I/72000)**(1/3) + 411091/(3600*(-1/2 - sqrt(3)*I/2)*(52767683/216000 + sqrt(7409803141670898)*I/72000)**(1/3)): 1}