<?xml version="1.0" encoding="iso-8859-1" ?> 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0//EN" 
"http://www.w3.org/Math/DTD/mathml2/xhtml-math11-f.dtd" > 
<?xml-stylesheet type="text/css" href="montecarlo2010.css"?> 
<html  
xmlns="http://www.w3.org/1999/xhtml"  
><head><title>Project 1:
Analyzing Monte Carlo Integration</title> 
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> 
<meta name="generator" content="TeX4ht (http://www.cse.ohio-state.edu/~gurari/TeX4ht/)" /> 
<meta name="originator" content="TeX4ht (http://www.cse.ohio-state.edu/~gurari/TeX4ht/)" /> 
<!-- xhtml,mozilla --> 
<meta name="src" content="montecarlo2010.tex" /> 
<meta name="date" content="2010-12-01 13:34:00" /> 
<link rel="stylesheet" type="text/css" href="montecarlo2010.css" /> 
</head><body 
>
   <div class="maketitle">
                                                                  

                                                                  
                                                                  

                                                                  

<h2 class="titleHead">Project 1:<br />
Analyzing Monte Carlo Integration</h2>
<div class="author" ><span 
class="cmr-12">Steve Dunbar</span>
<br /><span 
class="cmr-12">Math 489/889</span>
<br />   <span 
class="cmr-12">Fall 2010</span></div><br />
<div class="date" ><span 
class="cmr-12">December 1, 2010</span></div>
   </div>
<!--l. 24--><p class="indent" >   One of the methods used extensively in mathematical finance is the <span 
class="cmti-10">Monte Carlo</span>
<span 
class="cmti-10">method</span>. A Monte Carlo method is &#x201C;Any method which solves a problem by
generating suitable random numbers and observing that fraction of the numbers
obeying some property or properties. The method is useful for obtaining numerical
solutions to problems which are too complicated to solve analytically. It was named
by S. Ulam, who in 1946 became the first mathematician to dignify this approach
with a name, in honor of a relative having a propensity to gamble &#x2026;&#x201D; (from Weisstein,
Eric W. &#x201D;Monte Carlo Method.&#x201D; From MathWorld&#x2013;A Wolfram Web Resource.
<a 
href="http://mathworld.wolfram.com/MonteCarloMethod.html" >,</a>http://mathworld.wolfram.com/MonteCarloMethod.html.)
</p><!--l. 34--><p class="indent" >   We don&#x2019;t have the time or the background to thoroughly explore the huge variety
of Monte Carlo methods, and the complicated problems they are used to solve,
especially in mathematical finance. However, we can get some insight into basic
Monte Carlo methods with some well-chosen examples. In fact, we will use the
probability theory that we have developed to analyze the likely error that this
probabilistic method creates.
</p><!--l. 42--><p class="indent" >   Recall that <!--l. 42--><math 
 xmlns="http://www.w3.org/1998/Math/MathML" display="inline" ><mrow 
><mi 
>E</mi> <mfenced separators="" 
open="["  close="]" ><mrow><mi 
>X</mi></mrow></mfenced> <mo 
class="MathClass-rel">=</mo><msubsup><mrow 
><mo 
class="MathClass-op"> &#x222B;
 <!--nolimits--></mo><!--nolimits--></mrow><mrow 
><mo 
class="MathClass-bin">&#x2212;</mo><mi 
>&#x221E;</mi></mrow><mrow 
><mi 
>&#x221E;</mi></mrow></msubsup 
><mi 
>x</mi><mi 
>f</mi><mrow ><mo 
class="MathClass-open">(</mo><mrow><mi 
>x</mi></mrow><mo 
class="MathClass-close">)</mo></mrow><mspace width="0em" class="thinspace"/><mi 
>d</mi><mi 
>x</mi></mrow></math> where
<!--l. 42--><math 
 xmlns="http://www.w3.org/1998/Math/MathML" display="inline" ><mrow 
