Aller au contenu

Mathc initiation/a169

Un livre de Wikilivres.


Sommaire

Installer ce fichier dans votre répertoire de travail.

s_n.h
/* --------------------------------- */
/* save as s_n.h                     */
/* --------------------------------- */
double S_n(
int n)
{
        return(    n*(n+1)/2 );
}
char  S_neq[] =  "[n(n+1)]/2";
/* --------------------------------- */
/*  Compute the partial sum of the sequence a_n = n


   S_n =    1  +    2  +     3  +  ... + (n-2) + (n-1) +  n    
   S_n =   n   + (n-1) +  (n-2) +  ... +    3  +    2  +     1    
      -------------------------------------------------
 2 S_n =  (n+1) + (n+1) +  (n+1) +  ... + (n+1) + (n+1) + (n+1) 
                                                                              
 2 S_n =  n (n+1) 
 
   S_n =  n (n+1) 
          -------
             2
*/                              
/* --------------------------------- */
/* --------------------------------- */


Dans ce fichier il y a les utilitaires.