Cs130 ps1

Page 1

CS 130 WFW/WFX Problem Set 1 Due: 11 January 2013

• This should be done individually. • If you have consulted references for an item, cite them as footnotes to that specific item. • Discussion notes included in this problem set are taken from the section on “Introduction to Fractals” of the book “Introductory Linear Algebra with Applications” by Kolman and Hill. • For manual computations, show your complete solution. • For Scilab implementations, include a screenshot of the output. • Submit on or before 11 January 2013, 5pm. Late submissions will not be accepted. • For clarifications on an item in the problem set, you may email me at nshernandez@dcs.upd.edu.ph. Note that I will only be available for email consultation until Dec 23 this year and from Jan 4 onwards next year.

1


Definitions. 1. Let transb : R2 → R2 be defined by transb (v) = v + b where b is a fixed vector in R2 . We call this a translation by vector b. 2. The function T : R2 → R2 defined by T (v) = Av + b, where A is a specified 2 × 2 matrix and b is a fixed vector in R2 , is called an affine transformation. Remark: A translation by vector b, b 6= 0, is not a linear transformation. This follows from noting that transb (0) 6= 0. Similarly, an affine transformation T where b 6= 0 is not a linear transformation. Example: Let T be the affine transformation T (v) = Av + b, where "

A= "

#!

"

0 1 −1 0

#

#

"

and b = #!

"

2 −1

#

. #

"

2 0 2 1 = ; T = We have T −1 0 −2 0 Remark: The image of a line segment in R2 by an affine transformation is another line segment. A line segment is determined by its endpoints. Consider the line segment determined by the points (1, 0) and (0, 0). Given the T in the above example, the image of the line segment under T is the line segment determined by the points (2, −2) and (2, −1). Next we show the result of applying an affine transformation to a figure in R2 composed of line segments. Consider a set of points {(1, 0), (0, 0), (1, 1), (0, 2), (1, 2)}. Let Σ be the figure formed when the points are connected in the order listed by straight line segments. It is convenient to represent Σ as the matrix "

Σ=

1 0 1 0 1 0 0 1 2 2

#

where the first row is the set of x-coordinates of the points defining Σ and the second row is the corresponding set of y-coordinates. For ease of manipulation, under the affine transformation T in the above example, h i A col1 (Σ) + b A col2 (Σ) + b A col3 (Σ) + b A col4 (Σ) + b A col5 (Σ) + b h

i

=A Σ+ b b b b b " #" # " # 0 1 1 0 1 0 1 2 2 2 2 2 = + −1 0 0 0 1 2 2 −1 −1 −1 −1 −1 " # 2 2 3 4 4 = −2 −1 −2 −1 −2 This matrix gives the coordinates of the endpoints of the line segments in the image. T performs a clockwise rotation of 90o followed by a translation by the vector b.

2


PS1: item1

A “house” is made by connecting the set of points {(1, 1), (1, 2), (2, 2), (3, 4), (4, 2), (4, 1), (1, 1)} with straight line segments in the order listed. (a) Write a Scilab script that will perform the affine transformation T (v) = Av + b on this figure, where " # " # 1 1 −2 A= and b = . −1 1 5

(b) Write a Scilab script that wil plot the original figure and its image under the affine transformation T on the same coordinate plane. Use different colors to distinguish the two. (c) Compute for the translation b and the matrix A of the affine transformation that should be applied to the original “house” to obtain the image determined by the set of points {(4, 1), (4, 3), (6, 3), (8, 7), (10, 3), (10, 1), (4, 1)}

3


Affine transformations seem simple; they map line segments to line segments. However, the simplicity of the process does not mean that repetitions of it will lead to simple patterns. In fact, a wide variety of complex patterns are the result of repeated applications of affine transformations. It was this type of mathematical observation that laid the foundation for new areas of mathematics such as fractal geometry. A fractal is a figure that appears self-similar as we make a change of scale. The term self-similar is used to described figures composed of infinite repetitions of the same shape, that is, the figure is composed of smaller objects that are similar to the whole. ———————————————————————————————————————————— PS1: item2

