File:GauMap.png

From TORI
Jump to: navigation, search
Original file(1,706 × 1,690 pixels, file size: 264 KB, MIME type: image/png)

Complex map of the Gauss Distribution density:

\( \displaystyle u + \mathrm i v = \frac{\exp(-(x+\mathrm i y)^2/2)}{\sqrt{2\pi)}} \)

C++ generator of curves


#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#define DB double
#define DO(x,y) for(x=0;x<y;x++)
//using namespace std;
#include<complex>
typedef std::complex<double> z_type;
#define Re(x) x.real()
#define Im(x) x.imag()
#define I z_type(0.,1.)
#include "conto.cin"
#include "fac.cin"

z_type Student(z_type n, z_type t){
z_type c,d,e;
c=fac((n-1.)/2.);
d=fac(.5*n-1.);
e=exp(-.5*(n+1.)*log(1.+t*t/n));
return e*c/(sqrt(M_PI*n)*d);
}

z_type Gau(z_type z){ return exp(-.5*z*z)/sqrt(2*M_PI);} 

int main(){ int j,k,m,n; DB x1,x,y, p,q, t; z_type z,c,d, cu,cd;
int M=800,M1=M+1;
int N=800,N1=N+1;
DB X[M1],Y[N1];
DB *g, *f, *w; // w is working array.
g=(DB *)malloc((size_t)((M1*N1)*sizeof(DB)));
f=(DB *)malloc((size_t)((M1*N1)*sizeof(DB)));
w=(DB *)malloc((size_t)((M1*N1)*sizeof(DB)));
char v[M1*N1]; // v is working array
FILE *o;o=fopen("GauMa.eps","w");  ado(o,802,802);
fprintf(o,"401 401 translate\n 100 100 scale\n");
fprintf(o,"1 setlinejoin 2 setlinecap\n");
DO(m,M1) X[m]=-4.+.01*(m-.5);
DO(n,N1) Y[n]=-4.+.01*(n-.5); 
for(m=-4;m<5;m++) {M(m,-5)L(m,5)}
for(n=-4;n<5;n++) {M(  -5,n)L(5,n)} fprintf(o,".006 W 0 0 0 RGB S\n");
DO(m,M1)DO(n,N1){      g[m*N1+n]=999;
                       f[m*N1+n]=999;}
DO(m,M1){x=X[m]; if(m/10*10==m) printf("x=%6.3f\n",x);
DO(n,N1){y=Y[n]; z=z_type(x,y);  
//c=zex(z);  
//c=1./(1.+z*z);
//c=Student(20.,z);
c=Gau(z);

p=Re(c); q=Im(c);
//        if(p>-19 && p<19 &&  fabs(q)>1.e-12 && fabs(p)>1.e-12) 
g[m*N1+n]=p;
//        if(p>-19 && p<19 &&  fabs(q)>1.e-12 && fabs(p)>1.e-12) 
f[m*N1+n]=q;
       }}
fprintf(o,"1 setlinejoin 1 setlinecap\n");  p=20.;q=.3;
for(m=-2;m<2;m++)for(n=1;n<10;n+=1)conto(o,f,w,v,X,Y,M,N,(m+.1*n),-q,q);fprintf(o,".007 W 0 .6 0 RGB S\n");
for(m=0;m<2;m++) for(n=1;n<10;n+=1)conto(o,g,w,v,X,Y,M,N,-(m+.1*n),-q,q);fprintf(o,".007 W .9 0 0 RGB S\n");
for(m=0;m<2;m++) for(n=1;n<10;n+=1)conto(o,g,w,v,X,Y,M,N, (m+.1*n),-q,q);fprintf(o,".007 W 0 0 .9 RGB S\n");
for(m= 1;m<5;m++) conto(o,f,w,v,X,Y,M,N, (0.-m),-p,p);fprintf(o,".02 W .8 0 0 RGB S\n");
for(m= 1;m<5;m++) conto(o,f,w,v,X,Y,M,N, (0.+m),-p,p);fprintf(o,".02 W 0 0 .8 RGB S\n");
               conto(o,f,w,v,X,Y,M,N, (0.  ),-p,p); fprintf(o,".02 W .5 0 .5 RGB S\n");
for(m=-4;m<5;m++)conto(o,g,w,v,X,Y,M,N,(0.+m),-p,p);fprintf(o,".02 W 0 0 0 RGB S\n");
fprintf(o,"showpage\n");  fprintf(o,"%c%cTrailer\n",'%','%');
fclose(o);  free(f); free(g); free(w);
      system("epstopdf GauMa.eps"); 
      system(    "open GauMa.pdf"); //for macintosh
      getchar(); system("killall Preview"); // For macintosh

Keywords

«Gauss», «Normal Distribution»,

File history

Click on a date/time to view the file as it appeared at that time.

Date/TimeThumbnailDimensionsUserComment
current23:02, 10 May 2024Thumbnail for version as of 23:02, 10 May 20241,706 × 1,690 (264 KB)T (talk | contribs)less lines, this corresponds to the updated description
08:27, 9 May 2024Thumbnail for version as of 08:27, 9 May 20241,706 × 1,690 (315 KB)T (talk | contribs)== Summary == Complex map of the Gauss function Category:Complex map Category:Gauss Category:Student Distribution
  • You cannot overwrite this file.

The following page links to this file:

Metadata