Linear Algebra and the C Language/a0df
Appearance
Install and compile this file in your working directory.
/* ------------------------------------ */ /* Save as: c00f.c */ /* ------------------------------------ */ #include "v_a.h" /* ------------------------------------ */ void fun(int r) { double p = rp_I(3)+1; double **A = rsymmetric_mR( i_mR(r, r),9); double **EValueA = eigs_mR(A, i_mR(r,C1)); double **A_p = pow_mR(p,A,i_mR(r, r)); double **EValueA_p = eigs_mR(A_p,i_mR(r,C1)); int i = 0; clrscrn(); printf(" A:"); p_mR(A,S3,P0,C6); printf(" EValue:"); p_mR(EValueA,S13,P6,C1); printf(" A**%.0f:",p); p_mR(A_p,S8,P0,C6); printf(" EValueA**%.0f:",p); p_mR(EValueA_p,S15,P6,C1); stop(); clrscrn(); printf(" EValueA**%.0f:",p); p_mR(EValueA_p,S15,P6,C1); printf(" (EValueA)**%.0f:\n",p); for(i=R1;i<=r;i++) printf(" %+14.6f\n", pow(EValueA[i][C1],p)); f_mR(A); f_mR(EValueA); f_mR(A_p); f_mR(EValueA_p); } /* ------------------------------------ */ int main(void) { time_t t; srand(time(&t)); do { fun(rp_I(R2)+R2); } while(stop_w()); return 0; } /* ------------------------------------ */ /* ------------------------------------ */
Screen output example:
A: +3 +4 +9 -6 +4 +4 -7 -1 +9 -7 -4 +7 -6 -1 +7 -9 EValue: -19.986039 +9.418681 +8.894894 -4.327537 A**4: +36271 -15247 -40574 +42229 -15247 +13030 +19708 -23689 -40574 +19708 +64151 -59433 +42229 -23689 -59433 +60582 EValueA**4: +159553.700324 +7869.739165 +6259.838545 +350.721967 Press return to continue. EValueA**4: +159553.700324 +7869.739165 +6259.838545 +350.721967 (EValueA)**4: +159553.700324 +7869.739165 +6259.838545 +350.721967 Press return to continue Press X return to stop