54
P-Set 2 Solution Set Solutions created by Melissa Diskin I2-1 (Handworked, 5 points) This solves for the intersection of y and z in terms of x and y. In[160]:= planesol = Solve@8z == 1 + 2x + 3y,y == 3-2z-4x<, 8x, y<D; planesol êê Simplify Out[161]= ::x Ø 1 - 7z 10 ,y Ø-1 + 4z 5 >> Here are the coordinates of any point on the line in terms of z. In[162]:= line = 8x, y, z. planesol@@1DD êê Simplify Out[162]= :1 - 7z 10 , -1 + 4z 5 ,z> Normalize to get the parallel unit vector. In[163]:= Normalize@8- 7, 8, 10<D Out[163]= :- 7 213 , 8 213 , 10 213 > Visual representation of this solution.

P-Set 2 Solution Setpruffle.mit.edu/3.016-2009/Homeworks/PS2-2009-Solutions.pdf · 2009-11-02 · P-Set 2 Solution Set Solutions created by Melissa Diskin I2-1 (Handworked, 5 points)

  • Upload
    others

  • View
    3

  • Download
    0

Embed Size (px)

Citation preview

Page 1: P-Set 2 Solution Setpruffle.mit.edu/3.016-2009/Homeworks/PS2-2009-Solutions.pdf · 2009-11-02 · P-Set 2 Solution Set Solutions created by Melissa Diskin I2-1 (Handworked, 5 points)

P-Set 2 Solution Set

Solutions created by Melissa Diskin

I2-1 (Handworked, 5 points)

This solves for the intersection of y and z in terms of x and y.

In[160]:= planesol = Solve@8z == 1 + 2 x + 3 y , y == 3 - 2 z - 4 x<, 8x, y<D;planesol êê Simplify

Out[161]= ::x Ø 1 -7 z

10, y Ø -1 +

4 z

5>>

Here are the coordinates of any point on the line in terms of z.

In[162]:= line = 8x, y, z< ê. planesol@@1DD êê Simplify

Out[162]= :1 -7 z

10, -1 +

4 z

5, z>

Normalize to get the parallel unit vector.

In[163]:= Normalize@8-7, 8, 10<D

Out[163]= :-7

213,

8

213,

10

213>

Visual representation of this solution.

Page 2: P-Set 2 Solution Setpruffle.mit.edu/3.016-2009/Homeworks/PS2-2009-Solutions.pdf · 2009-11-02 · P-Set 2 Solution Set Solutions created by Melissa Diskin I2-1 (Handworked, 5 points)

In[203]:= ParametricPlot3D@line, 8z, -1, 1<D

Out[203]=

0.51.0

1.5

-1.5

-1.0

-0.5

-1.0

-0.5

0.0

0.5

1.0

I2-2 (10 points)

A function that creates a matrix with the given specifications.

In[165]:= randElementMat4x4 := RandomReal@8-1, 1<, 84, 4<DMatrixForm@randElementMat4x4D

Out[166]//MatrixForm=

0.348897 -0.676111 0.654281 -0.5667170.865387 0.726989 0.98561 -0.67875-0.87135 0.71568 0.935621 -0.0467418-0.188167 -0.103992 0.898638 -0.966279

This one creates a matrix based upon a 4D vector, magnitude 1 (using the Norm function).

2 PS3-2009-Solutions.nb

Page 3: P-Set 2 Solution Setpruffle.mit.edu/3.016-2009/Homeworks/PS2-2009-Solutions.pdf · 2009-11-02 · P-Set 2 Solution Set Solutions created by Melissa Diskin I2-1 (Handworked, 5 points)

In[167]:= randVectorMat4x4 := Module@8rm<,rm = randElementMat4x4;Table@rm@@iDDêNorm@rm@@iDDD, 8i, 1, Length@rmD<D

D

MatrixForm@randVectorMat4x4DOut[168]//MatrixForm=

0.55786 0.575555 0.595587 0.0529548-0.719157 -0.0825773 -0.689728 -0.01642410.473504 0.579094 -0.476952 -0.461478-0.427678 0.0503686 0.902115 0.0272574

This verifies that the magitude is 1 for each row.

In[169]:= test = randVectorMat4x4;Table@Norm@test@@iDDD ã 1, 8i, 1, Length@testD<D

Out[170]= 8True, True, True, True<

I2-3 (Handworked, 5 points)

Creates and displays the matricies.

In[171]:= matrices =888a, c<, 8c, b<<,88a, c + b Sqrt@-1D<, 8c - b Sqrt@-1D, 1<<,88a, -c<, 8c, b<<,88a, c + b Sqrt@-1D<, 8c + b Sqrt@-1D, 1<<

<;Row@Table@MatrixForm@matrices@@iDDD, 8i, 1, 4<DD

Out[172]= Ka cc b

Oa  b + c

-Â b + c 1Ka -cc b

Oa  b + c

 b + c 1

Displays the eigenvalues of each matrix assuming a, b, and c are real. The first two matricies always have real eignevalues.

PS3-2009-Solutions.nb 3

Page 4: P-Set 2 Solution Setpruffle.mit.edu/3.016-2009/Homeworks/PS2-2009-Solutions.pdf · 2009-11-02 · P-Set 2 Solution Set Solutions created by Melissa Diskin I2-1 (Handworked, 5 points)

In[173]:= Table@FullSimplify@Eigenvalues@matrices@@iDDD,Assumptions Ø 8a œ Reals, b œ Reals, c œ Reals<D, 8i, 4<D

Out[173]= ::1

2a + b - Ha - bL2 + 4 c2 ,

1

2a + b + Ha - bL2 + 4 c2 >,

:1

21 + a - 1 + H-2 + aL a + 4 b2 + 4 c2 ,

1

21 + a + 1 + H-2 + aL a + 4 b2 + 4 c2 >,

:1

2a + b - Ha - bL2 - 4 c2 ,

1

2a + b + Ha - bL2 - 4 c2 >,

:1

21 + a - 1 + H-2 + aL a - 4 Hb - Â cL2 ,

1

21 + a + 1 + H-2 + aL a - 4 Hb - Â cL2 >>

Displays the eigenvectors of each matrix assuming a, b, and c are real.

In[174]:= Row@Table@MatrixForm@FullSimplify@Eigenvectors@matrices@@iDDD,Assumptions Ø 8a œ Reals, b œ Reals, c œ Reals<DD, 8i, 4<DD

Out[174]=-

-a+b+ Ha-bL2+4 c2

2 c1

a-b+ Ha-bL2+4 c2

2 c1

-Â 1-a+ 1+H-2+aL a+4 b2+4 c2

2 Hb+Â cL1

 -1+a+ 1+H-2+aL a+4 b2+4 c2

2 Hb+Â cL1

--a+b+ Ha-bL2-4 c2

2 c1

a-b+ Ha-bL2-4 c2

2 c1

 1-a+ 1+H-2+aL a-4 Hb- cL2

2 Hb-Â cL1

-Â -1+a+ 1+H-2+aL a-4 Hb-Â cL2

2 Hb-Â cL1

In[175]:= FullSimplify@Sqrt@1 - 2 a + a^2 + 4 c^2 + 4 b*I*IDD

Out[175]= 1 + H-2 + aL a - 4 b + 4 c2

1 + H-2 + aL a - 4 b + 4 c2

1 + H-2 + aL a - 4 Hb - Â cL2

I2-4 (10 points)

The given matricies.

In[176]:= amat = Table@a@i, jD, 8i, 1, 2<, 8j, 1, 2<D;bmat = Table@b@i, jD, 8i, 1, 2<, 8j, 1, 2<D;

The necessary condition is AB = BA or AB - BA = 0.

4 PS3-2009-Solutions.nb

Page 5: P-Set 2 Solution Setpruffle.mit.edu/3.016-2009/Homeworks/PS2-2009-Solutions.pdf · 2009-11-02 · P-Set 2 Solution Set Solutions created by Melissa Diskin I2-1 (Handworked, 5 points)

In[178]:= commute = amat.bmat - bmat.amat

Out[178]= 88-a@2, 1D b@1, 2D + a@1, 2D b@2, 1D,-a@1, 2D b@1, 1D + a@1, 1D b@1, 2D - a@2, 2D b@1, 2D + a@1, 2D b@2, 2D<,

8a@2, 1D b@1, 1D - a@1, 1D b@2, 1D + a@2, 2D b@2, 1D - a@2, 1D b@2, 2D,a@2, 1D b@1, 2D - a@1, 2D b@2, 1D<<

Finds the conditions such that AB - BA = 0.

In[179]:= eqs =Flatten@Table@commute@@i, jDD ã 0, 8i, 2<, 8j, 2<D, 1D

Out[179]= 8-a@2, 1D b@1, 2D + a@1, 2D b@2, 1D ã 0,-a@1, 2D b@1, 1D + a@1, 1D b@1, 2D - a@2, 2D b@1, 2D + a@1, 2D b@2, 2D ã 0,a@2, 1D b@1, 1D - a@1, 1D b@2, 1D + a@2, 2D b@2, 1D - a@2, 1D b@2, 2D ã 0,a@2, 1D b@1, 2D - a@1, 2D b@2, 1D ã 0<

In[180]:= Solve@eqs, 8a@1, 2D, a@2, 1D<D

Out[180]= ::a@1, 2D ØHa@1, 1D - a@2, 2DL b@1, 2D

b@1, 1D - b@2, 2D, a@2, 1D Ø -

-a@1, 1D b@2, 1D + a@2, 2D b@2, 1D

b@1, 1D - b@2, 2D>>

I2-5 (10 points)

Start by constructing a vector that is a linear combination of a set of input vectors.

