Documentation for c26eea874d

This commit is contained in:
realstealthninja
2025-05-19 11:38:33 +00:00
parent c7a9a42397
commit 14583a2f33
2829 changed files with 30266 additions and 21669 deletions

View File

@@ -4,7 +4,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.12.0"/>
<meta name="generator" content="Doxygen 1.13.2"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>TheAlgorithms/C++: numerical_methods/rungekutta.cpp File Reference</title>
<link rel="icon" href="../../favicon.svg" type="image/x-icon" />
@@ -60,7 +60,7 @@ window.MathJax = {
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.12.0 -->
<!-- Generated by Doxygen 1.13.2 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
var searchBox = new SearchBox("searchBox", "../../search/",'.html');
@@ -196,7 +196,7 @@ Functions</h2></td></tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span> </td>
<span class="mlabels"><span class="mlabel static">static</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
@@ -301,7 +301,7 @@ Functions</h2></td></tr>
<div class="line"><span class="lineno"> 66</span> </div>
<div class="line"><span class="lineno"> 67</span> <span class="keyword">auto</span> n = <span class="keyword">static_cast&lt;</span>uint64_t<span class="keyword">&gt;</span>((x - init_x) / <a class="code hl_function" href="../../d1/df3/hash__search_8cpp.html#a566eaf0ffafd50bc61e644561fd27001">h</a>);</div>
<div class="line"><span class="lineno"> 68</span> <span class="comment">// used a vector container for the variables</span></div>
<div class="line"><span class="lineno"> 69</span> std::vector&lt;double&gt; <a class="code hl_function" href="../../d4/d18/composite__simpson__rule_8cpp.html#a1b74d828b33760094906797042b89442">k</a>(4, 0.0);</div>
<div class="line"><span class="lineno"> 69</span> std::vector&lt;double&gt; k(4, 0.0);</div>
<div class="line"><span class="lineno"> 70</span> </div>
<div class="line"><span class="lineno"> 71</span> <span class="comment">// Iterate for number of iterations</span></div>
<div class="line"><span class="lineno"> 72</span> </div>
@@ -309,10 +309,10 @@ Functions</h2></td></tr>
<div class="line"><span class="lineno"> 74</span> <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 1; i &lt;= n; ++i) {</div>
<div class="line"><span class="lineno"> 75</span> <span class="comment">// Apply Runge Kutta Formulas</span></div>
<div class="line"><span class="lineno"> 76</span> <span class="comment">// to find next value of y</span></div>
<div class="line"><span class="lineno"> 77</span> <a class="code hl_function" href="../../d4/d18/composite__simpson__rule_8cpp.html#a1b74d828b33760094906797042b89442">k</a>[0] = <a class="code hl_function" href="../../d1/df3/hash__search_8cpp.html#a566eaf0ffafd50bc61e644561fd27001">h</a> * <a class="code hl_function" href="#a450497475f5607333f9aca8f88901579">change</a>(init_x, y);</div>
<div class="line"><span class="lineno"> 78</span> <a class="code hl_function" href="../../d4/d18/composite__simpson__rule_8cpp.html#a1b74d828b33760094906797042b89442">k</a>[1] = <a class="code hl_function" href="../../d1/df3/hash__search_8cpp.html#a566eaf0ffafd50bc61e644561fd27001">h</a> * <a class="code hl_function" href="#a450497475f5607333f9aca8f88901579">change</a>(init_x + 0.5 * <a class="code hl_function" href="../../d1/df3/hash__search_8cpp.html#a566eaf0ffafd50bc61e644561fd27001">h</a>, y + 0.5 * k[0]);</div>
<div class="line"><span class="lineno"> 79</span> <a class="code hl_function" href="../../d4/d18/composite__simpson__rule_8cpp.html#a1b74d828b33760094906797042b89442">k</a>[2] = <a class="code hl_function" href="../../d1/df3/hash__search_8cpp.html#a566eaf0ffafd50bc61e644561fd27001">h</a> * <a class="code hl_function" href="#a450497475f5607333f9aca8f88901579">change</a>(init_x + 0.5 * <a class="code hl_function" href="../../d1/df3/hash__search_8cpp.html#a566eaf0ffafd50bc61e644561fd27001">h</a>, y + 0.5 * k[1]);</div>
<div class="line"><span class="lineno"> 80</span> <a class="code hl_function" href="../../d4/d18/composite__simpson__rule_8cpp.html#a1b74d828b33760094906797042b89442">k</a>[3] = <a class="code hl_function" href="../../d1/df3/hash__search_8cpp.html#a566eaf0ffafd50bc61e644561fd27001">h</a> * <a class="code hl_function" href="#a450497475f5607333f9aca8f88901579">change</a>(init_x + <a class="code hl_function" href="../../d1/df3/hash__search_8cpp.html#a566eaf0ffafd50bc61e644561fd27001">h</a>, y + k[2]);</div>
<div class="line"><span class="lineno"> 77</span> k[0] = <a class="code hl_function" href="../../d1/df3/hash__search_8cpp.html#a566eaf0ffafd50bc61e644561fd27001">h</a> * <a class="code hl_function" href="#a450497475f5607333f9aca8f88901579">change</a>(init_x, y);</div>
<div class="line"><span class="lineno"> 78</span> k[1] = <a class="code hl_function" href="../../d1/df3/hash__search_8cpp.html#a566eaf0ffafd50bc61e644561fd27001">h</a> * <a class="code hl_function" href="#a450497475f5607333f9aca8f88901579">change</a>(init_x + 0.5 * <a class="code hl_function" href="../../d1/df3/hash__search_8cpp.html#a566eaf0ffafd50bc61e644561fd27001">h</a>, y + 0.5 * k[0]);</div>
<div class="line"><span class="lineno"> 79</span> k[2] = <a class="code hl_function" href="../../d1/df3/hash__search_8cpp.html#a566eaf0ffafd50bc61e644561fd27001">h</a> * <a class="code hl_function" href="#a450497475f5607333f9aca8f88901579">change</a>(init_x + 0.5 * <a class="code hl_function" href="../../d1/df3/hash__search_8cpp.html#a566eaf0ffafd50bc61e644561fd27001">h</a>, y + 0.5 * k[1]);</div>
<div class="line"><span class="lineno"> 80</span> k[3] = <a class="code hl_function" href="../../d1/df3/hash__search_8cpp.html#a566eaf0ffafd50bc61e644561fd27001">h</a> * <a class="code hl_function" href="#a450497475f5607333f9aca8f88901579">change</a>(init_x + <a class="code hl_function" href="../../d1/df3/hash__search_8cpp.html#a566eaf0ffafd50bc61e644561fd27001">h</a>, y + k[2]);</div>
<div class="line"><span class="lineno"> 81</span> </div>
<div class="line"><span class="lineno"> 82</span> <span class="comment">// Update next value of y</span></div>
<div class="line"><span class="lineno"> 83</span> </div>
@@ -325,7 +325,6 @@ Functions</h2></td></tr>
<div class="line"><span class="lineno"> 90</span> </div>
<div class="line"><span class="lineno"> 91</span> <span class="keywordflow">return</span> y;</div>
<div class="line"><span class="lineno"> 92</span>}</div>
<div class="ttc" id="acomposite__simpson__rule_8cpp_html_a1b74d828b33760094906797042b89442"><div class="ttname"><a href="../../d4/d18/composite__simpson__rule_8cpp.html#a1b74d828b33760094906797042b89442">numerical_methods::simpson_method::k</a></div><div class="ttdeci">double k(double x)</div><div class="ttdoc">Another test function.</div><div class="ttdef"><b>Definition</b> <a href="../../d4/d18/composite__simpson__rule_8cpp_source.html#l00117">composite_simpson_rule.cpp:117</a></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> <a href="../../d1/df3/hash__search_8cpp_source.html#l00045">hash_search.cpp:45</a></div></div>
<div class="ttc" id="arungekutta_8cpp_html_a450497475f5607333f9aca8f88901579"><div class="ttname"><a href="#a450497475f5607333f9aca8f88901579">change</a></div><div class="ttdeci">static double change(double x, double y)</div><div class="ttdoc">asserting the test functions</div><div class="ttdef"><b>Definition</b> <a href="../../d1/da6/rungekutta_8cpp_source.html#l00033">rungekutta.cpp:33</a></div></div>
</div><!-- fragment -->
@@ -349,7 +348,7 @@ Functions</h2></td></tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">static</span></span> </td>
<span class="mlabels"><span class="mlabel static">static</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
@@ -393,7 +392,7 @@ Functions</h2></td></tr>
<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="../../d1/da6/rungekutta_8cpp.html">rungekutta.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.12.0 </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.13.2 </li>
</ul>
</div>
</body>

