Monte Carlo double integral over surface of $|x|+|y| leq 1$












1












$begingroup$


$iint_{|x|+|y|le1}!x^2,dxdy$



I am supposed to calculate this by using Monte Carlo integration. Can anyone give basic hints or directions? I know the idea behind the Monte Carlo integration method but my brain can't seem to be able to grasp any straw at how to solve this.










share|cite|improve this question











$endgroup$

















    1












    $begingroup$


    $iint_{|x|+|y|le1}!x^2,dxdy$



    I am supposed to calculate this by using Monte Carlo integration. Can anyone give basic hints or directions? I know the idea behind the Monte Carlo integration method but my brain can't seem to be able to grasp any straw at how to solve this.










    share|cite|improve this question











    $endgroup$















      1












      1








      1


      1



      $begingroup$


      $iint_{|x|+|y|le1}!x^2,dxdy$



      I am supposed to calculate this by using Monte Carlo integration. Can anyone give basic hints or directions? I know the idea behind the Monte Carlo integration method but my brain can't seem to be able to grasp any straw at how to solve this.










      share|cite|improve this question











      $endgroup$




      $iint_{|x|+|y|le1}!x^2,dxdy$



      I am supposed to calculate this by using Monte Carlo integration. Can anyone give basic hints or directions? I know the idea behind the Monte Carlo integration method but my brain can't seem to be able to grasp any straw at how to solve this.







      monte-carlo






      share|cite|improve this question















      share|cite|improve this question













      share|cite|improve this question




      share|cite|improve this question








      edited Dec 9 '18 at 20:01









      postmortes

      1,91721117




      1,91721117










      asked Dec 9 '18 at 19:40









      That guy who is bad at mathThat guy who is bad at math

      134




      134






















          1 Answer
          1






          active

          oldest

          votes


















          0












          $begingroup$

          Enclose your integration in $displaystyle{left[-1,1right)^{,2}}$. The Monte-Carlo integration becomes $left(~overline overline{phantom{AAA}}mbox{means average with an uniform distibution over} left[-1,1right)^{,2}~right)$
          begin{align}
          S_{N} & = sum_{i = 1}^{N}x_{i}^{2}
          left[vphantom{Large A}leftvert x_{i}rightvert +
          leftvert y_{i}rightvert leq 1right]
          \[2mm]
          overline{S_{N}} & = N overline{x^{2}
          left[vphantom{Large A}leftvert xrightvert +
          leftvert yrightvert leq 1right]} =
          Nint_{-1}^{1}int_{-1}^{1}{1 over 4}
          left[vphantom{Large A}leftvert xrightvert +
          leftvert yrightvert leq 1right]x^{2}
          ,mathrm{d}x,mathrm{d}y
          \[5mm]
          & implies int_{-1}^{1}int_{-1}^{1}
          left[vphantom{Large A}leftvert xrightvert +
          leftvert yrightvert leq 1right]x^{2}
          ,mathrm{d}x,mathrm{d}y = 4,{overline{S_{N}} over N}
          approx bbox[10px,#ffd,border:1px groove navy]
          {4,{S_{N} over N}}
          end{align}



          The following code is a $texttt{javascript}$ script which can be run in a terminal with $texttt{node.js}$:




          "use strict";
          const ITERATIONS = 10000;
          let i = 0, theSum = 0, x = null, y = null;

          while (i < ITERATIONS) {
          x = 2.0*Math.random() - 1.0;
          y = 2.0*Math.random() - 1.0;
          if (Math.abs(x) + Math.abs(y) <= 1.0) theSum += x*x;
          ++i;
          }

          console.log(4.0*(theSum/ITERATIONS));


          A typical "run" yields $bbox[10px,#ffd,border:1px groove navy]{displaystyle 0.3302123390009306}$. The exact result is
          $bbox[10px,#ffd,border:1px groove navy]
          {displaystyle{1 over 3}}$
          .






          share|cite|improve this answer











          $endgroup$













            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: "69"
            };
            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',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            noCode: true, onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f3032861%2fmonte-carlo-double-integral-over-surface-of-xy-leq-1%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0












            $begingroup$

            Enclose your integration in $displaystyle{left[-1,1right)^{,2}}$. The Monte-Carlo integration becomes $left(~overline overline{phantom{AAA}}mbox{means average with an uniform distibution over} left[-1,1right)^{,2}~right)$
            begin{align}
            S_{N} & = sum_{i = 1}^{N}x_{i}^{2}
            left[vphantom{Large A}leftvert x_{i}rightvert +
            leftvert y_{i}rightvert leq 1right]
            \[2mm]
            overline{S_{N}} & = N overline{x^{2}
            left[vphantom{Large A}leftvert xrightvert +
            leftvert yrightvert leq 1right]} =
            Nint_{-1}^{1}int_{-1}^{1}{1 over 4}
            left[vphantom{Large A}leftvert xrightvert +
            leftvert yrightvert leq 1right]x^{2}
            ,mathrm{d}x,mathrm{d}y
            \[5mm]
            & implies int_{-1}^{1}int_{-1}^{1}
            left[vphantom{Large A}leftvert xrightvert +
            leftvert yrightvert leq 1right]x^{2}
            ,mathrm{d}x,mathrm{d}y = 4,{overline{S_{N}} over N}
            approx bbox[10px,#ffd,border:1px groove navy]
            {4,{S_{N} over N}}
            end{align}



            The following code is a $texttt{javascript}$ script which can be run in a terminal with $texttt{node.js}$:




            "use strict";
            const ITERATIONS = 10000;
            let i = 0, theSum = 0, x = null, y = null;

            while (i < ITERATIONS) {
            x = 2.0*Math.random() - 1.0;
            y = 2.0*Math.random() - 1.0;
            if (Math.abs(x) + Math.abs(y) <= 1.0) theSum += x*x;
            ++i;
            }

            console.log(4.0*(theSum/ITERATIONS));


            A typical "run" yields $bbox[10px,#ffd,border:1px groove navy]{displaystyle 0.3302123390009306}$. The exact result is
            $bbox[10px,#ffd,border:1px groove navy]
            {displaystyle{1 over 3}}$
            .






            share|cite|improve this answer











            $endgroup$


















              0












              $begingroup$

              Enclose your integration in $displaystyle{left[-1,1right)^{,2}}$. The Monte-Carlo integration becomes $left(~overline overline{phantom{AAA}}mbox{means average with an uniform distibution over} left[-1,1right)^{,2}~right)$
              begin{align}
              S_{N} & = sum_{i = 1}^{N}x_{i}^{2}
              left[vphantom{Large A}leftvert x_{i}rightvert +
              leftvert y_{i}rightvert leq 1right]
              \[2mm]
              overline{S_{N}} & = N overline{x^{2}
              left[vphantom{Large A}leftvert xrightvert +
              leftvert yrightvert leq 1right]} =
              Nint_{-1}^{1}int_{-1}^{1}{1 over 4}
              left[vphantom{Large A}leftvert xrightvert +
              leftvert yrightvert leq 1right]x^{2}
              ,mathrm{d}x,mathrm{d}y
              \[5mm]
              & implies int_{-1}^{1}int_{-1}^{1}
              left[vphantom{Large A}leftvert xrightvert +
              leftvert yrightvert leq 1right]x^{2}
              ,mathrm{d}x,mathrm{d}y = 4,{overline{S_{N}} over N}
              approx bbox[10px,#ffd,border:1px groove navy]
              {4,{S_{N} over N}}
              end{align}



              The following code is a $texttt{javascript}$ script which can be run in a terminal with $texttt{node.js}$:




              "use strict";
              const ITERATIONS = 10000;
              let i = 0, theSum = 0, x = null, y = null;

              while (i < ITERATIONS) {
              x = 2.0*Math.random() - 1.0;
              y = 2.0*Math.random() - 1.0;
              if (Math.abs(x) + Math.abs(y) <= 1.0) theSum += x*x;
              ++i;
              }

              console.log(4.0*(theSum/ITERATIONS));


              A typical "run" yields $bbox[10px,#ffd,border:1px groove navy]{displaystyle 0.3302123390009306}$. The exact result is
              $bbox[10px,#ffd,border:1px groove navy]
              {displaystyle{1 over 3}}$
              .






              share|cite|improve this answer











              $endgroup$
















                0












                0








                0





                $begingroup$

                Enclose your integration in $displaystyle{left[-1,1right)^{,2}}$. The Monte-Carlo integration becomes $left(~overline overline{phantom{AAA}}mbox{means average with an uniform distibution over} left[-1,1right)^{,2}~right)$
                begin{align}
                S_{N} & = sum_{i = 1}^{N}x_{i}^{2}
                left[vphantom{Large A}leftvert x_{i}rightvert +
                leftvert y_{i}rightvert leq 1right]
                \[2mm]
                overline{S_{N}} & = N overline{x^{2}
                left[vphantom{Large A}leftvert xrightvert +
                leftvert yrightvert leq 1right]} =
                Nint_{-1}^{1}int_{-1}^{1}{1 over 4}
                left[vphantom{Large A}leftvert xrightvert +
                leftvert yrightvert leq 1right]x^{2}
                ,mathrm{d}x,mathrm{d}y
                \[5mm]
                & implies int_{-1}^{1}int_{-1}^{1}
                left[vphantom{Large A}leftvert xrightvert +
                leftvert yrightvert leq 1right]x^{2}
                ,mathrm{d}x,mathrm{d}y = 4,{overline{S_{N}} over N}
                approx bbox[10px,#ffd,border:1px groove navy]
                {4,{S_{N} over N}}
                end{align}



                The following code is a $texttt{javascript}$ script which can be run in a terminal with $texttt{node.js}$:




                "use strict";
                const ITERATIONS = 10000;
                let i = 0, theSum = 0, x = null, y = null;

                while (i < ITERATIONS) {
                x = 2.0*Math.random() - 1.0;
                y = 2.0*Math.random() - 1.0;
                if (Math.abs(x) + Math.abs(y) <= 1.0) theSum += x*x;
                ++i;
                }

                console.log(4.0*(theSum/ITERATIONS));


                A typical "run" yields $bbox[10px,#ffd,border:1px groove navy]{displaystyle 0.3302123390009306}$. The exact result is
                $bbox[10px,#ffd,border:1px groove navy]
                {displaystyle{1 over 3}}$
                .






                share|cite|improve this answer











                $endgroup$



                Enclose your integration in $displaystyle{left[-1,1right)^{,2}}$. The Monte-Carlo integration becomes $left(~overline overline{phantom{AAA}}mbox{means average with an uniform distibution over} left[-1,1right)^{,2}~right)$
                begin{align}
                S_{N} & = sum_{i = 1}^{N}x_{i}^{2}
                left[vphantom{Large A}leftvert x_{i}rightvert +
                leftvert y_{i}rightvert leq 1right]
                \[2mm]
                overline{S_{N}} & = N overline{x^{2}
                left[vphantom{Large A}leftvert xrightvert +
                leftvert yrightvert leq 1right]} =
                Nint_{-1}^{1}int_{-1}^{1}{1 over 4}
                left[vphantom{Large A}leftvert xrightvert +
                leftvert yrightvert leq 1right]x^{2}
                ,mathrm{d}x,mathrm{d}y
                \[5mm]
                & implies int_{-1}^{1}int_{-1}^{1}
                left[vphantom{Large A}leftvert xrightvert +
                leftvert yrightvert leq 1right]x^{2}
                ,mathrm{d}x,mathrm{d}y = 4,{overline{S_{N}} over N}
                approx bbox[10px,#ffd,border:1px groove navy]
                {4,{S_{N} over N}}
                end{align}



                The following code is a $texttt{javascript}$ script which can be run in a terminal with $texttt{node.js}$:




                "use strict";
                const ITERATIONS = 10000;
                let i = 0, theSum = 0, x = null, y = null;

                while (i < ITERATIONS) {
                x = 2.0*Math.random() - 1.0;
                y = 2.0*Math.random() - 1.0;
                if (Math.abs(x) + Math.abs(y) <= 1.0) theSum += x*x;
                ++i;
                }

                console.log(4.0*(theSum/ITERATIONS));


                A typical "run" yields $bbox[10px,#ffd,border:1px groove navy]{displaystyle 0.3302123390009306}$. The exact result is
                $bbox[10px,#ffd,border:1px groove navy]
                {displaystyle{1 over 3}}$
                .







                share|cite|improve this answer














                share|cite|improve this answer



                share|cite|improve this answer








                edited Dec 10 '18 at 18:36

























                answered Dec 9 '18 at 21:56









                Felix MarinFelix Marin

                67.8k7107142




                67.8k7107142






























                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Mathematics Stack Exchange!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    Use MathJax to format equations. MathJax reference.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f3032861%2fmonte-carlo-double-integral-over-surface-of-xy-leq-1%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Ellipse (mathématiques)

                    Quarter-circle Tiles

                    Mont Emei