In the theoretical development of fractals the concept of a fixed point of an affine transformation plays an important role. v is a fixed point of the affine transformation T provided that T (v) = v. (a) Let T : R2 → R2 be an affine transformation defined by T (v) = Av + b, where "

#

p r s t

A=

"

and b =

b1 b2

#

.

Prove that T has a single fixed point whenever (p − 1)(t − 1) − rs 6= 0. (b) Determine the fixed point of the following affine transformation T , where √

1 6

A= 

3 6

3 6

1 6

4

  

and b =

 1  2    √ . 3 6


?;@!<),/2'&%2!2#$!-)%#!A30$!

@;!B21'2!9.2#!1!/2'1.0#2!8.,$;! ! !! ?;@!<),/2'&%2!2#$!-)%#!A30$! @;!B21'2!9.2#!1!/2'1.0#2!8.,$;!

!

C;!"#$!/2'1.0#2!8.,$!./!3.(.3$3!.,2)!?!$:&18!71'2/>!1,3!2#$!6.338$!71'2!./!! !!@;!B21'2!9.2#!1!/2'1.0#2!8.,$;! ! ?;@!<),/2'&%2!2#$!-)%#!A30$! !

!!

C;!"#$!/2'1.0#2!8.,$!./!3.(.3$3!.,2)!?!$:&18!71'2/>!1,3!2#$!6.338$!71'2!./!! @;!B21'2!9.2#!1!/2'1.0#2!8.,$;! !!!!!'$781%$3!45!29)!8.,$1'!/$06$,2/!12!1,08$/!DEF!1,3!@CEF;! One of the most familiar fractals is the Koch curve. It is constructed by removing the middle C;!"#$!/2'1.0#2!8.,$!./!3.(.3$3!.,2)!?!$:&18!71'2/>!1,3!2#$!6.338$!71'2!./!! ! !!

third of a line segment, replacing it with an equilateral triangle, and then removing the base.

!!!!!'$781%$3!45!29)!8.,$1'!/$06$,2/!12!1,08$/!DEF!1,3!@CEF;! C;!"#$!/2'1.0#2!8.,$!./!3.(.3$3!.,2)!?!$:&18!71'2/>!1,3!2#$!6.338$!71'2!./!! !!!!!'$781%$3!45!29)!8.,$1'!/$06$,2/!12!1,08$/!DEF!1,3!@CEF;! Step 1. Start with an initial line segment.!! ! !!!!!'$781%$3!45!29)!8.,$1'!/$06$,2/!12!1,08$/!DEF!1,3!@CEF;!

Step 2. The line segment is divided into 3C;!"#$!/2'1.0#2!8.,$!./!3.(.3$3!.,2)!?!$:&18!71'2/>!1,3!2#$!6 equal parts, and the middle part is replaced by two line ! segments at angles 60o and 120o .

!!!!!

! ! !!!!!'$781%$3!45!29)!8.,$1'!/$06$,2/!12!1,08$/!DEF!1,3!@CEF !!!!! ?;!G$7$12!2#$!/2$7/!@!1,3!C!2)!2#$!*)&'!8.,$!/$06$,2/!0$,$'12$3!.,!29)! !!!!! ?;!G$7$12!2#$!/2$7/!@!1,3!C!2)!2#$!*)&'!8.,$!/$06$,2/!0$,$'12$3!.,!29)!

! !!!!!?;!G$7$12!2#$!/2$7/!@!1,3!C!2)!2#$!*)&'!8.,$!/$06$,2/!0$,$'12$3!.,!29)! Step 3. Repeat steps 1 and 2 to all the line segments generated in step 2.

?;!G$7$12!2#$!/2$7/!@!1,3!C!2)!2#$!*)&'!8.,$!/$06$,2/!0$,$'12$3!.,!29)!

!!!

!

!!!

!

!!!!!

!

