YAMP.Numerics.Newton.Run C# (CSharp) 메소드

Run() 공개 메소드

Calculates a single Newton fractal value.
public Run ( double x, double y ) : double
x double The x value.
y double The y value.
리턴 double
        public override double Run(double x, double y)
        {
            var iter = 0;
            var maxiter = MaxIterations;

            ScalarValue zn = new ScalarValue(x, y);
            ScalarValue pz = ScalarValue.One;
            ScalarValue pzd = ScalarValue.Zero;

            if(x != 0 || y != 0)
            {
                while ((iter < maxiter) && pz.AbsSquare() > 1e-8)
                {
                    pz = zn.Pow(new ScalarValue(3)) - 1.0;
                    pzd = 3.0 * zn.Square();
                    zn = zn - pz / pzd;
                    iter++;
                }
            }

            return Math.Max((double)(maxiter - iter * Colors) / (double)maxiter, 0.0);
        }

Usage Example

예제 #1
0
 public ScalarValue Function(ScalarValue x, ScalarValue y)
 {
     var m = new Newton();
     return new ScalarValue(m.Run(x.Re, y.Re));
 }
All Usage Examples Of YAMP.Numerics.Newton::Run