Git Product home page Git Product logo

tensorflow-fractal-playground's Introduction

tensorflow-fractal-playground

Use TensorFlow to generate beautiful fractals, including the Mandelbrot Set and the Julia set.

Requirements:

  • TensorFlow >= 1.0
  • PIL
  • moviepy(Optional, only useful when making a gif)

Generate the Standard Mandelbrot Set:

Run:

python mandelbrot.py

and check "mandelbrot.png":

Generate the Julia set:

Run:

python julia.py

and check "julia.png":

Modify the settings in julia.py to get a differnt Julia Set. The variable "c" is corresponding to the c of a Julia Set. The variable "bg_ratio" and "ratio" is used to set the colors.

Use the setting:

c = -0.8 * 1j
bg_ratio = (1, 3.5, 3.5)
ratio = (0.9, 0.9, 0.9)

Will get:

Use the setting:

c = 0.285 + 0.01 * 1j
bg_ratio = (4, 2.5, 1)
ratio = (2, 2, 0.1)

Will get:

Try more settings by yourself!

In addition, you can make an animation with Julia Set, Run:

python julia_gif.py

Then check out "julia_gif.gif":

Explore the Mandelbrot Set:

To get a local area image of Mandelbrot Set, run:

python mandelbrot_area.py

Check "mandelbrot.png":

Modify the varibales "start_x", "end_x", "start_y", "end_y" in mandelbrot_area.py to get a different area of the Mandelbrot Set. To get a different color, adjust the variables "ratio1, ratio2, ratio3".

For example, the following setting:

start_x = -0.090  # x range
end_x = -0.086
start_y = 0.654  # y range
end_y = 0.657
width = 1000
ratio1, ratio2, ratio3 = 0.2, 0.6, 0.6

will result in:

Setting:

start_x = -0.750  # x range
end_x = -0.747
start_y = 0.099  # y range
end_y = 0.102
width = 1000
ratio1, ratio2, ratio3 = 0.1, 0.1, 0.3

will generate:

Image Size:

The variable "width" controls the width of generated image.

If memory is a issue, please decrease it.

Jupyter Notebook:

You can use "Mandelbrot.ipynb" and "Julia.ipynb" for more convenient exploration. Enjoy it!

tensorflow-fractal-playground's People

Contributors

hzy46 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.