Cell[CellGroupData[{Cell[BoxData[ RowBox[{"Manipulate", "[", RowBox[{ RowBox[{"With", "[", RowBox[{ RowBox[{"{", RowBox[{"horizontalRange", "=", RowBox[{"Which", "[", RowBox[{ RowBox[{ RowBox[{"c", "-", RowBox[{"E", "^", "r"}]}], "<", "0"}], ",", RowBox[{"{", RowBox[{"0", ",", RowBox[{"Min", "[", RowBox[{ RowBox[{"2", " ", SuperscriptBox["E", "r"]}], ",", "1"}], "]"}]}], "}"}], ",", RowBox[{ RowBox[{"c", "+", RowBox[{"E", "^", "r"}]}], ">", "1"}], ",", RowBox[{"{", RowBox[{ RowBox[{"Max", "[", RowBox[{ RowBox[{"1", "-", RowBox[{"2", " ", SuperscriptBox["E", "r"]}]}], ",", "0"}], "]"}], ",", "1"}], "}"}], ",", "True", ",", RowBox[{"{", RowBox[{ RowBox[{"c", "-", RowBox[{"E", "^", "r"}]}], ",", RowBox[{"c", "+", RowBox[{"E", "^", "r"}]}]}], "}"}]}], "]"}]}], "}"}], ",", RowBox[{"Graphics", "[", RowBox[{ RowBox[{"{", RowBox[{"Red", ",", RowBox[{"Antialiasing", "->", "True"}], ",", RowBox[{ RowBox[{ RowBox[{ RowBox[{ RowBox[{"Rectangle", "@@", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{ "#", "[[", "1", "]]"}], ",", "0"}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{ "#", "[[", "2", "]]"}], ",", "1"}], "}"}]}], "}"}]}], "&"}], "[", "#", "]"}], "&"}], "/@", RowBox[{"Select", "[", RowBox[{ RowBox[{"Nest", "[", RowBox[{ RowBox[{ RowBox[{"Flatten", "[", RowBox[{ RowBox[{ RowBox[{"(", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{ "#1", "[[", "1", "]]"}], ",", RowBox[{ RowBox[{ "#1", "[[", "1", "]]"}], "+", RowBox[{ FractionBox["1", "3"], " ", RowBox[{"(", RowBox[{ RowBox[{ "#1", "[[", "2", "]]"}], "-", RowBox[{ "#1", "[[", "1", "]]"}]}], ")"}]}]}]}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{ RowBox[{ "#1", "[[", "2", "]]"}], "-", RowBox[{ FractionBox["1", "3"], " ", RowBox[{"(", RowBox[{ RowBox[{ "#1", "[[", "2", "]]"}], "-", RowBox[{ "#1", "[[", "1", "]]"}]}], ")"}]}]}], ",", RowBox[{ "#1", "[[", "2", "]]"}]}], "}"}]}], "}"}], "&"}], ")"}], "/@", "#1"}], ",", "1"}], "]"}], "&"}], ",", RowBox[{"{", RowBox[{"{", RowBox[{"0", ",", "1"}], "}"}], "}"}], ",", "n"}], "]"}], ",", RowBox[{ RowBox[{"Last", "@", RowBox[{"Union", "[", RowBox[{"{", RowBox[{ RowBox[{ RowBox[{ "#", "[[", "1", "]]"}], "<", RowBox[{ "horizontalRange", "[[", "2", "]]"}]}], ",", RowBox[{ RowBox[{ "#", "[[", "2", "]]"}], ">", RowBox[{ "horizontalRange", "[[", "1", "]]"}]}]}], "}"}], "]"}]}], "&"}]}], "]"}]}]}], "}"}], ",", " ", RowBox[{"PlotRange", "->", RowBox[{"{", RowBox[{"horizontalRange", ",", RowBox[{"{", RowBox[{"0", ",", "1"}], "}"}]}], "}"}]}], ",", " ", RowBox[{"AspectRatio", "->", "Full"}], ",", " ", RowBox[{"ImageSize", "->", RowBox[{"{", RowBox[{"478", ",", "200"}], "}"}]}], ",", RowBox[{"Axes", "->", RowBox[{"If", "[", RowBox[{"a", ",", RowBox[{"{", RowBox[{"True", ",", "False"}], "}"}], ",", "None"}], "]"}]}], ",", RowBox[{"Ticks", "->", RowBox[{"If", "[", RowBox[{"a", ",", RowBox[{"{", RowBox[{ RowBox[{"Join", "[", RowBox[{ RowBox[{"Nest", "[", RowBox[{ RowBox[{ RowBox[{"#", "[[", RowBox[{"1", ";;", RowBox[{"-", "1"}], ";;", "2"}], "]]"}], "&"}], ",", RowBox[{"Flatten", "[", RowBox[{"Nest", "[", RowBox[{ RowBox[{ RowBox[{"Flatten", "[", RowBox[{ RowBox[{ RowBox[{"(", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{ "#1", "[[", "1", "]]"}], ",", RowBox[{ RowBox[{ "#1", "[[", "1", "]]"}], "+", RowBox[{ FractionBox["1", "3"], " ", RowBox[{"(", RowBox[{ RowBox[{ "#1", "[[", "2", "]]"}], "-", RowBox[{ "#1", "[[", "1", "]]"}]}], ")"}]}]}]}], "}"}], ",", RowBox[{"{", RowBox[{ RowBox[{ RowBox[{ "#1", "[[", "2", "]]"}], "-", RowBox[{ FractionBox["1", "3"], " ", RowBox[{"(", RowBox[{ RowBox[{ "#1", "[[", "2", "]]"}], "-", RowBox[{ "#1", "[[", "1", "]]"}]}], ")"}]}]}], ",", RowBox[{ "#1", "[[", "2", "]]"}]}], "}"}]}], "}"}], "&"}], ")"}], "/@", "#1"}], ",", "1"}], "]"}], "&"}], ",", RowBox[{"{", RowBox[{"{", RowBox[{"0", ",", "1"}], "}"}], "}"}], ",", "n"}], "]"}], "]"}], ",", RowBox[{ RowBox[{ RowBox[{"If", "[", RowBox[{ RowBox[{"#", "<", "0"}], ",", "0", ",", "#"}], "]"}], "&"}], "[", RowBox[{"Round", "[", RowBox[{"1", "/", RowBox[{"Log", "[", RowBox[{ RowBox[{ FractionBox[ RowBox[{"Subtract", "@@", RowBox[{"Reverse", "@", "horizontalRange"}]}], "11"], "/", RowBox[{"(", RowBox[{"3", "^", RowBox[{"-", "n"}]}], ")"}]}], ",", "3"}], "]"}]}], "]"}], "]"}]}], "]"}], ",", RowBox[{"{", RowBox[{"{", RowBox[{"c", ",", RowBox[{"Invisible", "[", RowBox[{"1", "/", "6"}], "]"}]}], "}"}], "}"}]}], "]"}], ",", "Automatic"}], "}"}], ",", "None"}], "]"}]}]}], "]"}]}], "]"}], ",", " ", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"n", ",", "5", ",", "\"\\""}], "}"}], ",", "0", ",", "9", ",", "1", ",", RowBox[{"Appearance", "->", "\"\\""}]}], "}"}], ",", " ", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"c", ",", RowBox[{"N", "[", RowBox[{"8", "/", "27"}], "]"}], ",", "\"\\""}], "}"}], ",", "0", ",", "1", ",", RowBox[{"Appearance", "->", "\"\\""}]}], "}"}], ",", " ", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"r", ",", RowBox[{ RowBox[{"-", "2"}], "/", "3"}], ",", "\"\\""}], "}"}], ",", RowBox[{ RowBox[{"-", "2"}], "/", "3"}], ",", RowBox[{"-", "10"}]}], "}"}], ",", " ", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"a", ",", "True", ",", "\"\\""}], "}"}], ",", RowBox[{"{", RowBox[{"True", ",", "False"}], "}"}]}], "}"}], ",", RowBox[{"AutorunSequencing", "->", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"1", ",", "10"}], "}"}], ",", RowBox[{"{", RowBox[{"2", ",", "5"}], "}"}], ",", RowBox[{"{", RowBox[{"3", ",", "5"}], "}"}]}], "}"}]}]}], "]"}]], "Input", CellGroupingRules->{"GroupTogetherGrouping", 10000.}, CellChangeTimes->{ 3.35757176568782*^9, {3.3591119554641*^9, 3.35911195749702*^9}, { 3.35911209514495*^9, 3.35911214823129*^9}, {3.35911220224896*^9, 3.3591122459518*^9}, {3.359112442204*^9, 3.35911244857316*^9}, { 3.35911251727194*^9, 3.35911252743656*^9}, {3.35911257772887*^9, 3.35911267261531*^9}, {3.35913288908517*^9, 3.35913296256082*^9}, { 3.35913300241813*^9, 3.35913300249825*^9}, {3.3591330647077*^9, 3.35913312362242*^9}, {3.35913515497981*^9, 3.35913518090709*^9}, { 3.3591352446187*^9, 3.35913524645134*^9}, {3.3591353059569*^9, 3.35913537164135*^9}, {3.3591354355833*^9, 3.35913554770452*^9}, { 3.35913561563219*^9, 3.35913563819464*^9}, {3.35913566996031*^9, 3.35913574825289*^9}, {3.35913580098872*^9, 3.35913580948093*^9}, { 3.35913614003625*^9, 3.35913614030664*^9}, {3.36070381739063*^9, 3.360703911875*^9}, {3.36179378901254*^9, 3.36179379006405*^9}, { 3.379278567686624*^9, 3.379278578266581*^9}, {3.379278631037636*^9, 3.37927866384968*^9}, {3.379334313327153*^9, 3.379334317964262*^9}, {3.3793344196073112`*^9, 3.379334474169231*^9}, {3.379334656035193*^9, 3.379334738450489*^9}, {3.3793347936530237`*^9, 3.379334796155623*^9}, {3.379334845280345*^9, 3.379334860534169*^9}, {3.37933491080812*^9, 3.379334920106578*^9}, {3.379334962487898*^9, 3.379334967812961*^9}, {3.379335002932248*^9, 3.379335045747575*^9}, {3.379335204103097*^9, 3.379335204665118*^9}, {3.379335284140098*^9, 3.3793352846526318`*^9}, {3.3793353334273653`*^9, 3.379335336295566*^9}, {3.379335480239813*^9, 3.379335494214875*^9}, {3.37933727110054*^9, 3.379337291849348*^9}, {3.379337345471882*^9, 3.379337481565957*^9}, {3.379339303141539*^9, 3.379339310872797*^9}, {3.379360745474182*^9, 3.3793607485994*^9}, {3.37936078985513*^9, 3.379360792861417*^9}, { 3.379360913967718*^9, 3.37936093149402*^9}, { 3.3793609903716087`*^9, 3.37936099600981*^9}, { 3.379361054319682*^9, 3.379361081904273*^9}, {3.379704576986929*^9, 3.3797045773620234`*^9}, {3.37970855676668*^9, 3.379708564481285*^9}, {3.379708631109028*^9, 3.3797086374287453`*^9}, {3.3797086786635923`*^9, 3.379708679056306*^9}, {3.379708725738237*^9, 3.37970876726962*^9}, {3.379708808887752*^9, 3.379708879977956*^9}, {3.379708913236128*^9, 3.379709121608861*^9}, {3.379709175029737*^9, 3.379709177115506*^9}, {3.3797092235689163`*^9, 3.379709228998465*^9}, {3.379709278777526*^9, 3.379709279132823*^9}, {3.379709350239348*^9, 3.379709352264192*^9}, {3.3797093990646143`*^9, 3.3797094028966227`*^9}, {3.3797094593068132`*^9, 3.37970946541081*^9}, {3.379709518289263*^9, 3.379709540263503*^9}, {3.379709584892441*^9, 3.379709589384214*^9}, {3.379709696368825*^9, 3.379709697368641*^9}, {3.379709776039295*^9, 3.379709776641616*^9}, {3.3797104751980953`*^9, 3.37971048028644*^9}, {3.379710540958922*^9, 3.37971054319615*^9}, {3.379710577292391*^9, 3.379710603021228*^9}, {3.3797108258042793`*^9, 3.3797108532332487`*^9}, {3.3797108908418207`*^9, 3.379710891226852*^9}, {3.379767081615168*^9, 3.379767096324235*^9}, {3.3797671554266*^9, 3.379767227219646*^9}, {3.379767276764534*^9, 3.379767290219872*^9}, {3.379768508211555*^9, 3.379768512346559*^9}, {3.379768633030954*^9, 3.37976865026784*^9}, {3.379768967576523*^9, 3.379768995406787*^9}, {3.379769084472252*^9, 3.379769101654881*^9}, {3.379769328273568*^9, 3.379769334330414*^9}, {3.379769484093141*^9, 3.379769488313023*^9}, {3.379769630883973*^9, 3.379769678971631*^9}, {3.379769770947047*^9, 3.37976977639811*^9}, {3.3797698917549686`*^9, 3.379769977608162*^9}, 3.379770061053246*^9, {3.379770322113585*^9, 3.379770380647565*^9}, {3.379770418438702*^9, 3.37977056565913*^9}, {3.379770595782155*^9, 3.379770597900141*^9}, {3.379770639256452*^9, 3.379770639954235*^9}, {3.3797722322060843`*^9, 3.3797722519464817`*^9}, {3.379772311753199*^9, 3.3797723232388697`*^9}, {3.3797724756972227`*^9, 3.37977252584286*^9}, {3.379772624298892*^9, 3.3797726669476957`*^9}, {3.379772734771802*^9, 3.3797728809624453`*^9}, {3.379773111107209*^9, 3.3797731829256783`*^9}, {3.3797738340833073`*^9, 3.379773909818041*^9}, {3.379773977901744*^9, 3.3797739890788116`*^9}, {3.3797741158963203`*^9, 3.379774266221456*^9}, {3.379774303673728*^9, 3.3797743177762213`*^9}, 3.379774408187031*^9, { 3.379775433989307*^9, 3.3797754346027393`*^9}, { 3.379775749799234*^9, 3.379775785228907*^9}, 3.379776117023273*^9, {3.37978061352582*^9, 3.3797806516604633`*^9}, {3.3797808095184937`*^9, 3.3797808480864153`*^9}, {3.379780879792508*^9, 3.379780902977663*^9}, {3.3797811274748383`*^9, 3.379781128036462*^9}, {3.379781163562819*^9, 3.379781166718717*^9}, {3.379782278956684*^9, 3.3797822809141417`*^9}, {3.379782315557745*^9, 3.37978235751296*^9}, {3.379782396967577*^9, 3.379782401655102*^9}, 3.3797824666996403`*^9, {3.3797825027342157`*^9, 3.379782523191025*^9}, {3.379782674044533*^9, 3.379782713827531*^9}, {3.379782816639689*^9, 3.379782857962679*^9}, {3.3797828940847*^9, 3.3797829303131104`*^9}, {3.3797830091200457`*^9, 3.379783009767695*^9}, {3.3797830591492033`*^9, 3.3797830771965513`*^9}, {3.379783124892487*^9, 3.37978317208927*^9}, {3.379783327682109*^9, 3.379783378888694*^9}, 3.3797852658750887`*^9, 3.379786885082314*^9, { 3.379786958923424*^9, 3.379786988828144*^9}, {3.379787025984046*^9, 3.37978703162822*^9}, {3.379787127081933*^9, 3.379787272208033*^9}, {3.379787380151963*^9, 3.379787393698592*^9}, {3.37978747087636*^9, 3.379787471882148*^9}, {3.379787535000149*^9, 3.3797875414929037`*^9}, {3.379787574175136*^9, 3.37978760092693*^9}, {3.3797876458426867`*^9, 3.379787645942116*^9}, {3.379787676000692*^9, 3.379787676198155*^9}, {3.37978807510203*^9, 3.379788091636085*^9}, {3.37978812919705*^9, 3.3797881365224047`*^9}, {3.379788167441514*^9, 3.379788174899227*^9}, {3.379788223479238*^9, 3.37978825854431*^9}, {3.379788543965291*^9, 3.379788644450251*^9}, {3.379788717983528*^9, 3.379788721101575*^9}, {3.3797888619688673`*^9, 3.379788862088126*^9}, {3.379788899672885*^9, 3.379788900375396*^9}, {3.37978901415451*^9, 3.379789020967605*^9}, 3.379789172198687*^9, 3.3797912335518417`*^9, { 3.379792094237306*^9, 3.379792104111518*^9}, 3.379792145587966*^9, {3.3797933732681723`*^9, 3.379793456819199*^9}, {3.379793878254365*^9, 3.379793888766694*^9}, {3.379793940845284*^9, 3.379793940922783*^9}, {3.379793975647935*^9, 3.379793983107368*^9}, {3.382218834312106*^9, 3.3822188359627447`*^9}, {3.382270873033332*^9, 3.382270873623364*^9}, {3.382270909230336*^9, 3.382270929311648*^9}, {3.382270969958436*^9, 3.3822710038058767`*^9}, {3.382271159264496*^9, 3.382271211609812*^9}, {3.3822712821723547`*^9, 3.3822712835634117`*^9}, {3.3822713469404993`*^9, 3.3822713618354273`*^9}, 3.3834916439534507`*^9, { 3.383492129150481*^9, 3.383492146345893*^9}, 3.760732860673258*^9}, CellID->2021138638], Cell[BoxData[ TagBox[ StyleBox[ DynamicModuleBox[{$CellContext`a$$ = True, $CellContext`c$$ = 0.2962962962962963, $CellContext`n$$ = 5, $CellContext`r$$ = Rational[-2, 3], Typeset`show$$ = True, Typeset`bookmarkList$$ = {}, Typeset`bookmarkMode$$ = "Menu", Typeset`animator$$, Typeset`animvar$$ = 1, Typeset`name$$ = "\"untitled\"", Typeset`specs$$ = {{{ Hold[$CellContext`n$$], 5, "number of iterations"}, 0, 9, 1}, {{ Hold[$CellContext`c$$], 0.2962962962962963, "pan"}, 0, 1}, {{ Hold[$CellContext`r$$], Rational[-2, 3], "zoom"}, Rational[-2, 3], -10}, {{ Hold[$CellContext`a$$], True, "show number line"}, { True, False}}}, Typeset`size$$ = {478., {98., 102.}}, Typeset`update$$ = 0, Typeset`initDone$$, Typeset`skipInitDone$$ = True, $CellContext`n$224$$ = 0, $CellContext`c$225$$ = 0, $CellContext`r$226$$ = 0, $CellContext`a$227$$ = False}, DynamicBox[Manipulate`ManipulateBoxes[ 1, StandardForm, "Variables" :> {$CellContext`a$$ = True, $CellContext`c$$ = 0.2962962962962963, $CellContext`n$$ = 5, $CellContext`r$$ = Rational[-2, 3]}, "ControllerVariables" :> { Hold[$CellContext`n$$, $CellContext`n$224$$, 0], Hold[$CellContext`c$$, $CellContext`c$225$$, 0], Hold[$CellContext`r$$, $CellContext`r$226$$, 0], Hold[$CellContext`a$$, $CellContext`a$227$$, False]}, "OtherVariables" :> { Typeset`show$$, Typeset`bookmarkList$$, Typeset`bookmarkMode$$, Typeset`animator$$, Typeset`animvar$$, Typeset`name$$, Typeset`specs$$, Typeset`size$$, Typeset`update$$, Typeset`initDone$$, Typeset`skipInitDone$$}, "Body" :> With[{$CellContext`horizontalRange$ = Which[$CellContext`c$$ - E^$CellContext`r$$ < 0, {0, Min[2 E^$CellContext`r$$, 1]}, $CellContext`c$$ + E^$CellContext`r$$ > 1, { Max[1 - 2 E^$CellContext`r$$, 0], 1}, True, {$CellContext`c$$ - E^$CellContext`r$$, $CellContext`c$$ + E^$CellContext`r$$}]}, Graphics[{Red, Antialiasing -> True, Map[(Apply[Rectangle, {{ Part[#, 1], 0}, { Part[#, 2], 1}}]& )[#]& , Select[ Nest[Flatten[ Map[{{ Part[#, 1], Part[#, 1] + (1/3) (Part[#, 2] - Part[#, 1])}, { Part[#, 2] - (1/3) (Part[#, 2] - Part[#, 1]), Part[#, 2]}}& , #], 1]& , {{0, 1}}, $CellContext`n$$], Last[ Union[{Part[#, 1] < Part[$CellContext`horizontalRange$, 2], Part[#, 2] > Part[$CellContext`horizontalRange$, 1]}]]& ]]}, PlotRange -> {$CellContext`horizontalRange$, {0, 1}}, AspectRatio -> Full, ImageSize -> {478, 200}, Axes -> If[$CellContext`a$$, {True, False}, None], Ticks -> If[$CellContext`a$$, { Join[ Nest[Part[#, Span[1, -1, 2]]& , Flatten[ Nest[Flatten[ Map[{{ Part[#, 1], Part[#, 1] + (1/3) (Part[#, 2] - Part[#, 1])}, { Part[#, 2] - (1/3) (Part[#, 2] - Part[#, 1]), Part[#, 2]}}& , #], 1]& , {{0, 1}}, $CellContext`n$$]], (If[# < 0, 0, #]& )[ Round[1/Log[(Apply[Subtract, Reverse[$CellContext`horizontalRange$]]/11)/ 3^(-$CellContext`n$$), 3]]]], {{$CellContext`c$$, Invisible[1/6]}}], Automatic}, None]]], "Specifications" :> {{{$CellContext`n$$, 5, "number of iterations"}, 0, 9, 1, Appearance -> "Labeled"}, {{$CellContext`c$$, 0.2962962962962963, "pan"}, 0, 1, Appearance -> "Labeled"}, {{$CellContext`r$$, Rational[-2, 3], "zoom"}, Rational[-2, 3], -10}, {{$CellContext`a$$, True, "show number line"}, {True, False}}}, "Options" :> { ControllerLinking -> True, AutorunSequencing -> {{1, 10}, {2, 5}, {3, 5}}}, "DefaultOptions" :> {ControllerLinking -> True}], ImageSizeCache->{523., {182., 188.}}, SingleEvaluation->True], Deinitialization:>None, DynamicModuleValues:>{}, SynchronousInitialization->True, UnsavedVariables:>{Typeset`initDone$$}, UntrackedVariables:>{Typeset`size$$}], "Manipulate", Deployed->True, StripOnInput->False], Manipulate`InterpretManipulate[1]]], "Output", CellGroupingRules->{"GroupTogetherGrouping", 10000.}, CellChangeTimes->{3.7607328606735477`*^9}, CellID->5021214] }, {2}]]