In[181]:= createLinearDependent@listofVecs_D :=Sum@RandomReal@8-10, 10<D listofVecs@@iDD,8i, 1, Length@listofVecsD<D

Test of the function.

In[182]:= createLinearDependent@881, 2, 3<, 84, 5, 6<<D

Out[182]= 836.2939, 48.8774, 61.461<

Determinant = 0.

In[183]:= DetüJoin@881, 2, 3<, 84, 5, 6<<,8createLinearDependent@881, 2, 3<, 84, 5, 6<<D<D

Out[183]= 0.

Finds the nullity of the created matrix.

PS3-2009-Solutions.nb 5

Page 6: P-Set 2 Solution Setpruffle.mit.edu/3.016-2009/Homeworks/PS2-2009-Solutions.pdf · 2009-11-02 · P-Set 2 Solution Set Solutions created by Melissa Diskin I2-1 (Handworked, 5 points)

In[184]:= nullity4x4@nullity_D :=Module@8linindset<,linindset = RandomReal@8-1, 1<, 84 - nullity, 4<D;Join@linindset,Table@createLinearDependent@linindsetD, 8i, 1, nullity<DD

D

In[185]:= nullity4x4@2D êê MatrixFormOut[185]//MatrixForm=

0.0917457 -0.653663 0.445847 0.62263-0.698773 -0.411504 -0.511863 -0.48036-7.02533 -1.14386 -6.74771 -7.19622-5.4639 -1.64034 -4.84633 -5.00324

As nullity increases, the matrixrank decreases.

In[186]:= 4 - Table@MatrixRank@nullity4x4@iDD, 8i, 1, 3<D

Out[186]= 81, 2, 3<

In[187]:= e44@nul_D := Eigensystem@nullity4x4@nulDD

In[188]:= evals = Chop@Table@e44@iD@@1DD, 8i, 1, 3<DD

Out[188]= 884.14745, 1.74076, -1.30605, 0<,8-0.574452 + 1.02869 Â, -0.574452 - 1.02869 Â, 0, 0<, 87.1148, 0, 0, 0<<

The number of zeros in the set of eigenvalues increases as nullity increases.

In[189]:= countzeroes = Table@Count@evals@@iDD, 0D, 8i, 1, 3<D

Out[189]= 81, 2, 3<

I2-6 (10 points; 2 points for rotation, 4 for reflection and 4 for inversion)

Here is the starter code.

6 PS3-2009-Solutions.nb

Page 7: P-Set 2 Solution Setpruffle.mit.edu/3.016-2009/Homeworks/PS2-2009-Solutions.pdf · 2009-11-02 · P-Set 2 Solution Set Solutions created by Melissa Diskin I2-1 (Handworked, 5 points)

In[190]:= PolyhedronData@"SnubCube"D

Out[190]=

Looking a GraphicsComplex in help browser will show that it takes two arguments. The first is a list of 3d points (which can beindexed as point[[1]], point[[2]]...) and the second is a list of graphics objects that refer to the indexed points.

In[202]:= FullForm@NüPolyhedronData@"SnubCube"DD êê ShortOut[202]//Short=

Graphics3D@GraphicsComplex@List@\@LeftSkeletonD1\@RightSkeletonDD,Polygon@List@List@3, 1, 17D, \@LeftSkeletonD36\@RightSkeletonD, List@8, 5, 7, 6DDDDD

This uses a conditional pattern, it looks for instances of lists of three numbers and returns those cases. We only want the points here.

PS3-2009-Solutions.nb 7

Page 8: P-Set 2 Solution Setpruffle.mit.edu/3.016-2009/Homeworks/PS2-2009-Solutions.pdf · 2009-11-02 · P-Set 2 Solution Set Solutions created by Melissa Diskin I2-1 (Handworked, 5 points)

In[192]:= snubCubePoints = Cases@NüPolyhedronData@"SnubCube"D,8a_ ê; HNumberQ@aD && ! IntegerQ@aDL,b_ ê; HNumberQ@bD && ! IntegerQ@bDL,c_ ê; HNumberQ@cD && ! IntegerQ@cDL<, InfinityD

Out[192]= 88-1.14261, -0.337754, -0.621226<, 8-1.14261, 0.337754, 0.621226<,8-1.14261, -0.621226, 0.337754<, 8-1.14261, 0.621226, -0.337754<,81.14261, -0.337754, 0.621226<, 81.14261, 0.337754, -0.621226<,81.14261, -0.621226, -0.337754<, 81.14261, 0.621226, 0.337754<,8-0.337754, -1.14261, 0.621226<, 8-0.337754, 1.14261, -0.621226<,8-0.337754, -0.621226, -1.14261<, 8-0.337754, 0.621226, 1.14261<,80.337754, -1.14261, -0.621226<, 80.337754, 1.14261, 0.621226<,80.337754, -0.621226, 1.14261<, 80.337754, 0.621226, -1.14261<,8-0.621226, -1.14261, -0.337754<, 8-0.621226, 1.14261, 0.337754<,8-0.621226, -0.337754, 1.14261<, 8-0.621226, 0.337754, -1.14261<,80.621226, -1.14261, 0.337754<, 80.621226, 1.14261, -0.337754<,80.621226, -0.337754, -1.14261<, 80.621226, 0.337754, 1.14261<<

List of polygons. (The use of ___ refers to somthing repeated).

In[193]:= snubCubePolygons =Cases@NüPolyhedronData@"SnubCube"D, List@a__IntegerD, InfinityD

Out[193]= 883, 1, 17<, 83, 17, 9<, 83, 19, 2<, 83, 9, 19<, 81, 4, 20<, 81, 20, 11<, 81, 11, 17<,82, 19, 12<, 82, 18, 4<, 82, 12, 18<, 84, 18, 10<, 84, 10, 20<, 817, 11, 13<, 819, 9, 15<,818, 12, 14<, 820, 10, 16<, 89, 21, 15<, 811, 23, 13<, 812, 24, 14<, 810, 22, 16<,813, 23, 7<, 813, 7, 21<, 815, 21, 5<, 815, 5, 24<, 816, 22, 6<, 816, 6, 23<,814, 24, 8<, 814, 8, 22<, 821, 7, 5<, 823, 6, 7<, 824, 5, 8<, 822, 8, 6<, 81, 3, 2, 4<,821, 9, 17, 13<, 824, 12, 19, 15<, 810, 18, 14, 22<, 811, 20, 16, 23<, 88, 5, 7, 6<<

This gives the the logical connection between points without regard to their coordinates, only where they are in list.

In[194]:= snubCubeColoredPolygons =Table@8FaceForm@Hue@RandomReal@DDD,

Polygon@8snubCubePolygons@@iDD<D<,8i, 1, Length@snubCubePolygonsD<D;

In[195]:= snubGraphics@pts_D :=Graphics3D@GraphicsComplex@pts, snubCubeColoredPolygonsD,Lighting Ø "Neutral", ViewPoint Ø FrontD

Visual representation of the polygons.

8 PS3-2009-Solutions.nb

Page 9: P-Set 2 Solution Setpruffle.mit.edu/3.016-2009/Homeworks/PS2-2009-Solutions.pdf · 2009-11-02 · P-Set 2 Solution Set Solutions created by Melissa Diskin I2-1 (Handworked, 5 points)

In[196]:= snubGraphics@snubCubePointsD

Out[196]=

A rotational matrix.

In[197]:= rotmat = RotationMatrix@Piê3, 80, 1, 0<D

Out[197]= ::1

2, 0,

3

2>, 80, 1, 0<, :-

3

2, 0,

1

2>>

Function to transform the coordinates of the points.

In[198]:= transformPoints@pts_, matrix_D :[email protected]@@iDD, 8i, 1, Length@ptsD<D

PS3-2009-Solutions.nb 9

Page 10: P-Set 2 Solution Setpruffle.mit.edu/3.016-2009/Homeworks/PS2-2009-Solutions.pdf · 2009-11-02 · P-Set 2 Solution Set Solutions created by Melissa Diskin I2-1 (Handworked, 5 points)

In[199]:= snubGraphics@transformPoints@snubCubePoints, rotmatDD

Out[199]=

Transforms given polygon.

In[200]:= snubGraphics@transformPoints@snubCubePoints, 88-1, 0, 0<, 80, 1, 0<, 80, 0, 1<<DD

Out[200]=

Group Problem G2-1

10 PS3-2009-Solutions.nb

Page 11: P-Set 2 Solution Setpruffle.mit.edu/3.016-2009/Homeworks/PS2-2009-Solutions.pdf · 2009-11-02 · P-Set 2 Solution Set Solutions created by Melissa Diskin I2-1 (Handworked, 5 points)

Group Problem G2-1

Commenting the starter code:

An asymmetric object with six points

„ This defines a set of colored polygons with indexed indices. The indices will refer to points that will be transformed as needed.

AssymetricObject = 88Lighter@BlueD, Polygon@81, 6, 2<D<,8Green, Polygon@81, 2, 3, 4<D<, 8Red, Polygon@81, 4, 5, 6<D<<

::RGBColorB1

3,1

3, 1F, Polygon@81, 6, 2<D>,

8RGBColor@0, 1, 0D, Polygon@81, 2, 3, 4<D<, 8RGBColor@1, 0, 0D, Polygon@81, 4, 5, 6<D<>

A graphical representation, given six points, this function creates an object ready for plotting

„ Looking at the Help Browser for GraphicsComplex shows that this function takes points and then creates a graphics object associated with those points using the object created above.

GraphicsAssymetricObject@pts_D :=GraphicsComplex@pts, AssymetricObjectD

A set of "generator" points

„ These are the original points---they have the shape of a house, but then a pattern-replace method is used to displace and rotate each point.

