
math Principal.1=Stress.1*0;
math Principal.2=Stress.1*0;
math Principal.3=Stress.1*0;

do i 0 [@ $NumberOfTimesteps-1] {
  math n=time($i);
  math a=0;
  math {
     for( k=0:size(n)[1]-1 ) {
       a(0,0)=Stress.1(k);
       a(1,1)=Stress.2(k);
       a(0,1)=Stress.4(k);
       a(1,0)=a(0,1);
       x=eig(a);
       Principal.1(k)=x(0,0);
       Principal.2(k)=x(1,0);
    }
  }
}
