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

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 RCA RC4 #define Pn 3 /* ------------------------------------ */ double f( double x) { return(pow(x,1./Pn)); } char feq[] = "x**Pn"; /* ------------------------------------ */ /* ------------------------------------ */ void fun(void) { double **A = rPsymmetric_mR( i_mR(RCA,RCA),99); double **SqrtA = i_mR(RCA,RCA); double **EVector = i_mR(RCA,RCA); double **EVectorT = i_mR(RCA,RCA); double **EValue = i_mR(RCA,RCA); double **f_EValue = i_mR(RCA,RCA); double **T1 = i_mR(RCA,RCA); clrscrn(); printf(" A:"); p_mR(A, S7,P0, C8); eigs_V_mR(A,EVector); transpose_mR(EVector,EVectorT); /* EValue: EVectorT A EVector */ mul_mR(EVectorT,A,T1); mul_mR(T1,EVector,EValue); printf(" A**(1/%d) = EVector EValue**(1/%d) EVectorT", Pn, Pn); f_eigs_mR(f,EValue,f_EValue); mul_mR(EVector,f_EValue,T1); mul_mR(T1,EVectorT,SqrtA); p_mR(SqrtA,S10,P4,C8); printf(" A = (A**(1/%d))**%d ",Pn,Pn); pow_mR(Pn,SqrtA,A); p_mR(A, S7,P0, C8); f_mR(A); f_mR(SqrtA); f_mR(EVector); f_mR(EVectorT); f_mR(EValue); f_mR(f_EValue); f_mR(T1); } /* ------------------------------------ */ int main(void) { time_t t; srand(time(&t)); do { fun(); } while(stop_w()); return 0; } /* ------------------------------------ */ /* ------------------------------------ */ Screen output example: A: +3330 -74 +16 +85 -74 +6549 -95 +80 +16 -95 +2442 -59 +85 +80 -59 +9990 A**(1/3) = EVector EValue**(1/3) EVectorT +14.9319 -0.0870 +0.0261 +0.0847 -0.0870 +18.7080 -0.1209 +0.0657 +0.0261 -0.1209 +13.4647 -0.0628 +0.0847 +0.0657 -0.0628 +21.5365 A = (A**(1/3))**3 +3330 -74 +16 +85 -74 +6549 -95 +80 +16 -95 +2442 -59 +85 +80 -59 +9990 Press return to continue Press X return to stop