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

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" /* ------------------------------------ */ void fun(void) { double **U_T = r_mR( i_mR(R1,C3), 9); double **V_T = r_mR( i_mR(R1,C3), 9); double **UxV_T = UxV_mR(U_T,V_T, i_mR(R1,C3)); double **U = transpose_mR(U_T, i_mR(R3, C1)); double **V = transpose_mR(V_T, i_mR(R3, C1)); double **UxV = transpose_mR(UxV_T, i_mR(R3, C1)); clrscrn(); printf(" u_t:"); p_mR(U_T, S4, P0, C6); printf(" v_t:"); p_mR(V_T, S4, P0, C6); printf(" uxv_t:"); p_mR(UxV_T, S4, P0, C6); printf(" ||u x v||**2 == %+.4f \n" " ||u||**2 ||v||**2 - (u.v)**2 == %+.4f \n\n", pow(norm_R(UxV),2), pow(norm_R(U),2) * pow(norm_R(V),2) - pow(dot_R(U,V),2) ); f_mR(U_T); f_mR(V_T); f_mR(UxV_T); f_mR(U); f_mR(V); f_mR(UxV); } /* ------------------------------------ */ int main(void) { time_t t; srand(time(&t)); do { fun(); } while(stop_w()); return 0; } /* ------------------------------------ */ /* ------------------------------------ */ ||u x v||**2 == ||u||**2 ||v||**2 - (u.v)**2 Screen output example: u_t : +3 +8 -8 v_t : +7 +8 -5 uxv_t : +24 -41 -32 ||u x v||**2 == +3281.0000 ||u||**2 ||v||**2 - (u.v)**2 == +3281.0000 Press return to continue Press X return to stop