Mathc initiation/0019
Apparence
Cette méthode permet aussi d'effectuer une conversion rapide d'un nombre écrit en base 16 en écriture en base 10. Voici un nombre écrit en base 16.
#A = 10 #D = 13
Exemple : #DA78 #B = 11 #E = 14
#C = 12 #F = 15
Ce nombre vaut : #DA78 = 55 928
(D) 16**3 + (A) 16**2 + 7 (16) + 8 =
(13) 16**3 + (10) 16**2 + 7 (16) + 8 = 55 928
Il s'agit de l'évaluation d'un polynôme. Le résultat est le reste de la division synthétique.
Installer et compiler ces fichiers dans votre répertoire de travail.
c01a.c |
|---|
/* ---------------------------------- */
/* save as c01a.c */
/* ---------------------------------- */
#include "x_a.h"
/* ---------------------------------- */
# define DEGREE 3
# define COEFF_NB DEGREE + 1
/* ---------------------------------- */
int main(void)
{
double k = 16;
double remainder;
double *Pa = I_Px( COEFF_NB);
double *Pt = I_Px( COEFF_NB);
double *Pqr = I_Px( COEFF_NB);
double *Pq = I_Px((COEFF_NB-1));
double a[COEFF_NB] = {13,10,7,8};
clrscrn();
printf(" Using this method, you can quickly convert\n"
" a number written in base 16 to base 10.\n\n"
" In fact, if a number is written in base 16.\n"
" #A = 10 #D = 13\n"
" Example : #DA78 #B = 11 #E = 14\n"
" #C = 12 #F = 15\n\n"
" this number is worth : #DA78 = 55 928\n\n"
" (D) 16**3 + (A) 16**2 + 7 (16) + 8 =\n"
" (13) 16**3 + (10) 16**2 + 7 (16) + 8 = 55 928\n\n"
" This is therefore the evaluation of a polynomial,\n"
" it is the remainder of the synthetic division.\n\n\n");
stop();
clrscrn();
c_a_Px(a,Pa);
printf("\n If P(x) is : \n\n ");
p_Px(Pa);printf(" = 0\n\n");
printf(" If we divide P(x) by : [x-(%+.0f)] \n\n",k);
remainder = compute_horner(k,Pa,Pt,Pqr,Pq);
p_horner(Pa,Pt,Pqr);printf("\n");
printf(" The synthetic division indicates that P(%+.0f) = %+.0f\n\n\n",
k, remainder);
stop();
free(Pa);
free(Pt);
free(Pqr);
free(Pq);
return 0;
}
/* ---------------------------------- */
/* ---------------------------------- */
Exemple de sortie écran :
Using this method, you can quickly convert
a number written in base 16 to base 10.
In fact, if a number is written in base 16.
#A = 10 #D = 13
Example : #DA78 #B = 11 #E = 14
#C = 12 #F = 15
this number is worth : #DA78 = 55 928
(D) 16**3 + (A) 16**2 + 7 (16) + 8 =
(13) 16**3 + (10) 16**2 + 7 (16) + 8 = 55 928
This is therefore the evaluation of a polynomial,
it is the remainder of the synthetic division.
Press return to continue.
If P(x) is :
+13x**3 +10x**2 +7x +8 = 0
If we divide P(x) by : [x-(+16)]
+13 +10 +7 +8
+0 +208 +3488 +55920
--------------------------------
+13 +218 +3495 +55928
The synthetic division indicates that P(+16) = +55928
Press return to continue.