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

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 : c00a.c */ /* ------------------------------------ */ #include "v_a.h" /* ------------------------------------ */ #define RCA RC4 /* ------------------------------------ */ int main(void) { double V1[RCA*C1] ={ +4, +3, -1, -2 }; double V2[RCA*C1] ={ -1, -1, +2, -3 }; double V3[RCA*C1] ={ -2, -5, +4, -3 }; double V4[RCA*C1] ={ -3, -4, +2, -4 }; double **v1 = ca_A_mR(V1, i_mR(RCA,C1)); double **Nv1 = smul_mR(1./norm_R(v1),v1, i_mR(RCA,C1)); double **v2 = ca_A_mR(V2, i_mR(RCA,C1)); double **Nv2 = smul_mR(1./norm_R(v2),v2, i_mR(RCA,C1)); double **v3 = ca_A_mR(V3, i_mR(RCA,C1)); double **Nv3 = smul_mR(1./norm_R(v3),v3, i_mR(RCA,C1)); double **v4 = ca_A_mR(V4, i_mR(RCA,C1)); double **Nv4 = smul_mR(1./norm_R(v4),v4, i_mR(RCA,C1)); double **Nvn = i_mR(RCA,RCA); clrscrn(); printf(" You can choose the values of:\n\n" " v1: The first vector of the hyperplan "); P_mR(v1,S3,P0,C6); printf(" Nv1 = (1/||v1||)v1"); p_mR(Nv1,S3,P12,C6); stop(); clrscrn(); printf(" v2: The second vector of the hyperplan"); P_mR(v2,S3,P0,C6); printf(" Nv2 = (1/||v2||)v2"); p_mR(Nv2,S3,P12,C6); stop(); clrscrn(); printf(" v3: The third vector of the hyperplan"); P_mR(v3,S3,P0,C6); printf(" Nv3 = (1/||v3||)v3"); p_mR(Nv3,S3,P12,C6); stop(); clrscrn(); printf(" v4: The vector for the projection"); P_mR(v4,S3,P0,C6); printf(" Nv4 = (1/||v4||)v4"); p_mR(Nv4,S3,P12,C6); printf("\n"); c_c_mR(Nv1,C1,Nvn,C1); c_c_mR(Nv2,C1,Nvn,C2); c_c_mR(Nv3,C1,Nvn,C3); c_c_mR(Nv4,C1,Nvn,C4); printf(" Nvn is the matrix of the eigenvectors of the matrix A. \n\n" " Copy this code into the files c00b.c and c00c.c\n\n" " Nv1 Nv2 Nv3 Nv4:"); P_mR(Nvn,S3,P12,C6); stop(); f_mR(v1); f_mR(Nv1); f_mR(v2); f_mR(Nv2); f_mR(v3); f_mR(Nv3); f_mR(v4); f_mR(Nv4); f_mR(Nvn); return 0; } /* ------------------------------------ */ /* ------------------------------------ */ You choose the vectors of the plan (V1), (V2) and (V3) and the vector for the projection (V4). Next you normalize these vectors and you copy these vectors into the matrix (Nvn). You must copy this matrix, (Nvn), into the files c00b.c and c00c.c Screen output example: You can choose the values of: v1: The first vector of the hyperplan +4, +3, -1, -2 Nv1 = (1/||v1||)v1 +0.730296743340 +0.547722557505 -0.182574185835 -0.365148371670 Press return to continue. v2: The second vector of the hyperplan -1, -1, +2, -3 Nv2 = (1/||v2||)v2 -0.258198889747 -0.258198889747 +0.516397779494 -0.774596669241 Press v3: The third vector of the hyperplan -2, -5, +4, -3 Nv3 = (1/||v3||)v3 -0.272165526976 -0.680413817440 +0.544331053952 -0.408248290464 Press return to continue. v4: The vector for the projection -3, -4, +2, -4 Nv4 = (1/||v4||)v4 -0.447213595500 -0.596284794000 +0.298142397000 -0.596284794000 Nvn is the matrix of the eigenvectors of the matrix A. Copy this code into the files c00b.c and c00c.c Nv1 Nv2 Nv3 Nv4: +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 Press return to continue.