File:SelfCosFTt200.png

Two self-fourier functions and their discrete representations and their discrete CosFourier transforms with $N\!=\!16$ nodes;
 * $ \displaystyle f_0(x)=\exp(-x^2/2)$
 * $ \displaystyle f_1(x)=\exp(-x^2/2) (x^4-3x^2)$

These functions are shown with dotted lines.

The discrete representations at the equidistant grid of $N=16$ nodes with step $d=\sqrt{\pi/N}$ are shown with thick lines. Their DCTI transforms are shown with thin black lines. For these self-fourier functions, the DCTIs coincide with the originals with 8 decimal digits.

The generator below can be used to test the numeric implementation of the CosFourier transform.

C++ generator of curves
// Files zfour1.cin, zrealft.cin, zcosft1.cin should be loaded in the working directory for the compilation of the C++ code below.

// cosft below realizes the DCFTI transform; the numeration of elements of the input array begins with zero.

using namespace std; //#include "cosft.cin" void cosft(z_type a[], int N){ int n; DB d; zcosft1(a-1,N); d=sqrt(2./N); DO(n,N) a[n]*=d; } // this cosft does the normalized DCTI void ado(FILE *O, int X, int Y) {      fprintf(O,"%c!PS-Adobe-2.0 EPSF-2.0\n",'%'); fprintf(O,"%c%cBoundingBox: 0 0 %d %d\n",'%','%',X,Y); fprintf(O,"/M {moveto} bind def\n"); fprintf(O,"/L {lineto} bind def\n"); fprintf(O,"/S {stroke} bind def\n"); fprintf(O,"/s {show newpath} bind def\n"); fprintf(O,"/C {closepath} bind def\n"); fprintf(O,"/F {fill} bind def\n"); fprintf(O,"/o {.01 0 360 arc C F} bind def\n"); fprintf(O,"/times-Roman findfont 20 scalefont setfont\n"); fprintf(O,"/W {setlinewidth} bind def\n"); fprintf(O,"/RGB {setrgbcolor} bind def\n");}
 * 1) include
 * 2) include
 * 3) include 
 * 1) include
 * 2) define z_type complex
 * 3) include "zfour1.cin"
 * 4) include "zrealft.cin"
 * 5) include "zcosft1.cin"
 * 6) define DB double
 * 7) define Re(x) x.real
 * 8) define Im(x) x.imag
 * 9) define DO(x,y) for(x=0;x<y;x++)

// #include "ado.cin" main{ z_type *a, *b; int j,N=16; FILE *o; DB x,y,d,xx=x*x; o=fopen("SelfFourierDCTI.eps","w"); ado(o,55,24); fprintf(o,"1 13 translate 10 10 scale\n"); M(0, 1)L(0,-1) M(0,0)L(5,0) fprintf(o,"2 setlinecap .004 W S\n"); M(0, 1)L(5, 1) fprintf(o,"2 setlinecap .004 W S\n"); M(0,-1)L(5,-1) fprintf(o,"2 setlinecap .004 W S\n"); for(j=1;j<11;j++){ M(j,-1)L(j,1);} fprintf(o,"2 setlinecap .004 W S\n"); d=sqrt(M_PI/N); a=(z_type *) malloc((size_t)((N+1)*sizeof(z_type))); b=(z_type *) malloc((size_t)((N+1)*sizeof(z_type))); for(j=0;j5) break;} fprintf(o,"0 .9 0 RGB .02 W S\n"); cosft(a,N); //zcosft1(a-1,N); for(j=0;j5) break;} fprintf(o,"0 0 0 RGB .008 W S\n"); DO(j,N) a[j]-=b[j]; for(j=0;j9) break;} for(j=0;j5) break;} fprintf(o,"0 0 1 RGB .016 W S\n"); cosft(a,N); //zcosft1(a-1,N); for(j=0;j5) break;} fprintf(o,"0 0 0 RGB .005 W S\n"); DO(j,N) a[j]-=b[j]; for(j=0;j9) break;} free(a); free(b); fprintf(o,"showpage\n"); fprintf(o,"%c%cTrailer\n",'%','%'); fclose(o); system("epstopdf SelfFourierDCTI.eps"); system(   "open SelfFourierDCTI.pdf"); }
 * 1) define M(x,y) fprintf(o,"%8.4f %8.4f M\n",0.+x,0.+y);
 * 2) define L(x,y) fprintf(o,"%8.4f %8.4f L\n",0.+x,0.+y);
 * 3) define o(x,y) fprintf(o,"%8.4f %8.4f o\n",0.+x,0.+y);

Latex generator of labels
%File SelfCosFT.pdf should be generated in the working directory with the code above in order to compile the Latex document below.

\documentclass[12pt]{article} % \usepackage{geometry} % \paperwidth 530pt % \paperheight 230pt % \topmargin -92pt % \oddsidemargin -78pt % \textwidth 800pt % \textheight 300pt % \parindent 0pt % \pagestyle{empty} % \usepackage{graphicx} % \usepackage{epstopdf} % \newcommand \sx \scalebox % \begin{document} % \begin{picture}(520,220) % %\put(16,0){\sx{10}{\includegraphics{SelfCosFT}}} % \put(16,0){\sx{10}{\includegraphics{SelfFourierDCTI}}} % \put(12,223){\sx{1.8}{$1$}} % \put(12,124){\sx{1.8}{$0$}} % \put(2, 24){\sx{1.8}{$-\!1$}} % \put(122, 14){\sx{1.8}{$1$}} % \put(222, 14){\sx{1.8}{$2$}} % \put(322, 14){\sx{1.8}{$3$}} % \put(422, 14){\sx{1.8}{$4$}} % \put(522, 14){\sx{1.9}{$x$}} % \put(99, 212){\sx{2}{$f_0(x)$}} % \put( 58, 102){\sx{2}{$f_1(x)$}} % %\put( 66, 100){\sx{2}{$\exp(-x^2/2)(x^4-3x^2)$}} % \end{picture} % \end{document}   % %