H;!I&'2#$'!.2$'12.),/!9.88!0$,$'12$!2#$!*)88)9.,0!%&'($/! !!! ! ?;!G$7$12!2#$!/2$7/!@!1,3!C!2)!2#$!*)&'!8.,$!/$06$,2/!0$,$' H;!I&'2#$'!.2$'12.),/!9.88!0$,$'12$!2#$!*)88)9.,0!%&'($/! Further iterations will generate the curves:

!!! ! H;!I&'2#$'!.2$'12.),/!9.88!0$,$'12$!2#$!*)88)9.,0!%&'($/! H;!I&'2#$'!.2$'12.),/!9.88!0$,$'12$!2#$!*)88)9.,0!%&'($/!

!!

!!!

!!!!! !!!!!

!!

!

!

!

used to obtain the Koch curve,! note that one step gener!!!!!!!!!!!!!!!!!!'$7$12!2#'$$!2.6$/!!!!!!!!!!!!!!!!!!!!!!!!'$7$12!*)&'!2.6$/! !!To determine the affine transformation !!!!!H;!I&'2#$'!.2$'12.),/!9.88!0$,$'12$!2#$!*)88)9.,0!%&'($/! !!!!!!!!!!!!!!!!!!'$7$12!2#'$$!2.6$/!!!!!!!!!!!!!!!!!!!!!!!!'$7$12!*)&'!2.6$/! ates 4 line segments from each line segment of the current figure. Hence, 4 affine transformations, !!!!!this fractal. In each case, there ! will be a scaling of 1 . T1 !! throught T4 , will be used to generate 3 !

!!!!!!!!!!!!!!!!!!'$7$12!2#'$$!2.6$/!!!!!!!!!!!!!!!!!!!!!!!!'$7$12!*)&'!2.6$/! ! !!!!!!!!!!!!!!!!!!'$7$12!2#'$$!2.6$/!!!!!!!!!!!!!!!!!!!!!!!!'$7$12!*)&'!2.6$/! Suppose we start with a line segment which is 1 unit in length. ! ! • T1! is a contraction by a factor of

!

!!

!!!!!

• T2 is a contraction by a factor" of #13 followed by a rotation of 60o counterclockwise and then a ! 1 translation by the vector b = 3!!!!!!!!!!!!!!!!!!'$7$12!2#'$$!2.6$/!!!!!!!!!!!!!!!!!!!!!!!!'$7$12!*)&'!2.6$/! . ! 0 JDJ!

!

! !

1 . 3

• T3 is a contraction "by a factor of #

!

by the vector b =

1 √3 3 6

1 3

JDJ! !by a rotation of 60o clockwise and then a translation followed JDJ!

.

JDJ! !

"

• T4 is a contraction by a factor of

1 3

followed by a translation by the vector b =

2 3

0

#

.

These 4 affine transformations are applied to each line segment with adjustments in the translation ! JDJ! at each step that take the scale into account. 5


PS1: item3

Every affine " # transformation " # can be written in the form T (v) = Av + b, where p r b1 A = and b = . Thus, we can specify the transformations that generate the koch s t b2 fractal as a table of coefficients for p, r, s, t, b1 , and b2 . The following table specifies the transformations T1 through T4 in the preceding page. p

r

s

t

b1

b2

T1

1 3

0

0

1 3

0

0

T2

1 6

1 6

1 3

0

T3

1 6

1 6

1 2

T4

1 3

1 3

2 3

3 6

3 6

3 6

0

3 6

0

3 6

0

(a) Write a Scilab script that will perform the affine transformations T1 through T4 on the line segment with endpoints at (0, 0) and (1, 0) and plot the resulting Koch curve (see the sample figure in step 2 of the Koch curve construction). (b) The next curve is generated by applying 4 transformations to each of the 4 line segments in (a), that is a total of 16 transformations. Give the table of coefficients for p, r, s, t, b1 , and b2 specifying these 16 affine transformations. (c) If the process in the previous page is applied to the sides of an equilateral triangle (only on the outer sides), what pattern is generated?

END OF PS1


Turn static files into dynamic content formats.

Create a flipbook
Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.