><mi 
>f</mi><mrow ><mo 
class="MathClass-open">(</mo><mrow><mi 
>x</mi></mrow><mo 
class="MathClass-close">)</mo></mrow></mrow></math> is the p.d.f.&#x00A0;of the
random variable <!--l. 43--><math 
 xmlns="http://www.w3.org/1998/Math/MathML" display="inline" ><mrow 
><mi 
>X</mi></mrow></math>.
Slightly generalizing, <!--l. 44--><math 
 xmlns="http://www.w3.org/1998/Math/MathML" display="inline" ><mrow 
><mi 
>E</mi> <mfenced separators="" 
open="["  close="]" ><mrow><mi 
>G</mi><mrow ><mo 
class="MathClass-open">(</mo><mrow><mi 
>X</mi></mrow><mo 
class="MathClass-close">)</mo></mrow></mrow></mfenced> <mo 
class="MathClass-rel">=</mo><msubsup><mrow 
><mo 
class="MathClass-op"> &#x222B;
 <!--nolimits--></mo><!--nolimits--></mrow><mrow 
><mo 
class="MathClass-bin">&#x2212;</mo><mi 
>&#x221E;</mi></mrow><mrow 
><mi 
>&#x221E;</mi></mrow></msubsup 
><mi 
>G</mi><mrow ><mo 
class="MathClass-open">(</mo><mrow><mi 
>x</mi></mrow><mo 
class="MathClass-close">)</mo></mrow><mi 
>f</mi><mrow ><mo 
class="MathClass-open">(</mo><mrow><mi 
>x</mi></mrow><mo 
class="MathClass-close">)</mo></mrow><mspace width="0em" class="thinspace"/><mi 
>d</mi><mi 
>x</mi></mrow></math>
when <!--l. 45--><math 
 xmlns="http://www.w3.org/1998/Math/MathML" display="inline" ><mrow 
><mi 
>G</mi><mrow ><mo 
class="MathClass-open">(</mo><mrow><mo 
class="MathClass-bin">&#x22C5;</mo></mrow><mo 
class="MathClass-close">)</mo></mrow></mrow></math> is some function
defined on the range of <!--l. 45--><math 
 xmlns="http://www.w3.org/1998/Math/MathML" display="inline" ><mrow 
><mi 
>X</mi></mrow></math>.
We have already used this idea when we defined the m.g.f.
</p><!--l. 48--><p class="indent" >   Suppose we wish to numerically evaluate
<!--l. 48--><math 
 xmlns="http://www.w3.org/1998/Math/MathML" display="inline" ><mrow 
><mi 
>J</mi> <mo 
class="MathClass-rel">=</mo><msubsup><mrow 
><mo 
class="MathClass-op"> &#x222B;
 <!--nolimits--></mo><!--nolimits--></mrow><mrow 
><mn>0</mn></mrow><mrow 
><mi 
>&#x03C0;</mi><mo 
class="MathClass-bin">&#x2215;</mo><mn>2</mn></mrow></msubsup 
><mo class="qopname"> cos</mo><!--nolimits--><mrow ><mo 
class="MathClass-open">(</mo><mrow><mi 
>x</mi></mrow><mo 
class="MathClass-close">)</mo></mrow><mspace width="0em" class="thinspace"/><mi 
>d</mi><mi 
>x</mi></mrow></math>
reliably to some specified relative error. (Although we can evaluate this integral with
basic calculus, pretend that this is an integral which is too complicated to solve
analytically. ) We notice that we could consider
                                                                  

                                                                  
</p>
   <div class="math-display"><!--l. 53--><math 
 xmlns="http://www.w3.org/1998/Math/MathML" display="block" ><mrow 
>
                          <msubsup><mrow 
><mo 
class="MathClass-op">&#x222B;
 <!--nolimits--></mo><!--nolimits--></mrow><mrow 
