Complex numbers

Hello; i use complex number which give results related to Mandelbrot Set
I see that i can create curves from the points but it’s hard to know how to find the start point
in some cases interpolate work.
I tried using and the curves are very clear but i can’t separate them ; some method work for some cases ,not always
If someone have an idea, i appreciate any help to solve this

complex (7.5 KB)

This isn’t fully parameterized because I don’t yet understand how to compute the slider value (Partition size), other than trial and error: (12.2 KB)


Nice! (12.9 KB)
Pick the first point and search for the other nearest; using the found point’s index +1 as your partition size.
Using [Closest Points] instead to have more options…

1 Like

Cool. That works surprisingly well. It’s basically what I did visually, using my ‘Tree/List Viewer’ tool, but I wasn’t confident that closest point would always work, given the many variations in point distribution as the second Series ‘Step’ slider changes.

@seghierkhaled, would you care to explain what “cmath.rect(x,y)” is doing? How does it work? Oh wait, here it is:

Thanks ; yes the problem is always in the numbers of point group (number of lines) because it changed with simple change in sliders

Thank you ; this work fine i tested with closest points before but the first points was my problem.
Your method work excellent but it doesn’t work in some cases for example:

Yes cmath is about complex number; i use rect(x,y) to convert complex number to points with coordinates (x,y,0) ; grasshopper has some components about complex number but i don’t find how to convert it to point
this is related to Mandelbrot Set


Hi @seghierkhaled,

You can use the cmath.phase() function to indicate whether each generated point is above or below the x axis. For one complete revolution (ie the partition size) you get two changes of phase. I added this to your python component.

I knocked up a quick second python component to output the count of points up to the second phase change and plugged it into @Joseph_Oster’s solution.

complex (16.8 KB)

A more elegant solution would be to change the original python to process list input and combine the two.

Note: This is dependent on the first point being placed horizontally from the centre. Further tweaking needed if you want to place it elsewhere…

Edit: As pointed out below, this approach is too simplistic and does not work in all cases. :disappointed_relieved:



Thank you very much
Sadly don’t work for all cases , i think the mesh is step of the solution if it is possible to separate black lines
also the points order is very clear but the problem is how to find the first or end points of the curves
the solutions above and every solution i tried don’t work for all cases.
i tried to explain the idea in the images , there are more closest points to the circle


If your eventual aim is related to the Mandelbrot set, you’ll need to look not just at simple parametric curve plots like this, but iterated functions.

Also, to get a curve out, rather than just a raster image or collection of points, one way is to work with a potential and plot it as a height-field mesh, then contour it.
Here’s a basic example (6.2 KB)

See here for some further reading


You can select different input rectangles to focus in on areas of interest


Thank you very much; very interesting i will use it to do something.
What i need exactly is not the Mandelbrot set but the curves result when the point move inside its area

1 Like

This video show what i mean about curves

1 Like

Looks like they’re just plotting the iterations of z²+c (8.9 KB)

1 Like

Closest point method fails if your point start near the center. (you have the 3rd slider at 0 )
If you use the last (most external) point to do the search, it works every time.

1 Like

Yes exactly and with python i get the same points and need the curve from them

i will check again ; thank you

This approach (white group) uses culled angles to find the partition size and seems to be robust, though I’m pretty sure it can be done better. (22.4 KB)

What’s interesting about the slider method yesterday is that there are many arbitrary values that appear to yield “interesting” results, though on closer inspection, curves are redundant, partial (sub-curves) and overlayed on top of each other. The method in this post doesn’t appear to have that problem.

1 Like

Thank you i will check it later

1 Like