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/a0pb

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 : c00c.c */ /* ------------------------------------ */ #include "v_a.h" /* ------------------------------------ */ #define RCA RC4 /* ------------------------------------ */ /* ------------------------------------ */ int main(void) { double a[RCA*RCA] ={ +0.812500000000, -0.656250000000, -1.406250000000, -0.656250000000, -0.250000000000, +0.125000000000, -1.875000000000, -0.875000000000, +0.125000000000, +0.437500000000, +1.937500000000, +0.437500000000, -0.250000000000, -0.875000000000, -1.875000000000, +0.125000000000 }; double NVN[RCA*RCA] ={ +0.730296743340, -0.258198889747, -0.272165526976, -0.447213595500, +0.547722557505, -0.258198889747, -0.680413817440, -0.596284794000, -0.182574185835, +0.516397779494, +0.544331053952, +0.298142397000, -0.365148371670, -0.774596669241, -0.408248290464, -0.596284794000 }; double **A = ca_A_mR(a, i_mR(RCA,RCA)); double **Nvn = ca_A_mR(NVN, i_mR(RCA,RCA)); double **invNvn = invgj_mR(Nvn, i_mR(RCA,RCA)); double **EValue = i_mR(RCA,RCA); double **T = i_mR(RCA,RCA); clrscrn(); printf(" A :"); p_mR(A, S9,P12, C4); printf(" Nvn :"); p_mR(Nvn, S9,P12, C4); printf(" Verify if:\n\n" " EValue = invNvn * A * Nvn\n\n" " EValue 1 EValue 2 EValue 3 EValue 4"); mul_mR(invNvn,A,T); mul_mR(T,Nvn,EValue); p_mR(EValue, S9,P12, C4); stop(); clrscrn(); printf(" A :"); p_mR(A, S9,P12, C4); printf(" Verify if:\n\n" " A = Nvn EValue invNvn"); mul_mR(Nvn,EValue,T); mul_mR(T,invNvn,A); p_mR(A, S8,P12, C4); stop(); clrscrn(); printf(" det(Nvn) = %.3e\n" " det(Nvn) != 0 V1 and V2 and V3 and V4 are" " linearly independent\n\n", det_R(Nvn)); printf(" The matrix A projects the hyperspace in the direction\n" " of the eigenvector V4 on a hyperplan determined by\n" " the eigenvectors V1, V2 and V3 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 one and \n" " The eigenvector V4 has its eigenvalue equal to zero and \n\n" " If The vectors V1, V2, V3, V4 are linearly independent\n\n"); stop(); f_mR(A); f_mR(Nvn); f_mR(invNvn); f_mR(T); f_mR(EValue); return 0; } /* ------------------------------------ */ /* ------------------------------------ */ You verify the properties of the matrix A. * The values of the eigenvalues: EValue = invNvn A Nvn * The matrix: A = Nvn EValue invNvn * If the column vectors of A are linearly independent Screen output example: A : +0.812500000000 -0.656250000000 -1.406250000000 -0.656250000000 -0.250000000000 +0.125000000000 -1.875000000000 -0.875000000000 +0.125000000000 +0.437500000000 +1.937500000000 +0.437500000000 -0.250000000000 -0.875000000000 -1.875000000000 +0.125000000000 Nvn : +0.730296743340 -0.258198889747 -0.272165526976 -0.447213595500 +0.547722557505 -0.258198889747 -0.680413817440 -0.596284794000 -0.182574185835 +0.516397779494 +0.544331053952 +0.298142397000 -0.365148371670 -0.774596669241 -0.408248290464 -0.596284794000 Verify if: EValue = invNvn * A * Nvn EValue 1 EValue 2 EValue 3 EValue 4 +1.000000000000 -0.000000000000 -0.000000000000 -0.000000000000 -0.000000000000 +1.000000000000 +0.000000000000 -0.000000000000 +0.000000000000 -0.000000000000 +1.000000000000 +0.000000000000 -0.000000000000 +0.000000000000 +0.000000000000 +0.000000000000 Press return to continue. A : +0.812500000000 -0.656250000000 -1.406250000000 -0.656250000000 -0.250000000000 +0.125000000000 -1.875000000000 -0.875000000000 +0.125000000000 +0.437500000000 +1.937500000000 +0.437500000000 -0.250000000000 -0.875000000000 -1.875000000000 +0.125000000000 Verify if: A = Nvn EValue invNvn +0.812500000000 -0.656250000000 -1.406250000000 -0.656250000000 -0.250000000000 +0.125000000000 -1.875000000000 -0.875000000000 +0.125000000000 +0.437500000000 +1.937500000000 +0.437500000000 -0.250000000000 -0.875000000000 -1.875000000000 +0.125000000000 Press return to continue. det(Nvn) = -9.180e-02 det(Nvn) != 0 V1 and V2 and V3 and V4 are linearly independent The matrix A projects the hyperspace in the direction of the eigenvector V4 on a hyperplan determined by the eigenvectors V1, V2 and V3 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 one and The eigenvector V4 has its eigenvalue equal to zero and If The vectors V1, V2, V3, V4 are linearly independent Press return to continue.