*/
Are you blogging on PH? Get your free blog.
*/

View \xiareagh.h

Calculus (Derivative:Tangent). v04

Submitted By: xhunga
Rating: (Not rated) (Rate It)


/* f.h                    freeware                          [[Email Removed]] */


/* ------------------------------------- FUNCTION --------------------------  */
/* Do    :                                                                    */
/*                                                                            */
/* -------------------------------------------------------------------------- */
void gplt_ghab(
double xmin,
double xmax,
double ymin,
double ymax,
double a,
double b,
  char geq[TXT_EQ],
  char heq[TXT_EQ],
double (*P_g)(double x),
double (*P_h)(double x)
)
{
FILE   *fp;
char    FA[FILENAME] = "a";
char    FB[FILENAME] = "b";
double  t;

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

fprintf(fp,"#\n");
fprintf(fp,"# Worksheet for gp371w32.exe by xhunga bernard 06000 Nice France\n");
fprintf(fp,"#\n\n");
fprintf(fp," set zeroaxis lt 8\n");
fprintf(fp," set grid\n\n");
fprintf(fp," plot [%0.3f:%0.3f] [%0.3f:%0.3f] ",xmin,xmax,ymin,ymax);
fprintf(fp,"%s",geq);
fprintf(fp,", ");
fprintf(fp,"%s",heq);
fprintf(fp,", ");
fprintf(fp," \"%s\" with linesp lt 3 pt 1",FA);
fprintf(fp,", ");
fprintf(fp," \"%s\" with linesp lt 3 pt 1",FB);

fprintf(fp,"\n\n");
fprintf(fp," reset");

             fclose(fp);

        fp = fopen(FA,  "w");

t = ((*P_g)(a)) ;
fprintf(fp," %0.6f   %0.6f\n", a, t);
t = ((*P_h)(a)) ;
fprintf(fp," %0.6f   %0.6f\n", a, t);

             fclose(fp);

        fp = fopen(FB,  "w");

t = ((*P_g)(b)) ;
fprintf(fp," %0.6f   %0.6f\n", b, t);
t = ((*P_h)(b)) ;
fprintf(fp," %0.6f   %0.6f\n", b, t);

             fclose(fp);
}


/* ------------------------------------- FUNCTION --------------------------  */
/* Do    :                                                                    */
/*                                                                            */
/* -------------------------------------------------------------------------- */
void gplt_areagh(
double xmin,
double xmax,
double ymin,
double ymax,
double a,
double b,
double r,
double step,
double (*P_g)(double x),
double (*P_h)(double x)
)
{
FILE   *fp;

char    FA[FILENAME] = "a";
char    FB[FILENAME] = "b";
char    FR[FILENAME] = "r";
char    FL[FILENAME] = "l";
char    FM[FILENAME] = "m";

double  t;
double  i;

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

fprintf(fp,"#\n");
fprintf(fp,"# Worksheet for gp371w32.exe by xhunga bernard 06000 Nice France\n");
fprintf(fp,"#\n\n");
fprintf(fp," set zeroaxis lt 8\n");
fprintf(fp," set grid\n\n");

t = ( (*P_g)((a+b)/2.) + (*P_h)((a+b)/2.) )/2.;
fprintf(fp," set label \"g(x) - h(x)\" at %0.3f, %0.3f\n\n", (((a+b)/2)+ (2.5*r)),t);
t = (*P_g)((a+b)/2.) + 5. * r;
fprintf(fp," set label \"dx\" at %0.3f, %0.3f\n\n", ((a+b)/2.), t);

fprintf(fp," plot [%0.3f:%0.3f] [%0.3f:%0.3f] ",xmin,xmax,ymin,ymax);
fprintf(fp," \"%s\" with linesp lt 3 pt 1",FA);
fprintf(fp,", ");
fprintf(fp," \"%s\" with linesp lt 3 pt 1",FB);
fprintf(fp,", ");
fprintf(fp," \"%s\" with linesp lt 3 pt 0",FL);
fprintf(fp,", ");
fprintf(fp," \"%s\" with linesp lt 3 pt 0",FM);
fprintf(fp,", ");
fprintf(fp," \"%s\" with linesp lt 9 pt 0",FR);
fprintf(fp,"\n\n");
fprintf(fp," reset");

             fclose(fp);

        fp = fopen(FA,  "w");

t = ((*P_g)(a)) ;
fprintf(fp," %0.6f   %0.6f\n", a, t);
t = ((*P_h)(a)) ;
fprintf(fp," %0.6f   %0.6f\n", a, t);

             fclose(fp);

        fp = fopen(FB,  "w");

t = ((*P_g)(b)) ;
fprintf(fp," %0.6f   %0.6f\n", b, t);
t = ((*P_h)(b)) ;
fprintf(fp," %0.6f   %0.6f\n", b, t);

             fclose(fp);

        fp = fopen(FR,  "w");

t = (*P_g)( (a+b)/2.) ;
fprintf(fp," %0.6f   %0.6f\n", (a+b)/2.-(r), t);
t = (*P_h)( (a+b)/2.) ;
fprintf(fp," %0.6f   %0.6f\n", (a+b)/2.-(r), t);
fprintf(fp," %0.6f   %0.6f\n", (a+b)/2.+(r), t);
t = (*P_g)( (a+b)/2.) ;
fprintf(fp," %0.6f   %0.6f\n", (a+b)/2.+(r), t);
fprintf(fp," %0.6f   %0.6f\n", (a+b)/2.-(r), t);

             fclose(fp);


        fp = fopen(FL,  "w");

i = a;
do{
   t = ((*P_g)(i)) ;
   fprintf(fp," %0.6f   %0.6f\n", i, t);
   i += step;
}while(i <=  b);

             fclose(fp);

        fp = fopen(FM,  "w");

i = a;
do{
   t = ((*P_h)(i)) ;
   fprintf(fp," %0.6f   %0.6f\n", i, t);
   i += step;
}while(i <=  b);

             fclose(fp);
}

corner
© 1996-2008 CommunityHeaven LLC. All rights reserved. Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
North American business development: Nicolai Wadstrom. Publisher: Lars Hagelin.