# File:Cosftes04t300.jpg

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\!=4$, 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.

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 4

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("cosftes04.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 .5 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 cosftes04.eps");

system( "open cosftes04.pdf");

}

## Latex generator of labels

\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{cosftes04}}

\put(.6,120){\sx{1.25}{$y\!=\!\exp(-x^2/2)$ and its discrete representation with CFT at $N\!= 4$}}

\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$}}

\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 (135 KB) | Maintenance script (talk | contribs) | Importing image file |

- You cannot overwrite this file.

## File usage

The following page links to this file: