Linear Algebra and the C Language/a0md
Appearance
Install and compile this file in your working directory.
/* ------------------------------------ */ /* Save as : c00b.c */ /* ------------------------------------ */ #include "v_a.h" /* ------------------------------------ */ #define RCA RC3 #define EVALUE RC3 /* ------------------------------------ */ /* ------------------------------------ */ void fun(void) { double a[RCA*RCA] ={ +1.345288030, +1.760536858, -1.232763852, +1.760536858, +4.139646496, +0.479295438, -1.232763852, +0.479295438, +3.515065475 }; double **A = ca_A_mR(a, i_mR(RCA,RCA)); double **V = eigs_V_mR(A, i_mR(RCA,RCA)); double **V3 = c_c_mR(V,EVALUE, i_mR(RCA, C1),C1); double **AV3 = mul_mR(A,V3, i_mR(RCA, C1)); clrscrn(); printf(" We know: A V3 = EVALUE3 V3 \n\n" " Verify if A V3 = 0 with A!= 0 and V3 != 0\n\n" " When EVALUE3 = 0 \n\n"); stop(); clrscrn(); printf(" A:"); p_mR(A, S9,P5, C3); printf(" V:"); p_mR(V, S9,P5, C4); printf(" V%d:",EVALUE); p_mR(V3, S9,P5, C3); printf(" A V%d:",EVALUE); p_mR(AV3, S9,P5, C3); stop(); f_mR(A); f_mR(V); f_mR(V3); f_mR(AV3); } /* ------------------------------------ */ int main(void) { fun(); return 0; } /* ------------------------------------ */ /* ------------------------------------ */ Screen output example:
We know: A V3 = EVALUE3 V3 Verify if A V3 = 0 with A!= 0 and V3 != 0 When EVALUE3 = 0 Press return to continue. A: +1.34529 +1.76054 -1.23276 +1.76054 +4.13965 +0.47930 -1.23276 +0.47930 +3.51507 V: +0.45779 -0.27269 +0.84621 +0.88400 +0.24101 -0.40057 -0.09471 +0.93143 +0.35139 V3: +0.84621 -0.40057 +0.35139 A V3: +0.00000 -0.00000 +0.00000 Press return to continue.