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

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 RC2 /* ------------------------------------ */ /* ------------------------------------ */ int main(void) { double a[RCA*RCA] ={ +1.142857142857, +0.571428571428, -0.285714285714, -0.142857142857 }; double NLV[RCA*RCA] ={ +0.970142500145, -0.447213595500, -0.242535625036, +0.894427191000 }; double **A = ca_A_mR(a, i_mR(RCA,RCA)); double **Nlv = ca_A_mR(NLV, i_mR(RCA,RCA)); double **invNlv = invgj_mR(Nlv, 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(" Nlv :"); p_mR(Nlv, S9,P12, C4); printf(" Verify if:\n\n" " EValue = invNlv * A * Nlv"); mul_mR(invNlv,A,T); mul_mR(T,Nlv,EValue); p_mR(EValue, S9,P12, C4); printf(" Verify if:\n\n" " A = Nlv EValue invNlv"); mul_mR(Nlv,EValue,T); mul_mR(T,invNlv,A); p_mR(A, S8,P12, C3); stop(); clrscrn(); printf(" The matrix A projects the plane in the direction\n" " of the eigenvector V on a line determined by\n" " the eigenvector V1 if :\n\n" " The eigenvector V1 has its eigenvalue equal to one and\n" " The eigenvector V2 has its eigenvalue equal to zero and\n\n" " If The vectors V1 and V2 are linearly independent\n\n" " det(Nlv) = %.2f\n\n",det_R(Nlv)); stop(); f_mR(A); f_mR(Nlv); f_mR(invNlv); f_mR(T); f_mR(EValue); return 0; } /* ------------------------------------ */ /* ------------------------------------ */ You verify the properties of the matrix A. * The values of the eigenvalues: EValue = invNlv A Nlv * The matrix: A = Nlv EValue invNlv * If the column vector of A are linearly independent Screen output example: A : +1.142857142857 +0.571428571428 -0.285714285714 -0.142857142857 Nlv : +0.970142500145 -0.447213595500 -0.242535625036 +0.894427191000 Verify if: EValue = invNlv * A * Nlv +1.000000000000 -0.000000000001 -0.000000000000 -0.000000000000 Verify if: A = Nlv EValue invNlv +1.142857142857 +0.571428571428 -0.285714285714 -0.142857142857 Press return to continue. The matrix A projects the plane in the direction of the eigenvector V on a line determined by the eigenvector V1 if : The eigenvector V1 has its eigenvalue equal to one and The eigenvector V2 has its eigenvalue equal to zero and If The vectors V1 and V2 are linearly independent det(Nlv) = 0.76 Press return to continue.