genPoints =8 880, 0<, 8-.5, .5<, 8-.5, -.5<, 80, -.5<, 8.5, -.5<, 80.5, 0.5<<< ê.H8a_, b_< ß 80.1, 0.25< + 0.1 RotationMatrix@Piê12D.8a, b<L

8880.1, 0.25<, 80.0387628, 0.285355<, 80.0646447, 0.188763<,80.112941, 0.201704<, 80.161237, 0.214645<, 80.135355, 0.311237<<<

genPoints@@1DD

880.1, 0.25<, 80.0387628, 0.285355<, 80.0646447, 0.188763<,80.112941, 0.201704<, 80.161237, 0.214645<, 80.135355, 0.311237<<

PS3-2009-Solutions.nb 11

Page 12: P-Set 2 Solution Setpruffle.mit.edu/3.016-2009/Homeworks/PS2-2009-Solutions.pdf · 2009-11-02 · P-Set 2 Solution Set Solutions created by Melissa Diskin I2-1 (Handworked, 5 points)

GraphicsAssymetricObject@genPoints@@1DDD

GraphicsComplexB880.1, 0.25<, 80.0387628, 0.285355<, 80.0646447, 0.188763<,

80.112941, 0.201704<, 80.161237, 0.214645<, 80.135355, 0.311237<<,

::RGBColorB1

3,1

3, 1F, Polygon@81, 6, 2<D>, 8RGBColor@0, 1, 0D, Polygon@81, 2, 3, 4<D<,

8RGBColor@1, 0, 0D, Polygon@81, 4, 5, 6<D<>F

An example of an asymmetric object: this is kind of boring...one can do better...

Graphics@GraphicsAssymetricObject@genPoints@@1DDDD

Mapping Points back into unit cell: Modulus Mapping

Square lattice modulus mapping

ü This takes any point and finds it equivalent point in the primary unit square cell

SquareLatticeMod@pt_D := Mod@pt, 1D

Hexagonal lattice modulus mapping

12 PS3-2009-Solutions.nb

Page 13: P-Set 2 Solution Setpruffle.mit.edu/3.016-2009/Homeworks/PS2-2009-Solutions.pdf · 2009-11-02 · P-Set 2 Solution Set Solutions created by Melissa Diskin I2-1 (Handworked, 5 points)

Hexagonal lattice modulus mapping

„ Working from the inside of the function calls out (i.e., the order of opertion), the matrix 1 -

1

3

0 2

3

takes a vector in the

hexagonal system and then maps it to a Cartesian frame. The modulus mapping function above can be applied directly in the Cartesian coordinate system. Finally the inverse of the first matrix is used to map the result back into the hexagonal system.

cartToHex = ::1,1

2>, :0,

3

2>>;

hexToCart = Inverse@cartToHexD

::1, -1

3>, :0,

2

3>>

HexLatticeMod@pt_D := H*take a pattern ofnumbers and use the modulus function to map back*L

pt ê. H8a_ ê; NumberQ@aD, b_ ê; NumberQ@bD< ß[email protected], b<, 1DL

[email protected], 0.99<D

80.6, 0.123975<

RandomReal@80, 2<, 820, 2<D

881.1815, 0.0501105<, 80.701729, 0.457317<, 80.433046, 1.93023<, 80.950424, 0.70391<,81.35294, 0.583786<, 81.92407, 0.631786<, 81.85535, 1.32161<, 81.96879, 1.52197<,81.73951, 1.55352<, 80.287979, 0.0988185<, 80.562582, 1.66186<, 80.337093, 1.17102<,80.16801, 1.59379<, 80.00529066, 1.72497<, 81.06661, 1.90741<, 80.552723, 0.0126638<,81.62724, 1.15432<, 80.0212442, 1.34539<, 81.63674, 1.97756<, 81.95014, 1.83545<<

PS3-2009-Solutions.nb 13

Page 14: P-Set 2 Solution Setpruffle.mit.edu/3.016-2009/Homeworks/PS2-2009-Solutions.pdf · 2009-11-02 · P-Set 2 Solution Set Solutions created by Melissa Diskin I2-1 (Handworked, 5 points)

ü An example of mapping back to the "fundamental hexagonal cell"

„ This shows that all points get mapped back---this is a demonstration that the function, at least, has proper behavior.

ListPlot@HexLatticeMod êü RandomReal@80, 10<, 82000, 2<D,PlotRange Ø 880, 2<, 80, 2<<, AspectRatio Ø 1D

0.0 0.5 1.0 1.5 2.00.0

0.5

1.0

1.5

2.0

