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

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 : c00m.c */ /* ------------------------------------ */ #include "v_a.h" /* ------------------------------------ */ void fun(int r) { double **u = r_mR( i_mR(r,C1),9.); double **v = r_mR( i_mR(r,C1),9.); double **umnsv = sub_mR(u, v, i_mR(r,C1) ); clrscrn(); printf(" u :"); p_mR(u,S3,P0,C6); printf(" v :"); p_mR(v,S3,P0,C6); printf(" ||u||^2 + ||v||^2 - ||u - v||^2 = %.0f \n\n", pow(norm_R( u),2.) + pow(norm_R( v),2.) - pow(norm_R(umnsv),2.)); printf(" 2 * <u,v> = %.0f \n\n", 2 * dot_R(u,v) ); f_mR(u); f_mR(v); f_mR(umnsv); } /* ------------------------------------ */ int main(void) { time_t t; srand(time(&t)); do { fun(rp_I(R3)+R2); } while(stop_w()); return 0; } /* ------------------------------------ */ /* ------------------------------------ */ Screen output example: u : +1 -6 -8 v : +9 -8 +3 ||u||^2 + ||v||^2 - ||u - v||^2 = 66 2 * <u,v> = 66 Press return to continue