><mn>0</mn></mrow><mrow 
><mi 
>&#x03C0;</mi><mo 
class="MathClass-bin">&#x2215;</mo><mn>2</mn></mrow></msubsup 
><mo class="qopname"> cos</mo><!--nolimits--><mrow ><mo 
class="MathClass-open">(</mo><mrow><mi 
>x</mi></mrow><mo 
class="MathClass-close">)</mo></mrow><mspace width="0em" class="thinspace"/><mi 
>d</mi><mi 
>x</mi> <mo 
class="MathClass-rel">=</mo> <mfrac><mrow 
><mi 
>&#x03C0;</mi></mrow> 
<mrow 
><mn>2</mn></mrow></mfrac> <msubsup><mrow 
><mo class="qopname">&#x222B; 
<!--nolimits--></mo><!--nolimits--></mrow><mrow 
><mn>0</mn></mrow><mrow 
><mi 
>&#x03C0;</mi><mo 
class="MathClass-bin">&#x2215;</mo><mn>2</mn></mrow></msubsup 
><mo class="qopname"> cos</mo><!--nolimits--><mrow ><mo 
class="MathClass-open">(</mo><mrow><mi 
>x</mi></mrow><mo 
class="MathClass-close">)</mo></mrow> <mfrac><mrow 
><mn>2</mn></mrow>
<mrow 
><mi 
>&#x03C0;</mi></mrow></mfrac><mspace width="0em" class="thinspace"/><mi 
>d</mi><mi 
>x</mi>
</mrow></math></div>
<!--l. 56--><p class="nopar" > and that
</p>
   <div class="math-display"><!--l. 57--><math 
 xmlns="http://www.w3.org/1998/Math/MathML" display="block" ><mrow 
>
                                <mi 
>E</mi> <mfenced separators="" 
open="["  close="]" ><mrow><mo class="qopname">cos</mo><!--nolimits--><mrow ><mo 
class="MathClass-open">(</mo><mrow><mi 
>X</mi></mrow><mo 
class="MathClass-close">)</mo></mrow></mrow></mfenced> <mo 
class="MathClass-rel">=</mo><msubsup><mrow 
><mo 
class="MathClass-op"> &#x222B;
 <!--nolimits--></mo><!--nolimits--></mrow><mrow 
><mn>0</mn></mrow><mrow 
><mi 
>&#x03C0;</mi><mo 
class="MathClass-bin">&#x2215;</mo><mn>2</mn></mrow></msubsup 
><mo class="qopname"> cos</mo><!--nolimits--><mrow ><mo 
class="MathClass-open">(</mo><mrow><mi 
>x</mi></mrow><mo 
class="MathClass-close">)</mo></mrow> <mfrac><mrow 
><mn>2</mn></mrow>
<mrow 
><mi 
>&#x03C0;</mi></mrow></mfrac><mspace width="0em" class="thinspace"/><mi 
>d</mi><mi 
>x</mi>
</mrow></math></div>
<!--l. 59--><p class="nopar" > is the mean of <!--l. 59--><math 
 xmlns="http://www.w3.org/1998/Math/MathML" display="inline" ><mrow 
><mo class="qopname">cos</mo><!--nolimits--><mrow ><mo 
class="MathClass-open">(</mo><mrow><mi 
>X</mi></mrow><mo 
class="MathClass-close">)</mo></mrow></mrow></math>, where
<!--l. 59--><math 
 xmlns="http://www.w3.org/1998/Math/MathML" display="inline" ><mrow 
><mi 
>X</mi></mrow></math> is a uniformly distributed
random variable on <!--l. 60--><math 
 xmlns="http://www.w3.org/1998/Math/MathML" display="inline" ><mrow 
><mrow ><mo 
class="MathClass-open">[</mo><mrow><mn>0</mn><mo 
class="MathClass-punc">,</mo><mi 
>&#x03C0;</mi><mo 
class="MathClass-bin">&#x2215;</mo><mn>2</mn></mrow><mo 
class="MathClass-close">]</mo></mrow></mrow></math>.
Therefore
</p>
                                                                  

                                                                  
   <div class="math-display"><!--l. 61--><math 
 xmlns="http://www.w3.org/1998/Math/MathML" display="block" ><mrow 
>
                                         <mi 
