Mathc initiation/a374
Apparence
Installer et compiler ces fichiers dans votre répertoire de travail.
c00a.c |
---|
/* --------------------------------- */
/* save as c00a.c */
/* --------------------------------- */
#include "x_afile.h"
#include "fa.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-> exp(x/4.)-2.
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 +1.4903430
3 -0.5485171
4 -1.1281425
5 -1.2457532
Press return to continue.