Calculus (Derivative:Tangent). v04
Submitted By:
xhunga
Rating:
(Not rated) (
Rate It)
/* .c freeware [[Email Removed]]
*/
/* --------------------------------- INCLUDES ------------------------------- */
#include "xa_hfile.h"
#include "f___4.h"
/* --------------------------------- MAIN ----------------------------------- */
int main(void)
{
double (*P_f)(double x);
double (*pDf)(double x);
double c = .5;
double t;
/*-------------------------------- PROGRAM ---------------------------------- */
P_f = f;
pDf = Df;
clrscrn();
printf(" f : x-> %s\n\n", feq);
printf(" Df : x-> %s\n\n\n",Dfeq);
printf(" With c = %0.3f, the equation of the tangent is :\n\n",c);
printf(" Df(c) (x-c) + f(c) = ");
eq_Tan( c,
(*P_f),
(*pDf)
);
printf("\n\n\n");
printf(" Find PA, the length of the tangent from P to the x axis.\n\n");
t = ((*P_f)(c));
printf(" P(%6.3f, %6.3f) P( c, f(c)) \n", c, t);
t = c- ( ((*P_f)(c)) / ((*pDf)(c)) );
printf(" A(%6.3f, %6.3f) A(c-f(c)/Df(c), 0)\n\n\n",t, 0.0);
t = ((*P_f)(c)) * sqrt(1+(1/ pow(((*pDf)(c)) ,2) ));
printf(" PA = f(c) sqrt(1 + (1/Df(c)**2)) = %6.3f\n\n\n", t);
/* plot [xmin:xmax] [ymin:ymax] */
gplt_TanPx (-4, /* xmin */
4, /* xmax */
-4, /* ymin */
4, /* ymax */
c,
feq,
(*P_f),
(*pDf));
printf(" To see the graph, open the file \"f_Df.plt\" with Gnuplot.\n\n");
printf(" Press return to continue\n");
getchar();
return 0;
}