This example uses Newton’s method to draw a fractal for the polynomial equation F(z) = z^{N} + z^{N-1} + … + z + 1.

For more information about how the program works, see these examples:

- Use Newton’s method to draw fractals for equations of the form F(z) = z^C – C^z in C#
- Use Newton’s method to draw a fractal in C#

Once you know how to use Newton’s methods to generate one kind of fractal, it’s easy to make new ones. Simply use the examples in the links above and change the equation and its derivative. This example is the same as the previous one except it uses the equation:

F(z) = z^{N}+ z^{N-1}+ ... + z + 1

Fortunately it’s easy to take the derivative of this equation:

dFdz(z) = N * z^{N-1}+ (N - 1) * z^{N-2}+ ... + 2 * z + 1

The following code shows how the program calculate F(z) and dFdz(z).

// F(x) = x ^ Power + // x ^ (Power - 1) + // x ^ (Power - 2) + ... + x + 1 private Complex F(Complex x) { Complex result = 1; for (int i = 1; i <= Power; i++) { result += x ^ i; } return result; } // dFdx(x) = Power * x ^ (Power - 1) + // (Power - 1) * x ^ (Power - 2) + // (Power - 2) * x ^ (Power - 3) + ... + 1 private Complex dFdx(Complex x) { Complex result = 1; for (int i = 2; i <= Power; i++) { result += i * (x ^ (i - 1)); } return result; }

See the code and the previous examples for details.