Skip to main content

  | मौसम…

411 समाचार
Public archive edition · Attributed source reporting with original dates · AI drafts are excluded

411 REFERENCE · Wikibooks

Linear Algebra and the C Language/a0ct

Reference material by Wikibooks contributors. This retains its source identity and is not 411 news reporting.

__NOTOC__ Install and compile this file in your working directory. /* ------------------------------------ */ /* Save as : c00b.c */ /* ------------------------------------ */ #include "v_a.h" /* ------------------------------------ */ #define RCA RC3 /* ------------------------------------ */ /* ------------------------------------ */ int main(void) { double a[RCA*RCA] ={ +0.390117647059, +0.169411764706, +0.457411764706, +0.169411764706, +0.952941176471, -0.127058823529, +0.457411764706, -0.127058823529, +0.656941176471 }; double **A = ca_A_mR(a, i_mR(RCA,RCA)); double **V = eigs_V_mR(A, i_mR(RCA,RCA)); double **invV = invgj_mR(V, i_mR(RCA,RCA)); double **EValue = i_mR(RCA,RCA); double **T = i_mR(RCA,RCA); clrscrn(); printf(" A :"); p_mR(A, S8,P6, C3); printf(" V :"); p_mR(V, S9,P6, C4); printf(" EValue = invV * A * V"); mul_mR(invV,A,T); mul_mR(T,V,EValue); p_mR(EValue, S9,P6, C4); printf("\n\n" " A = V * EValue * invV (Just verify the computation)"); mul_mR(V,EValue,T); mul_mR(T,invV,A); p_mR(A, S8,P6, C3); stop(); clrscrn(); printf(" V1 V2 V3 :"); p_mR(V, S9,P6, C4); printf(" EValue1 EValue2 EValue3 "); p_mR(EValue, S9,P6, C4); printf(" det(V) = %.3e\n" " det(V) != 0.00 V1 and V2 and V3 are linearly independent\n\n", det_R(V)); printf(" The matrix A projects the space in the direction\n" " of the eigenvector V3 on a plan determined by\n" " the eigenvector V1 and V2 if :\n\n" " The eigenvector V1 has its eigenvalue equal to one and \n" " The eigenvector V2 has its eigenvalue equal to one and \n" " The eigenvector V3 has its eigenvalue equal to zero and \n\n" " If The vectors V1 and V2 and V3 are linearly independent\n\n"); stop(); f_mR(A); f_mR(V); f_mR(invV); f_mR(T); f_mR(EValue); return 0; } /* ------------------------------------ */ /* ------------------------------------ */ Screen output example: A : +0.390118 +0.169412 +0.457412 +0.169412 +0.952941 -0.127059 +0.457412 -0.127059 +0.656941 V : +0.173564 +0.173839 +0.780950 +0.976187 +0.976187 -0.216930 -0.130131 -0.129765 -0.585712 EValue = invV * A * V +1.000000 -0.000000 +0.000000 +0.000000 +1.000000 -0.000000 +0.000000 +0.000000 +0.000000 A = V * EValue * invV (Just verify the computation) +0.390118 +0.169412 +0.457412 +0.169412 +0.952941 -0.127059 +0.457412 -0.127059 +0.656941 Press return to continue. V1 V2 V3 : +0.173564 +0.173839 +0.780950 +0.976187 +0.976187 -0.216930 -0.130131 -0.129765 -0.585712 EValue1 EValue2 EValue3 +1.000000 -0.000000 +0.000000 +0.000000 +1.000000 -0.000000 +0.000000 +0.000000 +0.000000 det(V) = 4.582e-04 det(V) != 0.00 V1 and V2 and V3 are linearly independent The matrix A projects the space in the direction of the eigenvector V3 on a plan determined by the eigenvector V1 and V2 if : The eigenvector V1 has its eigenvalue equal to one and The eigenvector V2 has its eigenvalue equal to one and The eigenvector V3 has its eigenvalue equal to zero and If The vectors V1 and V2 and V3 are linearly independent Press return to continue.