fractals

Unable to understand this recursive turtle python code

我是研究僧i 提交于 2019-11-28 10:36:14
问题 this is my first time asking a question, I hope some of you will find time to answer. So my goal is to write a python script using the turtle module to code a pythagoras tree. I've spent days on it, and I really couldn't advance past a certain point, so I looked online to help me. I've found a code that does what I want but with very little lines of code: import turtle t = turtle.Pen() LIMIT =11 SCALAR = 0.5 * (2 ** 0.5) def drawTree(size, depth): drawSquare(size) if depth + 1 <= LIMIT: t

Generating Custom Color Palette for Julia set

房东的猫 提交于 2019-11-28 09:22:44
I need an algorithm or a method to generate a color palette to Color the Julia set images. When using the escape time algorithm to generate the image I for example come up with the following image: However I need some way to generate a custom color palette like on the Wikipedia page : How do I achieve an image similar to that? Also, what color smoothing algorithm should be used for Julia set? Here is the code snippet for clarification: int max_iter = 256; ComplexNumber constant = new ComplexNumber(cReal,cImag); float Saturation = 1f; for(int X=0; X<WIDTH; X++) { for(int Y=0; Y<HEIGHT; Y++) {

Programming Fractals [closed]

社会主义新天地 提交于 2019-11-28 06:48:00
问题 As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 6 years ago . Would learning to program fractals help think clearly about certain set of programming problems? 回答1: Fractal programming would

How to program a fractal?

血红的双手。 提交于 2019-11-27 16:41:41
I do not have any experience with programming fractals. Of course I've seen the famous Mandelbrot images and such. Can you provide me with simple algorithms for fractals. Programming language doesn't matter really, but I'm most familiar with actionscript, C#, Java. I know that if I google fractals, I get a lot of (complicated) information but I would like to start with a simple algorithm and play with it. Suggestions to improve on the basic algorithm are also welcome, like how to make them in those lovely colors and such. Programming the Mandelbrot is easy. My quick-n-dirty code is below (not

Generating Custom Color Palette for Julia set

只谈情不闲聊 提交于 2019-11-27 02:51:34
问题 I need an algorithm or a method to generate a color palette to Color the Julia set images. When using the escape time algorithm to generate the image I for example come up with the following image: However I need some way to generate a custom color palette like on the Wikipedia page: How do I achieve an image similar to that? Also, what color smoothing algorithm should be used for Julia set? Here is the code snippet for clarification: int max_iter = 256; ComplexNumber constant = new

Can't find a way to color the Mandelbrot-set the way i'm aiming for

拟墨画扇 提交于 2019-11-26 23:13:06
I've been successful in coloring the Mandelbrot-set although I can't zoom in very far until it becomes "blurry" and the pattern stops. I fix this by increasing the max_iteration, this works but I get very few colors at *1 magnification and lot's of colors only appear when I zoom in. I understand why this happens since in a "true" Mandelbrot-set there are no colors and increasing the max_iterations just brings it closer to that. But my question is, is how do zooms such as on youtube have beautiful colors throughout the whole zooming process while still being able to zoom on for what feels like

Tkinter create image function error (pyimage1 does not exist)

感情迁移 提交于 2019-11-26 18:37:50
问题 I'm a student from the outside world with no previous programming experience. I have been learning Python as an extension of my math class. I have been trying to create a program that generates fractals using Tkinter. The code works well on its own, but the inclusion of a user-input GUI causes it to give an error: Exception in Tkinter callback Traceback (most recent call last): File "C:\Python33\lib\tkinter\__init__.py", line 1475, in __call__ return self.func(*args) File "C:\Python33

Function with varying number of For Loops (python)

倾然丶 夕夏残阳落幕 提交于 2019-11-26 17:43:01
My problem is difficult to explain. I want to create a function that contains nested for loops, the amount of which is proportional to an argument passed to the function. Here's a hypothetical example: Function(2) ...would involve... for x in range (y): for x in range (y): do_whatever() Another example... Function(6) ...would involve... for x in range (y): for x in range (y): for x in range (y): for x in range (y): for x in range (y): for x in range (y): whatever() The variables of the for loop (y) are NOT actually used in the nested code. Your first thought might be to create ONE for loop,

Can&#39;t find a way to color the Mandelbrot-set the way i&#39;m aiming for

亡梦爱人 提交于 2019-11-26 08:35:59
问题 I\'ve been successful in coloring the Mandelbrot-set although I can\'t zoom in very far until it becomes \"blurry\" and the pattern stops. I fix this by increasing the max_iteration, this works but I get very few colors at *1 magnification and lot\'s of colors only appear when I zoom in. I understand why this happens since in a \"true\" Mandelbrot-set there are no colors and increasing the max_iterations just brings it closer to that. But my question is, is how do zooms such as on youtube

Function with varying number of For Loops (python)

送分小仙女□ 提交于 2019-11-26 04:24:44
问题 My problem is difficult to explain. I want to create a function that contains nested for loops, the amount of which is proportional to an argument passed to the function. Here\'s a hypothetical example: Function(2) ...would involve... for x in range (y): for x in range (y): do_whatever() Another example... Function(6) ...would involve... for x in range (y): for x in range (y): for x in range (y): for x in range (y): for x in range (y): for x in range (y): whatever() The variables of the for