Mathc initiation/a342

Un livre de Wikilivres.


Sommaire


Installer ce fichier dans votre répertoire de travail.

g_tan.h
/* ---------------------------------- */
/* save as g_tan.h                    */
/* ---------------------------------- */
/* -------------------------------- 
   y = ax + b                                 [P(xp,yp);(y-yp)=a(x-xp)]
   
   a = f'(x)
   
   b = y - ax 
   b = y - f'(x)x 
   b = f(x) - f'(x)x
   
   x=c 
   a = f'(c)
   b = f(c) - f'(c)c
    ------------------------ */
void eq_Tan(
double    c,
double (*P_f)(double x),
double (*PDf)(double x)
)
{
 double a = (*PDf)(c);                                        
 double b = (*P_f)(c) - (*PDf)(c)*c ;

 printf(" %0.3f*x %+0.3f", a, b);
}
/* ---------------------------------- */
void G_Tan(
CTRL_splot w,
double     c,
double (*P_f)(double x),
char    feq[],
double (*PDf)(double x)
)
{
FILE  *fp;

double a =  (*PDf)(c);
double b =(-(*PDf)(c)* c + (*P_f)(c));

        fp = fopen("a_main.plt","w");

fprintf(fp," set zeroaxis lt 8\n"
           " set grid\n\n"
//           " set size ratio -1\n"
           " plot [%0.3f:%0.3f] [%0.3f:%0.3f]\\\n"
           " %s               with line lt 6 lw 3,\\\n"
           " %0.6f*x %+0.6f   with line lt 7 lw 3\n\n",
             w.xmin,w.xmax,w.ymin,w.ymax,
             feq, 
             a,b);

 fclose(fp);
}
/* ---------------------------------- */
/* ---------------------------------- */

Dans ce fichier il y a la déclaration des fichiers h.