Mathc matrices/a38
Fonctions matricielles ex : cos(A)
Installer et compiler ces fichiers dans votre répertoire de travail.
c00a.c |
---|
/* ------------------------------------ */
/* Save as : c00a.c */
/* ------------------------------------ */
#include "v_a.h"
/* ------------------------------------ */
#define RCA RC4
#define Pn 3
/* ------------------------------------ */
double f(
double x)
{
return(pow(x,1./Pn));
}
char feq[] = "x**Pn";
/* ------------------------------------ */
/* ------------------------------------ */
void fun(void)
{
double **A = rPsymmetric_mR(i_mR(RCA,RCA),99.);
double **SqrtA = i_mR(RCA,RCA);
double **EigsVector = i_mR(RCA,RCA);
double **T_EigsVector = i_mR(RCA,RCA);
double **EigsValue = i_mR(RCA,RCA);
double **f_EigsValue = i_mR(RCA,RCA);
double **T1 = i_mR(RCA,RCA);
clrscrn();
printf(" A :");
p_mR(A, S7,P0, C8);
eigs_V_mR(A,EigsVector);
transpose_mR(EigsVector,T_EigsVector);
/* EigsValue : T_EigsVector * A * EigsVector */
mul_mR(T_EigsVector,A,T1);
mul_mR(T1,EigsVector,EigsValue);
printf(" A**(1/%d) = EigsVector * EigsValue**(1/%d)"
" * T_EigsVector\n", Pn, Pn);
f_eigs_mR(f,EigsValue,f_EigsValue);
mul_mR(EigsVector,f_EigsValue,T1);
mul_mR(T1,T_EigsVector,SqrtA);
p_mR(SqrtA,S10,P4,C8);
printf(" A = A**%d ",Pn);
pow_mR(Pn,SqrtA,A);
p_mR(A, S7,P0, C8);
f_mR(A);
f_mR(SqrtA);
f_mR(EigsVector);
f_mR(T_EigsVector);
f_mR(EigsValue);
f_mR(f_EigsValue);
f_mR(T1);
}
/* ------------------------------------ */
int main(void)
{
time_t t;
srand(time(&t));
do
{
fun();
} while(stop_w());
return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */
A**1/3 = V EValue**1/3 T_V
Exemple de sortie écran :
------------------------------------
A :
+999 -80 +61 -56
-80 +7881 -99 -60
+61 -99 +10434 +27
-56 -60 +27 +2664
A**(1/3) = EigsVector * EigsValue**(1/3) * T_EigsVector
+9.9921 -0.1153 +0.0763 -0.1311
-0.1153 +19.8993 -0.0752 -0.0701
+0.0763 -0.0752 +21.8511 +0.0279
-0.1311 -0.0701 +0.0279 +13.8610
A = A**3
+999 -80 +61 -56
-80 +7881 -99 -60
+61 -99 +10434 +27
-56 -60 +27 +2664
Press return to continue
Press X to stop