Mathc complexes/078
Apparence
Installer et compiler ces fichiers dans votre répertoire de travail.
c00c.c |
|---|
/* ------------------------------------ */
/* Save as : c00c.c */
/* ------------------------------------ */
#include "w_a.h"
/* ------------------------------------ */
#define RA R5
#define CA C5
#define Cb C1
/* ------------------------------------ */
int main(void)
{
double xy[6] ={
1, 10,
2, 1,
3, -10 };
double ta[RA*CA]={
/* x**2 y**2 x y e */
+1, +0, +0, +0, +0,
+0, +1, +0, +0, +0,
+1, +100, +1, +10, +1,
+4, +1, +2, +1, +1,
+9, +100, +3, -10, +1,
};
double tb[RA*C1]={
/* b */
+1,
+1,
+0,
+0,
+0,
};
double **XY = ca_A_mRZ(xy,i_mZ(R3,C2));
double **A = ca_A_mRZ(ta,i_mZ(RA,CA));
double **b = ca_A_mRZ(tb,i_mZ(RA,C1));
double **Inv = i_mZ(CA,RA);
double **Invb = i_mZ(CA,C1);
clrscrn();
printf("\n");
printf(" Find the coefficients a, b, c, d, of a circle \n\n");
printf(" ax**2 + ay**2 + bx + cy + d = 0 \n\n");
printf(" that passes through these three XY. \n\n");
printf(" x y");
p_mRZ(XY,S5,P0,C6);
stop();
clrscrn();
printf(" Using the given XY, we obtain this matrix.\n");
printf(" (a = 1. This is my choice)\n\n");
printf(" A :");
p_mRZ(A,S10,P2,C7);
printf(" b :");
p_mRZ(b,S10,P2,C7);
printf(" Inv :");
invgj_mZ(A,Inv);
pE_mRZ(Inv,S12,P4,C10);
stop();
clrscrn();
printf(" Inv :");
p_mRZ(Inv,S10,P4,C10);
printf(" x = Inv * b ");
mul_mZ(Inv,b,Invb);
p_mRZ(Invb,S10,P4,C10);
printf(" The coefficients a, b, c, d, e, of the curve are : \n\n"
" %+.2fx**2 %+.2fy**2 %+.2fx %+.2fy %+.2f = 0\n\n"
,Invb[R1][C1],Invb[R2][C1],Invb[R3][C1],
Invb[R4][C1],Invb[R5][C1]);
stop();
f_mZ(XY);
f_mZ(A);
f_mZ(b);
f_mZ(Inv);
f_mZ(Invb);
return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */
Exemple de sortie écran :
Find the coefficients a, b, c, d, of a circle
ax**2 + ay**2 + bx + cy + d = 0
that passes through these three XY.
x y
+1 +10
+2 +1
+3 -10
Press return to continue.
Using the given XY, we obtain this matrix.
(a = 1. This is my choice)
A :
+1.00 +0.00 +0.00 +0.00 +0.00
+0.00 +1.00 +0.00 +0.00 +0.00
+1.00 +100.00 +1.00 +10.00 +1.00
+4.00 +1.00 +2.00 +1.00 +1.00
+9.00 +100.00 +3.00 -10.00 +1.00
b :
+1.00
+1.00
+0.00
+0.00
+0.00
Inv :
+1.0000e+00 +0.0000e+00 +0.0000e+00 +0.0000e+00 +0.0000e+00
+0.0000e+00 +1.0000e+00 -0.0000e+00 +0.0000e+00 -0.0000e+00
+6.0000e+00 +9.9000e+02 -5.5000e+00 +1.0000e+01 -4.5000e+00
+1.0000e+00 +9.9000e+01 -5.0000e-01 +1.0000e+00 -5.0000e-01
-1.7000e+01 -2.0800e+03 +1.1500e+01 -2.0000e+01 +9.5000e+00
Press return to continue.
Inv :
+1.0000 +0.0000 +0.0000 +0.0000 +0.0000
+0.0000 +1.0000 -0.0000 +0.0000 -0.0000
+6.0000 +990.0000 -5.5000 +10.0000 -4.5000
+1.0000 +99.0000 -0.5000 +1.0000 -0.5000
-17.0000 -2080.0000 +11.5000 -20.0000 +9.5000
x = Inv * b
+1.0000
+1.0000
+996.0000
+100.0000
-2097.0000
The coefficients a, b, c, d, e, of the curve are :
+1.00x**2 +1.00y**2 +996.00x +100.00y -2097.00 = 0
Press return to continue.