File:Cosftes16t300.jpg
Original file (2,366 × 564 pixels, file size: 139 KB, MIME type: image/jpeg)
Test of implementation of the CosFT through CFT:
Explicit plot of the self–CosFT function $y\!=\!\exp(-x^2/2)$, dark green curve,
its representation at the discrete set of $N\!+\!1$ nodes with $N\!=16$, thick light red segmented line,
the approximation of the CosFT transform with CFT, thin black segmented line.
The small number of nodes is taken in order to see difference between the smooth function and its discrete representation, it is barely seen; the dark green line is almost covered with the discrete approximation.
The deviation of the representation at the discrete mesh from its CFT transform is still small, of order of $10^{-3}$, and it is difficult to see even at the high resolution of the image, it is much smaller than thickness of the lines.
C++ generator of curves
// Files scft.cin and ado.cin should be loaded in order to compile the test below:
#include <stdio.h>
#include <math.h>
#include<stdlib.h>
#include "scft.cin"
#include "ado.cin"
#define NP 16
int main(){ int i; double a[NP+1],b[NP+1]; double d=sqrt(M_PI/NP); double x,y; FILE *o;
for(i=0;i<=NP;i++){ x=i*d; a[i]=b[i]=exp(-.5*x*x); }
cosft1(b-1,NP);
for(i=0;i<NP;i++) { b[i]*=sqrt(2./NP); printf("%2d %19.14lf %19.14lf %19.14lf\n",i,a[i],b[i], b[i]-a[i]);}
o=fopen("cosftes16.eps","w"); ado(o,570,140);
#define M(x,y) fprintf(o,"%9.4lf %9.4lf M\n",x+0.,y+0.);
#define L(x,y) fprintf(o,"%9.4lf %9.4lf L\n",x+0.,y+0.);
fprintf(o,"10 10 translate 100 100 scale 2 setlinecap 1 setlinejoin\n");
for(i=0;i<12;i++){M(.5*i,0)L(.5*i,1)}
for(i=0;i<3;i++){M(0,.5*i)L(5.5,.5*i)}
fprintf(o,".007 W S\n");
for(i=0;i<110;i++){ x=.05*i; y=exp(-.5*x*x);if(i==0)M(x,y) else L(x,y);} fprintf(o,".009 W 0 0 0 RGB S\n");
for(i=0;i<=NP;i++){ x=d*i; y=a[i]; if(i==0)M(x,y) else L(x,y);} fprintf(o,".04 W 1 0 .5 RGB S\n");
for(i=0;i<=NP;i++){ x=d*i; y=b[i]; if(i==0)M(x,y) else L(x,y);} fprintf(o,".015 W 0 0 0 RGB S\n");
fprintf(o,"showpage\n%c%cTrailer\n",'%','%'); fclose(o);
system("epstopdf cosftes16.eps");
system( "open cosftes16.pdf");
}
Latex generator of curves
\documentclass[12pt]{article}
\usepackage{geometry}
\usepackage{graphics}
\paperwidth 570pt
\paperheight 136pt
\textwidth 420pt
\textheight 300pt
\topmargin -108pt
\oddsidemargin -73pt
\newcommand \ds {\displaystyle}
\newcommand \sx {\scalebox}
\newcommand \rme {\mathrm{e}}
\newcommand \rot {\begin{rotate}}
\newcommand \ero {\end{rotate}}
\newcommand \ing {\includegraphics}
\pagestyle{empty}
\parindent 0pt
\begin{document}
\begin{picture}(410,132)
\put(0,0){\ing{cosftes16}}
\put(.6,120){\sx{1.25}{$y\!=\!\exp(-x^2/2)$ and its discrete representation with CFT at $N\!= 16$}}
\put(.6,104){\sx{1.3}{$1$}}
\put(.6,56){\sx{1.4}{$\frac{1}{2}$}}
\put(.6, 5){\sx{1.3}{$0$}}
\put(108,-2){\sx{1.3}{$1$}}
\put(208,-2){\sx{1.3}{$2$}}
\put(308,-2){\sx{1.3}{$3$}}
\put(408,-2){\sx{1.3}{$4$}}
\put(508,-2){\sx{1.3}{$5$}}
\put(562,-1.6){\sx{1.3}{$x$}}
%\put(43,89){\sx{1.2}{$\displaystyle F(r)\!=\!\frac{1}{r \sqrt{\pi}} \exp\!\Big(\!-\ln(r)^2 \Big)$}}
\end{picture}
\end{document}
References
File history
Click on a date/time to view the file as it appeared at that time.
Date/Time | Thumbnail | Dimensions | User | Comment | |
---|---|---|---|---|---|
current | 06:11, 1 December 2018 | 2,366 × 564 (139 KB) | Maintenance script (talk | contribs) | Importing image file |
You cannot overwrite this file.
File usage
The following page uses this file: