<commit_before># Mandelbrot Set

Visualizing the Mandelbrot set doesn't have anything to do with machine
learning, but it makes for a fun example of how one can use TensorFlow for
general mathematics.  This is actually a pretty naive implementation of the
visualization, but it makes the point.  (We may end up providing a more
elaborate implementation down the line to produce more truly beautiful images.)

Note: This tutorial was originally prepared as an IPython notebook.

## Basic Setup

We'll need a few imports to get started.

```python
# Import libraries for simulation
import tensorflow as tf
import numpy as np

# Imports for visualization
import PIL.Image
from cStringIO import StringIO
from IPython.display import clear_output, Image, display
import scipy.ndimage as nd
```

Now we'll define a function to actually display the image once we have
iteration counts.

```python
def DisplayFractal(a, fmt='jpeg'):
  """Display an array of iteration counts as a
     colorful picture of a fractal."""
  a_cyclic = (6.28*a/20.0).reshape(list(a.shape)+[1])<commit_msg>add a wiki reference for Mandelbrot set (#1963)<commit_after># Mandelbrot Set

Visualizing the [Mandelbrot set](https://en.wikipedia.org/wiki/Mandelbrot_set)
doesn't have anything to do with machine learning, but it makes for a fun
example of how one can use TensorFlow for general mathematics.  This is
actually a pretty naive implementation of the visualization, but it makes the
point.  (We may end up providing a more elaborate implementation down the line
to produce more truly beautiful images.)

Note: This tutorial was originally prepared as an IPython notebook.

## Basic Setup

We'll need a few imports to get started.

```python
# Import libraries for simulation
import tensorflow as tf
import numpy as np

# Imports for visualization
import PIL.Image
from cStringIO import StringIO
from IPython.display import clear_output, Image, display
import scipy.ndimage as nd
```

Now we'll define a function to actually display the image once we have
iteration counts.

```python
def DisplayFractal(a, fmt='jpeg'):
  """Display an array of iteration counts as a
     colorful picture of a fractal."""
  a_cyclic = (6.28*a/20.0).reshape(list(a.shape)+[1])
{'fraction_non_alphanumeric': 0.06541218637992832, 'fraction_numerical': 0.008064516129032258, 'mean_word_length': 4.725641025641026, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1879721', 'n_tokens_mistral': 643, 'n_tokens_neox': 604, 'n_words': 306}