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

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" /* ------------------------------------ */ #define RCA RC5 /* ------------------------------------ */ /* ------------------------------------ */ void fun(void) { double **A = rEsymmetric_mR( i_mR(RCA,RCA),555.,1E-3); double **coshA = i_mR(RCA,RCA); double **coshA_EValue = i_mR(RCA,RCA); double **EVector = i_mR(RCA,RCA); double **EVectorT = i_mR(RCA,RCA); double **EValue = i_mR(RCA,RCA); double **cosh_EValue = i_mR(RCA,RCA); double **T1 = i_mR(RCA,RCA); clrscrn(); printf(" A:"); p_mR(A,S10,P4,C6); /* ================================================================== */ eigs_V_mR(A,EVector); transpose_mR(EVector,EVectorT); /* EValue = EVectorT A EVector */ mul_mR(EVectorT,A,T1); mul_mR(T1,EVector,EValue); printf(" cosh(A):"); f_eigs_mR(cosh,EValue,cosh_EValue); /* coshA = EVector cosh_EValue EVectorT */ mul_mR(EVector,cosh_EValue,T1); mul_mR(T1,EVectorT,coshA); p_mR(coshA,S10,P4,C6); /* ================================================================== */ eigs_V_mR(coshA,EVector); transpose_mR(EVector,EVectorT); /* coshA_EValue = EVectorT coshA EVector */ mul_mR(EVectorT,coshA,T1); mul_mR(T1,EVector,coshA_EValue); printf(" acosh(cosh(A)) = A:"); f_eigs_mR(acosh,coshA_EValue,EValue); /* A = EVector EValue EVectorT */ mul_mR(EVector,EValue,T1); mul_mR(T1,EVectorT,A); p_mR(A,S10,P4,C6); f_mR(A); f_mR(coshA); f_mR(coshA_EValue); f_mR(EVector); f_mR(EVectorT); f_mR(EValue); f_mR(cosh_EValue); f_mR(T1); } /* ------------------------------------ */ int main(void) { time_t t; srand(time(&t)); do { fun(); } while(stop_w()); return 0; } /* ------------------------------------ */ /* ------------------------------------ */ Screen output example: A : +0.0522 -0.0059 +0.0828 +0.0150 -0.0654 -0.0059 +0.5696 -0.0106 -0.2065 -0.2950 +0.0828 -0.0106 +0.2041 +0.0014 -0.2069 +0.0150 -0.2065 +0.0014 +0.3984 -0.1084 -0.0654 -0.2950 -0.2069 -0.1084 +0.6454 cosh(A): +1.0073 +0.0069 +0.0181 +0.0078 -0.0333 +0.0069 +1.2420 +0.0296 -0.0880 -0.1813 +0.0181 +0.0296 +1.0476 +0.0137 -0.0950 +0.0078 -0.0880 +0.0137 +1.1100 -0.0264 -0.0333 -0.1813 -0.0950 -0.0264 +1.3012 acosh(cosh(A)) = A : +0.0522 -0.0059 +0.0828 +0.0150 -0.0654 -0.0059 +0.5696 -0.0106 -0.2065 -0.2950 +0.0828 -0.0106 +0.2041 +0.0014 -0.2069 +0.0150 -0.2065 +0.0014 +0.3984 -0.1084 -0.0654 -0.2950 -0.2069 -0.1084 +0.6454 Press return to continue Press X return to stop