Aller au contenu

Mathc initiation/Fichiers c : c26ce

Un livre de Wikilivres.


Sommaire


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

c16c.c
/* --------------------------------- */
/* save as c16d.c                    */
/* --------------------------------- */
#include "x_hfile.h"
#include      "fa.h"
/* --------------------------------- */
int main(void)
{
double   h = .01;
pt3d  p = i_pt3d(0.50, 0.20, 0.30);

 clrscrn();
 
 printf(" f    : x,y-> %s\n\n",   feq   );
 printf(" f_xx : x,y-> %s\n\n\n",Dfeq_xx); 
 
 printf("  f_xx(%0.2f,%0.2f,%0.2f) = %0.9f"
        " with the equation\n\n",
           p.x,p.y,p.z,   f_xx(p.x,p.y,p.z));
 printf("  f_xx(%0.2f,%0.2f,%0.2f) = %0.9f"
        " with the formula \n\n",
           p.x,p.y,p.z, fxyz_xx(f,h,p));
 stop();

 clrscrn();
 
 printf(" f    : x,y-> %s\n\n",   feq   );
 printf(" f_yy : x,y-> %s\n\n\n",Dfeq_yy);
 
 printf("  f_yy(%0.2f,%0.2f,%0.2f) = %0.9f"
        " with the equation\n\n",
           p.x,p.y,p.z,   f_yy(p.x,p.y,p.z));
 printf("  f_yy(%0.2f,%0.2f,%0.2f) = %0.9f"
        " with the formula \n\n",
           p.x,p.y,p.z, fxyz_yy(f,h,p));
 stop();

 clrscrn();
 
 printf(" f    : x,y-> %s\n\n",   feq   );
 printf(" f_zz : x,y-> %s\n\n\n",Dfeq_zz);
 
 printf("  f_zz(%0.2f,%0.2f,%0.2f) = %0.9f"
        " with the equation\n\n",
           p.x,p.y,p.z,   f_zz(p.x,p.y,p.z));
 printf("  f_zz(%0.2f,%0.2f,%0.2f) = %0.9f"
        " with the formula \n\n",
           p.x,p.y,p.z, fxyz_zz(f,h,p));

 stop();

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


Essayez avec h = .1, h = .01, h = .001, h = .0001, h = .00001 pour observer l'augmentation de la précision des calculs.


Exemple de sortie écran :

 f    : x,y-> y*sin(x*y*z)*z

 f_xx : x,y-> -y**3*z**3*sin(x*y*z)


  f_xx(0.50,0.20,0.30) = -0.000006479 with the equation

  f_xx(0.50,0.20,0.30) = -0.000006479 with the formula 

 Press return to continue.


Exemple de sortie écran :

 f    : x,y-> y*sin(x*y*z)*z

 f_yy : x,y-> 2*x*z**2*cos(x*y*z)-x**2*y*z**3*sin(x*y*z)


  f_yy(0.50,0.20,0.30) = 0.089919009 with the equation

  f_yy(0.50,0.20,0.30) = 0.089918975 with the formula 

 Press return to continue.


Exemple de sortie écran :

 f    : x,y-> y*sin(x*y*z)*z

 f_zz : x,y-> 2*x*z**2*cos(x*y*z)-x**2*z*y**3*sin(x*y*z)


  f_zz(0.50,0.20,0.30) = 0.039964004 with the equation

  f_zz(0.50,0.20,0.30) = 0.039963997 with the formula 

 Press return to continue.