# function gauss sigma mu x_mu mu sigma sqrt pi exp pow mu pow sigma ret

 ``` 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60``` ```function gauss(\$x, \$sigma, \$mu) { \$x_mu = \$x - \$mu; \$y = (1 /(\$sigma * sqrt(2*pi())))*exp ( - pow(\$x -\$mu, 2) /(2*pow(\$sigma,2))); return \$y; } function norm(\$ar,\$k) { if(is_array(\$ar)) { \$max = max(\$ar); foreach(\$ar as \$key =>\$val) \$out[\$key] = (int) floor(\$k *(\$val / \$max)); return \$out; } } \$img = imagecreatetruecolor(256,256); \$res =15000; \$sigma = 50; for(\$k =0; \$k < 256; \$k++) { for(\$g =0; \$g < 256; \$g++) { \$w = \$g; if( \$w < 90) { \$ar['red'][\$w] = 0 ; } elseif(\$w >= 90 && \$w < 180) { \$ar['red'][\$w] = floor(100*\$res*gauss(\$w, 30, 90)); } elseif(\$w >= 180) { \$ar['red'][\$w] = floor(\$res*gauss(\$w, 30, 255)); } \$ar['green'][\$w] = floor(\$res*gauss(\$w, 50, 126)); \$ar['blue'][\$w] = floor(\$res*gauss(\$w, 50, 190)); } \$ar['red'] = norm( \$ar['red'], 255); \$ar['green'] = norm( \$ar['green'], 255); \$ar['blue'] = norm( \$ar['blue'], 255); foreach(\$ar['red'] as \$key => \$val ) { if(\$key <= 90) { \$color = imagecolorallocate(\$img, 255, \$ar['green'][\$key], \$ar['blue'][\$key]); } else { \$color = imagecolorallocate(\$img, \$val, \$ar['green'][\$key] , \$ar['blue'][\$key]); } imagesetpixel(\$img, \$k, \$key, \$color); } } header("Content-type: image/png"); imagepng(\$img); ```