Mathc complexes/Fichiers c : mul c
Apparence
Installer et compiler ce fichier dans votre répertoire de travail.
mul_c.c |
---|
/* ------------------------------------ */
/* Save as : mulc.c */
/* ------------------------------------ */
#include "w_a.h"
/* ------------------------------------ */
/* ------------------------------------ */
int take_c(int c)
{
int r = c;
if(r!=C1) r= (c-C1)*C2+C1;
return(r);
}
/* ------------------------------------ */
/* ------------------------------------ */
int main(void)
{
double a[R3*(C3*C2)] ={ 1,1, 2,1, 3,1,
1,1, 2,1, 3,1,
1,1, 2,1, 3,1};
double **A = ca_A_mZ(a,i_mZ(R3,C3));
nb_Z z = i_Z(10,0);
int c = take_c(C2);
clrscrn();
printf(" A : \n");
p_mZ(A, S5,P0, S3,P0, C6);
printf(" multiply column C%d by ",((c-C1)/C2)+C1);
p_Z(z, S1,P0, S1,P0);
printf("\n\n\n");
printf(" A : \n");
p_mZ(mulC_mZ(A,z,c), S5,P0, S4,P0, C6);
f_mZ(A);
stop();
return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */
La fonction mulC_mZ(); multiplie la colonne c par un complexe z.
Exemple de sortie écran :
A :
+1 +1i +2 +1i +3 +1i
+1 +1i +2 +1i +3 +1i
+1 +1i +2 +1i +3 +1i
multiply column C2 by +10+0i
A :
+1 +1i +20+10i +3 +1i
+1 +1i +20+10i +3 +1i
+1 +1i +20+10i +3 +1i
Press return to continue.