Aller au contenu

Mathc initiation/Fichiers c : c72c11

Un livre de Wikilivres.


Sommaire


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

c01i.c
/* ---------------------------------- */
/* save as c1i.c                      */
/* ---------------------------------- */
#include "x_hfile.h"
#include      "fi.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)/(1+(4*x+5)**2))  dx = 0.157895
    (1.000



 With the antiderivative of f.

 F(x) = 1/8*ln(|1+(4*x+5)**2|)  


 F(3.000) -  F(1.000)  = 0.157895 


 Press return to continue.



Calculons la primitive :
                           
Calculer la primitive de 
                                 
    
        /   (4x+5)
       |  ----------- dx =        
       /  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 =        
       /  1+(4x+5)**2             
                             

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


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

              
        /   (4x+5)              3   /   1     
       |  ----------- dx    +  --- |  --------  du      
       /  1+(4x+5)**2           4  /  1 + u**2   
       
       

   =  1/8 ln(1+(4x+5)**2) + 3/4  atan(u)    + c                    

   =  1/8 ln(1+(4x+5)**2) + 3/4  atan(4x+5) + c
Remarque 2 :
   
   
        /   (4x+5)**2
       |  ----------- dx =        
       /  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 =        
       /  1+(4x+5)**3             
             
                           

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


Remarque 3 :
   
   
        /  (4x+5)**(-1/2)
       |  --------------- dx =        
       /  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 =        
       /  1+(4x+5)**(1/2)              
             
                           

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