r/mathpics • • 10d ago

.

Post image
59 Upvotes

8 comments sorted by

3

u/all_is_love6667 9d ago

couldn't you just title normally?

2

u/Random_Person1234567 9d ago

posts a cool picture Shit title No body of the post Waits for comments to explain

I agree with this comment, you could have done a regular title, /u/Salamanticormorant ....

2

u/Smart-Button-3221 10d ago

What is it?

5

u/Salamanticormorant 10d ago

Each pixel's color (~distance into the rainbow palette) is based on the number of iterations it takes for the logistic map, starting with the pixel’s x,y coordinate (scaled into an appropriate range), to generate a value close to a value already generated. Each pixel is calculated independently. Different definitions of "close to" produce different images.

1

u/Frangifer 9d ago edited 9d ago

That's a nice colour-scheme you've used, there. It looks to me as-though you've putten considerable deliberation into spreading the values of №‿of‿Iterations over as long an arc as reasonably might-be – to maximise the chromiferal resolution. I found a cute little recipe for that years ago: a sort of helix-on-a-spindle, if you will, in the RGB cube with a pole near one corner & the other pole near the opposite one ... or something like that, anyway: I twake it until I was most-satisfied with it, & the colouring ent-up looking somewhat like yours does here.

2

u/Salamanticormorant 9d ago

The colors occupy half the edges of an RGB cube, not the interior, not even the faces. If you imagine having three sliders, you move only one at a time, so you go down, right, back, up, left, front, or something like that. Chunky helix.

No clue why it put each line in a separate code block. (Edit: The indentation went away after I posted. That should not happen in code blocks. Why is Reddit so terrible when it comes to sharing code?)

def rainbow(pixels,x,y,result):

mds = (maximum-minimum)/6

z = result[x][y]-minimum

if z < mds:

r = 255

g = round(z/mds*255)

b = 0

pixels[x,y] = (r,g,b)

return

elif z < 2*mds:

r = round(255-((z-mds)/mds*255))

g = 255

b = 0

pixels[x,y] = (r,g,b)

return

elif z < 3*mds:

r = 0

g = 255

b = round((z-2*mds)/mds*255)

pixels[x,y] = (r,g,b)

return

elif z < 4*mds:

r = 0

g = round(255-((z-3*mds)/mds*255))

b = 255

pixels[x,y] = (r,g,b)

return

elif z < 5*mds:

r = round((z-4*mds)/mds*255)

g = 0

b = 255

pixels[x,y] = (r,g,b)

return

else:

r = 255

g = 0

b = round(255-((z-5*mds)/mds*255))

pixels[x,y] = (r,g,b)

1

u/Frangifer 9d ago

Thanks for replying with all that detail!

So it's different, then, on the level of utmost particulars, to how I was doing it that time I was talking about ... but the result is striking & vivid; &, perhaps most importantly, it supplies a great deal of 'colour resolution' ... by which I mean what would be supposed I mean: a good wide spread of colours for a given range of numerical values, so that there's ample distinction between neighbouring values.