Linear Algebra and the C Language/a0k7


Install and compile this file in your working directory.

/* ------------------------------------ */
/*  Save as :   c00a.c                  */
/* ------------------------------------ */
#include      "v_a.h"
/* ------------------------------------ */
int main(void)
{
time_t t;

  srand(time(&t));
  
double ta[R3*C4]={ 1,0,0, 1,
                   0,1,0, 1,
                   0,0,1, 1};
                   
double **T  =  ca_A_mR(ta,                i_mR(R3,C4));
double **A  =    rE_mR(                   i_mR(R3,C3),999.,1E-3);  
double **AT =   mul_mR(A,T,               i_mR(R3,C4));  
double **Ab = gj_TP_mR(c_mR(AT, i_Abr_Ac_bc_mR(R3,C3,C1)));  

  clrscrn();
  printf(" You want to create this nonlinear system of equations :\n");
  printf("               (sin(*) = [-1..1]) \n");
  printf("\n"); 
  printf(" a sin(A) + b sin(B) + c sin(C) = d\n");
  printf(" e sin(A) + f sin(B) + g sin(C) = h\n");
  printf(" i sin(A) + j sin(B) + k sin(C) = l\n");
  printf("\n");
  printf(" With sin(A) = 1, sin(B) = 1, sin(C) = 1 \n");
  printf("\n");
  printf(" In  fact, you  want to  find a  matrix, \n");
  printf(" which has this reduced row-echelon form :\n\n"
          "Ab:");
   
  p_mR(T, S5,P0,C6);
  stop();  

  clrscrn();  
  printf(" If :\n\n A = rE_mR(i_mR(R3,C3),999.,1E-3); ");
  p_mR(A, S5,P3,C6);  
  
  printf(" And :\n\n T:");
  p_mR(T, S5,P3,C6); 

  printf(" I suggest this matrix : AT = Ab\n\n"  
  " Ab:");
  p_mR(AT, S5,P3,C6);
  stop();  

  clrscrn();    
  printf("\n  With the Gauss Jordan function :\n"
  "Ab:");
  p_mR(Ab, S5,P3,C6);
  stop();

  f_mR(Ab);
  f_mR(A);
  f_mR(T);
  f_mR(AT);

  return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */

Screen output example:

                                                                                       
 You want to create this nonlinear system of equations :
                (sin(*) = [-1..1])

 a sin(A) + b sin(B) + c sin(C) = d
 e sin(A) + f sin(B) + g sin(C) = h
 i sin(A) + j sin(B) + k sin(C) = l

 With sin(A) = 1, sin(B) = 1, sin(C) = 1 

 In  fact, you  want to  find a  matrix, 
 which has this reduced row-echelon form :

Ab:
   +1    +0    +0    +1 
   +0    +1    +0    +1 
   +0    +0    +1    +1 

 Press return to continue. 


 If :

 A = rE_mR(i_mR(R3,C3),999.,1E-3); 
+0.594 +0.823 +0.379 
+0.017 -0.723 -0.616 
+0.613 +0.402 -0.435 

 And :

 T:
+1.000 +0.000 +0.000 +1.000 
+0.000 +1.000 +0.000 +1.000 
+0.000 +0.000 +1.000 +1.000 

 I suggest this matrix : AT = Ab

 Ab:
+0.594 +0.823 +0.379 +1.796 
+0.017 -0.723 -0.616 -1.322 
+0.613 +0.402 -0.435 +0.580 

 Press return to continue. 


  With the Gauss Jordan function :
Ab:
+1.000 +0.000 +0.000 +1.000 
+0.000 +1.000 +0.000 +1.000 
+0.000 +0.000 +1.000 +1.000 

 Press return to continue.