Documentation for e64e3df18f

This commit is contained in:
github-actions
2021-11-07 17:56:58 +00:00
parent 50598d4e1b
commit 3e71d63380
64 changed files with 545 additions and 570 deletions

View File

@@ -116,7 +116,7 @@ Include dependency graph for composite_simpson_rule.cpp:</div>
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="namespaces" name="namespaces"></a>
Namespaces</h2></td></tr>
<tr class="memitem:d1/de0/namespacenumerical__methods"><td class="memItemLeft" align="right" valign="top">namespace &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d1/de0/namespacenumerical__methods.html">numerical_methods</a></td></tr>
<tr class="memdesc:d1/de0/namespacenumerical__methods"><td class="mdescLeft">&#160;</td><td class="mdescRight">for IO operations <br /></td></tr>
<tr class="memdesc:d1/de0/namespacenumerical__methods"><td class="mdescLeft">&#160;</td><td class="mdescRight">for assert <br /></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:d3/d6d/namespacesimpson__method"><td class="memItemLeft" align="right" valign="top">namespace &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d3/d6d/namespacesimpson__method.html">simpson_method</a></td></tr>
<tr class="memdesc:d3/d6d/namespacesimpson__method"><td class="mdescLeft">&#160;</td><td class="mdescRight">Contains the Simpson's method implementation. <br /></td></tr>
@@ -124,8 +124,8 @@ Namespaces</h2></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:a8b5934403b0a07e1e4599ee8c869f8ef"><td class="memItemLeft" align="right" valign="top">double&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d4/d18/composite__simpson__rule_8cpp.html#a8b5934403b0a07e1e4599ee8c869f8ef">numerical_methods::simpson_method::evaluate_by_simpson</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, <a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/utility/functional/function.html">std::function</a>&lt; double(double)&gt; func)</td></tr>
<tr class="separator:a8b5934403b0a07e1e4599ee8c869f8ef"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a6ccc5eddc537dc0293d0ae3d0480f068"><td class="memItemLeft" align="right" valign="top">double&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d4/d18/composite__simpson__rule_8cpp.html#a6ccc5eddc537dc0293d0ae3d0480f068">numerical_methods::simpson_method::evaluate_by_simpson</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, 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="separator:a6ccc5eddc537dc0293d0ae3d0480f068"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a4251b4df4748a0b9c43a48f61bdd2397"><td class="memItemLeft" align="right" valign="top">double&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../d4/d18/composite__simpson__rule_8cpp.html#a4251b4df4748a0b9c43a48f61bdd2397">numerical_methods::simpson_method::f</a> (double x)</td></tr>
<tr class="memdesc:a4251b4df4748a0b9c43a48f61bdd2397"><td class="mdescLeft">&#160;</td><td class="mdescRight">A function f(x) that will be used to test the method. <a href="../../d4/d18/composite__simpson__rule_8cpp.html#a4251b4df4748a0b9c43a48f61bdd2397">More...</a><br /></td></tr>
<tr class="separator:a4251b4df4748a0b9c43a48f61bdd2397"><td class="memSeparator" colspan="2">&#160;</td></tr>
@@ -158,8 +158,8 @@ Functions</h2></td></tr>
<p >Add sample function by replacing one of the f, g, k, l and the assert</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="a8b5934403b0a07e1e4599ee8c869f8ef" name="a8b5934403b0a07e1e4599ee8c869f8ef"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a8b5934403b0a07e1e4599ee8c869f8ef">&#9670;&nbsp;</a></span>evaluate_by_simpson()</h2>
<a id="a6ccc5eddc537dc0293d0ae3d0480f068" name="a6ccc5eddc537dc0293d0ae3d0480f068"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a6ccc5eddc537dc0293d0ae3d0480f068">&#9670;&nbsp;</a></span>evaluate_by_simpson()</h2>
<div class="memitem">
<div class="memproto">
@@ -185,7 +185,7 @@ Functions</h2></td></tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/utility/functional/function.html">std::function</a>&lt; double(double)&gt;&#160;</td>
<td class="paramtype">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;&#160;</td>
<td class="paramname"><em>func</em>&#160;</td>
</tr>
<tr>
@@ -195,43 +195,44 @@ Functions</h2></td></tr>
</tr>
</table>
</div><div class="memdoc">
<div class="fragment"><div class="line"><a id="l00067" name="l00067"></a><span class="lineno"> 67</span> {</div>
<div class="line"><a id="l00068" name="l00068"></a><span class="lineno"> 68</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/map.html">std::map&lt;std::int32_t, double&gt;</a></div>
<div class="line"><a id="l00069" name="l00069"></a><span class="lineno"> 69</span> data_table; <span class="comment">// Contains the data points. key: i, value: f(xi)</span></div>
<div class="line"><a id="l00070" name="l00070"></a><span class="lineno"> 70</span> <span class="keywordtype">double</span> xi = a; <span class="comment">// Initialize xi to the starting point x0 = a</span></div>
<div class="line"><a id="l00071" name="l00071"></a><span class="lineno"> 71</span> </div>
<div class="line"><a id="l00072" name="l00072"></a><span class="lineno"> 72</span> <span class="comment">// Create the data table</span></div>
<div class="line"><a id="l00073" name="l00073"></a><span class="lineno"> 73</span> <span class="keywordtype">double</span> temp;</div>
<div class="line"><a id="l00074" name="l00074"></a><span class="lineno"> 74</span> <span class="keywordflow">for</span> (<a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/types/integer.html">std::int32_t</a> i = 0; i &lt;= <a class="code hl_variable" href="../../d6/d42/data__structures_2sparse__table_8cpp.html#a10f3ffb3f6f7e1b83d556b9c8de89a5d">N</a>; i++) {</div>
<div class="line"><a id="l00075" name="l00075"></a><span class="lineno"> 75</span> temp = func(xi);</div>
<div class="line"><a id="l00076" name="l00076"></a><span class="lineno"> 76</span> data_table.<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/map/insert.html">insert</a>(</div>
<div class="line"><a id="l00077" name="l00077"></a><span class="lineno"> 77</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/utility/pair.html">std::pair&lt;std::int32_t, double&gt;</a>(i, temp)); <span class="comment">// add i and f(xi)</span></div>
<div class="line"><a id="l00078" name="l00078"></a><span class="lineno"> 78</span> xi += <a class="code hl_function" href="../../d1/df3/hash__search_8cpp.html#a566eaf0ffafd50bc61e644561fd27001">h</a>; <span class="comment">// Get the next point xi for the next iteration</span></div>
<div class="line"><a id="l00079" name="l00079"></a><span class="lineno"> 79</span> }</div>
<div class="line"><a id="l00080" name="l00080"></a><span class="lineno"> 80</span> </div>
<div class="line"><a id="l00081" name="l00081"></a><span class="lineno"> 81</span> <span class="comment">// Evaluate the integral.</span></div>
<div class="line"><a id="l00082" name="l00082"></a><span class="lineno"> 82</span> <span class="comment">// Remember: f(x0) + 4*f(x1) + 2*f(x2) + ... + 2*f(xN-2) + 4*f(xN-1) + f(xN)</span></div>
<div class="line"><a id="l00083" name="l00083"></a><span class="lineno"> 83</span> <span class="keywordtype">double</span> evaluate_integral = 0;</div>
<div class="line"><a id="l00084" name="l00084"></a><span class="lineno"> 84</span> <span class="keywordflow">for</span> (<a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/types/integer.html">std::int32_t</a> i = 0; i &lt;= <a class="code hl_variable" href="../../d6/d42/data__structures_2sparse__table_8cpp.html#a10f3ffb3f6f7e1b83d556b9c8de89a5d">N</a>; i++) {</div>
<div class="line"><a id="l00085" name="l00085"></a><span class="lineno"> 85</span> <span class="keywordflow">if</span> (i == 0 || i == N)</div>
<div class="line"><a id="l00086" name="l00086"></a><span class="lineno"> 86</span> evaluate_integral += data_table.<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/map/at.html">at</a>(i);</div>
<div class="line"><a id="l00087" name="l00087"></a><span class="lineno"> 87</span> <span class="keywordflow">else</span> <span class="keywordflow">if</span> (i % 2 == 1)</div>
<div class="line"><a id="l00088" name="l00088"></a><span class="lineno"> 88</span> evaluate_integral += 4 * data_table.<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/map/at.html">at</a>(i);</div>
<div class="line"><a id="l00089" name="l00089"></a><span class="lineno"> 89</span> <span class="keywordflow">else</span></div>
<div class="line"><a id="l00090" name="l00090"></a><span class="lineno"> 90</span> evaluate_integral += 2 * data_table.<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/map/at.html">at</a>(i);</div>
<div class="line"><a id="l00091" name="l00091"></a><span class="lineno"> 91</span> }</div>
<div class="line"><a id="l00092" name="l00092"></a><span class="lineno"> 92</span> </div>
<div class="line"><a id="l00093" name="l00093"></a><span class="lineno"> 93</span> <span class="comment">// Multiply by the coefficient h/3</span></div>
<div class="line"><a id="l00094" name="l00094"></a><span class="lineno"> 94</span> evaluate_integral *= <a class="code hl_function" href="../../d1/df3/hash__search_8cpp.html#a566eaf0ffafd50bc61e644561fd27001">h</a> / 3;</div>
<div class="line"><a id="l00095" name="l00095"></a><span class="lineno"> 95</span> </div>
<div class="line"><a id="l00096" name="l00096"></a><span class="lineno"> 96</span> <span class="comment">// If the result calculated is nan, then the user has given wrong input</span></div>
<div class="line"><a id="l00097" name="l00097"></a><span class="lineno"> 97</span> <span class="comment">// interval.</span></div>
<div class="line"><a id="l00098" name="l00098"></a><span class="lineno"> 98</span> assert(!<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/numeric/math/isnan.html">std::isnan</a>(evaluate_integral) &amp;&amp;</div>
<div class="line"><a id="l00099" name="l00099"></a><span class="lineno"> 99</span> <span class="stringliteral">&quot;The definite integral can&#39;t be evaluated. Check the validity of &quot;</span></div>
<div class="line"><a id="l00100" name="l00100"></a><span class="lineno"> 100</span> <span class="stringliteral">&quot;your input.\n&quot;</span>);</div>
<div class="line"><a id="l00101" name="l00101"></a><span class="lineno"> 101</span> <span class="comment">// Else return</span></div>
<div class="line"><a id="l00102" name="l00102"></a><span class="lineno"> 102</span> <span class="keywordflow">return</span> evaluate_integral;</div>
<div class="line"><a id="l00103" name="l00103"></a><span class="lineno"> 103</span>}</div>
<div class="fragment"><div class="line"><a id="l00068" name="l00068"></a><span class="lineno"> 68</span> {</div>
<div class="line"><a id="l00069" name="l00069"></a><span class="lineno"> 69</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/map.html">std::map&lt;std::int32_t, double&gt;</a></div>
<div class="line"><a id="l00070" name="l00070"></a><span class="lineno"> 70</span> data_table; <span class="comment">// Contains the data points. key: i, value: f(xi)</span></div>
<div class="line"><a id="l00071" name="l00071"></a><span class="lineno"> 71</span> <span class="keywordtype">double</span> xi = a; <span class="comment">// Initialize xi to the starting point x0 = a</span></div>
<div class="line"><a id="l00072" name="l00072"></a><span class="lineno"> 72</span> </div>
<div class="line"><a id="l00073" name="l00073"></a><span class="lineno"> 73</span> <span class="comment">// Create the data table</span></div>
<div class="line"><a id="l00074" name="l00074"></a><span class="lineno"> 74</span> <span class="keywordtype">double</span> temp = NAN;</div>
<div class="line"><a id="l00075" name="l00075"></a><span class="lineno"> 75</span> <span class="keywordflow">for</span> (<a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/types/integer.html">std::int32_t</a> i = 0; i &lt;= <a class="code hl_variable" href="../../d6/d42/data__structures_2sparse__table_8cpp.html#a10f3ffb3f6f7e1b83d556b9c8de89a5d">N</a>; i++) {</div>
<div class="line"><a id="l00076" name="l00076"></a><span class="lineno"> 76</span> temp = func(xi);</div>
<div class="line"><a id="l00077" name="l00077"></a><span class="lineno"> 77</span> data_table.<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/map/insert.html">insert</a>(</div>
<div class="line"><a id="l00078" name="l00078"></a><span class="lineno"> 78</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/utility/pair.html">std::pair&lt;std::int32_t, double&gt;</a>(i, temp)); <span class="comment">// add i and f(xi)</span></div>
<div class="line"><a id="l00079" name="l00079"></a><span class="lineno"> 79</span> xi += <a class="code hl_function" href="../../d1/df3/hash__search_8cpp.html#a566eaf0ffafd50bc61e644561fd27001">h</a>; <span class="comment">// Get the next point xi for the next iteration</span></div>
<div class="line"><a id="l00080" name="l00080"></a><span class="lineno"> 80</span> }</div>
<div class="line"><a id="l00081" name="l00081"></a><span class="lineno"> 81</span> </div>
<div class="line"><a id="l00082" name="l00082"></a><span class="lineno"> 82</span> <span class="comment">// Evaluate the integral.</span></div>
<div class="line"><a id="l00083" name="l00083"></a><span class="lineno"> 83</span> <span class="comment">// Remember: f(x0) + 4*f(x1) + 2*f(x2) + ... + 2*f(xN-2) + 4*f(xN-1) + f(xN)</span></div>
<div class="line"><a id="l00084" name="l00084"></a><span class="lineno"> 84</span> <span class="keywordtype">double</span> evaluate_integral = 0;</div>
<div class="line"><a id="l00085" name="l00085"></a><span class="lineno"> 85</span> <span class="keywordflow">for</span> (<a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/types/integer.html">std::int32_t</a> i = 0; i &lt;= <a class="code hl_variable" href="../../d6/d42/data__structures_2sparse__table_8cpp.html#a10f3ffb3f6f7e1b83d556b9c8de89a5d">N</a>; i++) {</div>
<div class="line"><a id="l00086" name="l00086"></a><span class="lineno"> 86</span> <span class="keywordflow">if</span> (i == 0 || i == N) {</div>
<div class="line"><a id="l00087" name="l00087"></a><span class="lineno"> 87</span> evaluate_integral += data_table.<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/map/at.html">at</a>(i);</div>
<div class="line"><a id="l00088" name="l00088"></a><span class="lineno"> 88</span> } <span class="keywordflow">else</span> <span class="keywordflow">if</span> (i % 2 == 1) {</div>
<div class="line"><a id="l00089" name="l00089"></a><span class="lineno"> 89</span> evaluate_integral += 4 * data_table.<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/map/at.html">at</a>(i);</div>
<div class="line"><a id="l00090" name="l00090"></a><span class="lineno"> 90</span> } <span class="keywordflow">else</span> {</div>
<div class="line"><a id="l00091" name="l00091"></a><span class="lineno"> 91</span> evaluate_integral += 2 * data_table.<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/map/at.html">at</a>(i);</div>
<div class="line"><a id="l00092" name="l00092"></a><span class="lineno"> 92</span> }</div>
<div class="line"><a id="l00093" name="l00093"></a><span class="lineno"> 93</span> }</div>
<div class="line"><a id="l00094" name="l00094"></a><span class="lineno"> 94</span> </div>
<div class="line"><a id="l00095" name="l00095"></a><span class="lineno"> 95</span> <span class="comment">// Multiply by the coefficient h/3</span></div>
<div class="line"><a id="l00096" name="l00096"></a><span class="lineno"> 96</span> evaluate_integral *= <a class="code hl_function" href="../../d1/df3/hash__search_8cpp.html#a566eaf0ffafd50bc61e644561fd27001">h</a> / 3;</div>
<div class="line"><a id="l00097" name="l00097"></a><span class="lineno"> 97</span> </div>
<div class="line"><a id="l00098" name="l00098"></a><span class="lineno"> 98</span> <span class="comment">// If the result calculated is nan, then the user has given wrong input</span></div>
<div class="line"><a id="l00099" name="l00099"></a><span class="lineno"> 99</span> <span class="comment">// interval.</span></div>
<div class="line"><a id="l00100" name="l00100"></a><span class="lineno"> 100</span> assert(!<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/numeric/math/isnan.html">std::isnan</a>(evaluate_integral) &amp;&amp;</div>
<div class="line"><a id="l00101" name="l00101"></a><span class="lineno"> 101</span> <span class="stringliteral">&quot;The definite integral can&#39;t be evaluated. Check the validity of &quot;</span></div>
<div class="line"><a id="l00102" name="l00102"></a><span class="lineno"> 102</span> <span class="stringliteral">&quot;your input.\n&quot;</span>);</div>
<div class="line"><a id="l00103" name="l00103"></a><span class="lineno"> 103</span> <span class="comment">// Else return</span></div>
<div class="line"><a id="l00104" name="l00104"></a><span class="lineno"> 104</span> <span class="keywordflow">return</span> evaluate_integral;</div>
<div class="line"><a id="l00105" name="l00105"></a><span class="lineno"> 105</span>}</div>
<div class="ttc" id="aat_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/container/map/at.html">std::map::at</a></div><div class="ttdeci">T at(T... args)</div></div>
<div class="ttc" id="adata__structures_2sparse__table_8cpp_html_a10f3ffb3f6f7e1b83d556b9c8de89a5d"><div class="ttname"><a href="../../d6/d42/data__structures_2sparse__table_8cpp.html#a10f3ffb3f6f7e1b83d556b9c8de89a5d">data_structures::sparse_table::N</a></div><div class="ttdeci">constexpr uint32_t N</div><div class="ttdoc">A struct to represent sparse table for min() as their invariant function, for the given array A....</div><div class="ttdef"><b>Definition:</b> sparse_table.cpp:47</div></div>
<div class="ttc" id="ahash__search_8cpp_html_a566eaf0ffafd50bc61e644561fd27001"><div class="ttname"><a href="../../d1/df3/hash__search_8cpp.html#a566eaf0ffafd50bc61e644561fd27001">h</a></div><div class="ttdeci">int h(int key)</div><div class="ttdef"><b>Definition:</b> hash_search.cpp:45</div></div>
@@ -267,7 +268,7 @@ Functions</h2></td></tr>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>the value of the dependent variable yi = f(xi) </dd></dl>
<div class="fragment"><div class="line"><a id="l00111" name="l00111"></a><span class="lineno"> 111</span>{ <span class="keywordflow">return</span> <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/numeric/math/sqrt.html">std::sqrt</a>(x) + <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/numeric/math/log.html">std::log</a>(x); }</div>
<div class="fragment"><div class="line"><a id="l00113" name="l00113"></a><span class="lineno"> 113</span>{ <span class="keywordflow">return</span> <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/numeric/math/sqrt.html">std::sqrt</a>(x) + <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/numeric/math/log.html">std::log</a>(x); }</div>
<div class="ttc" id="alog_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/numeric/math/log.html">std::log</a></div><div class="ttdeci">T log(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>
</div><!-- fragment --><div class="dynheader">
@@ -296,7 +297,7 @@ Here is the call graph for this function:</div>
</div><div class="memdoc">
<p>Another test function. </p>
<div class="fragment"><div class="line"><a id="l00113" name="l00113"></a><span class="lineno"> 113</span>{ <span class="keywordflow">return</span> <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/numeric/math/exp.html">std::exp</a>(-x) * (4 - <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/numeric/math/pow.html">std::pow</a>(x, 2)); }</div>
<div class="fragment"><div class="line"><a id="l00115" name="l00115"></a><span class="lineno"> 115</span>{ <span class="keywordflow">return</span> <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/numeric/math/exp.html">std::exp</a>(-x) * (4 - <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/numeric/math/pow.html">std::pow</a>(x, 2)); }</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="apow_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/numeric/math/pow.html">std::pow</a></div><div class="ttdeci">T pow(T... args)</div></div>
</div><!-- fragment --><div class="dynheader">
@@ -327,7 +328,7 @@ Here is the call graph for this function:</div>
<p>Another test function. </p>
<dl class="section examples"><dt>Examples</dt><dd><a class="el" href="../../dc/dc4/_2_users_2runner_2work_2_c-_plus-_plus_2_c-_plus-_plus_2numerical_methods_2rungekutta_8cpp-example.html#a4">/Users/runner/work/C-Plus-Plus/C-Plus-Plus/numerical_methods/rungekutta.cpp</a>.</dd>
</dl>
<div class="fragment"><div class="line"><a id="l00115" name="l00115"></a><span class="lineno"> 115</span>{ <span class="keywordflow">return</span> <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/numeric/math/sqrt.html">std::sqrt</a>(2 * <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/numeric/math/pow.html">std::pow</a>(x, 3) + 3); }</div>
<div class="fragment"><div class="line"><a id="l00117" name="l00117"></a><span class="lineno"> 117</span>{ <span class="keywordflow">return</span> <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/numeric/math/sqrt.html">std::sqrt</a>(2 * <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/numeric/math/pow.html">std::pow</a>(x, 3) + 3); }</div>
</div><!-- fragment --><div class="dynheader">
Here is the call graph for this function:</div>
<div class="dyncontent">
@@ -354,7 +355,7 @@ Here is the call graph for this function:</div>
</div><div class="memdoc">
<p>Another test function. </p>
<div class="fragment"><div class="line"><a id="l00117" name="l00117"></a><span class="lineno"> 117</span>{ <span class="keywordflow">return</span> x + <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/numeric/math/log.html">std::log</a>(2 * x + 1); }</div>
<div class="fragment"><div class="line"><a id="l00119" name="l00119"></a><span class="lineno"> 119</span>{ <span class="keywordflow">return</span> x + <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/numeric/math/log.html">std::log</a>(2 * x + 1); }</div>
</div><!-- fragment --><div class="dynheader">
Here is the call graph for this function:</div>
<div class="dyncontent">
@@ -402,45 +403,47 @@ Here is the call graph for this function:</div>
<p >Number of intervals to divide the integration interval. MUST BE EVEN</p>
<p >Starting and ending point of the integration in the real axis</p>
<p >Step, calculated by a, b and N</p>
<div class="fragment"><div class="line"><a id="l00168" name="l00168"></a><span class="lineno"> 168</span> {</div>
<div class="line"><a id="l00169" name="l00169"></a><span class="lineno"> 169</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> = 16; <span class="comment">/// Number of intervals to divide the integration</span><span class="comment"></span></div>
<div class="line"><a id="l00170" name="l00170"></a><span class="lineno"> 170</span><span class="comment"> /// interval. MUST BE EVEN</span></div>
<div class="line"><a id="l00171" name="l00171"></a><span class="lineno"> 171</span><span class="comment"></span> <span class="keywordtype">double</span> a = 1, b = 3; <span class="comment">/// Starting and ending point of the integration in</span><span class="comment"></span></div>
<div class="line"><a id="l00172" name="l00172"></a><span class="lineno"> 172</span><span class="comment"> /// the real axis</span></div>
<div class="line"><a id="l00173" name="l00173"></a><span class="lineno"> 173</span><span class="comment"></span> <span class="keywordtype">double</span> <a class="code hl_function" href="../../d1/df3/hash__search_8cpp.html#a566eaf0ffafd50bc61e644561fd27001">h</a>; <span class="comment">/// Step, calculated by a, b and N</span></div>
<div class="line"><a id="l00174" name="l00174"></a><span class="lineno"> 174</span> </div>
<div class="line"><a id="l00175" name="l00175"></a><span class="lineno"> 175</span> <span class="keywordtype">bool</span> used_argv_parameters =</div>
<div class="line"><a id="l00176" name="l00176"></a><span class="lineno"> 176</span> <span class="keyword">false</span>; <span class="comment">// If argv parameters are used then the assert must be omitted</span></div>
<div class="line"><a id="l00177" name="l00177"></a><span class="lineno"> 177</span> <span class="comment">// for the tst cases</span></div>
<div class="line"><a id="l00178" name="l00178"></a><span class="lineno"> 178</span> </div>
<div class="line"><a id="l00179" name="l00179"></a><span class="lineno"> 179</span> <span class="comment">// Get user input (by the command line parameters or the console after</span></div>
<div class="line"><a id="l00180" name="l00180"></a><span class="lineno"> 180</span> <span class="comment">// displaying messages)</span></div>
<div class="line"><a id="l00181" name="l00181"></a><span class="lineno"> 181</span> <span class="keywordflow">if</span> (argc == 4) {</div>
<div class="line"><a id="l00182" name="l00182"></a><span class="lineno"> 182</span> <a class="code hl_variable" href="../../d6/d42/data__structures_2sparse__table_8cpp.html#a10f3ffb3f6f7e1b83d556b9c8de89a5d">N</a> = <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/string/byte/atoi.html">std::atoi</a>(argv[1]);</div>
<div class="line"><a id="l00183" name="l00183"></a><span class="lineno"> 183</span> a = (double)<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/string/byte/atof.html">std::atof</a>(argv[2]);</div>
<div class="line"><a id="l00184" name="l00184"></a><span class="lineno"> 184</span> b = (double)<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/string/byte/atof.html">std::atof</a>(argv[3]);</div>
<div class="line"><a id="l00185" name="l00185"></a><span class="lineno"> 185</span> <span class="comment">// Check if a&lt;b else abort</span></div>
<div class="line"><a id="l00186" name="l00186"></a><span class="lineno"> 186</span> assert(a &lt; b &amp;&amp; <span class="stringliteral">&quot;a has to be less than b&quot;</span>);</div>
<div class="line"><a id="l00187" name="l00187"></a><span class="lineno"> 187</span> assert(N &gt; 0 &amp;&amp; <span class="stringliteral">&quot;N has to be &gt; 0&quot;</span>);</div>
<div class="line"><a id="l00188" name="l00188"></a><span class="lineno"> 188</span> <span class="keywordflow">if</span> (N &lt; 16 || a != 1 || b != 3)</div>
<div class="line"><a id="l00189" name="l00189"></a><span class="lineno"> 189</span> used_argv_parameters = <span class="keyword">true</span>;</div>
<div class="line"><a id="l00190" name="l00190"></a><span class="lineno"> 190</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> &lt;&lt; <span class="stringliteral">&quot;You selected N=&quot;</span> &lt;&lt; <a class="code hl_variable" href="../../d6/d42/data__structures_2sparse__table_8cpp.html#a10f3ffb3f6f7e1b83d556b9c8de89a5d">N</a> &lt;&lt; <span class="stringliteral">&quot;, a=&quot;</span> &lt;&lt; a &lt;&lt; <span class="stringliteral">&quot;, b=&quot;</span> &lt;&lt; b</div>
<div class="line"><a id="l00191" name="l00191"></a><span class="lineno"> 191</span> &lt;&lt; <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/manip/endl.html">std::endl</a>;</div>
<div class="line"><a id="l00192" name="l00192"></a><span class="lineno"> 192</span> } <span class="keywordflow">else</span></div>
<div class="line"><a id="l00193" name="l00193"></a><span class="lineno"> 193</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> &lt;&lt; <span class="stringliteral">&quot;Default N=&quot;</span> &lt;&lt; <a class="code hl_variable" href="../../d6/d42/data__structures_2sparse__table_8cpp.html#a10f3ffb3f6f7e1b83d556b9c8de89a5d">N</a> &lt;&lt; <span class="stringliteral">&quot;, a=&quot;</span> &lt;&lt; a &lt;&lt; <span class="stringliteral">&quot;, b=&quot;</span> &lt;&lt; b</div>
<div class="fragment"><div class="line"><a id="l00170" name="l00170"></a><span class="lineno"> 170</span> {</div>
<div class="line"><a id="l00171" name="l00171"></a><span class="lineno"> 171</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> = 16; <span class="comment">/// Number of intervals to divide the integration</span><span class="comment"></span></div>
<div class="line"><a id="l00172" name="l00172"></a><span class="lineno"> 172</span><span class="comment"> /// interval. MUST BE EVEN</span></div>
<div class="line"><a id="l00173" name="l00173"></a><span class="lineno"> 173</span><span class="comment"></span> <span class="keywordtype">double</span> a = 1, b = 3; <span class="comment">/// Starting and ending point of the integration in</span><span class="comment"></span></div>
<div class="line"><a id="l00174" name="l00174"></a><span class="lineno"> 174</span><span class="comment"> /// the real axis</span></div>
<div class="line"><a id="l00175" name="l00175"></a><span class="lineno"> 175</span><span class="comment"></span> <span class="keywordtype">double</span> <a class="code hl_function" href="../../d1/df3/hash__search_8cpp.html#a566eaf0ffafd50bc61e644561fd27001">h</a> = NAN; <span class="comment">/// Step, calculated by a, b and N</span></div>
<div class="line"><a id="l00176" name="l00176"></a><span class="lineno"> 176</span> </div>
<div class="line"><a id="l00177" name="l00177"></a><span class="lineno"> 177</span> <span class="keywordtype">bool</span> used_argv_parameters =</div>
<div class="line"><a id="l00178" name="l00178"></a><span class="lineno"> 178</span> <span class="keyword">false</span>; <span class="comment">// If argv parameters are used then the assert must be omitted</span></div>
<div class="line"><a id="l00179" name="l00179"></a><span class="lineno"> 179</span> <span class="comment">// for the tst cases</span></div>
<div class="line"><a id="l00180" name="l00180"></a><span class="lineno"> 180</span> </div>
<div class="line"><a id="l00181" name="l00181"></a><span class="lineno"> 181</span> <span class="comment">// Get user input (by the command line parameters or the console after</span></div>
<div class="line"><a id="l00182" name="l00182"></a><span class="lineno"> 182</span> <span class="comment">// displaying messages)</span></div>
<div class="line"><a id="l00183" name="l00183"></a><span class="lineno"> 183</span> <span class="keywordflow">if</span> (argc == 4) {</div>
<div class="line"><a id="l00184" name="l00184"></a><span class="lineno"> 184</span> <a class="code hl_variable" href="../../d6/d42/data__structures_2sparse__table_8cpp.html#a10f3ffb3f6f7e1b83d556b9c8de89a5d">N</a> = <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/string/byte/atoi.html">std::atoi</a>(argv[1]);</div>
<div class="line"><a id="l00185" name="l00185"></a><span class="lineno"> 185</span> a = <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/string/byte/atof.html">std::atof</a>(argv[2]);</div>
<div class="line"><a id="l00186" name="l00186"></a><span class="lineno"> 186</span> b = <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/string/byte/atof.html">std::atof</a>(argv[3]);</div>
<div class="line"><a id="l00187" name="l00187"></a><span class="lineno"> 187</span> <span class="comment">// Check if a&lt;b else abort</span></div>
<div class="line"><a id="l00188" name="l00188"></a><span class="lineno"> 188</span> assert(a &lt; b &amp;&amp; <span class="stringliteral">&quot;a has to be less than b&quot;</span>);</div>
<div class="line"><a id="l00189" name="l00189"></a><span class="lineno"> 189</span> assert(N &gt; 0 &amp;&amp; <span class="stringliteral">&quot;N has to be &gt; 0&quot;</span>);</div>
<div class="line"><a id="l00190" name="l00190"></a><span class="lineno"> 190</span> <span class="keywordflow">if</span> (N &lt; 16 || a != 1 || b != 3) {</div>
<div class="line"><a id="l00191" name="l00191"></a><span class="lineno"> 191</span> used_argv_parameters = <span class="keyword">true</span>;</div>
<div class="line"><a id="l00192" name="l00192"></a><span class="lineno"> 192</span> }</div>
<div class="line"><a id="l00193" name="l00193"></a><span class="lineno"> 193</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> &lt;&lt; <span class="stringliteral">&quot;You selected N=&quot;</span> &lt;&lt; <a class="code hl_variable" href="../../d6/d42/data__structures_2sparse__table_8cpp.html#a10f3ffb3f6f7e1b83d556b9c8de89a5d">N</a> &lt;&lt; <span class="stringliteral">&quot;, a=&quot;</span> &lt;&lt; a &lt;&lt; <span class="stringliteral">&quot;, b=&quot;</span> &lt;&lt; b</div>
<div class="line"><a id="l00194" name="l00194"></a><span class="lineno"> 194</span> &lt;&lt; <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/manip/endl.html">std::endl</a>;</div>
<div class="line"><a id="l00195" name="l00195"></a><span class="lineno"> 195</span> </div>
<div class="line"><a id="l00196" name="l00196"></a><span class="lineno"> 196</span> <span class="comment">// Find the step</span></div>
<div class="line"><a id="l00197" name="l00197"></a><span class="lineno"> 197</span> <a class="code hl_function" href="../../d1/df3/hash__search_8cpp.html#a566eaf0ffafd50bc61e644561fd27001">h</a> = (b - a) / N;</div>
<div class="line"><a id="l00198" name="l00198"></a><span class="lineno"> 198</span> </div>
<div class="line"><a id="l00199" name="l00199"></a><span class="lineno"> 199</span> <a class="code hl_function" href="../../d4/d18/composite__simpson__rule_8cpp.html#a2ae48a41e43dc6ab11b962742349646e">test</a>(N, <a class="code hl_function" href="../../d1/df3/hash__search_8cpp.html#a566eaf0ffafd50bc61e644561fd27001">h</a>, a, b, used_argv_parameters); <span class="comment">// run self-test implementations</span></div>
<div class="line"><a id="l00200" name="l00200"></a><span class="lineno"> 200</span> </div>
<div class="line"><a id="l00201" name="l00201"></a><span class="lineno"> 201</span> <span class="keywordflow">return</span> 0;</div>
<div class="line"><a id="l00202" name="l00202"></a><span class="lineno"> 202</span>}</div>
<div class="line"><a id="l00195" name="l00195"></a><span class="lineno"> 195</span> } <span class="keywordflow">else</span> {</div>
<div class="line"><a id="l00196" name="l00196"></a><span class="lineno"> 196</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> &lt;&lt; <span class="stringliteral">&quot;Default N=&quot;</span> &lt;&lt; <a class="code hl_variable" href="../../d6/d42/data__structures_2sparse__table_8cpp.html#a10f3ffb3f6f7e1b83d556b9c8de89a5d">N</a> &lt;&lt; <span class="stringliteral">&quot;, a=&quot;</span> &lt;&lt; a &lt;&lt; <span class="stringliteral">&quot;, b=&quot;</span> &lt;&lt; b</div>
<div class="line"><a id="l00197" name="l00197"></a><span class="lineno"> 197</span> &lt;&lt; <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/manip/endl.html">std::endl</a>;</div>
<div class="line"><a id="l00198" name="l00198"></a><span class="lineno"> 198</span> }</div>
<div class="line"><a id="l00199" name="l00199"></a><span class="lineno"> 199</span> </div>
<div class="line"><a id="l00200" name="l00200"></a><span class="lineno"> 200</span> <span class="comment">// Find the step</span></div>
<div class="line"><a id="l00201" name="l00201"></a><span class="lineno"> 201</span> <a class="code hl_function" href="../../d1/df3/hash__search_8cpp.html#a566eaf0ffafd50bc61e644561fd27001">h</a> = (b - a) / N;</div>
<div class="line"><a id="l00202" name="l00202"></a><span class="lineno"> 202</span> </div>
<div class="line"><a id="l00203" name="l00203"></a><span class="lineno"> 203</span> <a class="code hl_function" href="../../d4/d18/composite__simpson__rule_8cpp.html#a2ae48a41e43dc6ab11b962742349646e">test</a>(N, <a class="code hl_function" href="../../d1/df3/hash__search_8cpp.html#a566eaf0ffafd50bc61e644561fd27001">h</a>, a, b, used_argv_parameters); <span class="comment">// run self-test implementations</span></div>
<div class="line"><a id="l00204" name="l00204"></a><span class="lineno"> 204</span> </div>
<div class="line"><a id="l00205" name="l00205"></a><span class="lineno"> 205</span> <span class="keywordflow">return</span> 0;</div>
<div class="line"><a id="l00206" name="l00206"></a><span class="lineno"> 206</span>}</div>
<div class="ttc" id="aatof_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/string/byte/atof.html">std::atof</a></div><div class="ttdeci">T atof(T... args)</div></div>
<div class="ttc" id="aatoi_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/string/byte/atoi.html">std::atoi</a></div><div class="ttdeci">T atoi(T... args)</div></div>
<div class="ttc" id="abasic_ostream_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a></div></div>
<div class="ttc" id="acomposite__simpson__rule_8cpp_html_a2ae48a41e43dc6ab11b962742349646e"><div class="ttname"><a href="../../d4/d18/composite__simpson__rule_8cpp.html#a2ae48a41e43dc6ab11b962742349646e">test</a></div><div class="ttdeci">static void test(std::int32_t N, double h, double a, double b, bool used_argv_parameters)</div><div class="ttdoc">Self-test implementations.</div><div class="ttdef"><b>Definition:</b> composite_simpson_rule.cpp:130</div></div>
<div class="ttc" id="acomposite__simpson__rule_8cpp_html_a2ae48a41e43dc6ab11b962742349646e"><div class="ttname"><a href="../../d4/d18/composite__simpson__rule_8cpp.html#a2ae48a41e43dc6ab11b962742349646e">test</a></div><div class="ttdeci">static void test(std::int32_t N, double h, double a, double b, bool used_argv_parameters)</div><div class="ttdoc">Self-test implementations.</div><div class="ttdef"><b>Definition:</b> composite_simpson_rule.cpp:132</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><!-- fragment --><div class="dynheader">
Here is the call graph for this function:</div>
@@ -514,36 +517,36 @@ Here is the call graph for this function:</div>
</table>
</dd>
</dl>
<div class="fragment"><div class="line"><a id="l00131" name="l00131"></a><span class="lineno"> 131</span> {</div>
<div class="line"><a id="l00132" name="l00132"></a><span class="lineno"> 132</span> <span class="comment">// Call the functions and find the integral of each function</span></div>
<div class="line"><a id="l00133" name="l00133"></a><span class="lineno"> 133</span> <span class="keywordtype">double</span> result_f = numerical_methods::simpson_method::evaluate_by_simpson(</div>
<div class="line"><a id="l00134" name="l00134"></a><span class="lineno"> 134</span> N, <a class="code hl_function" href="../../d1/df3/hash__search_8cpp.html#a566eaf0ffafd50bc61e644561fd27001">h</a>, a, numerical_methods::simpson_method::f);</div>
<div class="line"><a id="l00135" name="l00135"></a><span class="lineno"> 135</span> assert((used_argv_parameters || (result_f &gt;= 4.09 &amp;&amp; result_f &lt;= 4.10)) &amp;&amp;</div>
<div class="line"><a id="l00136" name="l00136"></a><span class="lineno"> 136</span> <span class="stringliteral">&quot;The result of f(x) is wrong&quot;</span>);</div>
<div class="line"><a id="l00137" name="l00137"></a><span class="lineno"> 137</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> &lt;&lt; <span class="stringliteral">&quot;The result of integral f(x) on interval [&quot;</span> &lt;&lt; a &lt;&lt; <span class="stringliteral">&quot;, &quot;</span> &lt;&lt; b</div>
<div class="line"><a id="l00138" name="l00138"></a><span class="lineno"> 138</span> &lt;&lt; <span class="stringliteral">&quot;] is equal to: &quot;</span> &lt;&lt; result_f &lt;&lt; <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/manip/endl.html">std::endl</a>;</div>
<div class="line"><a id="l00139" name="l00139"></a><span class="lineno"> 139</span> </div>
<div class="line"><a id="l00140" name="l00140"></a><span class="lineno"> 140</span> <span class="keywordtype">double</span> result_g = numerical_methods::simpson_method::evaluate_by_simpson(</div>
<div class="line"><a id="l00141" name="l00141"></a><span class="lineno"> 141</span> N, <a class="code hl_function" href="../../d1/df3/hash__search_8cpp.html#a566eaf0ffafd50bc61e644561fd27001">h</a>, a, numerical_methods::simpson_method::g);</div>
<div class="line"><a id="l00142" name="l00142"></a><span class="lineno"> 142</span> assert((used_argv_parameters || (result_g &gt;= 0.27 &amp;&amp; result_g &lt;= 0.28)) &amp;&amp;</div>
<div class="line"><a id="l00143" name="l00143"></a><span class="lineno"> 143</span> <span class="stringliteral">&quot;The result of g(x) is wrong&quot;</span>);</div>
<div class="line"><a id="l00144" name="l00144"></a><span class="lineno"> 144</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> &lt;&lt; <span class="stringliteral">&quot;The result of integral g(x) on interval [&quot;</span> &lt;&lt; a &lt;&lt; <span class="stringliteral">&quot;, &quot;</span> &lt;&lt; b</div>
<div class="line"><a id="l00145" name="l00145"></a><span class="lineno"> 145</span> &lt;&lt; <span class="stringliteral">&quot;] is equal to: &quot;</span> &lt;&lt; result_g &lt;&lt; <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/manip/endl.html">std::endl</a>;</div>
<div class="line"><a id="l00146" name="l00146"></a><span class="lineno"> 146</span> </div>
<div class="line"><a id="l00147" name="l00147"></a><span class="lineno"> 147</span> <span class="keywordtype">double</span> result_k = numerical_methods::simpson_method::evaluate_by_simpson(</div>
<div class="line"><a id="l00148" name="l00148"></a><span class="lineno"> 148</span> N, <a class="code hl_function" href="../../d1/df3/hash__search_8cpp.html#a566eaf0ffafd50bc61e644561fd27001">h</a>, a, numerical_methods::simpson_method::k);</div>
<div class="line"><a id="l00149" name="l00149"></a><span class="lineno"> 149</span> assert((used_argv_parameters || (result_k &gt;= 9.06 &amp;&amp; result_k &lt;= 9.07)) &amp;&amp;</div>
<div class="line"><a id="l00150" name="l00150"></a><span class="lineno"> 150</span> <span class="stringliteral">&quot;The result of k(x) is wrong&quot;</span>);</div>
<div class="line"><a id="l00151" name="l00151"></a><span class="lineno"> 151</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> &lt;&lt; <span class="stringliteral">&quot;The result of integral k(x) on interval [&quot;</span> &lt;&lt; a &lt;&lt; <span class="stringliteral">&quot;, &quot;</span> &lt;&lt; b</div>
<div class="line"><a id="l00152" name="l00152"></a><span class="lineno"> 152</span> &lt;&lt; <span class="stringliteral">&quot;] is equal to: &quot;</span> &lt;&lt; result_k &lt;&lt; <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/manip/endl.html">std::endl</a>;</div>
<div class="line"><a id="l00153" name="l00153"></a><span class="lineno"> 153</span> </div>
<div class="line"><a id="l00154" name="l00154"></a><span class="lineno"> 154</span> <span class="keywordtype">double</span> result_l = numerical_methods::simpson_method::evaluate_by_simpson(</div>
<div class="line"><a id="l00155" name="l00155"></a><span class="lineno"> 155</span> N, <a class="code hl_function" href="../../d1/df3/hash__search_8cpp.html#a566eaf0ffafd50bc61e644561fd27001">h</a>, a, numerical_methods::simpson_method::l);</div>
<div class="line"><a id="l00156" name="l00156"></a><span class="lineno"> 156</span> assert((used_argv_parameters || (result_l &gt;= 7.16 &amp;&amp; result_l &lt;= 7.17)) &amp;&amp;</div>
<div class="line"><a id="l00157" name="l00157"></a><span class="lineno"> 157</span> <span class="stringliteral">&quot;The result of l(x) is wrong&quot;</span>);</div>
<div class="line"><a id="l00158" name="l00158"></a><span class="lineno"> 158</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> &lt;&lt; <span class="stringliteral">&quot;The result of integral l(x) on interval [&quot;</span> &lt;&lt; a &lt;&lt; <span class="stringliteral">&quot;, &quot;</span> &lt;&lt; b</div>
<div class="line"><a id="l00159" name="l00159"></a><span class="lineno"> 159</span> &lt;&lt; <span class="stringliteral">&quot;] is equal to: &quot;</span> &lt;&lt; result_l &lt;&lt; <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/manip/endl.html">std::endl</a>;</div>
<div class="line"><a id="l00160" name="l00160"></a><span class="lineno"> 160</span>}</div>
<div class="fragment"><div class="line"><a id="l00133" name="l00133"></a><span class="lineno"> 133</span> {</div>
<div class="line"><a id="l00134" name="l00134"></a><span class="lineno"> 134</span> <span class="comment">// Call the functions and find the integral of each function</span></div>
<div class="line"><a id="l00135" name="l00135"></a><span class="lineno"> 135</span> <span class="keywordtype">double</span> result_f = numerical_methods::simpson_method::evaluate_by_simpson(</div>
<div class="line"><a id="l00136" name="l00136"></a><span class="lineno"> 136</span> N, <a class="code hl_function" href="../../d1/df3/hash__search_8cpp.html#a566eaf0ffafd50bc61e644561fd27001">h</a>, a, numerical_methods::simpson_method::f);</div>
<div class="line"><a id="l00137" name="l00137"></a><span class="lineno"> 137</span> assert((used_argv_parameters || (result_f &gt;= 4.09 &amp;&amp; result_f &lt;= 4.10)) &amp;&amp;</div>
<div class="line"><a id="l00138" name="l00138"></a><span class="lineno"> 138</span> <span class="stringliteral">&quot;The result of f(x) is wrong&quot;</span>);</div>
<div class="line"><a id="l00139" name="l00139"></a><span class="lineno"> 139</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> &lt;&lt; <span class="stringliteral">&quot;The result of integral f(x) on interval [&quot;</span> &lt;&lt; a &lt;&lt; <span class="stringliteral">&quot;, &quot;</span> &lt;&lt; b</div>
<div class="line"><a id="l00140" name="l00140"></a><span class="lineno"> 140</span> &lt;&lt; <span class="stringliteral">&quot;] is equal to: &quot;</span> &lt;&lt; result_f &lt;&lt; <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/manip/endl.html">std::endl</a>;</div>
<div class="line"><a id="l00141" name="l00141"></a><span class="lineno"> 141</span> </div>
<div class="line"><a id="l00142" name="l00142"></a><span class="lineno"> 142</span> <span class="keywordtype">double</span> result_g = numerical_methods::simpson_method::evaluate_by_simpson(</div>
<div class="line"><a id="l00143" name="l00143"></a><span class="lineno"> 143</span> N, <a class="code hl_function" href="../../d1/df3/hash__search_8cpp.html#a566eaf0ffafd50bc61e644561fd27001">h</a>, a, numerical_methods::simpson_method::g);</div>
<div class="line"><a id="l00144" name="l00144"></a><span class="lineno"> 144</span> assert((used_argv_parameters || (result_g &gt;= 0.27 &amp;&amp; result_g &lt;= 0.28)) &amp;&amp;</div>
<div class="line"><a id="l00145" name="l00145"></a><span class="lineno"> 145</span> <span class="stringliteral">&quot;The result of g(x) is wrong&quot;</span>);</div>
<div class="line"><a id="l00146" name="l00146"></a><span class="lineno"> 146</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> &lt;&lt; <span class="stringliteral">&quot;The result of integral g(x) on interval [&quot;</span> &lt;&lt; a &lt;&lt; <span class="stringliteral">&quot;, &quot;</span> &lt;&lt; b</div>
<div class="line"><a id="l00147" name="l00147"></a><span class="lineno"> 147</span> &lt;&lt; <span class="stringliteral">&quot;] is equal to: &quot;</span> &lt;&lt; result_g &lt;&lt; <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/manip/endl.html">std::endl</a>;</div>
<div class="line"><a id="l00148" name="l00148"></a><span class="lineno"> 148</span> </div>
<div class="line"><a id="l00149" name="l00149"></a><span class="lineno"> 149</span> <span class="keywordtype">double</span> result_k = numerical_methods::simpson_method::evaluate_by_simpson(</div>
<div class="line"><a id="l00150" name="l00150"></a><span class="lineno"> 150</span> N, <a class="code hl_function" href="../../d1/df3/hash__search_8cpp.html#a566eaf0ffafd50bc61e644561fd27001">h</a>, a, numerical_methods::simpson_method::k);</div>
<div class="line"><a id="l00151" name="l00151"></a><span class="lineno"> 151</span> assert((used_argv_parameters || (result_k &gt;= 9.06 &amp;&amp; result_k &lt;= 9.07)) &amp;&amp;</div>
<div class="line"><a id="l00152" name="l00152"></a><span class="lineno"> 152</span> <span class="stringliteral">&quot;The result of k(x) is wrong&quot;</span>);</div>
<div class="line"><a id="l00153" name="l00153"></a><span class="lineno"> 153</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> &lt;&lt; <span class="stringliteral">&quot;The result of integral k(x) on interval [&quot;</span> &lt;&lt; a &lt;&lt; <span class="stringliteral">&quot;, &quot;</span> &lt;&lt; b</div>
<div class="line"><a id="l00154" name="l00154"></a><span class="lineno"> 154</span> &lt;&lt; <span class="stringliteral">&quot;] is equal to: &quot;</span> &lt;&lt; result_k &lt;&lt; <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/manip/endl.html">std::endl</a>;</div>
<div class="line"><a id="l00155" name="l00155"></a><span class="lineno"> 155</span> </div>
<div class="line"><a id="l00156" name="l00156"></a><span class="lineno"> 156</span> <span class="keywordtype">double</span> result_l = numerical_methods::simpson_method::evaluate_by_simpson(</div>
<div class="line"><a id="l00157" name="l00157"></a><span class="lineno"> 157</span> N, <a class="code hl_function" href="../../d1/df3/hash__search_8cpp.html#a566eaf0ffafd50bc61e644561fd27001">h</a>, a, numerical_methods::simpson_method::l);</div>
<div class="line"><a id="l00158" name="l00158"></a><span class="lineno"> 158</span> assert((used_argv_parameters || (result_l &gt;= 7.16 &amp;&amp; result_l &lt;= 7.17)) &amp;&amp;</div>
<div class="line"><a id="l00159" name="l00159"></a><span class="lineno"> 159</span> <span class="stringliteral">&quot;The result of l(x) is wrong&quot;</span>);</div>
<div class="line"><a id="l00160" name="l00160"></a><span class="lineno"> 160</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> &lt;&lt; <span class="stringliteral">&quot;The result of integral l(x) on interval [&quot;</span> &lt;&lt; a &lt;&lt; <span class="stringliteral">&quot;, &quot;</span> &lt;&lt; b</div>
<div class="line"><a id="l00161" name="l00161"></a><span class="lineno"> 161</span> &lt;&lt; <span class="stringliteral">&quot;] is equal to: &quot;</span> &lt;&lt; result_l &lt;&lt; <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/manip/endl.html">std::endl</a>;</div>
<div class="line"><a id="l00162" name="l00162"></a><span class="lineno"> 162</span>}</div>
</div><!-- fragment -->
</div>
</div>