/****************************************************************************
 * This formula file or any formula file derived from it cannot be used for
 * commercial purposes or to create hard copy output without the explicit
 * consent of the original author.
 ****************************************************************************/

fractal {

   // Establish the mapping between complex coordinates
   // and display coordinates

   mapping {
      (0.05360000000000000181,
       -0.00482758620689654160,
       1.12560000000000015596,
       0.85586206896551730861) => (1199,960)
   }


   formula
   {
      f_c = coth(current);
      zvalue = f_c * cosh(f_c ^ 2);

      $xavg = 0;    
      $yavg = 0;    
      $mavg = 0;    

      $xmax = 0;    
      $ymax = 0;    
      $mmax = 0;    

      $xtot = 0;    
      $ytot = 0;    
      $mtot = 0;    
     
      zSum           = 0;
      $denominator   = 1;
      $value         = 2;
      $maxIterations = 15;
      $tolerance     = 1e-6;

      while($count < $maxIterations && ssq(zvalue - zSum) > $tolerance)
      {
         zSum += (f_c ^ (4 * $count + 1)) / $denominator;

         $denominator *= ($value - 1) * $value;

         value = sech(zSum);

         $x = mag(value ^ .1);
         $y = mag(value ^ .2);
         $m = mag(value ^ .3);

         $xavg = ($x + $xavg * $count) / ($count + 1);
         $yavg = ($y + $yavg * $count) / ($count + 1);
         $mavg = ($m + $mavg * $count) / ($count + 1);

         $xdev = sqrt(($x - $xavg) * ($x - $xavg));
         $ydev = sqrt(($y - $yavg) * ($y - $yavg));
         $mdev = sqrt(($m - $mavg) * ($m - $mavg));

         $xmax = max($xmax, $xdev);
         $ymax = max($ymax, $ydev);
         $mmax = max($mmax, $mdev);

         $xtot += $xdev;
         $ytot += $ydev;
         $mtot += $mdev;

         $value += 2; 
      }

      $r = 0;
      $g = 0;
      $b = 0;

      if($count > 0)
      {
         $r = ($xtot/$count) / $xmax;
         $g = ($ytot/$count) / $ymax;
         $b = ($mtot/$count) / $mmax;

         $r = get_sin_color($r, 255, 1);
         $g = get_sin_color($g, 255, 1);
         $b = get_sin_color($b, 255, 1);
      }

      set_color($b, $r, $g);
   }
}








































































