SamTiba
|
|
« Reply #15 on: January 31, 2017, 09:11:09 AM » |
|
I already did, darkbeam For c = -0.1 I posted the formula earlier
For variable c it is: 26*c^8 + 80*c^7*z^2 + 144*c^6*z^4 + 64*c^6*z + 168*c^5*z^6 + 136*c^5*z^3 + 12*c^5 + 138*c^4*z^8 + 180*c^4*z^5 + 90*c^4*z^2 + 80*c^3*z^10 + 144*c^3*z^7 + 112*c^3*z^4 + 16*c^3*z + 32*c^2*z^12 + 76*c^2*z^9 + 96*c^2*z^6 + 52*c^2*z^3 + 4*c^2 + 8*c*z^14 + 24*c*z^11 + 42*c*z^8 + 28*c*z^5 + 12*c*z^2 + z^16 + 4*z^13 + 10*z^10 + 12*z^7 + 14*z^4 + z
(dumb MatLab sorted it for c)
|
|
|
Logged
|
|
|
|
DarkBeam
Global Moderator
Fractal Senior
Posts: 2512
Fragments of the fractal -like the tip of it
|
|
« Reply #16 on: January 31, 2017, 09:16:05 AM » |
|
oh interesting tx
|
|
|
Logged
|
No sweat, guardian of wisdom!
|
|
|
kram1032
|
|
« Reply #17 on: January 31, 2017, 07:05:24 PM » |
|
Nice stuff! Meanwhile, I am working on the other Metabrot idea: I already managed to make the Mathematica code a lot faster and also really cut down on the memory costs. Though I want to push it even further: To get really large point-sets out of Mathematica I had to transform the previous recursive call into a corecursive one and, to go even further, I'll also have to make the whole process lazy somehow.
If somebody could convert the equivalent thing to a different, perhaps faster programming language that'd probably help too. - It's not like I need anything mathematica-specific. I just like its pretty easy graphing abilities. Here's a question for the mods though: Since this thread is about a different Metabrot than the one in the old thread, should I rather revive the old one or semi-hijack this one? I mean I think the idea is similar enough and thus I don't think it'd be off-topic here, but I'm not quite sure.
|
|
|
Logged
|
|
|
|
gds-entropy
|
|
« Reply #18 on: February 01, 2017, 11:54:49 AM » |
|
Nice stuff! Meanwhile, I am working on the other Metabrot idea: I already managed to make the Mathematica code a lot faster and also really cut down on the memory costs. Though I want to push it even further: To get really large point-sets out of Mathematica I had to transform the previous recursive call into a corecursive one and, to go even further, I'll also have to make the whole process lazy somehow.
If somebody could convert the equivalent thing to a different, perhaps faster programming language that'd probably help too. - It's not like I need anything mathematica-specific. I just like its pretty easy graphing abilities.
Hmm...I have Mathematica, but have held off using it pending my acquisition of Wolfram MathCode. Otherwise if I am just making a "thing" [usually continuous domain n-D CA, PDE solvers, or what not] I'll hack out a version in Java via Processing, written so as to use no language features and thus be easily copypasta-able into pretty much anything else. Then I will migrate to C# through VS 2015 Enterprise if I really want to make it perform well in a short amount of time. Delphi performs excellently, but the language is weird. Embarcadero "seems" to have done something with their compiler that automatically takes advantage of 100% of your resources, as Jason Rampe a.k.a. Softology did nothing special with regards to language or compilation to make Visions of Chaos perform as such, but it does, and he didn't even explicitly parallelize his algorithms either... Java and C# will not do this without a bit of prodding. You may be interested in a new [very new, like, a few days ago] modification to Cilk via LLVM, which really upped the performance [as in 10 to 25% better parallel perf]: http://news.mit.edu/2017/optimizing-code-compiler-parallel-programs-0130Otherwise I say go for a GPU language like GLSL, OpenCL or CUDA. Personally, I utterly deplore the way those languages "taste" to my mind, and I find their use cumbersome at best. They are not clean, and are very ugly IMO. Some of what I am doing will not be able to proceed to larger resolution and more scales until I give in and throw it at a Tesla...but I'm holding out until I have no choice left.. Maybe the program Ready has enough of what you will need in place already to make the transition easy [it is C++ and OpenCL], plus there is a fork for Houdini. You can likely do what you wish quite easily with that...meaning easier than rolling your own mature code base which can harness OpenCL and so forth. https://github.com/GollyGang/readyRhino and Grasshopper support C#, and Lightwave supports SciPy and NumPy...though these are of low potential relevance to your goal, they are also loads of fun. Here's a question for the mods though: Since this thread is about a different Metabrot than the one in the old thread, should I rather revive the old one or semi-hijack this one? I mean I think the idea is similar enough and thus I don't think it'd be off-topic here, but I'm not quite sure.
Since no mods have spoken up, and given both the fact that I started this thread and I really cannot possibly care any less about "the proper thing", I say go for it man; hijack or do otherwise as you please. And honestly other than keeping OT and not trolling, who has time to care about the esoteric vagaries surrounding some internet forum, really? As a side note, I have been working on some ways to implement fractal cellular automata and reaction-diffusion PDEs with varying levels of success depending on the method. As they are not "true" fractals, I've not bothered posting them here [nor will I], but there will be some images and movies on my Flickr for two new algorithms, and there are already many previous examples of similar concepts on there, in case anyone cares. I'll probably roll in a decent FFT blur I made based on some work by some person named Nayuki as well at some point, though I'm still working some fiddly bits out with usability. Ian
|
|
|
Logged
|
|
|
|
kram1032
|
|
« Reply #19 on: February 06, 2017, 04:19:32 PM » |
|
Still working on polishing that Mathematica code of mine. However, in the mean time, I found this: http://blog.sigfpe.com/2017/02/logarithms-and-exponentials-of-functions.htmlI'm not entirely sure yet but I think this basic idea could also be implemented for the M-Set. It's a little abstract but if somebody can translate it to some simple iterations and the result converges this should give "the definitive" Meta-MSet. I will try to do that soon but I don't have time immediately so if anybody else wants to have a go, please go right ahead!
|
|
|
Logged
|
|
|
|
gds-entropy
|
|
« Reply #20 on: February 09, 2017, 09:21:53 PM » |
|
Still working on polishing that Mathematica code of mine. However, in the mean time, I found this: http://blog.sigfpe.com/2017/02/logarithms-and-exponentials-of-functions.htmlI'm not entirely sure yet but I think this basic idea could also be implemented for the M-Set. It's a little abstract but if somebody can translate it to some simple iterations and the result converges this should give "the definitive" Meta-MSet. I will try to do that soon but I don't have time immediately so if anybody else wants to have a go, please go right ahead! Very cool; any new developments? I looked into hacking Mandelbulber to render a meta, but as I said previously, I HATE shader languages , so I scrapped that idea pretty quickly once I had a look at the guts of the app; I simply have no financial incentive to learn shading languages at this point and modding that app would take too much time for me. Maybe someone else who already knows GL will do it at some point. Ian
|
|
|
Logged
|
|
|
|
kram1032
|
|
« Reply #21 on: February 09, 2017, 09:51:50 PM » |
|
Told you, I don't have time immediately right now. So nope, not yet. Not by me anyway. Perhaps anybody else looked into that?
|
|
|
Logged
|
|
|
|
kram1032
|
|
« Reply #22 on: February 11, 2017, 08:15:09 PM » |
|
I switched over to Python. Here is code that, provided you have all the dependencies, will indefinitely render out (and overwrite/update) a supposed limit-metabrot (as found in the other thread) Buddhabrot-style and save it into a png next to wherever your python script is stored. import random as rnd import sys as sys import threading as thrd from cmath import sqrt from math import floor from PIL import Image import numpy as np
class Tree: def __init__(self, v0, fl, fr): self.v = v0 self.fl = fl self.fr = fr
def left(self): return Tree(self.fl(self.v), self.fl, self.fr)
def right(self): return Tree(self.fr(self.v), self.fl, self.fr)
def empty(): # generator without elements. return # looks like a dirty hack. yield # as far as I know the only way.
def chain(*its): for it in its: for i_ in it: yield i_
def bf(t): # traverses infinite tree breadth first such that it gets to all the nodes and gives all the values eventually. For n iterations, need 2**(n+1)-1 points. ts = (t for t in [t]) # generator with one element while ts: nts = empty() for t in ts: if t is not None: yield t.v nts = chain(nts, [t.left()], [t.right()]) ts = nts
# I decided to sample from a circular region. Could go with rectangular region or with something more carefully chosen to get more detail in the busy central area
def rangle(): # generate random numbers evenly distributed on a circle in the complex plane while True: z = complex(rnd.uniform(-1, 1), rnd.uniform(-1, 1)) yield z*z/(z*z.conjugate())
def rcircle(c0, r0): # generate random numbers evenly distributed in a circle in the complex plane a = rangle() while True: r = sqrt(rnd.uniform(0, r0*r0)) yield r * next(a) - c0
def mtree(c_, z0_): # corecursively generates all the points to be plotted return Tree(z0_, lambda z: .5*(1-sqrt(1-4*z))+c_, lambda z: .5*(1+sqrt(1-4*z))+c_)
def mbrot(iterations, resolution, filename='MBrot'):
filename += '.png'
# triple code for the three colors
histr = np.array([[0. for _ in range(resolution)] for _ in range(resolution)], dtype=np.float32) histg = np.array([[0. for _ in range(resolution)] for _ in range(resolution)], dtype=np.float32) histb = np.array([[0. for _ in range(resolution)] for _ in range(resolution)], dtype=np.float32) img = Image.fromarray(np.uint8(histr)*255) img.save(filename)
cs = rcircle(.0+.0j, 2.)
itr = 2**(iterations + 1) - 1 # perhaps this shouldn't be hard-coded. As is, green will have half the number of points as red and blue will have half that itg = 2**iterations - 1 itb = 2**(iterations - 1) - 1
try: while True: tree = mtree(next(cs), next(cs)) # I decided to go Buddhagram-style, also giving a random initial z0. Could fix. Perhaps at the critical point z = .25+0i. points = bf(tree)
for z, it_ in zip(points, range(itr)): r = (z.real + 3.)/6. # the +3/6 determines what point is in the middle of the image (as is the 0,0 point) and how large the overall area is. Perhaps rewrite in terms of center point and zoom level and don't hard-code. x = floor((1. - 1.e-10) * resolution * r) # the 1.e-10 is to avoid being right on the edge of a pixel if 0 <= x < resolution: im = (z.imag + 3.)/6. y = floor((1. - 1.e-10) * resolution * im) if 0 <= y < resolution: histr[x, y] += 1 if it_ <= itg: histg[x, y] += 1 if it_ <= itb: histb[x, y] += 1
im = (3. - z.imag)/6 y = floor((1.-1.e-10) * resolution * im) # double code for enforced mirror-symmetry if 0 <= y < resolution: histr[x, y] += 1 if it_ <= itg: histg[x, y] += 1 if it_ <= itb: histb[x, y] += 1 imhistr, binsr = np.histogram(histr.flatten(), 2 ** 16, normed=True) # I'm not even sure if the 2 ** 16 even makes a difference imhistg, binsg = np.histogram(histr.flatten(), 2 ** 16, normed=True) # perhaps 2 ** 8 = 256 suffices. imhistb, binsb = np.histogram(histr.flatten(), 2 ** 16, normed=True) # It's how finely the histogram should be divided for equalization. cdfr = imhistr.cumsum() cdfr = cdfr / cdfr[-1] imeqr = np.interp(histr.flatten(), binsr[:-1], cdfr) mineqr = np.min(imeqr) maxeqr = np.max(imeqr) if mineqr != maxeqr: imeqr -= mineqr imeqr *= 255/(maxeqr-mineqr) cdfg = imhistg.cumsum() cdfg = cdfg / cdfg[-1] imeqg = np.interp(histg.flatten(), binsg[:-1], cdfg) mineqg = np.min(imeqg) maxeqg = np.max(imeqg) if mineqg != maxeqg: imeqg -= mineqg imeqg *= 255/(maxeqg-mineqg) cdfb = imhistb.cumsum() cdfb = cdfb / cdfb[-1] imeqb = np.interp(histb.flatten(), binsb[:-1], cdfb) mineqb = np.min(imeqb) maxeqb = np.max(imeqb) if mineqb != maxeqb: imeqb -= mineqb imeqb *= 255/(maxeqb-mineqb) imgr = Image.fromarray(imeqr.reshape(histr.shape)).convert('L') # perhaps these four lines could be made into a single step imgg = Image.fromarray(imeqg.reshape(histg.shape)).convert('L') imgb = Image.fromarray(imeqb.reshape(histb.shape)).convert('L') img = Image.merge('RGB', [imgr, imgg, imgb]) try: # if I don't do this, it crashes when something else accesses the file. img.save(filename) except IOError: pass except KeyboardInterrupt: # break loop when pressing Ctrl+C img.save(filename) # save a final time
def runbrot(): # need a parameter-less wrapper function to allow for deeper nesting -> higher iterations it = int(input("Please enter an iteration depth. " "(Note: If this is too large, it will crash. Try something in the very low double-digits. " "It will also be exponentially slower.")) res = int(input("Please Enter a resolution.")) fn = input("How would you like to call your file? (Without file ending)") print("To end, press Ctrl+C") mbrot(it, res, fn)
sys.setrecursionlimit(2 ** 28) # lift Python-interpreter-imposed nesting limit thrd.stack_size(2**28-1) # lift OS-imposed nesting limit - will crash when out of memory! thread = thrd.Thread(target=runbrot) thread.start()
I'm not sure but it could probably be made faster somehow. In some ways it looks like the usual Buddhabrot but in others it's quite different.
|
|
« Last Edit: February 12, 2017, 05:28:33 PM by kram1032 »
|
Logged
|
|
|
|
gds-entropy
|
|
« Reply #23 on: February 11, 2017, 10:51:17 PM » |
|
I switched over to Python. Here is code that, provided you have all the dependencies, will indefinitely render out (and overwrite/update) a supposed limit-metabrot (as found in the other thread) Buddhabrot-style and save it into a png next to wherever your python script is stored.
Pretty cool man, thanks for sharing. Depending on what I find when I look up the parts of python you used in terms of complexity to implement in another language, I just convert it to C# or C++. I'll shoot this over to Jason Rampe too, he may or may not be interested in doing something with it too...we'll see. Ian
|
|
|
Logged
|
|
|
|
kram1032
|
|
« Reply #24 on: February 12, 2017, 02:10:12 AM » |
|
I had a couple mistakes in the code and I switched over to histogram-equalized rendering. The code below has been updated accordingly. It looks much nicer now with those changes. (Though it's, of course, slightly slower than with the naive linear rendering I had before) I think I'll let one render overnight. EDIT 2: I added a bunch of comments to the code to make it easier to recognize what's going on and also to see what my design decisions were and what could be modified. Should also help for porting. EDIT: I updated the code with color and made higher iteration counts possible. Also, here is a link to a super early image (like three updates worth). It looks like it might be more interesting to look at early takes than at finished (or more developed at any rate) results. It's 2896²px, so right-click and open to get the full resolution. Iteration depth: 15 for red, 13 for green, 11 for blue. It looks like the structures that appear early on look much more interesting than the final result which tends to end up being way too bright.
|
|
« Last Edit: February 12, 2017, 05:30:15 PM by kram1032 »
|
Logged
|
|
|
|
kram1032
|
|
« Reply #25 on: February 12, 2017, 07:30:37 PM » |
|
Here is the same thing with a couple of hours worth of rendering time. I think the problem with these is that they actually are too detailed. They become much less interesting once they are almost entirely filled in. However I can only assume that that's nothing higher iteration levels couldn't fix. But as is, I'm running out of memory if I try that. Again, right click and open in new tab to get the full resolution.
|
|
|
Logged
|
|
|
|
youhn
Fractal Molossus
Posts: 696
Shapes only exists in our heads.
|
|
« Reply #26 on: February 13, 2017, 06:53:28 PM » |
|
Rendered in 5840px Scaled back to 640px Took a series of 10 snapshots, every 60 seconds Took some more series of 10, but with some pause in between (lazy scripting, sloppy human intervention) Converted all images to an animated GIF: I'll post some closeups from the end result later on.
|
|
|
Logged
|
|
|
|
kram1032
|
|
« Reply #27 on: February 13, 2017, 11:15:10 PM » |
|
Nice! What's the iteration depth you picked? I didn't manage that kind of resolution due to memory limitations. Did you fiddle with it at all or did you just take it directly as is? (Looks like as-is to me) It's pretty neat watching it grow, eh? The coloring helped a lot actually: I'm still rendering the one I posted there. With just a single color channel, basically all the detail got washed out and foggy. With three channels, things stay distinguishable. I think I'll give mine another night to fill in the blanks but then I'll finish and post it. Looking at it in full resolution is actually kind of important: Once it's this (mostly) filled-in, we are talking about single-pixel details making things interesting. After that, if nobody else wants to give it a go (it really should be simple enough), I'll add in new capabilities like zooming in on specific points, per-channel iteration level control, and perhaps picking a rendering area. (Right now it will always render around a fixed circle. Presumably, a rectangular area would be faster to since even finding the circular area involves four random numbers and a square root. It means the fringes look differently though.)
|
|
|
Logged
|
|
|
|
youhn
Fractal Molossus
Posts: 696
Shapes only exists in our heads.
|
|
« Reply #28 on: February 14, 2017, 03:45:23 PM » |
|
|
|
|
Logged
|
|
|
|
kram1032
|
|
« Reply #29 on: February 15, 2017, 11:23:29 AM » |
|
Ok, it's still changing quite a bit over time, filling in more and more holes, but by now, at least in the central areas, it has become pretty darn solid. This is direct output without image trickery, 15 (red), 13 (green) and 11 (blue) iterations. Please make sure to look at it in full resolution. (Right-click, open) The fine details, imo, are really what's selling this one. The shape at large is comparatively boring. What, do you think, would be a good place to explore?
|
|
|
Logged
|
|
|
|
|