Calculus (Derivative:Tangent). v04
Submitted By:
xhunga
Rating:
(Not rated) (
Rate It)
/* .c freeware [[Email Removed]]
*/
/* --------------------------------- INCLUDES ------------------------------- */
#include "xa_hfile.h"
#include "f___1.h"
/* --------------------------------- MAIN ----------------------------------- */
int main(void)
{
double (*P_f)(double x);
double (*PDf)(double x);
double t;
double c;
/*-------------------------------- PROGRAM ---------------------------------- */
P_f = f;
PDf = Df;
clrscrn();
printf(" f : x-> %s\n\n", feq);
printf(" Df : x-> %s\n\n\n",Dfeq);
c = .5;
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 PB, the length of the tangent from P to the y axis.\n\n\n");
printf(" P(%6.3f, %6.3f) P(c, f(c)) \n", c, f(c));
t = ((*P_f)(c)) - (((*PDf)(c))*c);
printf(" B(%6.3f, %6.3f) B(0, f(c) - c Df(c))\n\n\n", 0.0, t);
t = c * sqrt(1+pow(((*PDf)(c)),2));
printf(" PB = c sqrt(1 + (Df(c)**2)) = %6.3f \n\n\n", t);
/* plot [xmin:xmax] [ymin:ymax] */
gplt_TanPy (-4, /* xmin */
4, /* xmax */
-9, /* ymin */
2, /* 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;
}