Mathc complexes/07d
Apparence
Installer et compiler ces fichiers dans votre répertoire de travail.
c00d.c |
|---|
/* ------------------------------------ */
/* Save as : c00d.c */
/* ------------------------------------ */
#include "w_a.h"
/* ------------------------------------ */
/* ------------------------------------ */
#define RA R5
#define CA C5
#define Cb C1
/* ------------------------------------ */
int main(void)
{
double xy[8] ={
1, 4,
2, 5,
3, -7,
4, 5 };
double ta[RA*CA]={
/* x**2 y**2 x y e */
+1, +0, +0, +0, +0,
+1, +16, +1, +4, +1,
+4, +25, +2, +5, +1,
+9, +49, +3, -7, +1,
+16, +25, +4, +5, +1,
};
double tb[RA*C1]={
/* = 0 */
+1,
+0,
+0,
+0,
+0
};
double **XY = ca_A_mRZ(xy, i_mZ(R4,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, e, of the curve \n\n");
printf(" ax**2 + by**2 + cx + dy + e = 0 \n\n");
printf(" that passes through these four points.\n\n");
printf(" x y");
p_mRZ(XY,S10,P0,C6);
stop();
clrscrn();
printf(" Using the given points, 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(" 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(b);
f_mZ(A);
f_mZ(Inv);
f_mZ(Invb);
return 0;
}
/* ------------------------------------ */
/* ------------------------------------ */
Exemple de sortie écran :
Find the coefficients a, b, c, d, e, of the curve
ax**2 + by**2 + cx + dy + e = 0
that passes through these four points.
x y
+1 +4
+2 +5
+3 -7
+4 +5
Press return to continue.
Using the given points, we obtain this matrix.
(a = 1. This is my choice)
A :
+1.00 +0.00 +0.00 +0.00 +0.00
+1.00 +64.00 +1.00 -8.00 +1.00
+4.00 +4.00 +2.00 +2.00 +1.00
+9.00 +1.00 +3.00 +1.00 +1.00
+16.00 +4.00 +4.00 +2.00 +1.00
b :
+1.00
+0.00
+0.00
+0.00
+0.00
Inv
+1.0000e+00 +0.0000e+00 +2.0817e-17 +1.3878e-17 -1.3878e-17
-1.4444e-01 +1.1111e-02 +3.8889e-02 -1.1111e-01 +6.1111e-02
-6.0000e+00 -5.2042e-18 -5.0000e-01 -2.2204e-16 +5.0000e-01
-5.6667e-01 -3.3333e-02 +3.8333e-01 -6.6667e-01 +3.1667e-01
+9.7111e+00 +2.2222e-02 +1.0778e+00 +1.7778e+00 -1.8778e+00
Press return to continue.
x = Inv * b
+1.0000
-0.1444
-6.0000
-0.5667
+9.7111
The coefficients a, b, c, d, e, of the curve are :
+1.00x**2 -0.14y**2 -6.00x -0.57y +9.71 = 0
Press return to continue.