Advertisement
Guest User

Untitled

a guest
Apr 21st, 2018
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.37 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Numerics;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7. using MathNet.Numerics;
  8.  
  9. namespace ConsoleApp1
  10. {
  11.     class Program
  12.     {
  13.         static void Main(string[] args)
  14.         {
  15.             Equation equation = new Equation();
  16.             equation.itMax = 255;
  17.             equation.ComputeFunction = Calculate;
  18.             equation.ComputeIterateFunction = Iterate;
  19.             ImageProcessor processor = new ImageProcessor(1920, 1080, 7, 7);
  20.             processor.DrawImage(equation, "M:/Pictures/Complex/TFF/Baud4.png", false);
  21.  
  22.         }
  23.  
  24.         static Complex Calculate(Complex z)
  25.         {
  26.             return Complex.Add(
  27.                     new Complex(SpecialFunctions.Gamma((z.Real + 1) / 2), 0),
  28.                     Complex.Log(z));
  29.  
  30.         }
  31.  
  32.         static int Iterate(Complex c, int itMax)
  33.         {
  34.             Complex z = c;
  35.             int i = 0;
  36.             for (i = 0; i < itMax; i++)
  37.             {
  38.                 z = Complex.Add(Complex.Pow(z, 2), c);
  39.             }
  40.             /*
  41.             double mag = Math.Round(c.Magnitude);
  42.             int real = Convert.ToInt32(mag);
  43.             if (real < 0) real = Math.Abs(real);
  44.             int im = Convert.ToInt32(Math.Round(c.Imaginary));
  45.             int i;
  46.             for (i = 0; i < itMax; i++)
  47.             {
  48.                 if (real % 2 == 0) real /= 2;
  49.                 else real = 3*real + 1;
  50.                 if (real == 1)
  51.                 {
  52.                     break;
  53.                 }
  54.             }
  55.             if (i == itMax) return i;
  56.             */
  57.             return i;
  58.         }
  59.  
  60.         static Complex x(double a, double b)
  61.         {
  62.             return new Complex(a, b);
  63.         }
  64.     }
  65. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement