7
Project: Mandelbrot Set Dr. David Koslicki Math 399 Fall 2014 September 29, 2014 1 Introduction For this project, I used Matlab [1] to create code that would draw Mandelbrot sets. 1.1 Part 1: Code The Mandelbrot set is defined as the set of complex numbers {z 0 } such that the sequence {z k } k0 stays bounded for k =0, 1,... for z k+1 = z 2 k + z 0 . To implement this, I defined a Matlab function Mandelbrot(xlim,ylim, maxIterations, gridSize) that will return a square matrix A with dimensions gridSize where the entry A i,j gives the number of iterations of the recursion z k+1 = z 2 k + z 0 required before |z k | > 1. The code for this function is copied below in its entirety: 1

Project: Mandelbrot Set - Oregon State Universitymath.oregonstate.edu/~koslickd/MandelbrotExampleSolution.pdf · Project: Mandelbrot Set Dr. David Koslicki Math 399 Fall 2014 September

  • Upload
    phamque

  • View
    221

  • Download
    3

Embed Size (px)

Citation preview

Page 1: Project: Mandelbrot Set - Oregon State Universitymath.oregonstate.edu/~koslickd/MandelbrotExampleSolution.pdf · Project: Mandelbrot Set Dr. David Koslicki Math 399 Fall 2014 September

Project: Mandelbrot Set

Dr. David KoslickiMath 399Fall 2014

September 29, 2014

1 Introduction

For this project, I used Matlab [1] to create code that would draw Mandelbrotsets.

1.1 Part 1: Code

The Mandelbrot set is defined as the set of complex numbers {z0} such thatthe sequence {zk}k≥0 stays bounded for k = 0, 1, . . . for zk+1 = z2k + z0. Toimplement this, I defined a Matlab function

Mandelbrot(xlim,ylim, maxIterations, gridSize)

that will return a square matrix A with dimensions gridSize where the entryAi,j gives the number of iterations of the recursion zk+1 = z2k + z0 requiredbefore |zk| > 1. The code for this function is copied below in its entirety:

1

Page 2: Project: Mandelbrot Set - Oregon State Universitymath.oregonstate.edu/~koslickd/MandelbrotExampleSolution.pdf · Project: Mandelbrot Set Dr. David Koslicki Math 399 Fall 2014 September

1.2 Part 2: Plots

In figure 1 is a plot of the of the function

Mandelbrot([-1.5,.5], [-1,1], 750, 1500).

In figure 2 is a plot of the of the function:

Mandelbrot([-0.748766713922161, -0.748766707771757],...

[0.123640844894862, 0.123640851045266], 750, 1500).

1.3 Part 3: Other Mandelbrot sets

Here, we develop code to implement the following two Mandelbrot-like sets:{z0 ∈ C : ∀k ≥ 0, |zk| < ∞, zk+1 = z3k + z0

}and {

z0 ∈ C : ∀k ≥ 0, |zk| < ∞, zk+1 = sin

(zkz0

)}To implement the first, we used Matlab to develop the function

MandelbrotCubed(xlim,ylim, maxIterations, gridSize).

The complete source code is included below:

To implement the second, we used Matlab to develop the function

MandelbrotSin(xlim,ylim, maxIterations, gridSize).

The complete source code is included below:

2

Page 3: Project: Mandelbrot Set - Oregon State Universitymath.oregonstate.edu/~koslickd/MandelbrotExampleSolution.pdf · Project: Mandelbrot Set Dr. David Koslicki Math 399 Fall 2014 September

Real Part

Imag

inar

y P

art

Mandelbrot Set

−1.5 −1 −0.5 0 0.5

−1.5

−1

−0.5

0

0.5

1

1.5

Figure 1: Mandelbrot plot 1.

3

Page 4: Project: Mandelbrot Set - Oregon State Universitymath.oregonstate.edu/~koslickd/MandelbrotExampleSolution.pdf · Project: Mandelbrot Set Dr. David Koslicki Math 399 Fall 2014 September

Real Part

Imag

inar

y P

art

Mandelbrot Set

−0.7488 −0.7488 −0.7488 −0.7488 −0.7488 −0.7488

0.1236

0.1236

0.1236

0.1236

0.1236

0.1236

0.1236

Figure 2: Mandelbrot plot 2.

4

Page 5: Project: Mandelbrot Set - Oregon State Universitymath.oregonstate.edu/~koslickd/MandelbrotExampleSolution.pdf · Project: Mandelbrot Set Dr. David Koslicki Math 399 Fall 2014 September

In figure 3 we include a plot of the of the function:

MandelbrotCubed([-1, 1],[1, 1], 750, 1500).

In figure 4 we include a plot of the of the function:

MandelbrotSin([-1, 1],[1, 1], 750, 1500).

References

[1] Matlab 2013a, The MathWorks, Inc., Natick, Massachusetts, United States.

5

Page 6: Project: Mandelbrot Set - Oregon State Universitymath.oregonstate.edu/~koslickd/MandelbrotExampleSolution.pdf · Project: Mandelbrot Set Dr. David Koslicki Math 399 Fall 2014 September

Real Part

Imag

inar

y P

art

MandelbrotCubed Set

−1 −0.8 −0.6 −0.4 −0.2 0 0.2 0.4 0.6 0.8 1

−1

−0.8

−0.6

−0.4

−0.2

0

0.2

0.4

0.6

0.8

1

Figure 3: MandelbrotCubed plot.

6

Page 7: Project: Mandelbrot Set - Oregon State Universitymath.oregonstate.edu/~koslickd/MandelbrotExampleSolution.pdf · Project: Mandelbrot Set Dr. David Koslicki Math 399 Fall 2014 September

Real Part

Imag

inar

y P

art

MandelbrotSin Set

−1 −0.8 −0.6 −0.4 −0.2 0 0.2 0.4 0.6 0.8 1

−1

−0.8

−0.6

−0.4

−0.2

0

0.2

0.4

0.6

0.8

1

Figure 4: MandelbrotCubed plot.

7