Rectangular lattice modulus mapping (set rectangle coordinates to (GoldenMean, 1)

„ Here is an example just like the hexagonal case above, but the mapping is a bit simpler.

rectToCart = 881êGoldenRatio, 0<, 80, 1<<;

cartToRect = Inverse@rectToCartD

88GoldenRatio, 0<, 80, 1<<

RectLatticeMod@pt_D :=pt ê. H8a_ ê; NumberQ@aD, b_ ê; NumberQ@bD< ß

[email protected], b<, 1DL

[email protected], 0.99<D

81.1, 0.99<

14 PS3-2009-Solutions.nb

Page 15: P-Set 2 Solution Setpruffle.mit.edu/3.016-2009/Homeworks/PS2-2009-Solutions.pdf · 2009-11-02 · P-Set 2 Solution Set Solutions created by Melissa Diskin I2-1 (Handworked, 5 points)

ListPlot@RectLatticeMod êü RandomReal@80, 10<, 82000, 2<D,PlotRange Ø 880, 2<, 80, 2<<, AspectRatio Ø 1D

0.0 0.5 1.0 1.5 2.00.0

0.5

1.0

1.5

2.0

Prism lattice modulus mapping (set prism coordinates to (Sqrt[2], 1), Angle Pi/6)

„ This is a demonstration of the same method.

toCart = 881êSqrt@2D, Sin@Piê4DêSqrt@2D<, 80, Cos@Piê4D<<

::1

2,1

2>, :0,

1

2>>

Inverse@toCartD êê Simplify

:: 2 , -1>, :0, 2 >>

PrismLatticeMod@pt_D :=

pt ê. 8a_ ê; NumberQ@aD, b_ ê; NumberQ@bD< ß

::1

2,1

2>, :0,

1

2>>.ModB:: 2 , -1>, :0, 2 >>.8a, b<, 1F

PS3-2009-Solutions.nb 15

Page 16: P-Set 2 Solution Setpruffle.mit.edu/3.016-2009/Homeworks/PS2-2009-Solutions.pdf · 2009-11-02 · P-Set 2 Solution Set Solutions created by Melissa Diskin I2-1 (Handworked, 5 points)

[email protected], 0.99<D

81.1, 0.99<

ListPlot@PrismLatticeMod êü RandomReal@80, 10<, 82000, 2<D,PlotRange Ø 880, 2<, 80, 2<<, AspectRatio Ø 1D

0.0 0.5 1.0 1.5 2.00.0

0.5

1.0

1.5

2.0

Symmetry operations on a point

Define a function that translates points by a vector

„ Using replacement rules again. We use chop to eliminate small numercal errors-- and their cumulative effect from many mappings.

TranslateSet@pointset_, transvect_D :=Chop@pointset ê.

H8a_ ê; NumberQ@aD, b_ ê; NumberQ@bD< ß 8a, b< + transvectLD

„ For example:

TranslateSet@genPoints, 810, 100<D

88810.1, 100.25<, 810.0388, 100.285<, 810.0646, 100.189<,810.1129, 100.202<, 810.1612, 100.215<, 810.1354, 100.311<<<

Define a function that rotates points around origin by a counterclockwise angle

16 PS3-2009-Solutions.nb

Page 17: P-Set 2 Solution Setpruffle.mit.edu/3.016-2009/Homeworks/PS2-2009-Solutions.pdf · 2009-11-02 · P-Set 2 Solution Set Solutions created by Melissa Diskin I2-1 (Handworked, 5 points)

Define a function that rotates points around origin by a counterclockwise angle

ü This is a function that takes a set of points (which could be the vertices for several different instances of the assymetric object) and rotates the counter-clockwise through an angle. The function take an argument which is the name of a function that maps all the points back into the fundamental domain for the chosen symmetry.

The function creates the 2D rotation matrix from the input angle; uses a rule-replace to rotate each point in pointset and returns the results mapped back into the fundamental domain.

RotateSet@pointset_, angle_, LatticeMap_D :=Module@8rotmat<,rotmat = RotationMatrix@angleD;LatticeMap@Chop@pointset ê.

H8a_ ê; NumberQ@aD, b_ ê; NumberQ@bD< ß rotmat.8a, b<LDD

D

„ For example:

RotateSet@genPoints, Piê4, SquareLatticeModD

8880.893934, 0.247487<, 80.825633, 0.229186<, 80.912235, 0.179186<,80.937235, 0.222487<, 80.962235, 0.265789<, 80.875633, 0.315789<<<

Define a function that mirrors points through a plane defined by its direction and perpendicular offset from origin

ü This symmetry operation works on the same principle. It takes the line across which pointset will be reflected and the distance (perpendicular bisector) of that line from the origin.

MirrorSet@pointset_, line_, perpOffset_, LatticeMap_D :=Module@8refmat, normalline, normvector<,If@PossibleZeroQ@line@@2DDD, normalline = 80, 1<,normalline = 8-1, line@@1DDêline@@2DD<D;

normvector = Norm@normallineD;refmat = ReflectionMatrix@normallineD;LatticeMap@Chop@pointset ê. H8a_ ê; NumberQ@aD, b_ ê; NumberQ@bD< ß refmat.

H8a, b< - perpOffset normvectorL + perpOffset normvectorLDD

D

PS3-2009-Solutions.nb 17

Page 18: P-Set 2 Solution Setpruffle.mit.edu/3.016-2009/Homeworks/PS2-2009-Solutions.pdf · 2009-11-02 · P-Set 2 Solution Set Solutions created by Melissa Diskin I2-1 (Handworked, 5 points)

„ For example:

MirrorSet@genPoints, 8-1, 1<, Sqrt@2D, SquareLatticeModD

8880.75, 0.9<, 80.714645, 0.961237<, 80.811237, 0.935355<,80.798296, 0.887059<, 80.785355, 0.838763<, 80.688763, 0.864645<<<

Define a function that glide points along a direction and then mirrors across that line

„ This operates with the same basic method. It first mirrors and then translates in a direction specfied by vector and a magnitude.

GlideSet@pointset_, vector_, mag_, perpOffset_, LatticeMap_D := Mod@TranslateSet@MirrorSet@pointset, vector, perpOffset, LatticeMapD,mag vectorêNorm@vectorDD,

1D

„ For example:

GlideSet@genPoints, 8-1, 1<, Sqrt@2D, 2D

GlideSetB8880.1, 0.25<, 80.0387628, 0.285355<, 80.0646447, 0.188763<,

80.112941, 0.201704<, 80.161237, 0.214645<, 80.135355, 0.311237<<<, 8-1, 1<, 2 , 2F

18 PS3-2009-Solutions.nb

Page 19: P-Set 2 Solution Setpruffle.mit.edu/3.016-2009/Homeworks/PS2-2009-Solutions.pdf · 2009-11-02 · P-Set 2 Solution Set Solutions created by Melissa Diskin I2-1 (Handworked, 5 points)

Now, define a group of function that add symmetry elements to the generator---thus building up point group

ü This is a function that takes all of the input points, translates them, and then creates a set of the original points plus there translations. Thus, it builds up the image by adding a particular operation. The function will report back if it creates any duplicate objects--these would be redundant symmetry operations.

setAddTranslation@pointset_, transvect_D :=Module@8transset, psetchop, vecchop, joinset, unionset<,psetchop = Chop@ pointsetD;vecchop = Chop@transvectD;transset = TranslateSet@psetchop, transvectD;joinset = Join@psetchop, transsetD;H*Print@psetchopD;Print@transsetD;*Lunionset = Union@joinsetD;If@Length@joinsetD ≠ Length@unionsetD,Print@"translation produced " <>

ToString@Length@joinsetD - Length@unionsetDD <>" redundant objects"DD;

unionsetD

„ And a similarly for adding rotations incrementally.

setAddRotation@pointset_, angle_, LatticeMap_D :=Module@8rotset, rotmat, psetchop, joinset, unionset<,psetchop = Chop@ pointsetD;rotmat = RotationMatrix@angleD;

rotset = RotateSet@psetchop, angle, LatticeMapD;joinset = Chop@Join@psetchop, rotsetDD;unionset = Union@joinsetD;If@Length@joinsetD ≠ Length@unionsetD,Print@"rotation produced " <>

ToString@Length@joinsetD - Length@unionsetDD <>" redundant objects"DD;

unionsetD

PS3-2009-Solutions.nb 19

Page 20: P-Set 2 Solution Setpruffle.mit.edu/3.016-2009/Homeworks/PS2-2009-Solutions.pdf · 2009-11-02 · P-Set 2 Solution Set Solutions created by Melissa Diskin I2-1 (Handworked, 5 points)

„ And a similarly for adding mirrors incrementally.

setAddMirror@pointset_, line_, perpOffset_, LatticeMap_D :=Module@8refset, psetchop, joinset, unionset<,psetchop = Chop@ pointsetD;refset = MirrorSet@psetchop, line, perpOffset, LatticeMapD;joinset = Chop@Join@psetchop, refsetDD;unionset = Union@joinsetD;If@Length@joinsetD ≠ Length@unionsetD,Print@"reflection produced " <>

ToString@Length@joinsetD - Length@unionsetDD <>" redundant objects"DD;

unionsetD

„ And a similarly for adding glides incrementally.

setAddGlide@pointset_, vector_, mag_, perpOffset_, LatticeMap_D :=Module@8glideset, psetchop, joinset, unionset<,psetchop = Chop@pointsetD;glideset =GlideSet@psetchop, vector, mag, perpOffset, LatticeMapD;

joinset = Chop@Join@psetchop, glidesetDD;unionset = Union@joinsetD;If@Length@joinsetD ≠ Length@unionsetD,Print@"glide produced " <>

ToString@Length@joinsetD - Length@unionsetDD <>" redundant objects"DD;

unionsetD

ü The following functions use the previously defined rotations to create the 2-, 3-, 4-, and 6-fold rotation symmetries.

AddTwoFold@pointset_, LatticeMap_D :=setAddRotation@pointset, Pi, LatticeMapD

20 PS3-2009-Solutions.nb

Page 21: P-Set 2 Solution Setpruffle.mit.edu/3.016-2009/Homeworks/PS2-2009-Solutions.pdf · 2009-11-02 · P-Set 2 Solution Set Solutions created by Melissa Diskin I2-1 (Handworked, 5 points)

AddThreeFold@pointset_, LatticeMap_D :=Module@8psetchop, p1, p2, joinset, unionset<,psetchop = Chop@ pointsetD;p1 = RotateSet@psetchop, 2 Piê3, LatticeMapD;p2 = RotateSet@psetchop, 4 Piê3, LatticeMapD;joinset = Chop@Join@psetchop, p1, p2DD;unionset = Union@joinsetD;If@Length@joinsetD ≠ Length@unionsetD,Print@"p3 produced " <>

ToString@Length@joinsetD - Length@unionsetDD <>" redundant object vertices"DD;

unionsetD

AddFourFold@pointset_, LatticeMap_D :=Module@8psetchop, p1, p2, p3, joinset, unionset<,psetchop = Chop@ pointsetD;p1 = RotateSet@psetchop, Piê2, LatticeMapD;p2 = RotateSet@psetchop, Pi, LatticeMapD;p3 = RotateSet@psetchop, 3 Piê2, LatticeMapD;joinset = Chop@Join@psetchop, p1, p2, p3DD;unionset = Union@joinsetD;If@Length@joinsetD ≠ Length@unionsetD,Print@"p4 produced " <>

ToString@Length@joinsetD - Length@unionsetDD <>" redundant object vertices"DD;

unionsetD

AddSixFold@pointset_, LatticeMap_D :=Module@8psetchop, p1, p2, p3, p4, p5, joinset, unionset<,psetchop = Chop@ pointsetD;p1 = RotateSet@psetchop, Piê3, LatticeMapD;p2 = RotateSet@psetchop, 2 Piê3, LatticeMapD;p3 = RotateSet@psetchop, Pi, LatticeMapD;p4 = RotateSet@psetchop, 4 Piê3, LatticeMapD;p5 = RotateSet@psetchop, 5 Piê3, LatticeMapD;joinset = Chop@Join@psetchop, p1, p2, p3, p4, p5DD;unionset = Union@joinsetD;If@Length@joinsetD ≠ Length@unionsetD,Print@"p6 produced " <>

ToString@Length@joinsetD - Length@unionsetDD <>" redundant object vertices"DD;

unionsetD

Graphics functions

PS3-2009-Solutions.nb 21

Page 22: P-Set 2 Solution Setpruffle.mit.edu/3.016-2009/Homeworks/PS2-2009-Solutions.pdf · 2009-11-02 · P-Set 2 Solution Set Solutions created by Melissa Diskin I2-1 (Handworked, 5 points)

Graphics functions„ This is a somewhat inelegant. A graphics object representing the "grid" on which the plane-groups be drawn is defined by

hand. It would be more clever to write functions for "mirror" "glide" objects, and "n-fold" graphics objects.

grid@12D = Graphics@ GraphicsComplex@880, 0<, 8.5, 0<, 81, 0<, 81, .5<, 81, 1<, 8.5, 1<, 80, 1<, 80, .5<<,88Thick, Dashed, Line@81, 5<D, Line@83, 7<D<,8Thick, Line@82, 4<D, Line@84, 6<D, Line@86, 8<D, Line@88, 2<D<,8Thin, Line@81, 3<D, Line@83, 5<D, Line@85, 7<D, Line@87, 1<D<,8Line@881, 3<, 83, 5<, 85, 7<, 87, 1<<D,Line@82, 6<D, Line@84, 8<D<<DD

„ The takes the points and draws all the objects using the previously defined "GraphicsAssymetricObject" in a list created by table. The second argument is the "background grid"

SetGraphics@pointset_, grid_D :=Show@Graphics@Table@

GraphicsAssymetricObject@pointset@@iDDD,8i, 1, Length@pointsetD<D,

ImageSize Ø Medium, Axes Ø True, AxesOrigin Ø 80, 0<D,gridD

22 PS3-2009-Solutions.nb

Page 23: P-Set 2 Solution Setpruffle.mit.edu/3.016-2009/Homeworks/PS2-2009-Solutions.pdf · 2009-11-02 · P-Set 2 Solution Set Solutions created by Melissa Diskin I2-1 (Handworked, 5 points)

Example of "building p4 g m" (#12)

The asymmetric object:

SetGraphics@genPoints, grid@12DD

0.2 0.4 0.6 0.8 1.0

0.2

0.4

0.6

0.8

1.0

PS3-2009-Solutions.nb 23

Page 24: P-Set 2 Solution Setpruffle.mit.edu/3.016-2009/Homeworks/PS2-2009-Solutions.pdf · 2009-11-02 · P-Set 2 Solution Set Solutions created by Melissa Diskin I2-1 (Handworked, 5 points)

Add a mirror

SetGraphics@setAddMirror@genPoints, 81, -1<, Sqrt@2Dê8, SquareLatticeModD,grid@12D

D

0.2 0.4 0.6 0.8 1.0

0.2

0.4

0.6

0.8

1.0

24 PS3-2009-Solutions.nb

Page 25: P-Set 2 Solution Setpruffle.mit.edu/3.016-2009/Homeworks/PS2-2009-Solutions.pdf · 2009-11-02 · P-Set 2 Solution Set Solutions created by Melissa Diskin I2-1 (Handworked, 5 points)

Add a glide

SetGraphics@setAddGlide@setAddMirror@genPoints, 81, -1<, Sqrt@2Dê8, SquareLatticeModD, 81, 1<, Sqrt@2Dê2, 0, SquareLatticeMod

D, grid@12DD

0.2 0.4 0.6 0.8 1.0

0.2

0.4

0.6

0.8

1.0

PS3-2009-Solutions.nb 25

Page 26: P-Set 2 Solution Setpruffle.mit.edu/3.016-2009/Homeworks/PS2-2009-Solutions.pdf · 2009-11-02 · P-Set 2 Solution Set Solutions created by Melissa Diskin I2-1 (Handworked, 5 points)

Add a p4, this reproduces the image in TSOM plane group #12

ü The result is assigned to a symbol because it will be used below.

pg@12D = SetGraphics@AddFourFold@setAddGlide@setAddMirror@genPoints, 81, -1<, Sqrt@2Dê8, SquareLatticeModD, 81, 1<, Sqrt@2Dê2, 0, SquareLatticeMod

D, SquareLatticeModD, grid@12D

D

0.2 0.4 0.6 0.8 1.0

0.2

0.4

0.6

0.8

1.0

26 PS3-2009-Solutions.nb

Page 27: P-Set 2 Solution Setpruffle.mit.edu/3.016-2009/Homeworks/PS2-2009-Solutions.pdf · 2009-11-02 · P-Set 2 Solution Set Solutions created by Melissa Diskin I2-1 (Handworked, 5 points)

Example of "building p3 1 m" (#15)grid@15D = Graphics@ GraphicsComplex@880, 0<, 81ê2, 0<,

81, 0<, 81 + 1ê4, Sin@Piê3Dê2<, 81 + 1ê2, Sin@Piê3D<,81, Sin@Piê3D<, 81ê2, Sin@Piê3D<, 81ê4, Sin@Piê3Dê2<<,

88Thick, Line@81, 3<D, Line@83, 5<D, Line@85, 7<D, Line@87, 1<D<,8Thin, Line@83, 7<D<,8Thick, Dashed, Line@82, 6, 4, 8, 2<D<

<D

D

ü Need to move the asymmetric object into the hexagonal primitive domain

hexgenPoints = TranslateSet@genPoints, 80.1, -0.15<D

8880.2, 0.1<, 80.138763, 0.135355<, 80.164645, 0.0387628<,80.212941, 0.0517037<, 80.261237, 0.0646447<, 80.235355, 0.161237<<<

PS3-2009-Solutions.nb 27

Page 28: P-Set 2 Solution Setpruffle.mit.edu/3.016-2009/Homeworks/PS2-2009-Solutions.pdf · 2009-11-02 · P-Set 2 Solution Set Solutions created by Melissa Diskin I2-1 (Handworked, 5 points)

The asymmetric object:

SetGraphics@hexgenPoints, grid@15DD

0.2 0.4 0.6 0.8 1.0 1.2 1.4

0.2

0.4

0.6

0.8

Add a mirror

SetGraphics@setAddMirror@hexgenPoints, 81, 0<, 0, HexLatticeModD,grid@15D

D

0.2 0.4 0.6 0.8 1.0 1.2 1.4

0.2

0.4

0.6

0.8

28 PS3-2009-Solutions.nb

Page 29: P-Set 2 Solution Setpruffle.mit.edu/3.016-2009/Homeworks/PS2-2009-Solutions.pdf · 2009-11-02 · P-Set 2 Solution Set Solutions created by Melissa Diskin I2-1 (Handworked, 5 points)

Add a three fold to generate p3 1 m (#15)

pg@15D = SetGraphics@AddThreeFold@setAddMirror@hexgenPoints, 81, 0<, 0, HexLatticeModD,HexLatticeMod

D,grid@15D

D

0.2 0.4 0.6 0.8 1.0 1.2 1.4

0.2

0.4

0.6

0.8

ü Here, creating a lattice by adding the lattice translation vectors is explored just for fun.

pg15 = AddThreeFold@setAddMirror@hexgenPoints, 81, 0<, 0, HexLatticeModD,HexLatticeMod

D;

„ The lattice translations.

hvectx = 81, 0<;hvecty = 81ê2, Sqrt@3Dê2<;

„ A set of indices representing some of the points in the lattice.

siteindices = Tuples@80, 1, 2, 3<, 2D

880, 0<, 80, 1<, 80, 2<, 80, 3<, 81, 0<, 81, 1<, 81, 2<,81, 3<, 82, 0<, 82, 1<, 82, 2<, 82, 3<, 83, 0<, 83, 1<, 83, 2<, 83, 3<<

ü Using table, the lattice translations, and the indices to make a list of "lattice" points.

PS3-2009-Solutions.nb 29

Page 30: P-Set 2 Solution Setpruffle.mit.edu/3.016-2009/Homeworks/PS2-2009-Solutions.pdf · 2009-11-02 · P-Set 2 Solution Set Solutions created by Melissa Diskin I2-1 (Handworked, 5 points)

ü

Using table, the lattice translations, and the indices to make a list of "lattice" points.

hcoords =Table@siteindices@@i, 1DD hvectx + siteindices@@i, 2DD hvecty,8i, Length@siteindicesD<D

:80, 0<, :1

2,

3

2>, :1, 3 >, :

3

2,3 3

2>, 81, 0<, :

3

2,

3

2>, :2, 3 >, :

5

2,3 3

2>,

82, 0<, :5

2,

3

2>, :3, 3 >, :

7

2,3 3

2>, 83, 0<, :

7

2,

3

2>, :4, 3 >, :

9

2,3 3

2>>

ü An example with four unit cells

SetGraphics@Join@pg15, TranslateSet@pg15, 81.5, Sqrt@3Dê2<D,TranslateSet@pg15, 8.5, Sqrt@3Dê2<D,TranslateSet@pg15, 81, 0<DD, grid@15DD

0.5 1.0 1.5 2.0 2.5

0.5

1.0

1.5

„ An example with all the indices defined above. The generated list had to be "Flattened" into a single list of points, where a point is a list of length 2.

all = Flatten@Table@TranslateSet@pg15, hcoords@@iDDD, 8i, 1, Length@hcoordsD<D, 1D;

30 PS3-2009-Solutions.nb

Page 31: P-Set 2 Solution Setpruffle.mit.edu/3.016-2009/Homeworks/PS2-2009-Solutions.pdf · 2009-11-02 · P-Set 2 Solution Set Solutions created by Melissa Diskin I2-1 (Handworked, 5 points)

SetGraphics@all, grid@15DD

1 2 3 4 5 6

0.5

1.0

1.5

2.0

2.5

3.0

3.5

Building the remaining point groups:

Defining a map from cartesian to oblique and back...

#1 p1

0.2 0.4 0.6 0.8 1.0 1.2

0.20.40.60.81.01.2

#2 p2

0.2 0.4 0.6 0.8 1.0 1.2

0.2

0.4

0.6

0.8

1.0

1.2

#3 pm

0.5 1.0 1.5

0.20.40.60.81.0

#4 pm

0.5 1.0 1.5

0.20.40.60.81.0

#5 cm

0.5 1.0 1.5

0.20.40.60.81.0

PS3-2009-Solutions.nb 31

Page 32: P-Set 2 Solution Setpruffle.mit.edu/3.016-2009/Homeworks/PS2-2009-Solutions.pdf · 2009-11-02 · P-Set 2 Solution Set Solutions created by Melissa Diskin I2-1 (Handworked, 5 points)

#5 cm

0.5 1.0 1.5

0.20.40.60.81.0

#6 p2mm

0.5 1.0 1.5

0.20.40.60.81.0

#7 p2mg

0.5 1.0 1.5

0.20.40.60.81.0

#8 p2gg0.5 1.0 1.5

0.20.40.60.81.0

32 PS3-2009-Solutions.nb

Page 33: P-Set 2 Solution Setpruffle.mit.edu/3.016-2009/Homeworks/PS2-2009-Solutions.pdf · 2009-11-02 · P-Set 2 Solution Set Solutions created by Melissa Diskin I2-1 (Handworked, 5 points)

#9 c2mm

0.5 1.0 1.5

0.20.40.60.81.0

grid@9D =Graphics@ GraphicsComplex@Map@HcartToRect.Ò &L, 880, 0<, 8.5, 0<,

81, 0<, 81, .5<, 81, 1<, 8.5, 1<, 80, 1<, 80, .5<,81, .25<, H*9*L81, .75<, H*10*L80, .75<, H*11*L80, .25<, H*12*L8.25, 0<, H*13*L8.75, 0<, H*14*L8.75, 1<, H*15*L8.25, 1< H*16*L

<D,88Thick, Dashed, Line@8812, 9<, 810, 11<, 813, 16<, 814, 15<<D<,8Thick, Line@881, 3<, 84, 8<, 85, 7<, 82, 6<, 87, 1<, 83, 5<<D<

<D

D

PS3-2009-Solutions.nb 33

Page 34: P-Set 2 Solution Setpruffle.mit.edu/3.016-2009/Homeworks/PS2-2009-Solutions.pdf · 2009-11-02 · P-Set 2 Solution Set Solutions created by Melissa Diskin I2-1 (Handworked, 5 points)

pg@9D = SetGraphics@setAddMirror@AddTwoFold@setAddGlide@rectGenPoints, 81, 0<, .25, .75, RectLatticeModD,RectLatticeModD,

80, 1<, 0,RectLatticeModD,

grid@9DD

0.5 1.0 1.5

0.2

0.4

0.6

0.8

1.0

#10 p4

0.2 0.4 0.6 0.8 1.0

0.2

0.4

0.6

0.8

1.0

#11 p4mm

0.2 0.4 0.6 0.8 1.0

0.20.40.60.81.0

34 PS3-2009-Solutions.nb

Page 35: P-Set 2 Solution Setpruffle.mit.edu/3.016-2009/Homeworks/PS2-2009-Solutions.pdf · 2009-11-02 · P-Set 2 Solution Set Solutions created by Melissa Diskin I2-1 (Handworked, 5 points)

#12 p4gm

0.2 0.4 0.6 0.8 1.0

0.20.40.60.81.0

(worked out above)

#13 p3 0.20.40.60.81.01.21.4

0.20.40.60.8

„ The background grid. (I am going to use Map and a transform here. The methods defined above should work as well.

ü As for hexgenPoints, need to move the asymmetric object into the oblique primitive domain

pg@13D = SetGraphics@AddThreeFold@hexgenPoints, HexLatticeModD,grid@13DD

0.2 0.4 0.6 0.8 1.0 1.2 1.4

0.2

0.4

0.6

0.8

PS3-2009-Solutions.nb 35

Page 36: P-Set 2 Solution Setpruffle.mit.edu/3.016-2009/Homeworks/PS2-2009-Solutions.pdf · 2009-11-02 · P-Set 2 Solution Set Solutions created by Melissa Diskin I2-1 (Handworked, 5 points)

#14 p3m1 0.2 0.4 0.6 0.8 1.0 1.2 1.4

0.20.40.60.8

„ The background grid. (I am going to use Map and a transform here. The methods defined above should work as well.

grid@14D = Graphics@GraphicsComplex@Map@HcartToHex.Ò &L,880, 0<, 8.5, 0<, 81, 0<,81, .5<, 81, 1<, 8.5, 1<, 80, 1<, 80, .5<,8.25, 0<, H*9*L8.75, 0<, H*10*L81, .25<, H*11*L81, .75<, H*12*L8.25, 1<, H*13*L8.75, 1<, H*14*L80, .25<, H*15*L80, .75<H*16*L

<D,8Line@881, 3, 5, 7, 1<, 83, 7<<D,8Thick, Line@881, 5<, 83, 6<, 82, 7<, 83, 8<, 84, 7<<D<,8Thick, Dashed, Line@882, 4<, 84, 14<,

812, 6<, 86, 8<, 88, 9<, 815, 2<, 810, 13<, 811, 16<<D<<

DD

36 PS3-2009-Solutions.nb

Page 37: P-Set 2 Solution Setpruffle.mit.edu/3.016-2009/Homeworks/PS2-2009-Solutions.pdf · 2009-11-02 · P-Set 2 Solution Set Solutions created by Melissa Diskin I2-1 (Handworked, 5 points)

ü Need to move the points a little so as not to overlap

hexgenPointsAlt = TranslateSet@genPoints, 8.2, -0.175<D

8880.3, 0.075<, 80.238763, 0.110355<, 80.264645, 0.0137628<,80.312941, 0.0267037<, 80.361237, 0.0396447<, 80.335355, 0.136237<<<

pg@14D = SetGraphics@AddThreeFold@setAddMirror@hexgenPointsAlt, cartToHex.81, 1<, 0, HexLatticeModD,

HexLatticeModD,grid@14DD

0.2 0.4 0.6 0.8 1.0 1.2 1.4

0.2

0.4

0.6

0.8

PS3-2009-Solutions.nb 37

Page 38: P-Set 2 Solution Setpruffle.mit.edu/3.016-2009/Homeworks/PS2-2009-Solutions.pdf · 2009-11-02 · P-Set 2 Solution Set Solutions created by Melissa Diskin I2-1 (Handworked, 5 points)

#15 p31m 0.20.40.60.81.01.21.4

0.20.40.60.8

(worked out above)

#16 p6 0.2 0.4 0.6 0.8 1.0 1.2 1.4

0.20.40.60.8

grid@16D = grid@13D

ü Need to move the points a little so as not to overlap

pg@16D = SetGraphics@AddSixFold@hexgenPointsAlt, HexLatticeModD,

grid@16DD

0.2 0.4 0.6 0.8 1.0 1.2 1.4

0.2

0.4

0.6

0.8

#17 p6mm

0.2 0.4 0.6 0.8 1.0 1.2 1.4

0.20.40.60.8

38 PS3-2009-Solutions.nb

Page 39: P-Set 2 Solution Setpruffle.mit.edu/3.016-2009/Homeworks/PS2-2009-Solutions.pdf · 2009-11-02 · P-Set 2 Solution Set Solutions created by Melissa Diskin I2-1 (Handworked, 5 points)

#17 p6mm

0.2 0.4 0.6 0.8 1.0 1.2 1.4

0.20.40.60.8

„ The background grid. (I am going to use Map and a transform here. The methods defined above should work as well.

grid@17D = Graphics@GraphicsComplex@Map@HcartToHex.Ò &L,880, 0<, 8.5, 0<, 81, 0<,81, .5<, 81, 1<, 8.5, 1<, 80, 1<, 80, .5<,8.25, 0<, H*9*L8.75, 0<, H*10*L81, .25<, H*11*L81, .75<, H*12*L8.25, 1<, H*13*L8.75, 1<, H*14*L80, .25<, H*15*L80, .75<H*16*L

<D,8Line@881, 3, 5, 7, 1<, 83, 7<<D,8Thick, Line@881, 5<, 82, 7<, 83, 6<, 83, 8<, 84, 7<<D<,8Thick, Dashed, Line@8811, 16<, 810, 13<, 88, 9<, 86, 8<, 84, 14<,

82, 4<, 815, 2<, 812, 6<, 82, 6<, 84, 8<, 84, 6<, 88, 2<<D<<

DD

ü Need to move the points a little so as not to overlap

PS3-2009-Solutions.nb 39

Page 40: P-Set 2 Solution Setpruffle.mit.edu/3.016-2009/Homeworks/PS2-2009-Solutions.pdf · 2009-11-02 · P-Set 2 Solution Set Solutions created by Melissa Diskin I2-1 (Handworked, 5 points)

ü

Need to move the points a little so as not to overlap

hexgenPointsAlt = TranslateSet@genPoints, 8.2, -0.175<D

8880.3, 0.075<, 80.238763, 0.110355<, 80.264645, 0.0137628<,80.312941, 0.0267037<, 80.361237, 0.0396447<, 80.335355, 0.136237<<<

pg@17D = SetGraphics@AddSixFold@setAddMirror@hexgenPointsAlt,cartToHex.81, 1<, 0, HexLatticeModD,

HexLatticeModD,grid@17DD

0.2 0.4 0.6 0.8 1.0 1.2 1.4

0.2

0.4

0.6

0.8

40 PS3-2009-Solutions.nb

Page 41: P-Set 2 Solution Setpruffle.mit.edu/3.016-2009/Homeworks/PS2-2009-Solutions.pdf · 2009-11-02 · P-Set 2 Solution Set Solutions created by Melissa Diskin I2-1 (Handworked, 5 points)

Manipulate@pg@PlaneGroupD,88PlaneGroup, 1<,81 Ø "Ò1 p1 Oblique",2 Ø "Ò2 p2 Oblique" ,3 Ø "Ò3 pm Rectangular",4 Ø "Ò4 pg Rectangular" ,5 Ø "Ò5 cm Rectangular",6 Ø "Ò6 p2mm Rectangular" ,7 Ø "Ò7 p2mg Rectangular",8 Ø "Ò8 p2gg Rectangular" ,9 Ø "Ò9 c2mm Rectangular" ,10 Ø "Ò10 p4 Square" ,11 Ø "Ò11 p4mm Square" ,12 Ø "Ò11 p4gm Square" ,13 Ø "Ò13 p3 Hexagonal" ,14 Ø "Ò14 p3m1 Hexagonal" ,15 Ø "Ò15 p31m Hexagonal" ,16 Ø "Ò16 p6 Hexagonal" ,17 Ø "Ò17 p6mm Hexagonal"

<, ControlType Ø PopupMenu<,SaveDefinitions Ø TrueD

PlaneGroup Ò14 p3m1 Hexagonal

0.2 0.4 0.6 0.8 1.0 1.2 1.4

0.2

0.4

0.6

0.8

PS3-2009-Solutions.nb 41

Page 42: P-Set 2 Solution Setpruffle.mit.edu/3.016-2009/Homeworks/PS2-2009-Solutions.pdf · 2009-11-02 · P-Set 2 Solution Set Solutions created by Melissa Diskin I2-1 (Handworked, 5 points)

ü Final Graphical Result

„ Final compact graphical output

PlaneGroup Ò14 p3m1 Hexagonal

0.2 0.4 0.6 0.8 1.0 1.2 1.4

0.2

0.4

0.6

0.8

Group Problem G2-2

Start by creating some code to produce a radial distribution function from a set of given points

ü Function to compute number in each annuli from a chosen origin, out to a given distance. This is not normalized by the total density. This is normalized by the particle radius--which is the natural dimension for normalization.

rdf@pointList_, radii_, bins_, origin_, rMax_D :=Module@8distances, dr, areas, counts<,dr = rMaxêbins;distances =Table@Norm@pointList@@iDD - originD, 8i, 1, Length@pointListD<D;

areas = Table@2 Pi Hi drL dr, 8i, 1, bins<D;counts = BinCounts@distances, 80, rMax, dr<D;Table@8i drêradii, counts@@iDDêareas@@iDD<,8i, 1, Length@countsD<D

D

ü For example:

42 PS3-2009-Solutions.nb

Page 43: P-Set 2 Solution Setpruffle.mit.edu/3.016-2009/Homeworks/PS2-2009-Solutions.pdf · 2009-11-02 · P-Set 2 Solution Set Solutions created by Melissa Diskin I2-1 (Handworked, 5 points)

ü

For example:

ListLinePlot@rdf@RandomReal@8-10, 10<, 8100 000, 2<D,1, 400, 80, 0<, 10D, PlotRange Ø AllD

2 4 6 8 10

100

200

300

400

G-2-1

„ First create a square lattice of points:

squarelattice =Flatten@ Table@i 81, 0< + j 80, 1<, 8i, -20, 20<, 8j, -20, 20<D, 1D;

Short@squarelatticeD

88-20, -20<, 8-20, -19<, 8-20, -18<, 8-20, -17<, 8-20, -16<, 8-20, -15<, 8-20, -14<,á1667à, 820, 14<, 820, 15<, 820, 16<, 820, 17<, 820, 18<, 820, 19<, 820, 20<<

Using the origin: (there is a large peak at origin due to the "atom" sitting there). We use the hard packing radius as a measure ofparticle size.

GraphicsRow@8lp = ListLinePlot@rdf@squarelattice, 1ê2, 500, 80, 0<, 20D,

PlotRange Ø AllD, Show@lp, PlotRange Ø 880, 10<, All<D,Show@lp, PlotRange Ø 880, 10<, 80, 20<<D<,

ImageSize Ø FullD

10 20 30 40

20406080100

2 4 6 8 10020406080100

0 2 4 6 8 1005101520

G-2-2

PS3-2009-Solutions.nb 43

Page 44: P-Set 2 Solution Setpruffle.mit.edu/3.016-2009/Homeworks/PS2-2009-Solutions.pdf · 2009-11-02 · P-Set 2 Solution Set Solutions created by Melissa Diskin I2-1 (Handworked, 5 points)

G-2-2

Using the (1/2,1/2) : (this is more representative, the apparent curves are due to the "integer counts" in each bin)

GraphicsRow@8lp = ListLinePlot@rdf@squarelattice, 1ê2, 500, 0.5 81, 1<, 20D,

PlotRange Ø AllD, Show@lp, PlotRange Ø 880, 10<, All<D,Show@lp, PlotRange Ø 880, 10<, 80, 20<<D<,

ImageSize Ø FullD

10 20 30 40

5101520

2 4 6 8 1005101520

0 2 4 6 8 1005101520

G-2-(3&4)

ü We can reuse the transformation from G2-1, here we divide by the determinate to ensure that the areas are comparable.

cartToHex = ::1,1

2>, :0,

3

2>>ì H2êSqrt@3DL;

hexagonallattice = [email protected]@@iDD, 8i, 1, Length@squarelatticeD<D;

ListPlot@hexagonallatticeD

-20 -10 10 20

-15

-10

-5

5

10

15

„ In this case, the distributions appear to be quite different depending on the origin. I believe it would make sense to pick many origins a random and compute an rdf to simulate what might be measured in an experiment.

44 PS3-2009-Solutions.nb

Page 45: P-Set 2 Solution Setpruffle.mit.edu/3.016-2009/Homeworks/PS2-2009-Solutions.pdf · 2009-11-02 · P-Set 2 Solution Set Solutions created by Melissa Diskin I2-1 (Handworked, 5 points)

In this case, the distributions appear to be quite different depending on the origin. I believe it would make sense to pick many origins a random and compute an rdf to simulate what might be measured in an experiment.

GraphicsGrid@88lp = ListLinePlot@rdf@hexagonallattice,

Sqrt@3Dê4, 500, 81, 1<, 15D, PlotStyle Ø 8 Blue, Thick<,PlotLabel Ø "Hexagonal at H1,1L", PlotRange Ø AllD,

Show@lp, PlotRange Ø 880, 10<, All<D,Show@lp, PlotRange Ø 880, 10<, 80, 20<<D<,

8lp = ListLinePlot@rdf@hexagonallattice,Sqrt@3Dê4, 500, .1 81, 1<, 15D, PlotStyle Ø 8 Red, Thick<,

PlotLabel Ø "Hexagonal at H.1,.1L", PlotRange Ø AllD,Show@lp, PlotRange Ø 880, 10<, All<D,Show@lp, PlotRange Ø 880, 10<, 80, 20<<D<<,

ImageSize Ø FullD

5 1015202530352468101214Hexagonal at H1,1L

2 4 6 8 10024681012Hexagonal at H1,1L

0 2 4 6 8 1005101520Hexagonal at H1,1L

5 1015202530355101520253035Hexagonal at H.1,.1L

2 4 6 8 1005101520253035Hexagonal at H.1,.1L

0 2 4 6 8 1005101520Hexagonal at H.1,.1L

PS3-2009-Solutions.nb 45

Page 46: P-Set 2 Solution Setpruffle.mit.edu/3.016-2009/Homeworks/PS2-2009-Solutions.pdf · 2009-11-02 · P-Set 2 Solution Set Solutions created by Melissa Diskin I2-1 (Handworked, 5 points)

G-2-5

„ First, consider random placement for any three disks, the probability that a disk can fit between them is quite low as the mean distance between the disks approaches a small number.

In the algorithm that is described, the atoms are moved individually towards "empty space" and always leave a small gap between it and the nearest neighbor, the atoms expand until the specified density is achieved. As the distances between the neighbors becomes very small, the amount of available empty space limits the motion and thus the gaps. This reduction in gap size reduces the incremental expansion of each of the disks.

G-2-6

„ This is a repeat from last year; here are the results:

46 PS3-2009-Solutions.nb

Page 47: P-Set 2 Solution Setpruffle.mit.edu/3.016-2009/Homeworks/PS2-2009-Solutions.pdf · 2009-11-02 · P-Set 2 Solution Set Solutions created by Melissa Diskin I2-1 (Handworked, 5 points)

This is a repeat from last year; here are the results:

ü Compare the last one to an rdf for the hexagonal lattice above normalized to "roughly" the same sample size. The peaks in the high density amorphous plot begin to converge onto that of a charactistic crystal lattice---this might indicate the onset of six-fold nearest neighbors....

G-2-7

The code linked from the problem set works the following way. It takes a number of points and assigns a diameter to them. The points initially sit near the origin; so it is likely that many will overlap. The function picks a point at random and then "pushes" itself a short distance, but away from all overlapping disk centers. This creates more overlaps, but the outer disks tend to expand a bit. This process is to be repeated until there are no overlaps.

It turns out that this code has a flaw. When any particle sits at the centroid of overlapping neighbors, it won't move. This will have the effect of evolving to a fixed point that has one or more overlaps.

Here, I have rewritten the code to generate an amorphous structure using an algorithm with a similar "pushing" idea.

„ The following is a function that takes a list of points in two-dimensions (pnts) and makes one move to eliminate the overlaps (i.e., create a point-to-point separation of at least diam) from a chosen point (choice).The algorithm operates by

1) Computing the displacements of the chosen point from all others (disps).

2) Using disps, Finds any other disk of diam that overlaps . This method works the the following way: it strings together a bunch of"ands". The and returns false at the first occurence of a false statement, thus it makes sense to put those which are less expensiveto compute. It checks first to see if the comparisons are valid, and then eliminates all but the strip -diam < x < diam, then a similarstrip in the y-direction; finally it computes the euclidian distance and eliminates all points within a radius of length diam. This lastcomputation is the most expensive and so it is performed on as few points as possible.

3) Each overlapping particle is pushed away at least a distance diam (with a little randomness built-in). Those disks are likely tooverlap their neighbors, and so this algorithmm is repeated until all overlaps disappear. The algorithm is visualized below.

PS3-2009-Solutions.nb 47

Page 48: P-Set 2 Solution Setpruffle.mit.edu/3.016-2009/Homeworks/PS2-2009-Solutions.pdf · 2009-11-02 · P-Set 2 Solution Set Solutions created by Melissa Diskin I2-1 (Handworked, 5 points)

1) Computing the displacements of the chosen point from all others (disps).

2) Using disps, Finds any other disk of diam that overlaps . This method works the the following way: it strings together a bunch of"ands". The and returns false at the first occurence of a false statement, thus it makes sense to put those which are less expensiveto compute. It checks first to see if the comparisons are valid, and then eliminates all but the strip -diam < x < diam, then a similarstrip in the y-direction; finally it computes the euclidian distance and eliminates all points within a radius of length diam. This lastcomputation is the most expensive and so it is performed on as few points as possible.

3) Each overlapping particle is pushed away at least a distance diam (with a little randomness built-in). Those disks are likely tooverlap their neighbors, and so this algorithmm is repeated until all overlaps disappear. The algorithm is visualized below.

decompress@pts_, diam_, choice_D :=H*find an atom and push away its neighbors*LModule@8cpt, numpts, intersecting, disps, tmpPts<,numpts = Length@ptsD;cpt = pts@@choiceDD;H*Print@choiceD;*Ldisps = Map@ HÒ - cptL &, ptsD;intersecting = Position@disps,

a_ ê; HLength@aD ã 2 && Abs@a@@1DDD § diam &&Abs@a@@2DDD § diam && Norm@aD § diamLD;

intersecting = DeleteCases@intersecting, 8choice<D;

If@Length@intersectingD ã 0, Return@ptsDD;H*Print@intersectingD;*LtmpPts = pts;Table@H*Print@

8i,tmpPts@@iDD, cpt + diam disps@@iDDêNorm@disps@@iDDD<D;*LtmpPts@@iDD = cpt + diam [email protected], 1.0001<, 82<D

disps@@iDDêNorm@disps@@iDDD,8i, Flatten@intersectingD<D;

tmpPtsD

„ This is the same algorithm as above, except a point is selected at random and passed as "choice" to the function above.

decompress@pts_, diam_D :=decompress@pts, diam, RandomChoice@Range@Length@ptsDDDD

48 PS3-2009-Solutions.nb

Page 49: P-Set 2 Solution Setpruffle.mit.edu/3.016-2009/Homeworks/PS2-2009-Solutions.pdf · 2009-11-02 · P-Set 2 Solution Set Solutions created by Melissa Diskin I2-1 (Handworked, 5 points)

„ This function displays the current state of all the points (data) as disks. Disccolors is a list of colors---if these are fixed then the evolution of the algorithm is easy to visualize. Additionally, text is drawn so that each particle in the list can be located by its position in data.

gob@data_, diam_, disccolors_D := Graphics@GraphicsComplex@data, Table@8disccolors@@iDD, Disk@i, diam ê2D,

8Black, Text@ToString@iD, iD<<, 8i, Length@dataD<DD,Axes Ø True, ImageSize Ø Large, PlotRange Ø 4 88-1, 1<, 8-1, 1<<,PlotLabel ß "overlaps by " <> ToString@minOverlap@data, diamDDD

H*draw a picture---here the code is modifiedto compute the amount of overlap*L

„ Compute the minium overlap. When this quantitiy goes to

minOverlap@data_, diam_D :=Module@8nf, nearestNeighbor, neighbordists<,nf = Nearest@dataD;nearestNeighbor =Table@Last@nf@data@@iDD, 2DD, 8i, 1, Length@dataD<D;

neighbordists = Min@Table@Norm@nearestNeighbor@@iDD - data@@iDDD -diam, 8i, 1, Length@dataD<DD

D

„ Start with a highly overlapping set of 400 disks and set their colors

randomdata = [email protected], .1<, 8400, 2<D;diskColors = Table@Hue@RandomReal@DD, 8Length@randomdataD<D;

„ The graphical output is wrapped inside Dynamic so that the graphic updates whenever the "randomdata" is updated.

Dynamic@gob@randomdata, .2, diskColorsDD

gob@randomdata, 0.2, diskColorsD

„ Here is how it works by running once. Here a single particle is picked randomly and its neighbors are pushed away

randomdata = decompress@randomdata, .2D;

„ Here, the algorithm is run a bunch of times. It does 100 iterations (in Nest) before updating the graphic, and then it does this 1000 times. Running this twice is about enough to get a good data set to work with.

Do@randomdata = Nest@decompress@Ò, .2D &, randomdata, 100D,8i, 1, 1000<D;

PS3-2009-Solutions.nb 49

Page 50: P-Set 2 Solution Setpruffle.mit.edu/3.016-2009/Homeworks/PS2-2009-Solutions.pdf · 2009-11-02 · P-Set 2 Solution Set Solutions created by Melissa Diskin I2-1 (Handworked, 5 points)

„ Pick a radius for which we are going to compute the rdf, in effect the edge effects are being trimmed off.

estimatedRadius = 1.9H*adjust this visually with following graphic,to remove any edge effects*L

1.9

50 PS3-2009-Solutions.nb

Page 51: P-Set 2 Solution Setpruffle.mit.edu/3.016-2009/Homeworks/PS2-2009-Solutions.pdf · 2009-11-02 · P-Set 2 Solution Set Solutions created by Melissa Diskin I2-1 (Handworked, 5 points)

„ Visualize the data set that will be used with the "cut-off" circle.

Show@gob@randomdata, .2, diskColorsD, Graphics@8Thick, Circle@Mean@randomdataD, estimatedRadiusD<D, Axes Ø TrueD

1

2

3

4

5

6 7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

3132

33

34

35

36

37

38

39

404142

43

44

45

46

47

48

49

50

51

52

53

54

55

56

57

58

59

6061

62

63

64

65

66

67

68

69

70

71

72

73

74

75

76

77

78

79

8081

82

83

8485

86

87

88

89

90

9192

93

94

95

96

97 98

99

100

101

102

103

104

105

106

107

108

109

110

111

112

113

114

115

116

117

118

119

120

121

122

123

124

125

126127

128

129

130

131

132

133

134

135

136

137

138

139

140141 142

143

144

145

146

147

148

149

150

151

152

153

154

155

156

157

158

159160

161

162

163

164

165

166

167

168

169

170

171

172

173174

175

176

177

178

179

180

181

182

183

184

185

186

187

188

189

190

191

192

193

194195

196

197

198

199

200

201

202

203

204

205

206

207

208

209

210

211

212

213

214

215

216 217

218

219

220

221

222

223

224

225

226

227 228

229

230

231232

233

234

235

236

237

238

239

240241

242

243

244

245

246

247248

249

250

251

252

253

254

255

256

257

258259

260

261

262

263

264

265

266

267

268

269

270

271 272

273

274

275

276

277

278

279280

281

282

283

284

285

286

287288

289

290

291292

293

294

295

296

297

298

299

300301

302

303

304

305

306

307

308

309

310

311

312

313

314

315

316

317

318

319

320

321

322

323

324

325

326

327

328

329330

331

332

333

334

335

336

337338

339

340

341

342

343

344345

346

347

348 349

350

351

352

353

354

355

356

357

358

359

360

361

362

363

364

365

366

367368

369 370

371

372

373374375

376

377

378

379

380

381

382383

384

385

386

387

388

389

390

391

392

393

394

395

396

397398

399

400

-4 -2 2

-4

-2

2

4

overlaps by -95.6611 10

centerofMass = Mean@randomdataD

80.00137753, 0.0332047<

ü These are the "atoms" inside the cut-off circle that will be used in the rdf below.

PS3-2009-Solutions.nb 51

Page 52: P-Set 2 Solution Setpruffle.mit.edu/3.016-2009/Homeworks/PS2-2009-Solutions.pdf · 2009-11-02 · P-Set 2 Solution Set Solutions created by Melissa Diskin I2-1 (Handworked, 5 points)

ü

These are the "atoms" inside the cut-off circle that will be used in the rdf below.

reducedDiskSetPositions =Cases@randomdata, a_ ê; Norm@a - centerofMassD § estimatedRadiusD

Length@reducedDiskSetPositionsD

291

reducedDiskSetIndices = Position@randomdata,a_ ê; Norm@a - centerofMassD § estimatedRadius, 1D

reducedDiskSetColors = Extract@diskColors, reducedDiskSetIndicesD;

52 PS3-2009-Solutions.nb

Page 53: P-Set 2 Solution Setpruffle.mit.edu/3.016-2009/Homeworks/PS2-2009-Solutions.pdf · 2009-11-02 · P-Set 2 Solution Set Solutions created by Melissa Diskin I2-1 (Handworked, 5 points)

Show@gob@reducedDiskSetPositions, .2, reducedDiskSetColorsD,Graphics@8Thick, Circle@Mean@randomdataD, estimatedRadiusD<D,Axes Ø TrueD

1

2

3

4

5

67

8

9

10

11

12

13

14

15

16

17

18

19

20

2122

23

24

25

26

27

2829

30

31

32

33

34

35

36

37

38

39

40

4142

43

44

45

46

47

48

49

50

51

5253

5455

5657

58

59

6061

62

63

64

65

66

67

68

69

70

71 72

73

74

75

76

77

78

79

80

81

82

83

84

85

86

87

88

89

90

91

92

93

94

95

96

97

98

99100101 102

103

104

105

106

107

108

109

110

111

112

113

114

115

116

117118

119

120

121

122

123

124

125

126

127

128

129

130

131

132

133

134

135

136

137

138

139

140

141

142

143

144

145

146

147

148

149150

151

152

153

154 155

156

157

158 159

160

161

162

163

164

165

166

167

168 169

170

171172

173

174

175

176

177

178

179

180181

182

183

184

185

186187

188

189

190

191

192

193

194

195

196

197

198

199

200

201

202

203 204

205

206207

208

209

210

211

212

213214

215

216

217218

219

220

221

222

223

224

225

226

227

228

229

230

231

232

233

234

235

236

237

238

239

240

241

242

243

244

245

246

247

248

249

250

251

252

253

254255

256

257 258

259

260

261

262

263

264

265

266

267

268

269

270271

272 273

274275

276

277

278

279280

281

282

283

284

285

286

287288

289290

291

-4 -2 2

-4

-2

2

4

overlaps by -95.6611 10

PS3-2009-Solutions.nb 53

Page 54: P-Set 2 Solution Setpruffle.mit.edu/3.016-2009/Homeworks/PS2-2009-Solutions.pdf · 2009-11-02 · P-Set 2 Solution Set Solutions created by Melissa Diskin I2-1 (Handworked, 5 points)

ü This shows that the algorithm achieves a density of about 80%. This is about 88% of the maximum theoretical. Not bad.

HcountableDisks Pi .1^2LêHPi estimatedRadius^2L

0.806094

ListLinePlot@rdf@reducedDiskSetPositions, 0.1, 400,centerofMass, estimatedRadiusD, PlotRange Ø 880, 10<, 80, 200<<D

0 2 4 6 8 100

50

100

150

200

ü Compare this to a hexogonal rdf centered near the origin--the largest peaks seem to correlate (at least visually).

lp = ListLinePlot@rdf@hexagonallattice, Sqrt@3Dê4, 400, 80.01, 0.01<,estimatedRadius êHSqrt@3Dê4LD, PlotStyle Ø 8 Blue, Thick<,

PlotLabel Ø "Hexagonal at H1,1L", PlotRange Ø 880, 10<, 80, 50<<D

0 2 4 6 8 10

10

20

30

40

50Hexagonal at H1,1L

54 PS3-2009-Solutions.nb