Skip to main content
added 210 characters in body
Source Link
JEM
  • 1.2k
  • 6
  • 15

I have here an implementation of Newton's method that returns a list of 3-vectors. The first and second elements are the real and imaginary parts of the initial conditions and the third element is the results of Newton's method:

Newton[z_Complex] := z - (z^3 + 1)/(3 z^2);
Table[{n, m , NestWhile[Newton[#] &, n + m I, Abs[#] <= 20 &, All, 50]}, {n, -2, 2, .1}, {m, -2, 2, .1}]

What would be an efficient way of plotting the data and assigning a color depending on the 3rd component of each 3-vector? Could we build the specifications directly into the function ListPlot?

One implementation would be to partition the output into 3 lists of 2-tuples depending on the 3rd component and then use ListPlot on those 3 lists and manually define the color. There must be a better way.

I have here an implementation of Newton's method that returns a list of 3-vectors. The first and second elements are the real and imaginary parts of the initial conditions and the third element is the results of Newton's method:

Newton[z_Complex] := z - (z^3 + 1)/(3 z^2);
Table[{n, m , NestWhile[Newton[#] &, n + m I, Abs[#] <= 20 &, All, 50]}, {n, -2, 2, .1}, {m, -2, 2, .1}]

What would be an efficient way of plotting the data and assigning a color depending on the 3rd component of each 3-vector? Could we build the specifications directly into the function ListPlot?

I have here an implementation of Newton's method that returns a list of 3-vectors. The first and second elements are the real and imaginary parts of the initial conditions and the third element is the results of Newton's method:

Newton[z_Complex] := z - (z^3 + 1)/(3 z^2);
Table[{n, m , NestWhile[Newton[#] &, n + m I, Abs[#] <= 20 &, All, 50]}, {n, -2, 2, .1}, {m, -2, 2, .1}]

What would be an efficient way of plotting the data and assigning a color depending on the 3rd component of each 3-vector? Could we build the specifications directly into the function ListPlot?

One implementation would be to partition the output into 3 lists of 2-tuples depending on the 3rd component and then use ListPlot on those 3 lists and manually define the color. There must be a better way.

Source Link
JEM
  • 1.2k
  • 6
  • 15

Defining a color scheme from part of a list

I have here an implementation of Newton's method that returns a list of 3-vectors. The first and second elements are the real and imaginary parts of the initial conditions and the third element is the results of Newton's method:

Newton[z_Complex] := z - (z^3 + 1)/(3 z^2);
Table[{n, m , NestWhile[Newton[#] &, n + m I, Abs[#] <= 20 &, All, 50]}, {n, -2, 2, .1}, {m, -2, 2, .1}]

What would be an efficient way of plotting the data and assigning a color depending on the 3rd component of each 3-vector? Could we build the specifications directly into the function ListPlot?