Aller au contenu

Mathc initiation/c57cb

Un livre de Wikilivres.


Sommaire


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

c00b.c
/* --------------------------------- */
/* save as c00b.c                    */
/* --------------------------------- */
#include "x_hfile.h"
#include      "fb.h"
/* --------------------------------- */
int main(void)
{
CTRL_splot w = i_ctrl_splot(0.8,2.2, -1,8, 0,0, 0,0, 0,0);

double step =   .01;

double  m = simpson_dydx(f,  u,v,LOOP, ax,bx,LOOP);
double My = simpson_dydx(xf, u,v,LOOP, ax,bx,LOOP);
double Mx = simpson_dydx(yf, u,v,LOOP, ax,bx,LOOP);

pt2d    d = i_pt2d(My/m, Mx/m);

 clrscrn();

 printf(" Find the mass and the center of mass of the lamina\n");
 printf(" that has the shape of the region bounded by the   \n");
 printf(" graphs of the given equations.\n\n");

 printf(" y = %s, y = %s, x = %+.1f, x = %+.1f,  \n\n", veq, ueq, bx ,ax);
 printf(" and f(x,y)  (the area mass density at (x,y)) \n\n");
 printf(" f : (x,y)-> %s    \n\n", feq);
 printf(" These give :      \n\n");
 printf(" b :         %+.1f   \n",  bx);
 printf(" a :         %+.1f \n\n",  ax);
 printf(" v :   (x)-> %s      \n", veq);
 printf(" u :   (x)-> %s    \n\n", ueq);
 stop();
 
 clrscrn();

 printf("   Compute the mass m.\n\n");
 printf("         (b     (v(x)\n");
 printf(" m =  int(   int(     f(x,y)  dy dx\n");
 printf("         (a     (u(x)\n\n");

 printf("   Compute the moment Mx.\n\n");
 printf("         (b     (v(x)\n");
 printf(" Mx = int(   int(    y  f(x,y)  dy dx\n");
 printf("         (a     (u(x)\n\n");

 printf("   Compute the moment My.\n\n");
 printf("         (b     (v(x)\n");
 printf(" My = int(   int(     x  f(x,y)  dy dx\n");
 printf("         (a     (u(x)\n\n");

 printf("   The center of mass is (X,Y)\n\n");
 printf("     X = My/m      Y = Mx/m \n\n");
 stop();

 clrscrn();

 printf("   Compute the mass m.\n\n"); 
 printf("        (%.3f  (%s\n",      bx,veq);
 printf(" m = int(    int(       %s  dy dx = %.3f\n", feq, m);
 printf("        (%.3f (%s\n\n",  ax,ueq); 
 
 printf("   Compute the moment Mx.\n\n");
 printf("         (%.3f  (%s\n",      bx,veq);
 printf(" Mx = int(    int(       %s  dy dx = %.3f\n", yfeq, Mx);
 printf("         (%.3f (%s\n\n",  ax,ueq);

 printf("   Compute the moment My.\n\n");
 printf("         (%.3f  (%s\n",      bx,veq);
 printf(" My = int(    int(       %s  dy dx = %.3f\n", xfeq, My);
 printf("         (%.3f (%s\n\n",  ax,ueq);
 
 printf("   The center of mass is (X,Y)\n\n");
 printf("     X = My/m = %.2f     Y = Mx/m = %.2f\n\n",My/m,Mx/m);
 stop();

 clrscrn();

         G_uv(w,
              ax,bx,
              d,
              step,
              v,u);
 stop();
 
 return 0;
}
/* --------------------------------- */
/* --------------------------------- */


En mécanique, le centre de masse d'une plaque homogène est le point par rapport auquel la masse est uniformément répartie. Pratiquement, dans le cas d'un champ de pesanteur uniforme le centre de masse est confondu avec le centre de gravité de la plaque.
Calculons le centre de masse d'une plaque non homogène.

Exemple de sortie écran :

 Find the mass and the center of mass of the lamina
 that has the shape of the region bounded by the   
 graphs of the given equations.

 y = exp(x), y = log(x), x = +2.0, x = +1.0,  

 and f(x,y)  (the area mass density at (x,y)) 

 f : (x,y)-> x    

 These give :      

 b :         +2.0   
 a :         +1.0 

 v :   (x)-> exp(x)      
 u :   (x)-> log(x)    

 Press return to continue.
the center of mass of the lamina. Gnuplot. Language C

Exemple de sortie écran :

   Compute the mass m.

         (by     (v(y)
 m =  int(   int(     f(x,y)  dx dy
         (ay     (u(y)

   Compute the moment Mx.

         (by     (v(y)
 Mx = int(   int(    y  f(x,y)  dx dy
         (ay     (u(y)

   Compute the moment My.

         (by     (v(y)
 My = int(   int(     x  f(x,y)  dx dy
         (ay     (u(y)

   The center of mass is (X,Y)

     X = My/m     Y = Mx/m 

 Press return to continue.


Exemple de sortie écran :

   Compute the mass m.

        (2.000  (exp(x)
 m = int(    int(       x  dy dx = 6.753
        (1.000 (log(x)

   Compute the moment Mx.

         (2.000  (exp(x)
 Mx = int(    int(       (y)* (x)  dy dx = 19.388
         (1.000 (log(x)

   Compute the moment My.

         (2.000  (exp(x)
 My = int(    int(       (x)* (x)  dy dx = 10.989
         (1.000 (log(x)

   The center of mass is (X,Y)

     X = My/m = 1.63     Y = Mx/m = 2.87

 Press return to continue.