• date post

14-Nov-2014
• Category

## Documents

• view

103

0

TAGS:

Embed Size (px)

### Transcript of Phys102 Lecture09!08!10Fall Final Project

Computational Lab in Physics: Final Project

The Mandelbrot Set.

Rendering the Mandelbrot Set

Defined in the Complex plane

Use the c++ complex class.

Set of points such that the mappingz -> z2 + c does not escape to infinity.

In code:

must use a threshold. One can use e.g. |z| z2 + c

3

Part 1: Continued, Render M set

Test to determine if a point is in the set or not:

if |z| is always < 4 after 100 iterations, the point is considered to be in the set. if |z| goes beyond 4, it is not in the set. The number of iterations can be used as a distance measure of the point to the set. Use this to create a 2-D histogram

Each cell represents a choice of the c parameter:

x-axis : Real Part of c y-axis : Imaginary Part of c

Fill each cell with a weight equal to the number of iterations done by the algorithm for that value of c.

4

Result from Part 1:

Obtain a plot of the Mandelbrot Set Save

it as a gif file from root: part1.gif 60 points

5

Part 2: Look at the fine detail.

Now that you can render the Mandelbrot Set, have some fun with it:

It is easy to look at a smaller region, all you do is change the region you will loop over:

RealPartMin < Real Part < RealPartMax ImagPartMin < Imaginary Part < ImagPartMax

Result from part 2:

Choose a new range, magnification of at least 10,000 (5 points)

Save as part2a.gif

Magnfication of 1,000,000 or more (5 points)

Save as part2b.gif number of iterations can be adjusted. can try a different color palette in ROOT.

Note:

6

Magnificent magnifications

Coordinates of the center:

Horizontal diameter of the image:

Re(c) = -.743,643,887,037,151, Im(c) = . 131,825,904,205,330 .000,000,000,051,299 59,979,000,000

Magnification relative to the initial image:

Note: plot not done with ROOT. See wikipedia entry for Mandelbrot Set for reference.7

Make an Animation: zoom into a small region

Saved directly from ROOT using TCanvas::Print(part3.gif+10); 40 Points

8

Final Project Summary

Part 1: you rendered it full scale,

Part 2: you zoomed into a small region.

name it LastnamePart1.gif 60 points

Part 3: you can render many plots between the full Mandelbrot set and the zoomed in region. Use the one with the largest magnification factor.

5 + 5 = 10 points Name them LastnamePart2a.gif and LastnamePart2b.gif

Modify the program to make 20 plots for 20 choices of the complex plane range. Save each plot into an animated gif:

Use TCanvas::Print(LastnamePart3.gif+10);

The +n in the Print command will save the frame with a delay of n x 10 ms with respect to the previous frame.

Extra credit: Continuos Animation, use Gimp or Photoshop.

30 points

9

Extra points: Continuous Animations, Zoom in & out and repeat

Saved with ROOT using TCanvas::Print(part3.gif+10); Edited with the GIMP to produce continuous In+Out animation that repeats over and over.

Photoshop works too, if you have it. (GIMP is free.) 10 extra points.

10

Suggestions:

One can do the programs all in root. Suggest to split into two parts:

C++ Program to produce a text file with all the values needed to make a plot. compile it so its fast ROOT independent, so its portable ROOT macro read the text file fill in the histograms TH2D draw histogram in canvas save the gif file with TCanvas::Print

11

Useful code Snippets.

12

Text output into many files: ofstream#include char filename[255]; sprintf(filename,"MandelbrotRunDataAdapIter%i.txt",i); cout