Sommaire


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

c00c.c
/* --------------------------------- */
/* save as c00c.c                    */
/* --------------------------------- */
#include "x_afile.h"
#include      "fc.h"
/* --------------------------------- */
#define FIRST_TERM_VALUE  5.
#define      SECOND_TERM  2
#define        FIVE_TERM  5
#define      TWENTY_TERM 20
/* --------------------------------- */
int main(void)
{
int      n;
double a_n;

 clrscrn();
 
 printf(" If a sequence is defined recursively by a_1 = %.0f \n\n",
                                                      FIRST_TERM_VALUE);
 printf(" and a_k+1 = f(a_k), where \n\n\n");
 printf(" f : x-> %s\n\n\n", feq);
 printf(" a) Find the first five terms.\n\n");
 printf(" b) What happens to the terms of the sequence as k increases.\n\n");
 stop();

 clrscrn();
 printf(" a) The first five terms are :\n\n");

 printf("  1   %+6.7f\n",FIRST_TERM_VALUE);
 for(a_n = FIRST_TERM_VALUE, 
       n = SECOND_TERM;      n <= FIVE_TERM; ++n)
    {
     a_n = f(a_n);
     printf(" %2d   %+6.7f\n",n,a_n);
    }
 stop();

 clrscrn();
 printf(" b) The sequence appears to converge to :\n\n");

 printf("  1   %+6.7f\n",FIRST_TERM_VALUE);
 for(a_n = FIRST_TERM_VALUE, 
       n = SECOND_TERM;        n <= TWENTY_TERM; ++n)
    {
     a_n = f(a_n);
     printf(" %2d   %+6.12f\n",n,a_n);
    }
    
 stop();

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


Exemple de sortie écran :

 If a sequence is defined recursively by a_1 = 5 

 and a_k+1 = f(a_k), where 


 f : x-> sqrt(x)


 a) Find the first five terms.

 b) What happens to the terms of the sequence as k increases.

 Press return to continue.


Exemple de sortie écran :

 a) The first five terms are :

  1   +5.0000000
  2   +2.2360680
  3   +1.4953488
  4   +1.2228445
  5   +1.1058230
 Press return to continue.