Aller au contenu

Mathc matrices/032

Un livre de Wikilivres.


Application

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

c00a.c
/* ------------------------------------ */
/*  Save as :  c00a.c                   */
/* ------------------------------------ */
#include "v_a.h"
/* ------------------------------------ */
void fun(int r)
{
double **A      = rdefinite_negative_mR( i_mR(r,r), 99);
double **V      =                        i_mR(r,r);
double **EValue =                        i_mR(r,C1);

  clrscrn();
  printf(" Copy/Past into the octave windows \n\n");
  p_Octave_mR(A,"a",P9);
  printf(" [V, E] = eigs (a,%d) \n\n",r);

  printf(" V:");
  eigs_V_mR(A,V);
  p_mR(V,S9,P6,C6);

  printf(" EValue :");
  eigs_mR(A,EValue);
  p_mR(EValue,S10,P5,C6);
  
  f_mR(A);
  
  f_mR(V);
  f_mR(EValue);  
}
/* ------------------------------------ */
int main(void)
{
time_t t;

  srand(time(&t));

do
{
 fun(rp_I(R3)+R1);

} while(stop_w());

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


Vérifions avec octave

Exemple de sortie écran :

 Copy/Past into the octave windows 

 a=[
-6.170702088,+1.361544520,-5.158236324;
+1.361544520,-14.622049988,+26.359296206;
-5.158236324,+26.359296206,-64.207247924]

 [V, E] = eigs (a,3) 

 V:
+0.075337 +0.958537 -0.274828 
-0.394897 +0.281757 +0.874454 
+0.915631 +0.042650 +0.399750 

 EValue :
 -76.00000 
  -6.00000 
  -3.00000 


 Press   return to continue
 Press X return to stop