(* This is the file MakeFramesMobius.m, written by Douglas N. Arnold Department of Mathematics Penn State University Park, PA 16802 January 1997 *) Needs["complexcurves`"] Needs["Graphics`Colors`"] (* This file makes an animation of a homotopy from the identity to a "generic" Mobius transformation, the homotopy passing always through Mobius transformations, showing the evolution of the image of a rainbow shaded rectangle. The transformation is (z-I)/(2+I/Pi^4-Pi z). *) (* STEP 1: DESCRIBE THE DESIRED ANIMATION *) ll=-1- I; (* lower left and upper right corners of *) ur=-ll; (* the rectangle to be plotted *) llplot=-2.5-2.5 I; (* lower left and upper right corners of *) urplot=-llplot; (* plotting region *) nframes=11; (* number of frames in the animation *) vlines=300; (* number of vertical lines (these have varying hue) *) starthue=0; (* starting and ending hues for the vertical lines *) endhue=.9; (* (both should be in [0,1] ) *) vthickness=.01; (* thickness of the vertical lines *) hlines=11; (* number of horizontal grid lines to superimpose *) hgridcolor=Gray; (* color of the horizontal grid lines *) hthickness=.008 (* thickness of the horizontal grid lines *) vglines=11; (* number of horizontal grid lines to superimpose *) vgridcolor=Gray; (* color of the horizontal grid lines *) vgthickness=.008 (* thickness of the horizontal grid lines *) bdrycolor=White; (* color of the boundary *) bdrythickness=.01 (* thickness of the boundary lines *) width=400 (* frame width in pixels *) height=400 (* frame height in pixels *) prefix="frame"; (* filename prefix *) options = (* general plot options *) {Background->Black, DefaultColor->White, AspectRatio->Automatic}; (* STEP 2: MAKE THE ANIMATION *) writetofile[width_,height_,prefix_,i_] := StringJoin["!rasterps -w ", ToString[width]," -h ",ToString[height]," -format ppm > ", prefix,ToString[PaddedForm[i,3,NumberPadding->{"0",""}]],".ppm"] curvelist = Join[ (* colored vertical lines *) Table[ line@@Join[{Re[ll]+j(Re[ur]-Re[ll])/(vlines-1)+I Im[ll], Re[ll]+j(Re[ur]-Re[ll])/(vlines-1)+I Im[ur], PlotStyle->{{Thickness[vthickness], Hue[starthue + (endhue-starthue)j/(vlines-1)]}}}, options], {j,0,vlines-1}], (* horizontal grid lines *) hlinearray@@Join[{ll,ur,hlines, PlotStyle->{{Thickness[hthickness],hgridcolor}}}, options], (* vertical grid lines *) vlinearray@@Join[{ll,ur,vglines, PlotStyle->{{Thickness[vgthickness],vgridcolor}}}, options], (* boundary *) {rectangle@@Join[{ll,ur, PlotStyle->{{Thickness[bdrythickness],bdrycolor}}}, options]} ]; Table[ Module[{t},( t=(i-1)/(nframes-1); Display[ writetofile[width,height,prefix,i], showcurve[image[((1-t)#+t(#-I))/((1-t)+t(2+I/Pi^4-Pi#))&,curvelist], PlotRange->{{Re[llplot],Re[urplot]},{Im[llplot],Im[urplot]}}, DisplayFunction->Identity]])], {i,1,nframes}] Print[StringJoin["-- wrote frames --"]]