Aller au contenu

Mathc matrices/a136

Un livre de Wikilivres.


Application


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


Vous trouverez le code source et le fichier graphique correspondant à chaque transformation.

L'étude des matrices de transformation fait partie d'un cours de mathématiques et sort du cadre de ce livre.

cd01.c
/* ------------------------------------ */
/*  Save as :   cd01.c                  */
/* ------------------------------------ */
#include      "v_a.h"
#include  "d_strct.h"
#include "d_lastr1.h"
#include    "d_guv.h"
/* ------------------------------------ */
#define        N  (2*C5)
/* ------------------------------------ */
void fun(void)
{
double u[N] ={0,3,3,0,0,
              0,0,5,5,0 };
              
double **U  =           ca_A_mR(u,i_mR(R2,C5));
double **V  =                     i_mR(R2,C5);
double **T  =            eye_mR(  i_mR(R3,C3));
double **Ut = c_mR(U,lastr_1_mR(  i_mR(C3,C5)));
double **Vt =                     i_mR(C3,C5);

  c_s_mR(-1,T,R2,C2);

  clrscrn();
  printf(" Reflexion about the x-axis :\n\n");

  printf(" T:");
  p_mR(T,S5,P0,C9);

  printf(" U:");
  p_mR(U,S3,P0,C9);

  printf(" V:");
  mul_mR(T,Ut,Vt);
  c_nr_mR(Vt,R2,V);
  p_mR(V,S3,P0,C9);

  G_uv_mR(i_WGnuplot(-10,10,-10,10),Ut,Vt);

  printf("  * open the file main.plt with Gnuplot.\n\n\n");
  stop();
  
  f_mR(U);
  f_mR(V);
  f_mR(T);
  f_mR(Ut);
  f_mR(Vt);
}
/* ------------------------------------ */
void hello(void)
{
  printf("\n\n\n                                              ");
  printf("\n          Reflexion about the x-axis :             ");
  printf("\n          *************************               ");
  printf("\n\n                                                ");
  printf("\n\n                                                ");
  printf("\n               | 1      0       0 |               ");
  printf("\n          v  = | 0     -1       0 |  u            ");
  printf("\n               | 0      0       1 |           \n\n");
  printf("\n\n                                                ");
  printf("                                          \n\n\n\n\n");
  stop();
}
/* ------------------------------------ */
int main(void)
{
  hello();
    fun();
    
  return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */
cd02.c
/* ------------------------------------ */
/*  Save as :   cd02.c                  */
/* ------------------------------------ */
#include      "v_a.h"
#include  "d_strct.h"
#include "d_lastr1.h"
#include    "d_guv.h"
/* ------------------------------------ */
#define        N  (2*C5)
/* ------------------------------------ */
void fun(void)
{
double u[N] ={0,3,3,0,0,
              0,0,5,5,0 };
              
double **U  =           ca_A_mR(u,i_mR(R2,C5));
double **V  =                     i_mR(R2,C5);
double **T  =            eye_mR(  i_mR(R3,C3));
double **Ut = c_mR(U,lastr_1_mR(  i_mR(C3,C5)));
double **Vt =                     i_mR(C3,C5);

  c_s_mR(-1,T,R1,C1);

  clrscrn();
  printf("\n Reflexion about the y-axis :\n\n");
  printf(" T:");
  p_mR(T,S5,P0,C9);
  printf(" U:");
  p_mR(U,S3,P0,C9);
  mul_mR(T,Ut,Vt);
  printf(" V:");
  c_nr_mR(Vt,R2,V);
  p_mR(V,S3,P0,C9);

  G_uv_mR(i_WGnuplot(-10,10,-10,10),Ut,Vt);

  printf("  * open the file main.plt with Gnuplot.\n\n\n");
  stop();
  
  f_mR(U);
  f_mR(V);
  f_mR(T);
  f_mR(Ut);
  f_mR(Vt);
}
/* ------------------------------------ */
void hello(void)
{
  printf("\n\n\n                                              ");
  printf("\n          Reflexion about the y-axis :            ");
  printf("\n          *************************               ");
  printf("\n\n                                                ");
  printf("\n\n                                                ");
  printf("\n               |-1      0       0 |               ");
  printf("\n          v  = | 0      1       0 |  u            ");
  printf("\n               | 0      0       1 |           \n\n");
  printf("\n\n                                                ");
  printf("                                          \n\n\n\n\n");
  stop();
}
/* ------------------------------------ */
int main(void)
{
  hello();
    fun();
    
  return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */
cd03.c
/* ------------------------------------ */
/*  Save as :   cd03.c                  */
/* ------------------------------------ */
#include      "v_a.h"
#include  "d_strct.h"
#include "d_lastr1.h"
#include    "d_guv.h"
/* ------------------------------------ */
#define        N   (2*C5)
#define        Py  (10.)
/* ------------------------------------ */
void fun(void)
{
double u[N] ={0,3,3,0,0,
              0,0,5,5,0 };
              
double **U  =           ca_A_mR(u,i_mR(R2,C5));
double **V  =                     i_mR(R2,C5);
double **T  =            eye_mR(  i_mR(R3,C3));
double **Ut = c_mR(U,lastr_1_mR(  i_mR(C3,C5)));
double **Vt =                     i_mR(C3,C5);

  c_s_mR(    -1,T,R2,C2);
  c_s_mR((2*Py),T,R2,C3);

  clrscrn();
  printf("\n Reflexion about a line parallele with the x-axis : y = %.0f\n\n",Py);
  printf(" T:");
  p_mR(T,S5,P0,C9);
  printf(" U:");
  p_mR(U,S3,P0,C9);
  mul_mR(T,Ut,Vt);
  printf(" V:");
  c_nr_mR(Vt,R2,V);
  p_mR(V,S3,P0,C9);

  G_uv_mR(i_WGnuplot(-10,10,-5,25),Ut,Vt);

  printf("  * open the file main.plt with Gnuplot.\n\n\n");
  stop();

  f_mR(U);
  f_mR(V);
  f_mR(T);
  f_mR(Ut);
  f_mR(Vt);
}
/* ------------------------------------ */
void hello(void)
{
  printf("\n\n\n                                              ");
  printf("\n Reflexion about a line parallele with the x-axis ");
  printf("\n\n\n      *************************               ");
  printf("\n\n                                                ");
  printf("\n\n                                                ");
  printf("\n               | 1      0       0 |               ");
  printf("\n          v  = | 0     -1    2*yp |  u            ");
  printf("\n               | 0      0       1 |           \n\n");
  printf("\n\n                                                ");
  printf("                                          \n\n\n\n\n");
  stop();
}
/* ------------------------------------ */
int main(void)
{
  hello();
    fun();
    
  return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */
cd04.c
/* ------------------------------------ */
/*  Save as :   cd04.c                  */
/* ------------------------------------ */
#include      "v_a.h"
#include  "d_strct.h"
#include "d_lastr1.h"
#include    "d_guv.h"
/* ------------------------------------ */
#define        N   (2*C5)
#define        Px  (5.)
/* ------------------------------------ */
void fun(void)
{
double u[N] ={0,3,3,0,0,
              0,0,5,5,0 };
              
double **U  =           ca_A_mR(u,i_mR(R2,C5));
double **V  =                     i_mR(R2,C5);
double **T  =            eye_mR(  i_mR(R3,C3));
double **Ut = c_mR(U,lastr_1_mR(  i_mR(C3,C5)));
double **Vt =                     i_mR(C3,C5);

   c_s_mR(    -1,T,R1,C1);
   c_s_mR((2*Px),T,R1,C3);

  clrscrn();
  printf("\n Reflexion about a line parallele with the y-axis : xp:%.0f\n\n",Px);

  printf(" T:");
  p_mR(T,S5,P0,C9);

  printf(" U:");
  p_mR(U,S3,P0,C9);

  printf(" V:");
  mul_mR(T,Ut,Vt);
  c_nr_mR(Vt,R2,V);
  p_mR(V,S3,P0,C9);

  G_uv_mR(i_WGnuplot(-5,15,-10,10),Ut,Vt);

  printf("  * open the file main.plt with Gnuplot.\n\n\n");
  stop();
  
  f_mR(U);
  f_mR(V);
  f_mR(T);
  f_mR(Ut);
  f_mR(Vt);
}
/* ------------------------------------ */
void hello(void)
{
  printf("\n\n\n                                              ");
  printf("\n Reflexion about a line parallele with the y-axis ");
  printf("\n\n\n      *************************               ");
  printf("\n\n                                                ");
  printf("\n\n                                                ");
  printf("\n               |-1      0    2*xp |               ");
  printf("\n          v  = | 0      1       0 |  u            ");
  printf("\n               | 0      0       1 |           \n\n");
  printf("\n\n                                                ");
  printf("                                          \n\n\n\n\n");
  stop();
}
/* ------------------------------------ */
int main(void)
{
  hello();
    fun();
    
  return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */