Linear Algebra and the C Language/a0ka


Install and compile this file in your working directory.

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

  srand(time(&t));
  
double ta[R3*C4]={ 1,0,0,  16,
                   0,1,0,  27,
                   0,0,1,  25};
                   
double **T  =  ca_A_mR(ta,                i_mR(R3,C4));
double **A  =     r_mR(                   i_mR(R3,C3),9);  
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("\n");
  printf(" a X**4 + b Y**3 + c Z**2 = d \n");
  printf(" e X**4 + f Y**3 + g Z**2 = h \n");
  printf(" i X**4 + j Y**3 + k Z**2 = l \n");
  printf("\n");
  printf(" With        X = 2,     Y =  3,    Z = 5 \n");
  printf(" You have X**4 = 16, Y**3 = 27, Z**2 = 25 \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, S7,P3,C6);
  stop();  

  clrscrn();  
  printf(" If :\n\n A = r_mR(i_mR(R3,C3),9); ");
  p_mR(A, S7,P3,C6);  
  
  printf(" And :\n\n T:");
  p_mR(T, S7,P3,C6); 

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

  clrscrn();    
  printf("\n  With the Gauss Jordan function :\n"
  "Ab:");
  p_mR(Ab, S7,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 :

 a X**4 + b Y**3 + c Z**2 = d 
 e X**4 + f Y**3 + g Z**2 = h 
 i X**4 + j Y**3 + k Z**2 = l 

 With        X = 2,     Y =  3,    Z = 5 
 You have X**4 = 16, Y**3 = 27, Z**2 = 25 

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

Ab:
 +1.000  +0.000  +0.000 +16.000 
 +0.000  +1.000  +0.000 +27.000 
 +0.000  +0.000  +1.000 +25.000 

 Press return to continue. 


 If :

 A = r_mR(i_mR(R3,C3),9); 
 -4.000  +1.000  +8.000 
 +9.000  +3.000  +2.000 
 -1.000  -7.000  -3.000 

 And :

 T:
 +1.000  +0.000  +0.000 +16.000 
 +0.000  +1.000  +0.000 +27.000 
 +0.000  +0.000  +1.000 +25.000 

 I suggest this matrix : AT = Ab

 Ab:
  -4.000,   +1.000,   +8.000, +163.000, 
  +9.000,   +3.000,   +2.000, +275.000, 
  -1.000,   -7.000,   -3.000, -280.000  

 Press return to continue. 


  With the Gauss Jordan function :
Ab:
 +1.000  +0.000  +0.000 +16.000 
 -0.000  +1.000  -0.000 +27.000 
 +0.000  +0.000  +1.000 +25.000 

 Press return to continue.