Aller au contenu

Mathc initiation/Fichiers c : c72c12

Un livre de Wikilivres.


Sommaire


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

c01j.c
/* ---------------------------------- */
/* save as c1j.c                      */
/* ---------------------------------- */
#include "x_hfile.h"
#include      "fj.h"
/* ---------------------------------- */
int main(void)
{
int      n =  2*50;
double   a =  1.;
double   b =  3.;

 clrscrn();

 printf(" With the Simpson's rule.    (n = %d)\n\n"
        "    (%.3f\n"
        " int(      (%s)  dx = %.6f\n"
        "    (%.3f\n\n\n\n",n,  b, feq, simpson(f,a,b,n), a);

 printf(" With the antiderivative of f.\n\n"
        " F(x) = %s \n\n\n" 
        " F(%.3f) -  F(%.3f)  = %.6f \n\n\n", Feq, b,a, F(b)-F(a));
 
 stop();

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


Calculons l'intégrale avec la fonction simpson(f,a,b,n); puis avec sa primitive F(x).


Exemple de sortie écran :
 With the Simpson's rule.    (n = 100)

    (3.000
 int(      ((4*x+5)/sqrt(1+(4*x+5)**2))  dx = 1.993500
    (1.000



 With the antiderivative of f.

 F(x) = 1./4. *sqrt(1+(4*x+5)***2) 


 F(3.000) -  F(1.000)  = 1.993500 


 Press return to continue.



Calculons la primitive :
                           
Calculer la primitive de 
                                 
    
        /     (4x+5)
       |  ----------------- dx =        
       /  sqrt(1+(4x+5)**2)            
             
                         __________________________          
                        |      u =  1+(4x+5)**2    |            
                        |     du =   2(4x+5)(4) dx |  
                        | 1/8 du =    (4x+5)    dx |                                           
                        |__________________________|
             
        /      1
       |  -----------------   (4x+5) dx =        
       /  sqrt(1+(4x+5)**2)             
                             

    1   /   1
   --- |  ------    du =        
    8  /  u**1/2  
    
    
    1   /      
   --- |  u**(-1/2) du =    1/8 2 u**1/2            + c        
    8  /             
       
                       =     1/4 (1+(4x+5)**2)**1/2 + c


Remarque 1 :
                                 
    
        /     (4x+8)
       |  ----------------- dx =        
       /  sqrt(1+(4x+5)**2)            
             
             
        /   (4x+5)                     /     3
       |  ----------------- dx     +  |  ----------------- dx      
       /  sqrt(1+(4x+5)**2)           /  sqrt(1+(4x+5)**2)           
         
         
                         __________________         
                        |      u = 4x+5    |            
                        |     du = 4    dx |  
                        |1/4 du =       dx |                                           
                        |__________________|         

              
        /   (4x+5)                    3   /      1     
       |  ----------------- dx    +  --- |  ------------  du      
       /  sqrt(1+(4x+5)**2)           4  /  sqrt(1+u**2)   
       
                                                                *** int(1/sqrt(1+u**2) = sinh(u) ***
                                                                      Voir fin de fichier.
   =    1/4 (1+(4x+5)**2)**1/2    + 3/4 sinh(u)     + c                     

   =    1/4 (1+(4x+5)**2)**1/2    + 3/4 sinh(4x+5)  + c
Remarque 2 :
   
   
        /   (4x+5)**2
       |  -----------------  dx =        
       /  sqrt(1+(4x+5)**3)            
             
                         ____________________________         
                        |      u = 1+(4x+5)**3       |            
                        |     du =(3)(4x+5)**2(4) dx |  
                        |1/12 du =   (4x+5)**2    dx |                                           
                        |____________________________|
             
        /      1
       |  ----------------- (4x+5)**2 dx =        
       /  sqrt(1+(4x+5)**3)             
             
                           

    1   /  1
  ---- |  ------     du =          
   12  /  u**1/2  
   
   
    1   /  
  ---- |  u**(-1/2)  du = 1/12 2     u**1/2        + c         
   12  /    
   
                        =  1/6  (1+(4x+5)**3)**1/2 + c


Remarque 3 :
   
   
        /  (4x+5)**(-1/2)
       |  --------------------- dx =        
       /  sqrt(1+(4x+5)**(1/2))            
             
                         _____________________________________       
                        |      u =     1+(4x+5)**(1/2)         |            
                        |      du = (1/2)(4x+5)**(-1/2)(4) dx |  
                        |(1/2) du =      (4x+5)**(-1/2)    dx |                                           
                        |_____________________________________|
             
        /        1
       |  ---------------------  (4x+5)**(-1/2) dx =        
       /  sqrt(1+(4x+5)**(1/2))              
             
                           

    1   /  1
   --- |  ------    du =         
    2  /  u**1/2  
    
    
    1   /   
   --- |  u**(-1/2) du =  1/2  2   u**1/2       + c        
    2  /        
    
              
                       = [1+(4x+5)**(1/2)]**1/2 + c
   
   
       ...
 *** int(1/sqrt(1+u**2) = sinh(u)  ***