View File

@@ -2,6 +2,6 @@ var rungekutta_8cpp =
[
[ "change", "d1/da6/rungekutta_8cpp.html#a450497475f5607333f9aca8f88901579", null ],
[ "main", "d1/da6/rungekutta_8cpp.html#ae66f6b31b5ad750f1fe042a706a4e3d4", null ],
[ "rungeKutta", "d1/da6/rungekutta_8cpp.html#a7b9f40c7b5e9749cc550f19be3dc8856", null ],
[ "numerical_methods::runge_kutta::rungeKutta", "d1/da6/rungekutta_8cpp.html#a7b9f40c7b5e9749cc550f19be3dc8856", null ],
[ "test", "d1/da6/rungekutta_8cpp.html#aa8dca7b867074164d5f45b0f3851269d", null ]
];

View File

@@ -4,7 +4,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.12.0"/>
<meta name="generator" content="Doxygen 1.13.2"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>TheAlgorithms/C++: numerical_methods/rungekutta.cpp Source File</title>
<link rel="icon" href="../../favicon.svg" type="image/x-icon" />
@@ -60,7 +60,7 @@ window.MathJax = {
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.12.0 -->
<!-- Generated by Doxygen 1.13.2 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&amp;dn=expat.txt MIT */
var searchBox = new SearchBox("searchBox", "../../search/",'.html');
@@ -124,13 +124,13 @@ $(function(){initNavTree('d1/da6/rungekutta_8cpp_source.html','../../'); initRes
<div class="headertitle"><div class="title">rungekutta.cpp</div></div>
</div><!--header-->
<div class="contents">
<a href="../../d1/da6/rungekutta_8cpp.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a id="l00001" name="l00001"></a><span class="lineno"> 1</span> </div>
<a href="../../d1/da6/rungekutta_8cpp.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a id="l00001" name="l00001"></a><span class="lineno"> 1</span></div>
<div class="line"><a id="l00021" name="l00021"></a><span class="lineno"> 21</span><span class="preprocessor">#include &lt;cassert&gt;</span> </div>
<div class="line"><a id="l00022" name="l00022"></a><span class="lineno"> 22</span><span class="preprocessor">#include &lt;cstdint&gt;</span></div>
<div class="line"><a id="l00023" name="l00023"></a><span class="lineno"> 23</span><span class="preprocessor">#include &lt;iostream&gt;</span> </div>
<div class="line"><a id="l00024" name="l00024"></a><span class="lineno"> 24</span><span class="preprocessor">#include &lt;vector&gt;</span> </div>
<div class="line"><a id="l00033" name="l00033"></a><span class="lineno"><a class="line" href="../../d1/da6/rungekutta_8cpp.html#a450497475f5607333f9aca8f88901579"> 33</a></span><span class="keyword">static</span> <span class="keywordtype">double</span> <a class="code hl_function" href="../../d1/da6/rungekutta_8cpp.html#a450497475f5607333f9aca8f88901579">change</a>(<span class="keywordtype">double</span> x, <span class="keywordtype">double</span> y) { <span class="keywordflow">return</span> ((x - y) / 2.0); }</div>
<div class="line"><a id="l00034" name="l00034"></a><span class="lineno"> 34</span> </div>
<div class="line"><a id="l00034" name="l00034"></a><span class="lineno"> 34</span></div>
<div class="line"><a id="l00039" name="l00039"></a><span class="lineno"> 39</span><span class="keyword">namespace </span><a class="code hl_namespace" href="../../d1/de0/namespacenumerical__methods.html">numerical_methods</a> {</div>
<div class="line"><a id="l00045" name="l00045"></a><span class="lineno"> 45</span><span class="keyword">namespace </span><a class="code hl_namespace" href="../../d2/de7/namespacerunge__kutta.html">runge_kutta</a> {</div>
<div class="foldopen" id="foldopen00057" data-start="{" data-end="}">
@@ -173,7 +173,7 @@ $(function(){initNavTree('d1/da6/rungekutta_8cpp_source.html','../../'); initRes
</div>
<div class="line"><a id="l00093" name="l00093"></a><span class="lineno"> 93</span>} <span class="comment">// namespace runge_kutta</span></div>
<div class="line"><a id="l00094" name="l00094"></a><span class="lineno"> 94</span>} <span class="comment">// namespace numerical_methods</span></div>
<div class="line"><a id="l00095" name="l00095"></a><span class="lineno"> 95</span> </div>
<div class="line"><a id="l00095" name="l00095"></a><span class="lineno"> 95</span></div>
<div class="foldopen" id="foldopen00100" data-start="{" data-end="}">
<div class="line"><a id="l00100" name="l00100"></a><span class="lineno"><a class="line" href="../../d1/da6/rungekutta_8cpp.html#aa8dca7b867074164d5f45b0f3851269d"> 100</a></span><span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code hl_function" href="../../d1/da6/rungekutta_8cpp.html#aa8dca7b867074164d5f45b0f3851269d">test</a>() {</div>
<div class="line"><a id="l00101" name="l00101"></a><span class="lineno"> 101</span> std::cout &lt;&lt; <span class="stringliteral">&quot;The Runge Kutta function will be tested on the basis of &quot;</span></div>
@@ -181,27 +181,27 @@ $(function(){initNavTree('d1/da6/rungekutta_8cpp_source.html','../../'); initRes
<div class="line"><a id="l00103" name="l00103"></a><span class="lineno"> 103</span> </div>
<div class="line"><a id="l00104" name="l00104"></a><span class="lineno"> 104</span> std::cout &lt;&lt; <span class="stringliteral">&quot;Test 1....&quot;</span></div>
<div class="line"><a id="l00105" name="l00105"></a><span class="lineno"> 105</span> &lt;&lt; <span class="stringliteral">&quot;\n&quot;</span>;</div>
<div class="line"><a id="l00106" name="l00106"></a><span class="lineno"> 106</span> <span class="keywordtype">double</span> valfirst = numerical_methods::runge_kutta::rungeKutta(</div>
<div class="line"><a id="l00106" name="l00106"></a><span class="lineno"> 106</span> <span class="keywordtype">double</span> valfirst = <a class="code hl_function" href="../../d1/da6/rungekutta_8cpp.html#a7b9f40c7b5e9749cc550f19be3dc8856">numerical_methods::runge_kutta::rungeKutta</a>(</div>
<div class="line"><a id="l00107" name="l00107"></a><span class="lineno"> 107</span> 2, 3, 4, 0.2); <span class="comment">// Tests the function with pre calculated values</span></div>
<div class="line"><a id="l00108" name="l00108"></a><span class="lineno"> 108</span> assert(valfirst == 3.10363932323749570);</div>
<div class="line"><a id="l00109" name="l00109"></a><span class="lineno"> 109</span> std::cout &lt;&lt; <span class="stringliteral">&quot;Passed Test 1\n&quot;</span>;</div>
<div class="line"><a id="l00110" name="l00110"></a><span class="lineno"> 110</span> </div>
<div class="line"><a id="l00111" name="l00111"></a><span class="lineno"> 111</span> std::cout &lt;&lt; <span class="stringliteral">&quot;Test 2....&quot;</span></div>
<div class="line"><a id="l00112" name="l00112"></a><span class="lineno"> 112</span> &lt;&lt; <span class="stringliteral">&quot;\n&quot;</span>;</div>
<div class="line"><a id="l00113" name="l00113"></a><span class="lineno"> 113</span> <span class="keywordtype">double</span> valsec = numerical_methods::runge_kutta::rungeKutta(</div>
<div class="line"><a id="l00113" name="l00113"></a><span class="lineno"> 113</span> <span class="keywordtype">double</span> valsec = <a class="code hl_function" href="../../d1/da6/rungekutta_8cpp.html#a7b9f40c7b5e9749cc550f19be3dc8856">numerical_methods::runge_kutta::rungeKutta</a>(</div>
<div class="line"><a id="l00114" name="l00114"></a><span class="lineno"> 114</span> 1, 2, 5, 0.1); <span class="comment">// The value of step changed</span></div>
<div class="line"><a id="l00115" name="l00115"></a><span class="lineno"> 115</span> assert(valsec == 3.40600589380261409);</div>
<div class="line"><a id="l00116" name="l00116"></a><span class="lineno"> 116</span> std::cout &lt;&lt; <span class="stringliteral">&quot;Passed Test 2\n&quot;</span>;</div>
<div class="line"><a id="l00117" name="l00117"></a><span class="lineno"> 117</span> </div>
<div class="line"><a id="l00118" name="l00118"></a><span class="lineno"> 118</span> std::cout &lt;&lt; <span class="stringliteral">&quot;Test 3....&quot;</span></div>
<div class="line"><a id="l00119" name="l00119"></a><span class="lineno"> 119</span> &lt;&lt; <span class="stringliteral">&quot;\n&quot;</span>;</div>
<div class="line"><a id="l00120" name="l00120"></a><span class="lineno"> 120</span> <span class="keywordtype">double</span> valthird = numerical_methods::runge_kutta::rungeKutta(</div>
<div class="line"><a id="l00120" name="l00120"></a><span class="lineno"> 120</span> <span class="keywordtype">double</span> valthird = <a class="code hl_function" href="../../d1/da6/rungekutta_8cpp.html#a7b9f40c7b5e9749cc550f19be3dc8856">numerical_methods::runge_kutta::rungeKutta</a>(</div>
<div class="line"><a id="l00121" name="l00121"></a><span class="lineno"> 121</span> -1, 3, 4, 0.1); <span class="comment">// Tested with negative value</span></div>
<div class="line"><a id="l00122" name="l00122"></a><span class="lineno"> 122</span> assert(valthird == 2.49251005860244268);</div>
<div class="line"><a id="l00123" name="l00123"></a><span class="lineno"> 123</span> std::cout &lt;&lt; <span class="stringliteral">&quot;Passed Test 3\n&quot;</span>;</div>
<div class="line"><a id="l00124" name="l00124"></a><span class="lineno"> 124</span>}</div>
</div>
<div class="line"><a id="l00125" name="l00125"></a><span class="lineno"> 125</span> </div>
<div class="line"><a id="l00125" name="l00125"></a><span class="lineno"> 125</span></div>
<div class="foldopen" id="foldopen00130" data-start="{" data-end="}">
<div class="line"><a id="l00130" name="l00130"></a><span class="lineno"><a class="line" href="../../d1/da6/rungekutta_8cpp.html#ae66f6b31b5ad750f1fe042a706a4e3d4"> 130</a></span><span class="keywordtype">int</span> <a class="code hl_function" href="../../d1/da6/rungekutta_8cpp.html#ae66f6b31b5ad750f1fe042a706a4e3d4">main</a>() {</div>
<div class="line"><a id="l00131" name="l00131"></a><span class="lineno"> 131</span> <a class="code hl_function" href="../../d1/da6/rungekutta_8cpp.html#aa8dca7b867074164d5f45b0f3851269d">test</a>(); <span class="comment">// Execute the tests</span></div>
@@ -221,7 +221,7 @@ $(function(){initNavTree('d1/da6/rungekutta_8cpp_source.html','../../'); initRes
<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="../../d1/da6/rungekutta_8cpp.html">rungekutta.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.12.0 </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.13.2 </li>
</ul>
</div>
</body>