% Utilizar las siguintes variables para contestar:
%########### Código ################
% tensorial calculus exercise %% INITIAL DATA % TENSOR B DATA lambda1B= 27.1783; lambda2B= 6.4240; lambda3B= -12.6038; v1B=[-0.6978;-0.4139;-0.5845]; v2B=[-0.5243;0.8512;0.0230]; v3B=[-0.4880;-0.3225;0.8110]; % TENSOR C C=[-16/3 7 16;... 7 8/3 4;... 16 4 8/3];
% TENSOR B IS CALCULATED USING THE GIVEN EIGENVALUES & EIGENVECTORS
B=lambda1B*kron(v1B,v1B')+lambda2B*kron(v2B,v2B')+ lambda3B*kron(v3B,v3B'); %% THE GOAL OF THIS PART OF THE CODE IS TO PROJECT TENSOR B ONTO TENSOR C % WE CREATE TENSOR C_2 WHICH IS TENSOR C DIVIDED BY ITS NORMA normaC=sqrt(double_dot(C,C)); C_2=C/normaC; % projector tensor U= kron(C_2,C_2); % using matlab Kron function the tensor is represented in 2D(9x9), in % order for it to have meaning, it is required that we convert it to 4D( a % 3x3x3x3 matrix). Having this in mind, U is divided in 9 matrixes that are % later associated to an empty 4D dimensional array. X1=U(1:3,1:3); X2=U(1:3,4:6); X3=U(1:3,7:9); X4=U(4:6,1:3); X5=U(4:6,4:6); X6=U(4:6,7:9); X7=U(7:9,1:3); X8=U(7:9,4:6); X9=U(7:9,7:9); X=zeros(3,3,3,3); X(:,:,1,1)=X1; X(:,:,2,1)=X2; X(:,:,3,1)=X3; X(:,:,1,2)=X4; X(:,:,2,2)=X5; X(:,:,3,2)=X6; X(:,:,1,3)=X7; X(:,:,2,3)=X8; X(:,:,3,3)=X9; % B IS PROYECTED ONTO C_2. D=(B:C_2)*C_2. TENSOR D IS OBTAINED D=(double_dot(B,C_2))*C_2; %% CALCULATION OF TENSOR A I=[1 0 0;0 1 0; 0 0 1]; % as Tr(A) is a given data, the hydrostatic part is calculated A_hyd=(1/3)*5*I; % finally as tensor D is the deviatoric part of A, TENSOR A is calculated A=D+A_hyd; %########### Fin del código del alumno ########### % El tensor proyector paralelo a C en el sistema de referencia por defecto P_parC = X % La expresión matricial de A en dicho sistema de referencia. A = A %########### Funciones ################## %function to do the double dot product between two tensors A:B function dpe=double_dot(A,B) dpe=0; for i=1:1:3 for j=1:1:3 dpe=dpe+A(i,j)*B(i,j); end end end %#######################################