{"id":4830,"date":"2015-06-17T22:12:43","date_gmt":"2015-06-17T20:12:43","guid":{"rendered":"http:\/\/www.valcon.it\/pp\/?p=4830"},"modified":"2026-05-30T18:33:53","modified_gmt":"2026-05-30T16:33:53","slug":"integrazione-numerica-monte-carlo","status":"publish","type":"post","link":"https:\/\/www.valcon.it\/pp\/integrazione-numerica-monte-carlo\/","title":{"rendered":"Integrazione numerica con metodo Monte Carlo"},"content":{"rendered":"\n<div class=\"wp-block-buttons is-layout-flex wp-block-buttons-is-layout-flex\">\n<div class=\"wp-block-button\"><a class=\"wp-block-button__link wp-element-button\" href=\"https:\/\/www.valcon.it\/pp\/int-num\/\">Integrazione numerica<\/a><\/div>\n<\/div>\n\n\n\n<p><em>Esercizio del libro di testo<\/em><\/p>\n\n\n\n<p><span style=\"font-size: revert;\">Data la funzione&nbsp;<img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.valcon.it\/pp\/wp-content\/ql-cache\/quicklatex.com-8cc886d5a445683a8728bfe292d882b2_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#92;&#100;&#105;&#115;&#112;&#108;&#97;&#121;&#115;&#116;&#121;&#108;&#101;&#32;&#51;&#120;&#94;&#50;&#43;&#50;&#120;&#43;&#49;\" title=\"Rendered by QuickLaTeX.com\" height=\"18\" width=\"97\" style=\"vertical-align: -2px;\"\/> calcolare l&#8217;integrale definito della funzione da&nbsp;<\/span><strong style=\"font-size: revert;\">a<\/strong><span style=\"font-size: revert;\">=<\/span><strong style=\"font-size: revert;\">1<\/strong><span style=\"font-size: revert;\">&nbsp;a <\/span><strong style=\"font-size: revert;\">b<\/strong><span style=\"font-size: revert;\">=<\/span><strong style=\"font-size: revert;\">5<\/strong><span style=\"font-size: revert;\">.<\/span><\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"alignright size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"480\" height=\"461\" src=\"https:\/\/www.valcon.it\/pp\/wp-content\/uploads\/3x22x1-1.png\" alt=\"\" class=\"wp-image-42692\" srcset=\"https:\/\/www.valcon.it\/pp\/wp-content\/uploads\/3x22x1-1.png 480w, https:\/\/www.valcon.it\/pp\/wp-content\/uploads\/3x22x1-1-300x288.png 300w\" sizes=\"auto, (max-width: 480px) 100vw, 480px\" \/><\/figure>\n<\/div>\n\n\n<p>Nell&#8217;intervallo [1, 5] la funzione \u00e8 <em>continua<\/em>, <em>crescente<\/em>. <br>Assume il valore massimo nell&#8217;estremo a destra, per x=<strong>5<\/strong>, <\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>MAX = f(5) = <strong>86<\/strong>.<\/li>\n<\/ul>\n\n\n\n<p>Il grafico della funzione \u00e8 compreso nel rettangolo individuato dai punti<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>A = (a, 0) = (<strong>1<\/strong>, 0)<\/li>\n\n\n\n<li>B = (b, 0) = (<strong>5<\/strong>, 0)<\/li>\n\n\n\n<li>C = (b, f(b)) = (5, <strong>86<\/strong>)<\/li>\n<\/ul>\n\n\n\n<p>Siano<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>x*<\/strong> \u2208 [a, b], ascisse casuali<\/li>\n\n\n\n<li><strong>y*<\/strong> \u2208 [0, MAX], ordinate casuali<\/li>\n\n\n\n<li><strong>PUNTI<\/strong> = numero di punti casuali generati<\/li>\n\n\n\n<li><strong>punti<\/strong> = numero di punti casuali con <strong>y* &lt;= f(x*)<\/strong><\/li>\n\n\n\n<li><strong>AREA<\/strong> = area del rettangolo<\/li>\n\n\n\n<li><strong>area<\/strong> = integrale definito<\/li>\n<\/ul>\n\n\n\n<p>Osserva<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>AREA<\/strong> = (b-a)*f(b) = &#8230; =&nbsp;<strong>344<\/strong><\/li>\n<\/ul>\n\n\n\n<p>Come approssimare il valore di <strong>area<\/strong>?<\/p>\n\n\n\n<p>Per <strong>PUNTI<\/strong>&nbsp;<em>abbastanza<\/em> grande<\/p>\n\n\n\n<p class=\"has-text-align-center\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.valcon.it\/pp\/wp-content\/ql-cache\/quicklatex.com-a59940a1719b03b7113e8eaec27ca185_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#92;&#100;&#105;&#115;&#112;&#108;&#97;&#121;&#115;&#116;&#121;&#108;&#101;&#32;&#92;&#102;&#114;&#97;&#99;&#123;&#92;&#116;&#101;&#120;&#116;&#123;&#97;&#114;&#101;&#97;&#125;&#125;&#123;&#92;&#116;&#101;&#120;&#116;&#123;&#65;&#82;&#69;&#65;&#125;&#125;&#32;&#92;&#97;&#112;&#112;&#114;&#111;&#120;&#32;&#92;&#102;&#114;&#97;&#99;&#123;&#92;&#116;&#101;&#120;&#116;&#123;&#112;&#117;&#110;&#116;&#105;&#125;&#125;&#123;&#92;&#116;&#101;&#120;&#116;&#123;&#80;&#85;&#78;&#84;&#73;&#125;&#125;\" title=\"Rendered by QuickLaTeX.com\" height=\"36\" width=\"137\" style=\"vertical-align: -12px;\"\/><\/p>\n\n\n\n<p>e quindi<\/p>\n\n\n\n<p class=\"has-text-align-center\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.valcon.it\/pp\/wp-content\/ql-cache\/quicklatex.com-187f07df9fdbadb081b00fe2f623d33d_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#92;&#100;&#105;&#115;&#112;&#108;&#97;&#121;&#115;&#116;&#121;&#108;&#101;&#32;&#92;&#116;&#101;&#120;&#116;&#123;&#97;&#114;&#101;&#97;&#125;&#92;&#97;&#112;&#112;&#114;&#111;&#120;&#32;&#92;&#102;&#114;&#97;&#99;&#123;&#92;&#116;&#101;&#120;&#116;&#123;&#112;&#117;&#110;&#116;&#105;&#125;&#125;&#123;&#92;&#116;&#101;&#120;&#116;&#123;&#80;&#85;&#78;&#84;&#73;&#125;&#125;&#92;&#99;&#100;&#111;&#116;&#32;&#92;&#116;&#101;&#120;&#116;&#123;&#65;&#82;&#69;&#65;&#125;\" title=\"Rendered by QuickLaTeX.com\" height=\"36\" width=\"182\" style=\"vertical-align: -12px;\"\/><\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">Valore esatto<\/h2>\n\n\n\n<p>Il valore esatto, ricavato con il <em>calcolo integrale<\/em>, \u00e8<\/p>\n\n\n\n<p class=\"has-text-align-center\"><strong>area<\/strong> = <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.valcon.it\/pp\/wp-content\/ql-cache\/quicklatex.com-0834ff7efc636b73f228613b6f3bebcf_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#92;&#100;&#105;&#115;&#112;&#108;&#97;&#121;&#115;&#116;&#121;&#108;&#101;&#32;&#92;&#105;&#110;&#116;&#95;&#97;&#94;&#98;&#32;&#102;&#40;&#120;&#41;&#92;&#32;&#100;&#120;\" title=\"Rendered by QuickLaTeX.com\" height=\"44\" width=\"87\" style=\"vertical-align: -16px;\"\/> = <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.valcon.it\/pp\/wp-content\/ql-cache\/quicklatex.com-6e72303a823208755888205b4bc4cf8d_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#92;&#100;&#105;&#115;&#112;&#108;&#97;&#121;&#115;&#116;&#121;&#108;&#101;&#32;&#92;&#105;&#110;&#116;&#95;&#49;&#94;&#53;&#32;&#40;&#51;&#120;&#94;&#50;&#43;&#50;&#120;&#43;&#49;&#41;&#92;&#32;&#100;&#120;\" title=\"Rendered by QuickLaTeX.com\" height=\"44\" width=\"162\" style=\"vertical-align: -16px;\"\/> = <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.valcon.it\/pp\/wp-content\/ql-cache\/quicklatex.com-fdebd3dd96059ee06462a2f2e6a0d256_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#92;&#100;&#111;&#116;&#115;\" title=\"Rendered by QuickLaTeX.com\" height=\"2\" width=\"19\" style=\"vertical-align: 0px;\"\/> = <strong>152<\/strong><\/p>\n\n\n\n<p>Quindi<\/p>\n\n\n\n<p class=\"has-text-align-center\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.valcon.it\/pp\/wp-content\/ql-cache\/quicklatex.com-ba504be31354fdf2e6711f795811d9ec_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#92;&#100;&#105;&#115;&#112;&#108;&#97;&#121;&#115;&#116;&#121;&#108;&#101;&#32;&#92;&#102;&#114;&#97;&#99;&#123;&#92;&#116;&#101;&#120;&#116;&#123;&#97;&#114;&#101;&#97;&#125;&#125;&#123;&#92;&#116;&#101;&#120;&#116;&#123;&#65;&#82;&#69;&#65;&#125;&#125;\" title=\"Rendered by QuickLaTeX.com\" height=\"32\" width=\"52\" style=\"vertical-align: -12px;\"\/> = <img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.valcon.it\/pp\/wp-content\/ql-cache\/quicklatex.com-d7affb5e894d1d48ddff6ce1c984ab86_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#92;&#100;&#105;&#115;&#112;&#108;&#97;&#121;&#115;&#116;&#121;&#108;&#101;&#32;&#92;&#102;&#114;&#97;&#99;&#123;&#92;&#116;&#101;&#120;&#116;&#123;&#49;&#53;&#50;&#125;&#125;&#123;&#92;&#116;&#101;&#120;&#116;&#123;&#51;&#52;&#52;&#125;&#125;\" title=\"Rendered by QuickLaTeX.com\" height=\"37\" width=\"27\" style=\"vertical-align: -12px;\"\/> = 0,44186&#8230;<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<form>\n\n<figure class=\"wp-block-table is-style-stripes\"><table>\n<thead><tr><th><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.valcon.it\/pp\/wp-content\/ql-cache\/quicklatex.com-acf7456e0ee077cd613cfc6d9ccd3bd3_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#80;&#85;&#78;&#84;&#73;\" title=\"Rendered by QuickLaTeX.com\" height=\"12\" width=\"66\" style=\"vertical-align: 0px;\"\/><\/th><th><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.valcon.it\/pp\/wp-content\/ql-cache\/quicklatex.com-c7e8da6998db4550b8e9cf9dc67cf1e1_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#112;&#117;&#110;&#116;&#105;\" title=\"Rendered by QuickLaTeX.com\" height=\"16\" width=\"43\" style=\"vertical-align: -4px;\"\/><\/th><th><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.valcon.it\/pp\/wp-content\/ql-cache\/quicklatex.com-65553327c6f4b7214ee766394f9e04f0_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#92;&#100;&#105;&#115;&#112;&#108;&#97;&#121;&#115;&#116;&#121;&#108;&#101;&#32;&#92;&#102;&#114;&#97;&#99;&#123;&#112;&#117;&#110;&#116;&#105;&#125;&#123;&#80;&#85;&#78;&#84;&#73;&#125;\" title=\"Rendered by QuickLaTeX.com\" height=\"36\" width=\"67\" style=\"vertical-align: -12px;\"\/><\/th><th><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.valcon.it\/pp\/wp-content\/ql-cache\/quicklatex.com-21d56117359315bf57471cd69d85aa47_l3.png\" class=\"ql-img-inline-formula quicklatex-auto-format\" alt=\"&#97;&#114;&#101;&#97;\" title=\"Rendered by QuickLaTeX.com\" height=\"8\" width=\"35\" style=\"vertical-align: 0px;\"\/><\/th><th><input type=\"button\" value=\"ESEGUI!\" onclick=\"mc()\"><\/th>\n<\/tr><\/thead>\n<tbody>\n<tr><td align=\"right\"><strong>10<\/strong><\/td><td align=\"right\" id=\"p10\">?<\/td>     <td id=\"r10\">?<\/td>     <td id=\"a10\"><strong>?<\/strong><\/td>     <\/tr>\n<tr><td align=\"right\"><strong>100<\/strong><\/td><td  align=\"right\"id=\"p100\">?<\/td>    <td id=\"r100\">?<\/td>    <td id=\"a100\"><strong>?<\/strong><\/td>    <\/tr>    \n<tr><td align=\"right\"><strong>1 000<\/strong><\/td>  <td align=\"right\" id=\"p1000\">?<\/td>   <td id=\"r1000\">?<\/td>   <td id=\"a1000\"><strong>?<\/strong><\/td>  <\/tr>\n<tr><td align=\"right\"><strong>10 000<\/strong><\/td> <td align=\"right\" id=\"p10000\">?<\/td>  <td id=\"r10000\">?<\/td>  <td id=\"a10000\"><strong>?<\/strong><\/td> <\/tr>\n<tr><td align=\"right\"><strong>100 000<\/strong><\/td> <td align=\"right\" id=\"p100000\">?<\/td>  <td id=\"r100000\">?<\/td>  <td id=\"a100000\"><strong>?<\/strong><\/td> <\/tr>\n<tr><td align=\"right\"><strong>1 000 000<\/strong><\/td> <td align=\"right\" id=\"p1000000\">?<\/td>  <td id=\"r1000000\">?<\/td>  <td id=\"a1000000\"><strong>?<\/strong><\/td> <\/tr>\n<tr><td><\/td><td><\/td><td>0,44186<\/td><td>152<\/td><\/tr>\n<\/table><\/figure>\n\n<\/form>\n<script>function arrotonda(x){return \"<strong>\" + Math.round(x*1000000)\/1000000 + \"<\/strong>\"}\nfunction f(x) { return 3*x*x+2*x+1; }a=1;b=5;b_a =b-a;fb  =f(b);AREA=b_a*fb;function rx() { return b_a*Math.random()+a; }function ry() { return  fb*Math.random()  ; }PUNTI1=     10;PUNTI2=    100;PUNTI3=   1000;PUNTI4=  10000;PUNTI5= 100000;PUNTI6=1000000;function mc(){       punti=0;       for(i=1; i<=PUNTI1; i++)    {        x=rx();                     y=ry();                       fx=f(x);                      if(y <= fx) punti++;              }    ratio=punti\/PUNTI1; area=arrotonda(ratio*AREA);    document.getElementById(\"p10\").innerHTML=punti;    document.getElementById(\"r10\").innerHTML=ratio; document.getElementById(\"a10\").innerHTML=area;    for(i=PUNTI1+1; i<=PUNTI2; i++)    {        x=rx();                       y=ry();                       fx=f(x);        if(y <= fx) punti++;    }    ratio=punti\/PUNTI2; area=arrotonda(ratio*AREA);    document.getElementById(\"p100\").innerHTML=punti;    document.getElementById(\"r100\").innerHTML=ratio; document.getElementById(\"a100\").innerHTML=area;    for(i=PUNTI2+1; i<=PUNTI3; i++)    {        x=rx();                       y=ry();                       fx=f(x);        if(y <= fx) punti++;            }    ratio=punti\/PUNTI3; area=arrotonda(ratio*AREA);    document.getElementById(\"p1000\").innerHTML=punti;    document.getElementById(\"r1000\").innerHTML=ratio; document.getElementById(\"a1000\").innerHTML=area;    for(i=PUNTI3+1; i<=PUNTI4; i++)    {        x=rx();                     y=ry();          fx=f(x);        if(y <= fx) punti++;    }    ratio=punti\/PUNTI4; area=arrotonda(ratio*AREA);    document.getElementById(\"p10000\").innerHTML=punti;    document.getElementById(\"r10000\").innerHTML=ratio; document.getElementById(\"a10000\").innerHTML=area;    for(i=PUNTI4+1; i<=PUNTI5; i++)    {        x=rx();                       y=ry();                       fx=f(x);        if(y <= fx) punti++;    }    ratio=punti\/PUNTI5; area=arrotonda(ratio*AREA);\n    document.getElementById(\"p100000\").innerHTML=punti;    document.getElementById(\"r100000\").innerHTML=ratio; document.getElementById(\"a100000\").innerHTML=area;        for(i=PUNTI5+1; i<=PUNTI6; i++)    {        x=rx();                       y=ry();    fx=f(x);                   if(y<=fx) punti++;          }    ratio=punti\/PUNTI6; area=arrotonda(ratio*AREA);    document.getElementById(\"p1000000\").innerHTML=punti;    document.getElementById(\"r1000000\").innerHTML=ratio; document.getElementById(\"a1000000\").innerHTML=area;}<\/script>","protected":false},"excerpt":{"rendered":"<p>Esercizio del libro di testo Data la funzione&nbsp; calcolare l&#8217;integrale definito della funzione da&nbsp;a=1&nbsp;a b=5. Nell&#8217;intervallo [1, 5] la funzione \u00e8 continua, crescente. Assume il valore massimo nell&#8217;estremo a destra, per x=5, Il grafico della funzione \u00e8 compreso nel rettangolo individuato dai punti Siano Osserva Come approssimare il valore di area? Per PUNTI&nbsp;abbastanza grande e &#8230; <a title=\"Integrazione numerica con metodo Monte Carlo\" class=\"read-more\" href=\"https:\/\/www.valcon.it\/pp\/integrazione-numerica-monte-carlo\/\" aria-label=\"Per saperne di pi\u00f9 su Integrazione numerica con metodo Monte Carlo\">Leggi tutto<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[118,83],"tags":[],"class_list":["post-4830","post","type-post","status-publish","format-standard","hentry","category-probabilita-e-statistica","category-javascript"],"_links":{"self":[{"href":"https:\/\/www.valcon.it\/pp\/wp-json\/wp\/v2\/posts\/4830","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.valcon.it\/pp\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.valcon.it\/pp\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.valcon.it\/pp\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.valcon.it\/pp\/wp-json\/wp\/v2\/comments?post=4830"}],"version-history":[{"count":17,"href":"https:\/\/www.valcon.it\/pp\/wp-json\/wp\/v2\/posts\/4830\/revisions"}],"predecessor-version":[{"id":63749,"href":"https:\/\/www.valcon.it\/pp\/wp-json\/wp\/v2\/posts\/4830\/revisions\/63749"}],"wp:attachment":[{"href":"https:\/\/www.valcon.it\/pp\/wp-json\/wp\/v2\/media?parent=4830"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.valcon.it\/pp\/wp-json\/wp\/v2\/categories?post=4830"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.valcon.it\/pp\/wp-json\/wp\/v2\/tags?post=4830"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}