« Mathc initiation/c33cc » : différence entre les versions

Un livre de Wikilivres.
Contenu supprimé Contenu ajouté
petit correction
 
petit correction
Ligne 11 : Ligne 11 :
<syntaxhighlight lang="c">
<syntaxhighlight lang="c">
/* ---------------------------------- */
/* ---------------------------------- */
/* save as c17d.c */
/* save as c17c.c */
/* --------------------------------- */
/* --------------------------------- */
#include "x_hfile.h"
#include "x_hfile.h"
#include "fd.h"
#include "fc.h"
/* --------------------------------- */
/* --------------------------------- */
int main(void)
int main(void)
Ligne 27 : Ligne 27 :


ay = 0;
ay = 0;
by = 3;
by = 4;
n = 2*150;
n = 2*150;
ny = 2*150;
ny = 2*150;
M = trapezoid_dxdy(f, u,v,n, ay,by,ny);
M = trapezoid_dxdy(f, u,v,n, ay,by,ny);



printf(" With the trapezoidal's rule.\n\n");
printf(" With the trapezoidal's rule.\n\n");
Ligne 44 : Ligne 43 :
}
}
/* --------------------------------- */
/* --------------------------------- */

</syntaxhighlight>
</syntaxhighlight>


Ligne 53 : Ligne 51 :
<syntaxhighlight lang="dos">
<syntaxhighlight lang="dos">


f : (x,y)-> sqrt(9-y**2)
f : (x,y)-> x**3+4*y




u : (y)-> 0
u : (y)-> y/2.


v : (y)-> sqrt(9-y**2)
v : (y)-> sqrt(y)




Ligne 66 : Ligne 64 :
With the trapezoidal's rule.
With the trapezoidal's rule.


(3.000 (sqrt(9-y**2)
(4.000 (sqrt(y)
int( int( sqrt(9-y**2) dx dy = 17.999950
int( int( x**3+4*y dx dy = 10.666577
(0.000 (0
(0.000 (y/2.




Press return to continue.
Press return to continue.



</syntaxhighlight>
</syntaxhighlight>

Version du 19 juillet 2021 à 19:22


Sommaire


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


c17c.c
/* ---------------------------------- */
/* save as c17c.c                     */
/* --------------------------------- */
#include "x_hfile.h"
#include       "fc.h"
/* --------------------------------- */
int main(void)
{
double ay,by,n,ny,M;
 
 clrscrn();
 printf(" f : (x,y)-> %s\n\n\n", feq);
 printf(" u :   (y)-> %s  \n\n", ueq);
 printf(" v :   (y)-> %s\n\n\n", veq);
 printf("\n\n\n");

 ay = 0; 
 by = 4;
  n = 2*150;
 ny = 2*150;
 
 M = trapezoid_dxdy(f, u,v,n, ay,by,ny);

 printf(" With the trapezoidal's rule.\n\n");
 printf("    (%.3f  (%s\n", by, veq);
 printf(" int(   int(       %s  dx dy = %.6f\n", feq, M);
 printf("    (%.3f  (%s\n\n\n", ay, ueq);

 stop();

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



Exemple de sortie écran :

 f : (x,y)-> x**3+4*y


 u :   (y)-> y/2.  

 v :   (y)-> sqrt(y)





 With the trapezoidal's rule.

    (4.000  (sqrt(y)
 int(   int(       x**3+4*y  dx dy = 10.666577
    (0.000  (y/2.


 Press return to continue.