>J</mi> <mo 
class="MathClass-rel">=</mo> <mfrac><mrow 
><mi 
>&#x03C0;</mi></mrow> 
<mrow 
><mn>2</mn></mrow></mfrac> <mi 
>E</mi> <mfenced separators="" 
open="["  close="]" ><mrow><mo class="qopname">cos</mo><!--nolimits--><mrow ><mo 
class="MathClass-open">(</mo><mrow><mi 
>X</mi></mrow><mo 
class="MathClass-close">)</mo></mrow></mrow></mfenced><mo 
class="MathClass-punc">.</mo>
</mrow></math></div>
<!--l. 63--><p class="nopar" > But we have another way to evaluate the mean and therefore the integral,
namely
</p>
   <div class="math-display"><!--l. 65--><math 
 xmlns="http://www.w3.org/1998/Math/MathML" display="block" ><mrow 
>
                                  <msub><mrow 
><mi 
>J</mi></mrow><mrow 
><mi 
>n</mi></mrow></msub 
> <mo 
class="MathClass-rel">=</mo> <mfrac><mrow 
><mi 
>&#x03C0;</mi></mrow> 
<mrow 
><mn>2</mn></mrow></mfrac> <mo 
class="MathClass-bin">&#x22C5;</mo> <mfrac><mrow 
><mn>1</mn></mrow> 
<mrow 
><mi 
>n</mi></mrow></mfrac><munderover accentunder="false" accent="false"><mrow  
><mo mathsize="big" 
>&#x2211;</mo>
  </mrow><mrow 
><mi 
>i</mi><mo 
class="MathClass-rel">=</mo><mn>1</mn></mrow><mrow 
><mi 
>n</mi></mrow></munderover 
><mo class="qopname"> cos</mo><!--nolimits--><mrow ><mo 
class="MathClass-open">(</mo><mrow><msub><mrow 
><mi 
>X</mi></mrow><mrow 
>
<mi 
>i</mi></mrow></msub 
></mrow><mo 
class="MathClass-close">)</mo></mrow>
</mrow></math></div>
<!--l. 67--><p class="nopar" > where the <!--l. 67--><math 
 xmlns="http://www.w3.org/1998/Math/MathML" display="inline" ><mrow 
><msub><mrow 
><mi 
>X</mi></mrow><mrow 
><mi 
>k</mi></mrow></msub 
></mrow></math>
are uniformly distributed random numbers on the interval
<!--l. 68--><math 
 xmlns="http://www.w3.org/1998/Math/MathML" display="inline" ><mrow 
><mrow ><mo 
class="MathClass-open">[</mo><mrow><mn>0</mn><mo 
class="MathClass-punc">,</mo><mi 
>&#x03C0;</mi><mo 
class="MathClass-bin">&#x2215;</mo><mn>2</mn></mrow><mo 
class="MathClass-close">]</mo></mrow></mrow></math>.
     </p><ol  class="enumerate1" >
     <li 
  class="enumerate" id="x1-3x1">For preliminary reference, use calculus to symbolically evaluate <!--l. 73--><math 
 xmlns="http://www.w3.org/1998/Math/MathML" display="inline" ><mrow 
><mi 
>&#x03BC;</mi> <mo 
class="MathClass-rel">=</mo> <mi 
>E</mi> <mfenced separators="" 
open="["  close="]" ><mrow><mo class="qopname">cos</mo><!--nolimits--><mrow ><mo 
class="MathClass-open">(</mo><mrow><mi 
>X</mi></mrow><mo 
class="MathClass-close">)</mo></mrow></mrow></mfenced></mrow></math>
     and <!--l. 73--><math 
 xmlns="http://www.w3.org/1998/Math/MathML" display="inline" ><mrow 
