Mathc initiation/Fichiers c : c65cb

Un livre de Wikilivres.


Sommaire


Installer et compiler ces fichiers dans votre répertoire de travail.


c18b.c
/* ---------------------------------- */
/* save as c18b.c                     */
/* ---------------------------------- */
#include "x_hfile.h"
#include      "fb.h"
/* ---------------------------------- */
int main(void)
{
double   x1 = -1.;
double   y1 =  2.;

double   x2 =  3;
double   y2 =  1.;

double   m = 0;

 clrscrn();
 printf(" Let  F(x,y) = M(x,y) i + N(x,y) j \n\n\n");
 printf(" Be continuous on an open connected region D,\n");
 printf(" And let C be a piecewise-smooth curve  in D\n");
 printf(" With endpoints A(x1,y1) and B(x2,y2).\n\n\n");
 printf(" If F(x,y) = grad f(x,y) then \n\n\n");
 printf("    (               (                   (x2,y2)\n");
 printf(" int( M(x,y)dx + int( N(x,y)dy = [f(x,y)]\n");
 printf("    (c              (c                  (x1,y1)\n");
 printf(" \n");
 stop();


 clrscrn();
 printf(" Let  F(x,y) = %si + %sj       \n\n",Meq,Neq);
 printf(" and has  C parametrization :\n\n");
 printf(" x = %s;     y = %s;       %.1f < t =< %.1f \n\n\n",
          geq, heq, a, b);
 printf(" Let  f(x,y) = %s              \n\n\n",feq);
 printf(" Verify if F(x,y) = grad f(x,y)\n\n\n");
        
 m  =lint2d_dx(
              M,
              g,h,
              a,b,LOOP);

 m  +=lint2d_dy(
              N,
              g,h,
              a,b,LOOP);
                
 printf("  then \n\n");
 printf("    (               (                  \n");
 printf(" int( M(x,y)dx + int( N(x,y)dy =  %+.3f\n",  m);
 printf("    (c              (c             \n\n\n");
 
 printf("  f(x2,y2) - f(x1,y1)  = %+.3f\n\n", f(x2,y2) - f(x1,y1));
 stop();

 return 0;
}
/* ---------------------------------- */
/* ---------------------------------- */


Nous devons commencer par vérifier manuellement que F(x,y) = grad f(x,y). Ensuite nous vérifions que le calcul de l'intégrale de F(x,y) est bien égal à f(x2,y2) - f(x1,y1).


Exemple de sortie écran :
 Let  F(x,y) = M(x,y)n + N(x,y)h 


 Be continuous on an open connected region D,
 And let C be a piecewise-smooth curve  in D
 With endpoints A(x1,y1) and B(x2,y2).


 If F(x,y) = grad f(x,y) then 


    (                          ((x2,y2)              (x2,y2)
 int( M(x,y)dx + N(x,y)dy = int(       F.dr = [f(x,y)]
    (c                         ((x1,y1)              (x1,y1)
 
 Press return to continue.


Exemple de sortie écran :
 Let  F(x,y) = (y**2 + 2*x*y)i + (x**2 + 2*x*y)j       

 and has  C parametrization :

 x = t;     y = -1/4*t + 7/4;       -1.0 < t =< 3.0 


 Let  f(x,y) = (x*y**2 + x**2*y)              


 Verify if F(x,y) = grad f(x,y)


  then 

    (               (                  
 int( M(x,y)dx + int( N(x,y)dy =  +14.000
    (c              (c             


  f(x2,y2) - f(x1,y1)  = +14.000

 Press return to continue.