Mathc initiation/Fichiers h : c66a7


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        A_0        1.
#define        A_1        2.
#define SECON_TERM        2
#define        FIVE_TERM  5
#define      TWENTY_TERM 20
/* --------------------------------- */
/* --------------------------------- */
int main(void)
{
int      n;
double a_0;
double a_1;
double a_2;

 clrscrn();
 
 printf(" If a sequence is defined recursively by a_0 = %.3f   \n"
        "                                         a_1 = %.3f \n\n",
                                                      A_0, A_1);
 printf(" and a_k+2 = a_n(a_k+1, a_k) where \n\n\n");
 printf(" a_k+2 : k-> %s\n\n\n", a_neq);
 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(" a_0   %+10.3f\n",A_0);
 printf(" a_1   %+10.3f\n",A_1);
 
 for(a_0=A_0, a_1=A_1, n=SECON_TERM; n<=FIVE_TERM; ++n)
    {
     a_2 = a_n(a_1, a_0);
     
     printf(" a_%d   %+10.3f\n", n, a_2);
     a_0 = a_1;
     a_1 = a_2;
    }
 stop();
 
 clrscrn();
 printf(" b) The sequence is :\n\n");

 printf(" a_0   %+10.3f\n",A_0);
 printf(" a_1   %+10.3f\n",A_1);
 
 for(a_1 = A_1,
         a_0 = A_0,       
           n = SECON_TERM;        n <= TWENTY_TERM; ++n)
    {
     a_2 = a_n(a_1, a_0);
     printf(" a_%d   %+10.3f\n",n,a_2);
     a_0     = a_1;
     a_1 = a_2;
    }
 
 stop();
 
 return 0;
}
/* --------------------------------- */
/* --------------------------------- */


Exemple de sortie écran :

 If a sequence is defined recursively by a_0 = 1.000   
                                         a_1 = 2.000 

 and a_k+2 = a_n(a_k+1, a_k) where 


 a_k+2 : k-> (a_k+1)/a_k


 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 :

 a_0       +1.000
 a_1       +2.000
 a_2       +2.000
 a_3       +1.000
 a_4       +0.500
 a_5       +0.500
 Press return to continue.


Exemple de sortie écran :

 b) The sequence is :

 a_0       +1.000
 a_1       +2.000
 a_2       +2.000
 a_3       +1.000
 a_4       +0.500
 a_5       +0.500

 a_6       +1.000
 a_7       +2.000
 a_8       +2.000
 a_9       +1.000
 a_10       +0.500
 a_11       +0.500

 a_12       +1.000
 a_13       +2.000
 a_14       +2.000
 a_15       +1.000
 a_16       +0.500
 a_17       +0.500

 a_18       +1.000
 a_19       +2.000
 a_20       +2.000
 Press return to continue.