"Fossies" - the Fresh Open Source Software Archive

Member "ccmath-2.2.1/cfit/test/tchcof.c" (27 Oct 2000, 1125 Bytes) of package /linux/misc/old/ccmath-2.2.1.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 /*  tchcof.c    CCMATH mathematics library source code.
    2  *
    3  *  Copyright (C)  2000   Daniel A. Atkinson    All rights reserved.
    4  *  This code may be redistributed under the terms of the GNU library
    5  *  public license (LGPL). ( See the lgpl.license file for details.)
    6  * ------------------------------------------------------------------------
    7  */
    8 /*
    9     Test:  chcof
   10 */
   11 #include "ccmath.h"
   12 #include <math.h>
   13 char fnam[]="exp(x)";
   14 void main(void)
   15 { double c[20],fun(double x);
   16   int m=16,j;
   17   printf(" Test of Tchebycheff Coefficient Generator\n");
   18   printf("     function = %s\n",fnam);
   19   chcof(c,m,fun);
   20   for(j=0; j<=m ;++j) printf(" %2d %9.7f\n",j,c[j]);
   21 }
   22 /* other functions whose Tchebycheff series is
   23    desired can be substituted below. */
   24 double fun(double x)
   25 { double y=exp(x);
   26   return y;
   27 }
   28 /* Test output
   29 
   30  Test of Tchebycheff Coefficient Generator
   31      function = exp(x)
   32   0 2.5321318
   33   1 1.1303182
   34   2 0.2714953
   35   3 0.0443368
   36   4 0.0054742
   37   5 0.0005429
   38   6 0.0000450
   39   7 0.0000032
   40   8 0.0000002
   41   9 0.0000000
   42  10 0.0000000
   43  11 0.0000000
   44  12 0.0000000
   45  13 0.0000000
   46  14 0.0000000
   47  15 -0.0000000
   48  16 0.0000000
   49 */