Aller au contenu

Mathc initiation/Fichiers h : x 18a3

Un livre de Wikilivres.
Version datée du 11 juillet 2021 à 00:09 par Xhungab (discussion | contributions) (petit correction)


Sommaire

Installer ce fichier dans votre répertoire de travail.

x_init.h
utilitaire
/* ---------------------------------- */
/* save as x_init.h                  */
/* ---------------------------------- */
double *I_p(
int col)
{
double *P;
int i;

    ++col;

    P = (double*) malloc( col * sizeof(*P));

    if(!P) {
            printf(" I was unable to allocate "
                   "the memory you requested.\n\n"
                   " double *I_p();\n\n"
                   " P = malloc(col * sizeof(*P));\n\n");
            fflush(stdout);
            getchar();
            exit(EXIT_FAILURE);
            }

    P[0] = col;
    for(i=1; i<col; i++) P[i] = 0;

 return(P);
}
/* ----------------------------------------------------- */
void c_a_P(
double  *a,
double  *Px
)
{
int i=1;

 	for (; i<Px[0]; i++)

 	         Px[i]=a[i-1];
}


La première fonction nous permet de créer et d'initialiser notre polynôme. La deuxième fonction copie un tableau dans notre polynôme.