mirror of
https://github.com/TheAlgorithms/C-Plus-Plus.git
synced 2026-03-24 05:42:59 +08:00
Documentation for 2dadbf73f4
This commit is contained in:
@@ -3,16 +3,18 @@
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
|
||||
<meta name="generator" content="Doxygen 1.9.8"/>
|
||||
<meta name="generator" content="Doxygen 1.10.0"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
||||
<title>Algorithms_in_C++: math/integral_approximation2.cpp File Reference</title>
|
||||
<link href="../../tabs.css" rel="stylesheet" type="text/css"/>
|
||||
<script type="text/javascript" src="../../jquery.js"></script>
|
||||
<script type="text/javascript" src="../../dynsections.js"></script>
|
||||
<script type="text/javascript" src="../../clipboard.js"></script>
|
||||
<link href="../../navtree.css" rel="stylesheet" type="text/css"/>
|
||||
<script type="text/javascript" src="../../resize.js"></script>
|
||||
<script type="text/javascript" src="../../navtreedata.js"></script>
|
||||
<script type="text/javascript" src="../../navtree.js"></script>
|
||||
<script type="text/javascript" src="../../cookie.js"></script>
|
||||
<link href="../../search/search.css" rel="stylesheet" type="text/css"/>
|
||||
<script type="text/javascript" src="../../search/searchdata.js"></script>
|
||||
<script type="text/javascript" src="../../search/search.js"></script>
|
||||
@@ -41,7 +43,7 @@ MathJax.Hub.Config({
|
||||
</table>
|
||||
</div>
|
||||
<!-- end header part -->
|
||||
<!-- Generated by Doxygen 1.9.8 -->
|
||||
<!-- Generated by Doxygen 1.10.0 -->
|
||||
<script type="text/javascript">
|
||||
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
||||
var searchBox = new SearchBox("searchBox", "../../search/",'.html');
|
||||
@@ -53,7 +55,7 @@ var searchBox = new SearchBox("searchBox", "../../search/",'.html');
|
||||
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
||||
$(function() {
|
||||
initMenu('../../',true,false,'search.php','Search');
|
||||
$(document).ready(function() { init_search(); });
|
||||
$(function() { init_search(); });
|
||||
});
|
||||
/* @license-end */
|
||||
</script>
|
||||
@@ -71,7 +73,7 @@ $(function() {
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
|
||||
$(document).ready(function(){initNavTree('db/d40/integral__approximation2_8cpp.html','../../'); initResizable(); });
|
||||
$(function(){initNavTree('db/d40/integral__approximation2_8cpp.html','../../'); initResizable(); });
|
||||
/* @license-end */
|
||||
</script>
|
||||
<div id="doc-content">
|
||||
@@ -132,22 +134,21 @@ Namespaces</h2></td></tr>
|
||||
</table><table class="memberdecls">
|
||||
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="typedef-members" name="typedef-members"></a>
|
||||
Typedefs</h2></td></tr>
|
||||
<tr class="memitem:a56f3ff2501246c5e47bd2ac320a97446" id="r_a56f3ff2501246c5e47bd2ac320a97446"><td class="memItemLeft" align="right" valign="top"><a id="a56f3ff2501246c5e47bd2ac320a97446" name="a56f3ff2501246c5e47bd2ac320a97446"></a>
|
||||
using </td><td class="memItemRight" valign="bottom"><b>math::monte_carlo::Function</b> = <a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/utility/functional/function.html">std::function</a>< double(double &)></td></tr>
|
||||
<tr class="separator:a56f3ff2501246c5e47bd2ac320a97446"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:aa546b0e9315b7d9e9a8f6b71dd643de7" id="r_aa546b0e9315b7d9e9a8f6b71dd643de7"><td class="memItemLeft" align="right" valign="top">using </td><td class="memItemRight" valign="bottom"><a class="el" href="#aa546b0e9315b7d9e9a8f6b71dd643de7">math::monte_carlo::Function</a></td></tr>
|
||||
<tr class="separator:aa546b0e9315b7d9e9a8f6b71dd643de7"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
</table><table class="memberdecls">
|
||||
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="func-members" name="func-members"></a>
|
||||
Functions</h2></td></tr>
|
||||
<tr class="memitem:a71249ee535f16f8ed2e9cc8f0199a2cf" id="r_a71249ee535f16f8ed2e9cc8f0199a2cf"><td class="memItemLeft" align="right" valign="top"><a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector</a>< double > </td><td class="memItemRight" valign="bottom"><a class="el" href="../../db/d40/integral__approximation2_8cpp.html#a71249ee535f16f8ed2e9cc8f0199a2cf">math::monte_carlo::generate_samples</a> (const double &start_point, const <a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/utility/functional/function.html">Function</a> &pdf, const uint32_t &num_samples, const uint32_t &discard=100000)</td></tr>
|
||||
<tr class="memitem:a71249ee535f16f8ed2e9cc8f0199a2cf" id="r_a71249ee535f16f8ed2e9cc8f0199a2cf"><td class="memItemLeft" align="right" valign="top"><a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector</a>< double > </td><td class="memItemRight" valign="bottom"><a class="el" href="#a71249ee535f16f8ed2e9cc8f0199a2cf">math::monte_carlo::generate_samples</a> (const double &start_point, const <a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/utility/functional/function.html">Function</a> &pdf, const uint32_t &num_samples, const uint32_t &discard=100000)</td></tr>
|
||||
<tr class="memdesc:a71249ee535f16f8ed2e9cc8f0199a2cf"><td class="mdescLeft"> </td><td class="mdescRight">short-hand for std::functions used in this implementation <br /></td></tr>
|
||||
<tr class="separator:a71249ee535f16f8ed2e9cc8f0199a2cf"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:af7da9ba8932f1f48b9bbc2d80471af51" id="r_af7da9ba8932f1f48b9bbc2d80471af51"><td class="memItemLeft" align="right" valign="top">double </td><td class="memItemRight" valign="bottom"><a class="el" href="../../db/d40/integral__approximation2_8cpp.html#af7da9ba8932f1f48b9bbc2d80471af51">math::monte_carlo::integral_monte_carlo</a> (const double &start_point, const <a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/utility/functional/function.html">Function</a> &function, const <a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/utility/functional/function.html">Function</a> &pdf, const uint32_t &num_samples=1000000)</td></tr>
|
||||
<tr class="memitem:af7da9ba8932f1f48b9bbc2d80471af51" id="r_af7da9ba8932f1f48b9bbc2d80471af51"><td class="memItemLeft" align="right" valign="top">double </td><td class="memItemRight" valign="bottom"><a class="el" href="#af7da9ba8932f1f48b9bbc2d80471af51">math::monte_carlo::integral_monte_carlo</a> (const double &start_point, const <a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/utility/functional/function.html">Function</a> &function, const <a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/utility/functional/function.html">Function</a> &pdf, const uint32_t &num_samples=1000000)</td></tr>
|
||||
<tr class="memdesc:af7da9ba8932f1f48b9bbc2d80471af51"><td class="mdescLeft"> </td><td class="mdescRight">Compute an approximation of an integral using Monte Carlo integration. <br /></td></tr>
|
||||
<tr class="separator:af7da9ba8932f1f48b9bbc2d80471af51"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:aa8dca7b867074164d5f45b0f3851269d" id="r_aa8dca7b867074164d5f45b0f3851269d"><td class="memItemLeft" align="right" valign="top">static void </td><td class="memItemRight" valign="bottom"><a class="el" href="../../db/d40/integral__approximation2_8cpp.html#aa8dca7b867074164d5f45b0f3851269d">test</a> ()</td></tr>
|
||||
<tr class="memitem:aa8dca7b867074164d5f45b0f3851269d" id="r_aa8dca7b867074164d5f45b0f3851269d"><td class="memItemLeft" align="right" valign="top">static void </td><td class="memItemRight" valign="bottom"><a class="el" href="#aa8dca7b867074164d5f45b0f3851269d">test</a> ()</td></tr>
|
||||
<tr class="memdesc:aa8dca7b867074164d5f45b0f3851269d"><td class="mdescLeft"> </td><td class="mdescRight">Self-test implementations. <br /></td></tr>
|
||||
<tr class="separator:aa8dca7b867074164d5f45b0f3851269d"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
<tr class="memitem:ae66f6b31b5ad750f1fe042a706a4e3d4" id="r_ae66f6b31b5ad750f1fe042a706a4e3d4"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="../../db/d40/integral__approximation2_8cpp.html#ae66f6b31b5ad750f1fe042a706a4e3d4">main</a> ()</td></tr>
|
||||
<tr class="memitem:ae66f6b31b5ad750f1fe042a706a4e3d4" id="r_ae66f6b31b5ad750f1fe042a706a4e3d4"><td class="memItemLeft" align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="#ae66f6b31b5ad750f1fe042a706a4e3d4">main</a> ()</td></tr>
|
||||
<tr class="memdesc:ae66f6b31b5ad750f1fe042a706a4e3d4"><td class="mdescLeft"> </td><td class="mdescRight">Main function. <br /></td></tr>
|
||||
<tr class="separator:ae66f6b31b5ad750f1fe042a706a4e3d4"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
</table>
|
||||
@@ -156,7 +157,25 @@ Functions</h2></td></tr>
|
||||
<p>In mathematics, Monte Carlo integration is a technique for numerical integration using random numbers. It is a particular Monte Carlo method that numerically computes a definite integral. While other algorithms usually evaluate the integrand at a regular grid, Monte Carlo randomly chooses points at which the integrand is evaluated. This method is particularly useful for higher-dimensional integrals.</p>
|
||||
<p>This implementation supports arbitrary pdfs. These pdfs are sampled using the <a href="https://en.wikipedia.org/wiki/Metropolis–Hastings_algorithm" target="_blank">Metropolis-Hastings algorithm</a>. This can be swapped out by every other sampling techniques for example the inverse method. Metropolis-Hastings was chosen because it is the most general and can also be extended for a higher dimensional sampling space.</p>
|
||||
<dl class="section author"><dt>Author</dt><dd><a href="https://github.com/DerAndereDomenic" target="_blank">Domenic Zingsheim</a> </dd></dl>
|
||||
</div><h2 class="groupheader">Function Documentation</h2>
|
||||
</div><h2 class="groupheader">Typedef Documentation</h2>
|
||||
<a id="aa546b0e9315b7d9e9a8f6b71dd643de7" name="aa546b0e9315b7d9e9a8f6b71dd643de7"></a>
|
||||
<h2 class="memtitle"><span class="permalink"><a href="#aa546b0e9315b7d9e9a8f6b71dd643de7">◆ </a></span>Function</h2>
|
||||
|
||||
<div class="memitem">
|
||||
<div class="memproto">
|
||||
<table class="memname">
|
||||
<tr>
|
||||
<td class="memname">using <a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/utility/functional/function.html">math::monte_carlo::Function</a></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div><div class="memdoc">
|
||||
<b>Initial value:</b><div class="fragment"><div class="line"> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/utility/functional/function.html">std::function</a><double(</div>
|
||||
<div class="line"> <span class="keywordtype">double</span>&)></div>
|
||||
<div class="ttc" id="afunction_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/utility/functional/function.html">std::function</a></div></div>
|
||||
</div><!-- fragment -->
|
||||
</div>
|
||||
</div>
|
||||
<h2 class="groupheader">Function Documentation</h2>
|
||||
<a id="a71249ee535f16f8ed2e9cc8f0199a2cf" name="a71249ee535f16f8ed2e9cc8f0199a2cf"></a>
|
||||
<h2 class="memtitle"><span class="permalink"><a href="#a71249ee535f16f8ed2e9cc8f0199a2cf">◆ </a></span>generate_samples()</h2>
|
||||
|
||||
@@ -166,31 +185,22 @@ Functions</h2></td></tr>
|
||||
<tr>
|
||||
<td class="memname"><a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector</a>< double > math::monte_carlo::generate_samples </td>
|
||||
<td>(</td>
|
||||
<td class="paramtype">const double & </td>
|
||||
<td class="paramname"><em>start_point</em>, </td>
|
||||
<td class="paramtype">const double &</td> <td class="paramname"><span class="paramname"><em>start_point</em>, </span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="paramkey"></td>
|
||||
<td></td>
|
||||
<td class="paramtype">const <a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/utility/functional/function.html">Function</a> & </td>
|
||||
<td class="paramname"><em>pdf</em>, </td>
|
||||
<td class="paramtype">const <a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/utility/functional/function.html">Function</a> &</td> <td class="paramname"><span class="paramname"><em>pdf</em>, </span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="paramkey"></td>
|
||||
<td></td>
|
||||
<td class="paramtype">const uint32_t & </td>
|
||||
<td class="paramname"><em>num_samples</em>, </td>
|
||||
<td class="paramtype">const uint32_t &</td> <td class="paramname"><span class="paramname"><em>num_samples</em>, </span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="paramkey"></td>
|
||||
<td></td>
|
||||
<td class="paramtype">const uint32_t & </td>
|
||||
<td class="paramname"><em>discard</em> = <code>100000</code> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td>)</td>
|
||||
<td></td><td></td>
|
||||
<td class="paramtype">const uint32_t &</td> <td class="paramname"><span class="paramname"><em>discard</em><span class="paramdefsep"> = </span><span class="paramdefval">100000</span></span> )</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div><div class="memdoc">
|
||||
@@ -262,31 +272,22 @@ Here is the call graph for this function:</div>
|
||||
<tr>
|
||||
<td class="memname">double math::monte_carlo::integral_monte_carlo </td>
|
||||
<td>(</td>
|
||||
<td class="paramtype">const double & </td>
|
||||
<td class="paramname"><em>start_point</em>, </td>
|
||||
<td class="paramtype">const double &</td> <td class="paramname"><span class="paramname"><em>start_point</em>, </span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="paramkey"></td>
|
||||
<td></td>
|
||||
<td class="paramtype">const <a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/utility/functional/function.html">Function</a> & </td>
|
||||
<td class="paramname"><em>function</em>, </td>
|
||||
<td class="paramtype">const <a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/utility/functional/function.html">Function</a> &</td> <td class="paramname"><span class="paramname"><em>function</em>, </span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="paramkey"></td>
|
||||
<td></td>
|
||||
<td class="paramtype">const <a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/utility/functional/function.html">Function</a> & </td>
|
||||
<td class="paramname"><em>pdf</em>, </td>
|
||||
<td class="paramtype">const <a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/utility/functional/function.html">Function</a> &</td> <td class="paramname"><span class="paramname"><em>pdf</em>, </span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="paramkey"></td>
|
||||
<td></td>
|
||||
<td class="paramtype">const uint32_t & </td>
|
||||
<td class="paramname"><em>num_samples</em> = <code>1000000</code> </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td>)</td>
|
||||
<td></td><td></td>
|
||||
<td class="paramtype">const uint32_t &</td> <td class="paramname"><span class="paramname"><em>num_samples</em><span class="paramdefsep"> = </span><span class="paramdefval">1000000</span></span> )</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div><div class="memdoc">
|
||||
@@ -305,7 +306,7 @@ Here is the call graph for this function:</div>
|
||||
<div class="fragment"><div class="line"><span class="lineno"> 114</span> {</div>
|
||||
<div class="line"><span class="lineno"> 115</span> <span class="keywordtype">double</span> integral = 0.0;</div>
|
||||
<div class="line"><span class="lineno"> 116</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector<double></a> samples =</div>
|
||||
<div class="line"><span class="lineno"> 117</span> <a class="code hl_function" href="../../db/d40/integral__approximation2_8cpp.html#a71249ee535f16f8ed2e9cc8f0199a2cf">generate_samples</a>(start_point, pdf, num_samples);</div>
|
||||
<div class="line"><span class="lineno"> 117</span> <a class="code hl_function" href="#a71249ee535f16f8ed2e9cc8f0199a2cf">generate_samples</a>(start_point, pdf, num_samples);</div>
|
||||
<div class="line"><span class="lineno"> 118</span> </div>
|
||||
<div class="line"><span class="lineno"> 119</span> <span class="keywordflow">for</span> (<span class="keywordtype">double</span> sample : samples) {</div>
|
||||
<div class="line"><span class="lineno"> 120</span> integral += function(sample) / pdf(sample);</div>
|
||||
@@ -313,7 +314,7 @@ Here is the call graph for this function:</div>
|
||||
<div class="line"><span class="lineno"> 122</span> </div>
|
||||
<div class="line"><span class="lineno"> 123</span> <span class="keywordflow">return</span> integral / <span class="keyword">static_cast<</span><span class="keywordtype">double</span><span class="keyword">></span>(samples.<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector/size.html">size</a>());</div>
|
||||
<div class="line"><span class="lineno"> 124</span>}</div>
|
||||
<div class="ttc" id="aintegral__approximation2_8cpp_html_a71249ee535f16f8ed2e9cc8f0199a2cf"><div class="ttname"><a href="../../db/d40/integral__approximation2_8cpp.html#a71249ee535f16f8ed2e9cc8f0199a2cf">math::monte_carlo::generate_samples</a></div><div class="ttdeci">std::vector< double > generate_samples(const double &start_point, const Function &pdf, const uint32_t &num_samples, const uint32_t &discard=100000)</div><div class="ttdoc">short-hand for std::functions used in this implementation</div><div class="ttdef"><b>Definition</b> integral_approximation2.cpp:64</div></div>
|
||||
<div class="ttc" id="aintegral__approximation2_8cpp_html_a71249ee535f16f8ed2e9cc8f0199a2cf"><div class="ttname"><a href="#a71249ee535f16f8ed2e9cc8f0199a2cf">math::monte_carlo::generate_samples</a></div><div class="ttdeci">std::vector< double > generate_samples(const double &start_point, const Function &pdf, const uint32_t &num_samples, const uint32_t &discard=100000)</div><div class="ttdoc">short-hand for std::functions used in this implementation</div><div class="ttdef"><b>Definition</b> integral_approximation2.cpp:64</div></div>
|
||||
<div class="ttc" id="asize_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/container/vector/size.html">std::vector::size</a></div><div class="ttdeci">T size(T... args)</div></div>
|
||||
</div><!-- fragment --><div class="dynheader">
|
||||
Here is the call graph for this function:</div>
|
||||
@@ -332,8 +333,7 @@ Here is the call graph for this function:</div>
|
||||
<tr>
|
||||
<td class="memname">int main </td>
|
||||
<td>(</td>
|
||||
<td class="paramtype">void </td>
|
||||
<td class="paramname"></td><td>)</td>
|
||||
<td class="paramtype">void</td> <td class="paramname"><span class="paramname"></span></td><td>)</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</table>
|
||||
@@ -342,10 +342,10 @@ Here is the call graph for this function:</div>
|
||||
<p>Main function. </p>
|
||||
<dl class="section return"><dt>Returns</dt><dd>0 on exit </dd></dl>
|
||||
<div class="fragment"><div class="line"><span class="lineno"> 215</span> {</div>
|
||||
<div class="line"><span class="lineno"> 216</span> <a class="code hl_function" href="../../db/d40/integral__approximation2_8cpp.html#aa8dca7b867074164d5f45b0f3851269d">test</a>(); <span class="comment">// run self-test implementations</span></div>
|
||||
<div class="line"><span class="lineno"> 216</span> <a class="code hl_function" href="#aa8dca7b867074164d5f45b0f3851269d">test</a>(); <span class="comment">// run self-test implementations</span></div>
|
||||
<div class="line"><span class="lineno"> 217</span> <span class="keywordflow">return</span> 0;</div>
|
||||
<div class="line"><span class="lineno"> 218</span>}</div>
|
||||
<div class="ttc" id="aintegral__approximation2_8cpp_html_aa8dca7b867074164d5f45b0f3851269d"><div class="ttname"><a href="../../db/d40/integral__approximation2_8cpp.html#aa8dca7b867074164d5f45b0f3851269d">test</a></div><div class="ttdeci">static void test()</div><div class="ttdoc">Self-test implementations.</div><div class="ttdef"><b>Definition</b> integral_approximation2.cpp:133</div></div>
|
||||
<div class="ttc" id="aintegral__approximation2_8cpp_html_aa8dca7b867074164d5f45b0f3851269d"><div class="ttname"><a href="#aa8dca7b867074164d5f45b0f3851269d">test</a></div><div class="ttdeci">static void test()</div><div class="ttdoc">Self-test implementations.</div><div class="ttdef"><b>Definition</b> integral_approximation2.cpp:133</div></div>
|
||||
</div><!-- fragment --><div class="dynheader">
|
||||
Here is the call graph for this function:</div>
|
||||
<div class="dyncontent">
|
||||
@@ -366,7 +366,7 @@ Here is the call graph for this function:</div>
|
||||
<tr>
|
||||
<td class="memname">static void test </td>
|
||||
<td>(</td>
|
||||
<td class="paramname"></td><td>)</td>
|
||||
<td class="paramname"><span class="paramname"></span></td><td>)</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</table>
|
||||
@@ -411,7 +411,7 @@ Here is the call graph for this function:</div>
|
||||
<div class="line"><span class="lineno"> 162</span> <span class="keywordflow">return</span> 0.0;</div>
|
||||
<div class="line"><span class="lineno"> 163</span> };</div>
|
||||
<div class="line"><span class="lineno"> 164</span> </div>
|
||||
<div class="line"><span class="lineno"> 165</span> integral = <a class="code hl_function" href="../../db/d40/integral__approximation2_8cpp.html#af7da9ba8932f1f48b9bbc2d80471af51">math::monte_carlo::integral_monte_carlo</a>(</div>
|
||||
<div class="line"><span class="lineno"> 165</span> integral = <a class="code hl_function" href="#af7da9ba8932f1f48b9bbc2d80471af51">math::monte_carlo::integral_monte_carlo</a>(</div>
|
||||
<div class="line"><span class="lineno"> 166</span> (upper_bound - lower_bound) / 2.0, f, pdf);</div>
|
||||
<div class="line"><span class="lineno"> 167</span> </div>
|
||||
<div class="line"><span class="lineno"> 168</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> << <span class="stringliteral">"This number should be close to 10.666666: "</span> << integral</div>
|
||||
@@ -435,7 +435,7 @@ Here is the call graph for this function:</div>
|
||||
<div class="line"><span class="lineno"> 186</span> <span class="keywordflow">return</span> 0.0;</div>
|
||||
<div class="line"><span class="lineno"> 187</span> };</div>
|
||||
<div class="line"><span class="lineno"> 188</span> </div>
|
||||
<div class="line"><span class="lineno"> 189</span> integral = <a class="code hl_function" href="../../db/d40/integral__approximation2_8cpp.html#af7da9ba8932f1f48b9bbc2d80471af51">math::monte_carlo::integral_monte_carlo</a>(</div>
|
||||
<div class="line"><span class="lineno"> 189</span> integral = <a class="code hl_function" href="#af7da9ba8932f1f48b9bbc2d80471af51">math::monte_carlo::integral_monte_carlo</a>(</div>
|
||||
<div class="line"><span class="lineno"> 190</span> (upper_bound - lower_bound) / 2.0, f, pdf);</div>
|
||||
<div class="line"><span class="lineno"> 191</span> </div>
|
||||
<div class="line"><span class="lineno"> 192</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> << <span class="stringliteral">"This number should be close to 1.7182818: "</span> << integral</div>
|
||||
@@ -451,7 +451,7 @@ Here is the call graph for this function:</div>
|
||||
<div class="line"><span class="lineno"> 202</span> <span class="keywordflow">return</span> 1.0 / <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/numeric/math/sqrt.html">std::sqrt</a>(2.0 * M_PI) * <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/numeric/math/exp.html">std::exp</a>(-x * x / 2.0);</div>
|
||||
<div class="line"><span class="lineno"> 203</span> };</div>
|
||||
<div class="line"><span class="lineno"> 204</span> </div>
|
||||
<div class="line"><span class="lineno"> 205</span> integral = <a class="code hl_function" href="../../db/d40/integral__approximation2_8cpp.html#af7da9ba8932f1f48b9bbc2d80471af51">math::monte_carlo::integral_monte_carlo</a>(0.0, f, pdf, 10000000);</div>
|
||||
<div class="line"><span class="lineno"> 205</span> integral = <a class="code hl_function" href="#af7da9ba8932f1f48b9bbc2d80471af51">math::monte_carlo::integral_monte_carlo</a>(0.0, f, pdf, 10000000);</div>
|
||||
<div class="line"><span class="lineno"> 206</span> </div>
|
||||
<div class="line"><span class="lineno"> 207</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> << <span class="stringliteral">"This number should be close to 1.0: "</span> << integral</div>
|
||||
<div class="line"><span class="lineno"> 208</span> << <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/manip/endl.html">std::endl</a>;</div>
|
||||
@@ -460,8 +460,7 @@ Here is the call graph for this function:</div>
|
||||
<div class="ttc" id="acomposite__simpson__rule_8cpp_html_a4251b4df4748a0b9c43a48f61bdd2397"><div class="ttname"><a href="../../d4/d18/composite__simpson__rule_8cpp.html#a4251b4df4748a0b9c43a48f61bdd2397">numerical_methods::simpson_method::f</a></div><div class="ttdeci">double f(double x)</div><div class="ttdoc">A function f(x) that will be used to test the method.</div><div class="ttdef"><b>Definition</b> composite_simpson_rule.cpp:113</div></div>
|
||||
<div class="ttc" id="aendl_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/io/manip/endl.html">std::endl</a></div><div class="ttdeci">T endl(T... args)</div></div>
|
||||
<div class="ttc" id="aexp_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/numeric/math/exp.html">std::exp</a></div><div class="ttdeci">T exp(T... args)</div></div>
|
||||
<div class="ttc" id="afunction_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/utility/functional/function.html">std::function</a></div></div>
|
||||
<div class="ttc" id="aintegral__approximation2_8cpp_html_af7da9ba8932f1f48b9bbc2d80471af51"><div class="ttname"><a href="../../db/d40/integral__approximation2_8cpp.html#af7da9ba8932f1f48b9bbc2d80471af51">math::monte_carlo::integral_monte_carlo</a></div><div class="ttdeci">double integral_monte_carlo(const double &start_point, const Function &function, const Function &pdf, const uint32_t &num_samples=1000000)</div><div class="ttdoc">Compute an approximation of an integral using Monte Carlo integration.</div><div class="ttdef"><b>Definition</b> integral_approximation2.cpp:112</div></div>
|
||||
<div class="ttc" id="aintegral__approximation2_8cpp_html_af7da9ba8932f1f48b9bbc2d80471af51"><div class="ttname"><a href="#af7da9ba8932f1f48b9bbc2d80471af51">math::monte_carlo::integral_monte_carlo</a></div><div class="ttdeci">double integral_monte_carlo(const double &start_point, const Function &function, const Function &pdf, const uint32_t &num_samples=1000000)</div><div class="ttdoc">Compute an approximation of an integral using Monte Carlo integration.</div><div class="ttdef"><b>Definition</b> integral_approximation2.cpp:112</div></div>
|
||||
<div class="ttc" id="alower_bound_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/algorithm/lower_bound.html">std::lower_bound</a></div><div class="ttdeci">T lower_bound(T... args)</div></div>
|
||||
<div class="ttc" id="asin_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/numeric/math/sin.html">std::sin</a></div><div class="ttdeci">T sin(T... args)</div></div>
|
||||
<div class="ttc" id="asqrt_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/numeric/math/sqrt.html">std::sqrt</a></div><div class="ttdeci">T sqrt(T... args)</div></div>
|
||||
@@ -480,7 +479,7 @@ Here is the call graph for this function:</div>
|
||||
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
|
||||
<ul>
|
||||
<li class="navelem"><a class="el" href="../../dir_296d53ceaeaa7e099814a6def439fe8a.html">math</a></li><li class="navelem"><a class="el" href="../../db/d40/integral__approximation2_8cpp.html">integral_approximation2.cpp</a></li>
|
||||
<li class="footer">Generated by <a href="https://www.doxygen.org/index.html"><img class="footer" src="../../doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.8 </li>
|
||||
<li class="footer">Generated by <a href="https://www.doxygen.org/index.html"><img class="footer" src="../../doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.10.0 </li>
|
||||
</ul>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
Reference in New Issue
Block a user