Simple Fractal square

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
3
down vote

favorite












I am working on a math question about infinite series, and one of the question images is below.



iterations of subdividing a square



Each new white square has an area that is 1/4 of the previous square.



Always looking to learn elegant ways to create things using Mathematica, and in this case, probably recursion as well?



I know it's not complicated, but any help with the process would be appreciated.



Having a NICE diagram really helps with creating a better response.
(questions about sums of areas of white, black, etc.)










share|improve this question

























    up vote
    3
    down vote

    favorite












    I am working on a math question about infinite series, and one of the question images is below.



    iterations of subdividing a square



    Each new white square has an area that is 1/4 of the previous square.



    Always looking to learn elegant ways to create things using Mathematica, and in this case, probably recursion as well?



    I know it's not complicated, but any help with the process would be appreciated.



    Having a NICE diagram really helps with creating a better response.
    (questions about sums of areas of white, black, etc.)










    share|improve this question























      up vote
      3
      down vote

      favorite









      up vote
      3
      down vote

      favorite











      I am working on a math question about infinite series, and one of the question images is below.



      iterations of subdividing a square



      Each new white square has an area that is 1/4 of the previous square.



      Always looking to learn elegant ways to create things using Mathematica, and in this case, probably recursion as well?



      I know it's not complicated, but any help with the process would be appreciated.



      Having a NICE diagram really helps with creating a better response.
      (questions about sums of areas of white, black, etc.)










      share|improve this question













      I am working on a math question about infinite series, and one of the question images is below.



      iterations of subdividing a square



      Each new white square has an area that is 1/4 of the previous square.



      Always looking to learn elegant ways to create things using Mathematica, and in this case, probably recursion as well?



      I know it's not complicated, but any help with the process would be appreciated.



      Having a NICE diagram really helps with creating a better response.
      (questions about sums of areas of white, black, etc.)







      graphics recursion iteration






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked 1 hour ago









      Tom De Vries

      1,6351224




      1,6351224




















          2 Answers
          2






          active

          oldest

          votes

















          up vote
          3
          down vote













          coords = 0, 0, 0, 1, 1, 1, 1, 0;
          tf = Composition[TranslationTransform[1/2, 0], ScalingTransform[1/2, 1/2]]
          rects = NestList[tf /@ ## &, coords, 4];
          Graphics[ EdgeForm[Black], Rectangle,
          FaceForm[Gray], Polygon@#, FaceForm[White], Polygon@#2 & @@@
          Transpose[rects, Most /@ rects], FaceForm[White], Polygon[Last@rects]]


          enter image description here






          share|improve this answer





























            up vote
            1
            down vote













            n = 100;
            T1 = Developer`ToPackedArray[-1., 0., -0.5, 0., -0.5, 0.5];
            T2 = Developer`ToPackedArray[-0.5, 0.5, 0., 0.5, 0., 1.];
            Graphics[
            Polygon[Table[0.5^k T1, k, 0, n]],
            Polygon[Table[0.5^k T2, k, 0, n]]
            ]


            enter image description here





            share




















              Your Answer




              StackExchange.ifUsing("editor", function ()
              return StackExchange.using("mathjaxEditing", function ()
              StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix)
              StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
              );
              );
              , "mathjax-editing");

              StackExchange.ready(function()
              var channelOptions =
              tags: "".split(" "),
              id: "387"
              ;
              initTagRenderer("".split(" "), "".split(" "), channelOptions);

              StackExchange.using("externalEditor", function()
              // Have to fire editor after snippets, if snippets enabled
              if (StackExchange.settings.snippets.snippetsEnabled)
              StackExchange.using("snippets", function()
              createEditor();
              );

              else
              createEditor();

              );

              function createEditor()
              StackExchange.prepareEditor(
              heartbeatType: 'answer',
              convertImagesToLinks: false,
              noModals: false,
              showLowRepImageUploadWarning: true,
              reputationToPostImages: null,
              bindNavPrevention: true,
              postfix: "",
              onDemand: true,
              discardSelector: ".discard-answer"
              ,immediatelyShowMarkdownHelp:true
              );



              );













               

              draft saved


              draft discarded


















              StackExchange.ready(
              function ()
              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f184560%2fsimple-fractal-square%23new-answer', 'question_page');

              );

              Post as a guest






























              2 Answers
              2






              active

              oldest

              votes








              2 Answers
              2






              active

              oldest

              votes









              active

              oldest

              votes






              active

              oldest

              votes








              up vote
              3
              down vote













              coords = 0, 0, 0, 1, 1, 1, 1, 0;
              tf = Composition[TranslationTransform[1/2, 0], ScalingTransform[1/2, 1/2]]
              rects = NestList[tf /@ ## &, coords, 4];
              Graphics[ EdgeForm[Black], Rectangle,
              FaceForm[Gray], Polygon@#, FaceForm[White], Polygon@#2 & @@@
              Transpose[rects, Most /@ rects], FaceForm[White], Polygon[Last@rects]]


              enter image description here






              share|improve this answer


























                up vote
                3
                down vote













                coords = 0, 0, 0, 1, 1, 1, 1, 0;
                tf = Composition[TranslationTransform[1/2, 0], ScalingTransform[1/2, 1/2]]
                rects = NestList[tf /@ ## &, coords, 4];
                Graphics[ EdgeForm[Black], Rectangle,
                FaceForm[Gray], Polygon@#, FaceForm[White], Polygon@#2 & @@@
                Transpose[rects, Most /@ rects], FaceForm[White], Polygon[Last@rects]]


                enter image description here






                share|improve this answer
























                  up vote
                  3
                  down vote










                  up vote
                  3
                  down vote









                  coords = 0, 0, 0, 1, 1, 1, 1, 0;
                  tf = Composition[TranslationTransform[1/2, 0], ScalingTransform[1/2, 1/2]]
                  rects = NestList[tf /@ ## &, coords, 4];
                  Graphics[ EdgeForm[Black], Rectangle,
                  FaceForm[Gray], Polygon@#, FaceForm[White], Polygon@#2 & @@@
                  Transpose[rects, Most /@ rects], FaceForm[White], Polygon[Last@rects]]


                  enter image description here






                  share|improve this answer














                  coords = 0, 0, 0, 1, 1, 1, 1, 0;
                  tf = Composition[TranslationTransform[1/2, 0], ScalingTransform[1/2, 1/2]]
                  rects = NestList[tf /@ ## &, coords, 4];
                  Graphics[ EdgeForm[Black], Rectangle,
                  FaceForm[Gray], Polygon@#, FaceForm[White], Polygon@#2 & @@@
                  Transpose[rects, Most /@ rects], FaceForm[White], Polygon[Last@rects]]


                  enter image description here







                  share|improve this answer














                  share|improve this answer



                  share|improve this answer








                  edited 4 mins ago

























                  answered 14 mins ago









                  kglr

                  167k8188390




                  167k8188390




















                      up vote
                      1
                      down vote













                      n = 100;
                      T1 = Developer`ToPackedArray[-1., 0., -0.5, 0., -0.5, 0.5];
                      T2 = Developer`ToPackedArray[-0.5, 0.5, 0., 0.5, 0., 1.];
                      Graphics[
                      Polygon[Table[0.5^k T1, k, 0, n]],
                      Polygon[Table[0.5^k T2, k, 0, n]]
                      ]


                      enter image description here





                      share
























                        up vote
                        1
                        down vote













                        n = 100;
                        T1 = Developer`ToPackedArray[-1., 0., -0.5, 0., -0.5, 0.5];
                        T2 = Developer`ToPackedArray[-0.5, 0.5, 0., 0.5, 0., 1.];
                        Graphics[
                        Polygon[Table[0.5^k T1, k, 0, n]],
                        Polygon[Table[0.5^k T2, k, 0, n]]
                        ]


                        enter image description here





                        share






















                          up vote
                          1
                          down vote










                          up vote
                          1
                          down vote









                          n = 100;
                          T1 = Developer`ToPackedArray[-1., 0., -0.5, 0., -0.5, 0.5];
                          T2 = Developer`ToPackedArray[-0.5, 0.5, 0., 0.5, 0., 1.];
                          Graphics[
                          Polygon[Table[0.5^k T1, k, 0, n]],
                          Polygon[Table[0.5^k T2, k, 0, n]]
                          ]


                          enter image description here





                          share












                          n = 100;
                          T1 = Developer`ToPackedArray[-1., 0., -0.5, 0., -0.5, 0.5];
                          T2 = Developer`ToPackedArray[-0.5, 0.5, 0., 0.5, 0., 1.];
                          Graphics[
                          Polygon[Table[0.5^k T1, k, 0, n]],
                          Polygon[Table[0.5^k T2, k, 0, n]]
                          ]


                          enter image description here






                          share











                          share


                          share










                          answered 7 mins ago









                          Henrik Schumacher

                          42.8k261127




                          42.8k261127



























                               

                              draft saved


                              draft discarded















































                               


                              draft saved


                              draft discarded














                              StackExchange.ready(
                              function ()
                              StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f184560%2fsimple-fractal-square%23new-answer', 'question_page');

                              );

                              Post as a guest













































































                              Comments

                              Popular posts from this blog

                              What does second last employer means? [closed]

                              Installing NextGIS Connect into QGIS 3?

                              One-line joke