><msup><mrow 
><mi 
>&#x03C3;</mi></mrow><mrow 
><mn>2</mn></mrow></msup 
> <mo 
class="MathClass-rel">=</mo><mo class="qopname"> Var</mo><!--nolimits--> <mfenced separators="" 
open="["  close="]" ><mrow><mo class="qopname">cos</mo><!--nolimits--><mrow ><mo 
class="MathClass-open">(</mo><mrow><mi 
>X</mi></mrow><mo 
class="MathClass-close">)</mo></mrow></mrow></mfenced></mrow></math>.
     Numerically evaluate both to at least 5 places of accuracy.
     </li>
     <li 
  class="enumerate" id="x1-5x2">Express the mean and variance of <!--l. 76--><math 
 xmlns="http://www.w3.org/1998/Math/MathML" display="inline" ><mrow 
><msub><mrow 
><mi 
>J</mi></mrow><mrow 
><mi 
>n</mi></mrow></msub 
></mrow></math>
     in terms of <!--l. 76--><math 
 xmlns="http://www.w3.org/1998/Math/MathML" display="inline" ><mrow 
><mi 
>&#x03BC;</mi></mrow></math>
     and <!--l. 77--><math 
 xmlns="http://www.w3.org/1998/Math/MathML" display="inline" ><mrow 
><msup><mrow 
><mi 
>&#x03C3;</mi></mrow><mrow 
><mn>2</mn></mrow></msup 
></mrow></math>
     respectively.
     </li>
     <li 
  class="enumerate" id="x1-7x3">Justify that
                                                                  

                                                                  
<div class="math-display"><!--l. 80--><math 
 xmlns="http://www.w3.org/1998/Math/MathML" display="block" ><mrow 
>
                              <mfrac><mrow 
><msub><mrow 
><mi 
>J</mi></mrow><mrow 
><mi 
>n</mi></mrow></msub 
> <mo 
class="MathClass-bin">&#x2212;</mo> <mi 
>J</mi></mrow>
<mrow 
><msqrt><mrow><mo class="qopname">Var</mo> <!--nolimits--> <mfenced separators="" 
open="["  close="]" ><mrow><msub><mrow 
><mi 
>J</mi></mrow><mrow 
><mi 
>n</mi> </mrow> </msub 
> </mrow></mfenced></mrow></msqrt></mrow></mfrac>
</mrow></math></div>
     <!--l. 82--><p class="nopar" > is approximately normally distributed, and specify the mean and variance
     of the distribution.
     </p></li>
     <li 
  class="enumerate" id="x1-9x4">Now find <!--l. 85--><math 
 xmlns="http://www.w3.org/1998/Math/MathML" display="inline" ><mrow 
><mi 
>z</mi></mrow></math>
     so that
<div class="math-display"><!--l. 86--><math 
 xmlns="http://www.w3.org/1998/Math/MathML" display="block" ><mrow 
>
                       <mi 
>&#x2119;</mi> <mfenced separators="" 
open="["  close="]" ><mrow><mo 
class="MathClass-rel">|</mo> <mfrac><mrow 
><msub><mrow 
><mi 
>J</mi></mrow><mrow 
><mi 
>n</mi></mrow></msub 
> <mo 
class="MathClass-bin">&#x2212;</mo> <mi 
>J</mi></mrow>
<mrow 
><msqrt><mrow><mo class="qopname">Var</mo> <!--nolimits--> <mfenced separators="" 
open="["  close="]" ><mrow><msub><mrow 
><mi 
>J</mi></mrow><mrow 
><mi 
>n</mi> </mrow> </msub 
> </mrow></mfenced></mrow></msqrt></mrow></mfrac><mo 
class="MathClass-rel">|</mo> <mo 
class="MathClass-rel">&#x003C;</mo> <mi 
>z</mi></mrow></mfenced> <mo 
class="MathClass-rel">&#x2265;</mo> <mn>0</mn><mo 
class="MathClass-punc">.</mo><mn>9</mn><mn>9</mn>
</mrow></math></div>
     <!--l. 88--><p class="nopar" >
     </p></li>
     <li 
  class="enumerate" id="x1-11x5">The absolute error of the estimate is <!--l. 90--><math 
 xmlns="http://www.w3.org/1998/Math/MathML" display="inline" ><mrow 
