Field Trip #33 Creating and Saving Fractals. Julia Set We consider a complex function, f(z) For each point on the complex plane (x,y), where z = x + iy,

Slides:



Advertisements
Similar presentations
Chapter 20 Computational complexity. This chapter discusses n Algorithmic efficiency n A commonly used measure: computational complexity n The effects.
Advertisements

5.4 Complex Numbers (p. 272).
Digital Images in Java Java’s imaging classes. Java imaging library  Java has good support for image processing  Must master a handful of classes and.
MATH 224 – Discrete Mathematics
Graphics You draw on a Graphics object The Graphics object cannot directly be created by your code, instead one is generated when the method paintComponent.
Introduction to Programming
Prepared 7/28/2011 by T. O’Neil for 3460:677, Fall 2011, The University of Akron.
CSE Lecture 6 – Complex Numbers & Images
BackTracking Algorithms
An Array A sequence of elements of a particular type Each element in the array has an index which gives its position in the sequence An array is declared.
Lawrence Snyder University of Washington, Seattle © Lawrence Snyder 2004 Changing Control.
Grouping Objects Arrays and for loops. Objects First with Java - A Practical Introduction using BlueJ, © David J. Barnes, Michael Kölling Fixed-Size Collections.
Programming with Collections Collections in Java Using Arrays Week 9.
CSE 113 Week 5 February , Announcements  Module 2 due 2/15  Exam 3 is on 2/15  Module 3 due 2/22  Exam 4 is on 2/25  Module 4 due 2/29.
Programming Concepts MIT - AITI. Variables l A variable is a name associated with a piece of data l Variables allow you to store and manipulate data in.
5.4 Complex Numbers By: L. Keali’i Alicea. Goals 1)Solve quadratic equations with complex solutions and perform operations with complex numbers. 2)Apply.
5.7.1 – Complex Numbers. We used the method of square roots to solve specific types of quadratics Only used when we had problems such as x 2 – 16 = 0.
Discrete Mathematics Algorithms. Introduction  An algorithm is a finite set of instructions with the following characteristics:  Precision: steps are.
Ch 9 Infinity page 1CSC 367 Fractals (9.2) Self similar curves appear identical at every level of detail often created by recursively drawing lines.
5.6 Quadratic Equations and Complex Numbers
 2006 Pearson Education, Inc. All rights reserved Searching and Sorting.
CompSci Today’s topics Java Review Just a bunch of headings meant to trigger questions A contraction of previous notes Upcoming Midterm Exam Reading.
Two –Dimensional Arrays Mrs. C. Furman Java Programming November 19, 2008.
Slides for Parallel Programming Techniques & Applications Using Networked Workstations & Parallel Computers 2nd ed., by B. Wilkinson & M
For loops in programming Assumes you have seen assignment statements and print statements.
CONTENTS Processing structures and commands Control structures – Sequence Sequence – Selection Selection – Iteration Iteration Naming conventions – File.
Introduction to Computer Programming
Computer Vision Introduction to Digital Images.
Copyright © 2009 Pearson Addison-Wesley Complex Numbers, Polar Equations, and Parametric Equations.
8-1 Compilers Compiler A program that translates a high-level language program into machine code High-level languages provide a richer set of instructions.
Pascal Programming Iteration (looping) Carl Smith National Certificate Unit 4.
2.1 Functions.
ALGORITHMS.
 In computer programming, a loop is a sequence of instruction s that is continually repeated until a certain condition is reached.  PHP Loops :  In.
1 Printing in Python Every program needs to do some output This is usually to the screen (shell window) Later we’ll see graphics windows and external files.
Operator precedence.  Evaluate a + b * c –multiplication first? a + (b * c) –addition first? ( a + b) * c  Java solves this problem by assigning priorities.
1 Looping Dale/Weems/Headington. 2 KA/JS/P Warning l Save your work often! l In the Khan Academy, JavaScript environment, infinite loops will lock up.
Computer Science 320 Parallel Image Generation. The Mandelbrot Set.
Mandelbrot and Julian sets Vaclav Vavra. Definitions By both sets we compute the same sequence given by recursive formula: z n = (z n-1 ) 2 + c z n, z.
Warm-Up Use the quadratic formula to solve each equation. 6 minutes 1) x x + 35 = 02) x = 18x 3) x 2 + 4x – 9 = 04) 2x 2 = 5x + 9.
Copyright © Curt Hill Further Picture Manipulation Considering position.
Review. Problem 1 What is the output of the following piece of code void increment(int x) { x++; } int main() { int y = 10; increment(y); cout
Copyright © 2007 Pearson Education, Inc. Slide Trigonometric (Polar) Form of Complex Numbers The Complex Plane and Vector Representations Call.
 Write the expression as a complex number in standard form.  1.) (9 + 8i) + (8 – 9i)  2.) (-1 + i) – (7 – 5i)  3.) (8 – 5i) – ( i) Warm Up.
