Principal Stresses Program  help sought

11262021, 11:42 PM
(This post was last modified: 11272021 01:35 PM by Gene.)
Post: #1




Principal Stresses Program  help sought
Hi there,
Having trouble creating a program to solve the principal stress equation. This is done by finding the roots of the third order polynomial. Here is an example of input data: σx = 60MPa σy =30MPa σz =20MPa τxy =40MPa Tyz = 0, Tzx = 0. Using the normal equation: σ^3 −(σx +σy +σz )⋅σ^2 +(σxσy +σxσz +σyσz −τxy^2 −τyz^2 −τzx^2 )⋅σ −(σxσyσz +2*τxy*τyz*τzx −σx*τyz^2 −σy*τzx^2 −σz*τxy^2)=0 produces roots of 45.21, 20.0, and 75.21MPa. My goal is to create a simple program to do this with the input data. Code: EXPORT PrincipalStressCoeffs(X,Y,Z,L,M,N) BEGIN LOCAL C1:= (X+Y+Z); LOCAL C2:= (X*Y+X*Z+Y*ZL^2M^2N^2); LOCAL C3:= (X*Y*Z+2*L*M*NX*M^2Y*N^2Z*L^2); LOCAL r = CAS( proot([1, C1, C2, C3]) ); RETURN(r); END; This code ends up returning imaginary numbers and not the same roots. Any help would be much appreciated. 

11272021, 04:48 PM
Post: #2




RE: Principal Stresses Program  help sought
(11262021 11:42 PM)trs32596 Wrote: Hi there,You can simply calculate the eigenvalues Code:
Edwin 

11272021, 07:13 PM
Post: #3




RE: Principal Stresses Program  help sought
Thanks Edwin!
program works great and I completely forgot about doing eigenvalues. Thanks again! 

11272021, 07:25 PM
Post: #4




RE: Principal Stresses Program  help sought
To fix the OP's program, change this line:
LOCAL r = CAS( proot([1, C1, C2, C3]) ); to this: LOCAL r = CAS("proot([1, C1, C2, C3])"); road 

« Next Oldest  Next Newest »

User(s) browsing this thread: 1 Guest(s)