><mo 
class="MathClass-rel">|</mo><msub><mrow 
><mi 
>J</mi></mrow><mrow 
><mi 
>n</mi></mrow></msub 
> <mo 
class="MathClass-bin">&#x2212;</mo> <mi 
>J</mi><mo 
class="MathClass-rel">|</mo></mrow></math>.
     We desire that with probability greater than <!--l. 91--><math 
 xmlns="http://www.w3.org/1998/Math/MathML" display="inline" ><mrow 
><mn>0</mn><mo 
class="MathClass-punc">.</mo><mn>9</mn><mn>9</mn></mrow></math>,
     the absolute error from our experiment be less than 0.05. Find a value of
     <!--l. 93--><math 
 xmlns="http://www.w3.org/1998/Math/MathML" display="inline" ><mrow 
><mi 
>n</mi></mrow></math>
     large enough that the experiment reliably (probability <!--l. 94--><math 
 xmlns="http://www.w3.org/1998/Math/MathML" display="inline" ><mrow 
><mo 
class="MathClass-rel">&#x003E;</mo> <mn>0</mn><mo 
class="MathClass-punc">.</mo><mn>9</mn><mn>9</mn></mrow></math>
     ) generates this level of accuracy.
     </li>
     <li 
  class="enumerate" id="x1-13x6">Using some software, (A spreadsheet program such as Excel is sufficient,
     but other software such as Maple, Mathematica, Octave, Matlab, R, perl,
                                                                  

                                                                  
     and Python will also be satisfactory) actually do the Monte Carlo method
     to evaluate <!--l. 99--><math 
 xmlns="http://www.w3.org/1998/Math/MathML" display="inline" ><mrow 
><msubsup><mrow 
><mo 
class="MathClass-op">&#x222B;
 <!--nolimits--></mo><!--nolimits--></mrow><mrow 
><mn>0</mn></mrow><mrow 
><mi 
>&#x03C0;</mi><mo 
class="MathClass-bin">&#x2215;</mo><mn>2</mn></mrow></msubsup 
><mo class="qopname"> cos</mo><!--nolimits--><mrow ><mo 
class="MathClass-open">(</mo><mrow><mi 
>x</mi></mrow><mo 
class="MathClass-close">)</mo></mrow><mspace width="0em" class="thinspace"/><mi 
>d</mi><mi 
>x</mi></mrow></math>.
     </li>
     <li 
  class="enumerate" id="x1-15x7">Calculate the integral
<div class="math-display"><!--l. 103--><math 
 xmlns="http://www.w3.org/1998/Math/MathML" display="block" ><mrow 
>
                        <mi 
>J</mi> <mo 
class="MathClass-rel">=</mo><msubsup><mrow 
><mo 
class="MathClass-op"> &#x222B;
 <!--nolimits--></mo><!--nolimits--></mrow><mrow 
><mn>0</mn></mrow><mrow 
><mi 
>&#x03C0;</mi><mo 
class="MathClass-bin">&#x2215;</mo><mn>2</mn></mrow></msubsup 
><mo class="qopname"> sin</mo><!--nolimits--><mrow ><mo 
class="MathClass-open">(</mo><mrow><mi 
>x</mi></mrow><mo 
class="MathClass-close">)</mo></mrow><mspace width="0em" class="thinspace"/><mi 
>d</mi><mi 
>x</mi>
</mrow></math></div>
     <!--l. 105--><p class="nopar" > by a Monte Carlo method so that with probability <!--l. 105--><math 
 xmlns="http://www.w3.org/1998/Math/MathML" display="inline" ><mrow 
><mi 
>P</mi> <mo 
class="MathClass-rel">&#x2265;</mo> <mn>0</mn><mo 
class="MathClass-punc">.</mo><mn>9</mn><mn>9</mn></mrow></math>
     the absolute error will not exceed <!--l. 106--><math 
 xmlns="http://www.w3.org/1998/Math/MathML" display="inline" ><mrow 
><mn>0</mn><mo 
class="MathClass-punc">.</mo><mn>0</mn><mn>5</mn></mrow></math>.
     Use only the intuition gained from the previous analysis.</p></li></ol>
    
</body> 
</html> 

                                                                  



