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

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 : c00d.c */ /* ------------------------------------ */ #include "v_a.h" /* ------------------------------------ */ void fun(int r) { double s = rp_I(7)+2; double **A = rdefinite_negative_mR( i_mR(r,r), 99); double **sA = smul_mR(s,A, i_mR(r,r)); double **EValue = eigs_mR(sA, i_mR(r,C1)); clrscrn(); printf(" A: Definite negative"); p_mR(A,S12,P6,C6); printf(" %+.0f A: s > 0 ",s); p_mR(sA,S12,P6,C6); printf(" Eigenvalues: eigs_mR(%+.0f A,EValue);",s); p_mR(EValue,S9,P3,C1); f_mR(A); f_mR(sA); f_mR(EValue); } /* ------------------------------------ */ int main(void) { time_t t; srand(time(&t)); do { fun(RC4); } while(stop_w()); return 0; } /* ------------------------------------ */ /* ------------------------------------ */ If A is negative-definite and if s is a strictly positive real number, then s*A is negative definite. Screen output example: A: Definite negative -23.547463 -10.165334 +23.026402 -2.054072 -10.165334 -14.589254 +13.136219 -0.078367 +23.026402 +13.136219 -32.343357 +10.311199 -2.054072 -0.078367 +10.311199 -25.519927 +5 A: s > 0 -117.737314 -50.826671 +115.132012 -10.270360 -50.826671 -72.946269 +65.681093 -0.391836 +115.132012 +65.681093 -161.716783 +51.555995 -10.270360 -0.391836 +51.555995 -127.599633 Eigenvalues: eigs_mR(+5 A,EValue); -300.000 -125.000 -40.000 -15.000 Press return to continue Press X return to stop