Documentation for 0931d530ae

This commit is contained in:
github-actions
2023-01-22 19:44:10 +00:00
parent a448f64699
commit b48f6e8671
2457 changed files with 9513 additions and 8691 deletions

View File

@@ -3,7 +3,7 @@
<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.5"/>
<meta name="generator" content="Doxygen 1.9.6"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Algorithms_in_C++: numerical_methods/midpoint_integral_method.cpp File Reference</title>
<link href="../../tabs.css" rel="stylesheet" type="text/css"/>
@@ -41,7 +41,7 @@ MathJax.Hub.Config({
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.5 -->
<!-- Generated by Doxygen 1.9.6 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
var searchBox = new SearchBox("searchBox", "../../search/",'.html');
@@ -132,32 +132,32 @@ Namespaces</h2></td></tr>
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="func-members" name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:a7072493d1f0f8a91b2a71d4cc456c09c"><td class="memItemLeft" align="right" valign="top">double&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../df/d11/midpoint__integral__method_8cpp.html#a7072493d1f0f8a91b2a71d4cc456c09c">numerical_methods::midpoint_rule::midpoint</a> (const <a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/types/integer.html">std::int32_t</a> N, const double <a class="el" href="../../d1/df3/hash__search_8cpp.html#a566eaf0ffafd50bc61e644561fd27001">h</a>, const double a, const <a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/utility/functional/function.html">std::function</a>&lt; double(double)&gt; &amp;func)</td></tr>
<tr class="memdesc:a7072493d1f0f8a91b2a71d4cc456c09c"><td class="mdescLeft">&#160;</td><td class="mdescRight">Main function for implementing the Midpoint Integral Method implementation. <a href="../../df/d11/midpoint__integral__method_8cpp.html#a7072493d1f0f8a91b2a71d4cc456c09c">More...</a><br /></td></tr>
<tr class="memdesc:a7072493d1f0f8a91b2a71d4cc456c09c"><td class="mdescLeft">&#160;</td><td class="mdescRight">Main function for implementing the Midpoint Integral Method implementation. <br /></td></tr>
<tr class="separator:a7072493d1f0f8a91b2a71d4cc456c09c"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a7ee8e824ef3e138a9a21883b26d97226"><td class="memItemLeft" align="right" valign="top">double&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../df/d11/midpoint__integral__method_8cpp.html#a7ee8e824ef3e138a9a21883b26d97226">numerical_methods::midpoint_rule::f</a> (double x)</td></tr>
<tr class="memdesc:a7ee8e824ef3e138a9a21883b26d97226"><td class="mdescLeft">&#160;</td><td class="mdescRight">A function f(x) that will be used to test the method. <a href="../../df/d11/midpoint__integral__method_8cpp.html#a7ee8e824ef3e138a9a21883b26d97226">More...</a><br /></td></tr>
<tr class="memdesc:a7ee8e824ef3e138a9a21883b26d97226"><td class="mdescLeft">&#160;</td><td class="mdescRight">A function f(x) that will be used to test the method. <br /></td></tr>
<tr class="separator:a7ee8e824ef3e138a9a21883b26d97226"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ae682ee71af44b1e9e884849cc6a6b040"><td class="memItemLeft" align="right" valign="top">double&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../df/d11/midpoint__integral__method_8cpp.html#ae682ee71af44b1e9e884849cc6a6b040">numerical_methods::midpoint_rule::g</a> (double x)</td></tr>
<tr class="memdesc:ae682ee71af44b1e9e884849cc6a6b040"><td class="mdescLeft">&#160;</td><td class="mdescRight">A function g(x) that will be used to test the method. <a href="../../df/d11/midpoint__integral__method_8cpp.html#ae682ee71af44b1e9e884849cc6a6b040">More...</a><br /></td></tr>
<tr class="memdesc:ae682ee71af44b1e9e884849cc6a6b040"><td class="mdescLeft">&#160;</td><td class="mdescRight">A function g(x) that will be used to test the method. <br /></td></tr>
<tr class="separator:ae682ee71af44b1e9e884849cc6a6b040"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ae9f66040f8e0ba73c1c741261c22a52a"><td class="memItemLeft" align="right" valign="top">double&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../df/d11/midpoint__integral__method_8cpp.html#ae9f66040f8e0ba73c1c741261c22a52a">numerical_methods::midpoint_rule::k</a> (double x)</td></tr>
<tr class="memdesc:ae9f66040f8e0ba73c1c741261c22a52a"><td class="mdescLeft">&#160;</td><td class="mdescRight">A function k(x) that will be used to test the method. <a href="../../df/d11/midpoint__integral__method_8cpp.html#ae9f66040f8e0ba73c1c741261c22a52a">More...</a><br /></td></tr>
<tr class="memdesc:ae9f66040f8e0ba73c1c741261c22a52a"><td class="mdescLeft">&#160;</td><td class="mdescRight">A function k(x) that will be used to test the method. <br /></td></tr>
<tr class="separator:ae9f66040f8e0ba73c1c741261c22a52a"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ad53616fb4fa6880ae876bcba53365c51"><td class="memItemLeft" align="right" valign="top">double&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../df/d11/midpoint__integral__method_8cpp.html#ad53616fb4fa6880ae876bcba53365c51">numerical_methods::midpoint_rule::l</a> (double x)</td></tr>
<tr class="memdesc:ad53616fb4fa6880ae876bcba53365c51"><td class="mdescLeft">&#160;</td><td class="mdescRight">A function l(x) that will be used to test the method. <a href="../../df/d11/midpoint__integral__method_8cpp.html#ad53616fb4fa6880ae876bcba53365c51">More...</a><br /></td></tr>
<tr class="memdesc:ad53616fb4fa6880ae876bcba53365c51"><td class="mdescLeft">&#160;</td><td class="mdescRight">A function l(x) that will be used to test the method. <br /></td></tr>
<tr class="separator:ad53616fb4fa6880ae876bcba53365c51"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a2ae48a41e43dc6ab11b962742349646e"><td class="memItemLeft" align="right" valign="top">static void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../df/d11/midpoint__integral__method_8cpp.html#a2ae48a41e43dc6ab11b962742349646e">test</a> (<a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/types/integer.html">std::int32_t</a> N, double <a class="el" href="../../d1/df3/hash__search_8cpp.html#a566eaf0ffafd50bc61e644561fd27001">h</a>, double a, double b, bool used_argv_parameters)</td></tr>
<tr class="memdesc:a2ae48a41e43dc6ab11b962742349646e"><td class="mdescLeft">&#160;</td><td class="mdescRight">Self-test implementations. <a href="../../df/d11/midpoint__integral__method_8cpp.html#a2ae48a41e43dc6ab11b962742349646e">More...</a><br /></td></tr>
<tr class="memdesc:a2ae48a41e43dc6ab11b962742349646e"><td class="mdescLeft">&#160;</td><td class="mdescRight">Self-test implementations. <br /></td></tr>
<tr class="separator:a2ae48a41e43dc6ab11b962742349646e"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a3c04138a5bfe5d72780bb7e82a18e627"><td class="memItemLeft" align="right" valign="top">int&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../df/d11/midpoint__integral__method_8cpp.html#a3c04138a5bfe5d72780bb7e82a18e627">main</a> (int argc, char **argv)</td></tr>
<tr class="memdesc:a3c04138a5bfe5d72780bb7e82a18e627"><td class="mdescLeft">&#160;</td><td class="mdescRight">Main function. <a href="../../df/d11/midpoint__integral__method_8cpp.html#a3c04138a5bfe5d72780bb7e82a18e627">More...</a><br /></td></tr>
<tr class="memdesc:a3c04138a5bfe5d72780bb7e82a18e627"><td class="mdescLeft">&#160;</td><td class="mdescRight">Main function. <br /></td></tr>
<tr class="separator:a3c04138a5bfe5d72780bb7e82a18e627"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p >A numerical method for easy <a href="https://en.wikipedia.org/wiki/Midpoint_method" target="_blank">approximation of integrals</a> </p>
<p >The idea is to split the interval into N of intervals and use as interpolation points the xi for which it applies that xi = x0 + i*h, where h is a step defined as h = (b-a)/N where a and b are the first and last points of the interval of the integration [a, b].</p>
<p >We create a table of the xi and their corresponding f(xi) values and we evaluate the integral by the formula: I = h * {f(x0+h/2) + f(x1+h/2) + ... + f(xN-1+h/2)}</p>
<p >Arguments can be passed as parameters from the command line argv[1] = N, argv[2] = a, argv[3] = b. In this case if the default values N=16, a=1, b=3 are changed then the tests/assert are disabled.</p>
<div class="textblock"><p>A numerical method for easy <a href="https://en.wikipedia.org/wiki/Midpoint_method" target="_blank">approximation of integrals</a> </p>
<p>The idea is to split the interval into N of intervals and use as interpolation points the xi for which it applies that xi = x0 + i*h, where h is a step defined as h = (b-a)/N where a and b are the first and last points of the interval of the integration [a, b].</p>
<p>We create a table of the xi and their corresponding f(xi) values and we evaluate the integral by the formula: I = h * {f(x0+h/2) + f(x1+h/2) + ... + f(xN-1+h/2)}</p>
<p>Arguments can be passed as parameters from the command line argv[1] = N, argv[2] = a, argv[3] = b. In this case if the default values N=16, a=1, b=3 are changed then the tests/assert are disabled.</p>
<dl class="section author"><dt>Author</dt><dd><a href="https://github.com/ggkogkou" target="_blank">ggkogkou</a> </dd></dl>
</div><h2 class="groupheader">Function Documentation</h2>
<a id="a7ee8e824ef3e138a9a21883b26d97226" name="a7ee8e824ef3e138a9a21883b26d97226"></a>
@@ -335,11 +335,11 @@ Here is the call graph for this function:</div>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>0 on exit </dd></dl>
<p >Number of intervals to divide the integration interval.</p>
<p >MUST BE EVEN</p>
<p >Starting and ending point of the integration in</p>
<p >the real axis</p>
<p >Step, calculated by a, b and N</p>
<p>Number of intervals to divide the integration interval.</p>
<p>MUST BE EVEN</p>
<p>Starting and ending point of the integration in</p>
<p>the real axis</p>
<p>Step, calculated by a, b and N</p>
<div class="fragment"><div class="line"><span class="lineno"> 162</span> {</div>
<div class="line"><span class="lineno"> 163</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/types/integer.html">std::int32_t</a> <a class="code hl_variable" href="../../d6/d42/data__structures_2sparse__table_8cpp.html#a10f3ffb3f6f7e1b83d556b9c8de89a5d">N</a> =</div>
<div class="line"><span class="lineno"> 164</span> 16; <span class="comment">/// Number of intervals to divide the integration interval.</span><span class="comment"></span></div>
@@ -599,7 +599,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_9c6faab82c22511b50177aa2e38e2780.html">numerical_methods</a></li><li class="navelem"><a class="el" href="../../df/d11/midpoint__integral__method_8cpp.html">midpoint_integral_method.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.5 </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.6 </li>
</ul>
</div>
</body>