Linear Algebra and the C Language/a0j4


Install and compile this file in your working directory.

/* ------------------------------------ */
/*  Save as :   c00b.c                  */
/* ------------------------------------ */
#include "v_a.h"
/* ------------------------------------ */
void fun(int r)
{
double **Ab = r_singular_Ab_mR(    i_Abr_Ac_bc_mR(r,r,C1),999);
double **A  =        c_Ab_A_mR(Ab, i_mR(r,r));
double **b  =        c_Ab_b_mR(Ab, i_mR(r,C1));

  clrscrn();
  printf(" A:");
  p_mR(A, S8,P0,C7);
  printf(" b:");
  
  p_mR(b, S8,P0,C7); 
  printf(" Ab:");
  p_mR(c_A_b_Ab_mR(A,b,Ab), S8,P0,C7);
  stop();

  clrscrn();
  printf(" Copy/Paste into the octave window.\n\n");
  p_Octave_mR(Ab,"Ab",P0);
  printf("\n rref(Ab,.00000000001)\n\n");
  stop();

  clrscrn();
  printf(" gj_PP_mR(Ab,YES);");
  gj_PP_mR(Ab,YES);
  p_mR(Ab, S10,P4,C7);
  
  is_system_consistent_mR(Ab);

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

  srand(time(&t));
do
{
  fun(rp_I(R4)+R1);


} while(stop_w());

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


A matrix A with identical rows and identical values ​​of b. The system is consistent. Optionally, free variables can be introduced.


Screen output example:

                                                                                       
 A:
    +100     -451     -925     +459     -151 
    -271     -313     +821     -273     -551 
    +100     -451     -925     +459     -151 
    -982     -299     -985     -726     +594 
    +100     -451     -925     +459     -151 

 b:
    -209 
    -281 
    -209 
    -724 
    -209 

 Ab:
    +100     -451     -925     +459     -151     -209 
    -271     -313     +821     -273     -551     -281 
    +100     -451     -925     +459     -151     -209 
    -982     -299     -985     -726     +594     -724 
    +100     -451     -925     +459     -151     -209 

 Press return to continue. 


 Copy/Paste into the octave window.

 Ab=[
+100,-451,-925,+459,-151,-209;
-271,-313,+821,-273,-551,-281;
+100,-451,-925,+459,-151,-209;
-982,-299,-985,-726,+594,-724;
+100,-451,-925,+459,-151,-209]


 rref(Ab,.00000000001)

 Press return to continue. 


 gj_PP_mR(Ab,YES);
   +1.0000    +0.0000    +0.0000    +1.0404    -0.5117    +0.5463 
   +0.0000    +1.0000    +0.0000    -0.4542    +1.0911    +0.5144 
   -0.0000    -0.0000    +1.0000    -0.1623    -0.4241    +0.0342 
   -0.0000    -0.0000    +0.0000    -0.0000    -0.0000    -0.0000 
   -0.0000    -0.0000    +0.0000    -0.0000    -0.0000    -0.0000 


 Press   return to continue
 Press X return to stop