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

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 RB R2 #define CB C2 #define RU R2 #define CU C1 /* ------------------------------------ */ /* ------------------------------------ */ int main(void) { double b[RB*CB]={ +2, 4, +6, 2 }; double u_s[RU*(CU)]={ +6, +8 }; double **B = ca_A_mR( b,i_mR(RB,CB)); double **invB = ca_A_mR( b,i_mR(RB,CB)); double **U_s = ca_A_mR(u_s,i_mR(RU,CU)); double **U_b = i_mR(RU,CU) ; clrscrn(); printf(" B is the change of basis matrix for \"B\" \n\n" " Find the coordinate of U in the \"B\" basis.\n\n" " B : "); p_mR(B,S4,P0,C7); printf(" U_s : the coordinate of U in the Standard basis"); p_mR(U_s,S4,P0,C7); printf(" invB : "); p_mR(invgj_mR(B,invB),S6,P4,C7); printf(" U_b = invB U_s \n\n" " U_b : the coordinate of U in the \"B\" basis"); p_mR(mul_mR(invB,U_s,U_b),S6,P4,C7); stop(); f_mR(U_s); f_mR(U_b); f_mR(B); return 0; } /* ------------------------------------ */ /* ------------------------------------ */ The coordinates of U in standard basis: B * U_b = U_s (*) b) Find the coordinates of U in basis B: U_b = invB U_s We have: B * U_b = U_s (*) Let's use the inverse of B: invB B * U_b = invB U_s ID * U_b = invB U_s We have U in basis B: U_b = invB U_s Screen output example: B is the change of basis matrix for "B" Find the coordinate of U in the "B" basis. B : +2 +4 +6 +2 U_s : the coordinate of U in the Standard basis +6 +8 invB : -0.1000 +0.2000 +0.3000 -0.1000 U_b = invB U_s U_b : the coordinate of U in the "B" basis +1.0000 +1.0000 Press return to continue.