Aller au contenu

Mathc initiation/a249

Un livre de Wikilivres.


Sommaire


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

c0b3.c
/* ---------------------------------- */
/* save as c0b3.c                     */
/* ---------------------------------- */
#include "x_afile.h"
#include      "fb.h"
/* ---------------------------------- */
int main(void)
{
tvalue n;

  n.min   =  1; 
  n.max   =  9;  
  
double i;

 clrscrn();
 printf(" Compute the %.0f first term of the sequence [a_n]  \n\n\n"
        " a_n : a_1        r**(n-1) \n      %.2f  %.2f**(n-1) \n\n",
          n.max, A_1, R);

 for(i=n.min; i<=n.max; i++)
 
     printf(" a_%.0f = %+11.5f \n", i, a_n(i));
     
     
 printf("\n\n"
        " Partial sum S_n = %s for the sequence a_n.\n\n"
        " S_n = %.2f\n\n", S_aneq, S_an(n.max,A_1,R));        
 stop();

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


Exemple de sortie écran :

 Compute the 9 first term of the sequence [a_n]  


 a_n : a_1        r**(n-1) 
      -336.00  0.33**(n-1) 

 a_1 =  -336.00000 
 a_2 =  -112.00000 
 a_3 =   -37.33333 
 a_4 =   -12.44444 
 a_5 =    -4.14815 
 a_6 =    -1.38272 
 a_7 =    -0.46091 
 a_8 =    -0.15364 
 a_9 =    -0.05121 


 Partial sum S_n = [a_1 (1-r**(n))/(1-r) for the sequence a_n.

 S_n = -503.97

 Press return to continue.