Fractals Rule! Some Background Information Helpful to People Wanting to Understand Fractal Geometry.
A dynamic Complex Transformation generating FRACTALS 北京景山学校 纪光老师 April Fractals & Complex Numbers.
Chapter 4 Section 8 Complex Numbers Objective: I will be able to identify, graph, and perform operations with complex numbers I will be able to find complex.
For Friday Read No quiz Program 6 due. Program 6 Any questions?
Arrays [Array, Array, Array, Array] Our Very First Data Structure! Definition - A group of homogeneous elements of a specific data type* Examples: –[a,e,t,w,e,e,y,u,f,v,x,g,h,q,w,r,f,d,a,h,o,a,m,s,z,d]
The Mandlebrot Set Derek Ball University of Kentucky Math 341- College Geometry.
Arrays. What is an array? An array is a collection of data types. For example, what if I wanted to 10 different integers? int num1; int num2; int num3;
ALGEBRA TWO CHAPTER FIVE QUADRATIC FUNCTIONS 5.4 Complex Numbers.
Introduction to python programming
Complex numbers Algebra II Dr. Guram.
Complex integers? Here a and b are integers.
Operations with Complex Numbers
ITERATIVE DYNAMIC SYSTEMS THROUGH THE MANDELBROT AND JULIA SETS
4.6 Complex Numbers (p. 275).
Quadratic Formula & the Discriminant
24 Searching and Sorting.
2.1 Functions.
(Assignment due: Wed. Feb. 04, 2004)
For loops Taken from notes by Dr. Neil Moore
4.6 Complex Numbers Algebra II.
2.1 Functions.
Final Exam Review CSE113.
CSC1401 Manipulating Pictures 2
4.6 – Perform Operations with Complex Numbers
Types of loops definite loop: A loop that executes a known number of times. Examples: Repeat these statements 10 times. Repeat these statements k times.
QUADRATIC FUNCTION PARABOLA.
Presentation transcript:

Field Trip #33 Creating and Saving Fractals

Julia Set We consider a complex function, f(z) For each point on the complex plane (x,y), where z = x + iy, we consider the sequence of points f(z), f(f(z)), f(f(f(z))), f(f(f(f(z)))), etc. We define a point we call infinity For each point on the complex plane, we determine how many points in the sequence it takes until the magnitude of a point in the sequence is greater than infinity We then assign a different color based on how many points

Complex Numbers Recall that there is no real number, i, such that i*i = -1. We define the imaginary number i to be the square root of -1. We consider a plane where the horizontal axis represents real numbers and the vertical axis represents imaginary numbers. We define a complex number z to be x + iy

Iteration The sequence of points we generate is called an iteration An iteration involves taking the output of a function and putting that into the function to produce a result We sometimes call this recursion A recursion cannot go on indefinitely We define a maximum number of times we will perform the recursion

Loops To fill in the Julia Set, we will need to consider many points on the complex plane In order to do this, we will take advantage of the one of the pillars of structured programming: repeated execution or loops One form of a loop is the for loop A for loop uses a controlling variable that steps between two values and do something for each value of the controlling variable

Computing Color We create initially an array of values This array of values will contain the values we need to create colors The elements of the array determine what color is assigned to the number of iterations needed to exceed infinity If the iteration doesn't exceed infinity after the maximum number of iterations, then we assign the color black

Arrays The array is a structure that contains elements of the same type We use three parallel arrays The arrays contain the amount of red, green, and blue in the color We create an array with the syntax int[] red = new int[30]

Different Fractals There are some well known functions that produce interesting Julia Sets The quadratic function, f(z) = z^2 + c, where c is a complex number can produce different Julia Sets if we vary c The exponential function f(z) = ce^z also produces interesting results The sine function f(z) = csin(z) produces an interesting Julia Set

Quadratic Family, f(z) = z^

Exponential Family, f(z) = (1+i)e^z

Sine Family, f(z) = csin(z)

BufferedImage In the Java language, there is a package that deals with images One of the classes in the package is the BufferedImage After we create a BufferedImage, we can use the class javax.imageio.ImageIO to write the BufferedImage to a file where we specify the type of image file by using an appropriate setting: jpg, png, etc.

Creating the BufferedImage To create the BufferedImage, we first create an array that contain the color information For each Color, we specify how much red, green, and blue it contains. We specify this with integers between 0 and 255 The Color class contains a method called getRGB() that gives us a single integer We use an array of these single integers to create the BufferedImage

Saving an Image After the image has been created, we use the ImageIO class to write the BufferedImage to a file We use the method write which expects the BufferedImage, the type of file (“jpg”,”png”, etc.), and the location We specify the location to write the file by creating a new File object