Aller au contenu

Mathc complexes/a83

Un livre de Wikilivres.


Application

Le code de la fonction :

/* ------------------------------------ */
/* ------------------------------------ */
double **r_singular_Ab_mZ(
double **A,
int      n
)
{

  r_mZ(A,n);

  if(A[R_SIZE][C0]==3) c_r1Ar2_mZ(1,A, 2);
  if(A[R_SIZE][C0]==4){c_r1Ar2_mZ(  rp_I(A[R_SIZE][C0]-1),
                                  A, 
                                    rp_I(A[R_SIZE][C0]-1));
                       c_r1Ar2_mZ(  rp_I(A[R_SIZE][C0]-1),
                                  A,
                                    rp_I(A[R_SIZE][C0]-1));
                      }
  if(A[R_SIZE][C0]>4){  c_r1Ar2_mZ( rp_I(A[R_SIZE][C0]-1),
                                   A,
                                     rp_I(A[R_SIZE][C0]-1));
                        c_r1Ar2_mZ(  rp_I(A[R_SIZE][C0]-1),
                                   A,
                                     rp_I(A[R_SIZE][C0]-1));
                        c_r1Ar2_mZ(  rp_I(A[R_SIZE][C0]-1),
                                   A,
                                     rp_I(A[R_SIZE][C0]-1));
                        c_r1Ar2_mZ(  rp_I(A[R_SIZE][C0]-1),
                                   A,
                                     rp_I(A[R_SIZE][C0]-1));
                      }
        
return(A);
}
/* ------------------------------------ */
/* ------------------------------------ */
Je créé une matrice avec des lignes identiques avec la fonction c_r1Ar2_mZ(); qui copie une ligne de la matrice A dans une autre ligne de la même matrice. Le nombre de lignes copiés dépendent de la taille de la matrice.

Installer et compiler ces fichiers dans votre répertoire de travail.

c00a.c
/* ------------------------------------ */
/*  Save as :   c00a.c                  */
/* ------------------------------------ */
#include "w_a.h"
/* ------------------------------------ */
void fun(int r)
{
double **Ab = r_singular_Ab_mZ(    i_Abr_Ac_bc_mZ(r,r,C1),999);
double **A  =        c_Ab_A_mZ(Ab,           i_mZ(r,r));
double **b  =             r_mZ(              i_mZ(r,C1),999);;	   
                         /* I change the value of b */

  c_A_b_Ab_mZ(A,b,Ab);   /* I copy the new b in Ab  */
  
  clrscrn();
  printf(" A :");
  p_mZ(A, S5,P0, S4,P0, C6);
  printf(" b :");
  p_mZ(b, S5,P0, S4,P0, C6);
  stop();

  clrscrn();
  printf(" Copy/Paste into the octave window.\n\n");
  p_Octave_mZ(Ab,"Ab",P0, P0);
  printf(" rref(Ab,.00000000001)\n\n");
  printf(" Ab: gj_PP_mZ(Ab);");
  gj_PP_mZ(Ab);
  p_mZ(Ab,S9,P3,S9,P3,C4);
  
  printf(" You can see that in some row you have  0 = 123..."          
         " Inconsistent matrix.\n");  

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

  srand(time(&t));

do
{
  fun(RC3);

} while(stop_w());

  return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */
Une matrice A avec des lignes identiques, et des valeurs de b différentes. 
Le système est incohérent: +0 != +123 +123i.

Exemple de sortie écran :

 A :
 +866+508i  +655+352i  +581+909i 
 +914+685i  +299+954i    -8+198i 
 +914+685i  +299+954i    -8+198i 

 b :
 -292+946i 
 -668-785i 
 +851-213i 

 Press return to continue. 


 Copy/Paste into the octave window.

 Ab=[
+866+508*i,+655+352*i,+581+909*i,-292+946*i;
+914+685*i,+299+954*i,-8+198*i,-668-785*i;
+914+685*i,+299+954*i,-8+198*i,+851-213*i]

 rref(Ab,.00000000001)

 Ab: gj_PP_mZ(Ab);
   +1.000   -0.000i    +0.710   +0.511i    +0.098   +0.143i    -0.880   -0.199i 
   -0.000   +0.000i    +1.000   +0.000i    -0.551   +1.624i    -2.031   +2.164i 
   -0.000   +0.000i    -0.000   +0.000i    -0.000   +0.000i +1519.000 +572.000i 

 You can see that in some row you have  0 = 123... Inconsistent matrix.

 Press   return to continue
 Press X return to stop