Linear Algebra and the C Language/a0gp


Install and compile this file in your working directory.

/* ------------------------------------ */
/*  Save as :   c00b.c                  */
/* ------------------------------------ */
#include "v_a.h"
/* ------------------------------------ */
void fun(int rc)
{
int P = rp_I(R4)+R1;

double **A  = rsymmetric_mR(     i_mR(rc,rc),9);
double **An =        pow_mR(P,A, i_mR(rc,rc));

  clrscrn();
  
  printf(" A : ");
  p_mR(A, S4,P0,C6);

  printf(" A**%d : ",P);
  p_mR(An, S9,P0,C6);

  f_mR(A);
  f_mR(An);
}
/* ------------------------------------ */
int main(void)
{
time_t t;

  srand(time(&t));
  
   do 
         fun(rp_I(RC3)+RC1);
        
    while(stop_w());
        
  return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */
For all n, A**n is symmetric if A is symmetric.

Screen output example:

                                                                                       
 A : 
  -2   +1   +6   +4 
  +1   -1   -3   +2 
  +6   -3   -4   +2 
  +4   +2   +2   +1 

 A**2 : 
      +57       -13       -31       +10 
      -13       +15       +25        -2 
      -31       +25       +65       +12 
      +10        -2       +12       +25 


 Press   return to continue
 Press X return to stop