mirror of
https://github.com/TheAlgorithms/C-Plus-Plus.git
synced 2026-03-25 22:32:24 +08:00
Documentation for 8b1eab204b
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
<!-- HTML header for doxygen 1.12.0-->
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
|
||||
<head>
|
||||
@@ -5,10 +6,15 @@
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=11"/>
|
||||
<meta name="generator" content="Doxygen 1.12.0"/>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1"/>
|
||||
<title>Algorithms_in_C++: numerical_methods/successive_approximation.cpp File Reference</title>
|
||||
<title>TheAlgorithms/C++: numerical_methods/successive_approximation.cpp File Reference</title>
|
||||
<link rel="icon" href="../../favicon.svg" type="image/x-icon" />
|
||||
<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="https://cdn.jsdelivr.net/npm/@xpack-3rd-party/doxygen-awesome-css@2.2.0-1/doxygen-awesome-darkmode-toggle.js"></script>
|
||||
<script type="text/javascript">
|
||||
DoxygenAwesomeDarkModeToggle.init()
|
||||
</script>
|
||||
<script type="text/javascript" src="../../clipboard.js"></script>
|
||||
<link href="../../navtree.css" rel="stylesheet" type="text/css"/>
|
||||
<script type="text/javascript" src="../../navtreedata.js"></script>
|
||||
@@ -18,14 +24,24 @@
|
||||
<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>
|
||||
<script type="text/x-mathjax-config">
|
||||
MathJax.Hub.Config({
|
||||
extensions: ["tex2jax.js", "TeX/AMSmath.js", "TeX/AMSsymbols.js"],
|
||||
jax: ["input/TeX","output/HTML-CSS"],
|
||||
});
|
||||
<script type="text/javascript">
|
||||
window.MathJax = {
|
||||
options: {
|
||||
ignoreHtmlClass: 'tex2jax_ignore',
|
||||
processHtmlClass: 'tex2jax_process'
|
||||
},
|
||||
loader: {
|
||||
load: ['[tex]/ams']
|
||||
},
|
||||
tex: {
|
||||
macros: {},
|
||||
packages: ['base','configmacros','ams']
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<script type="text/javascript" async="async" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.7/MathJax.js?config=TeX-MML-AM_CHTML/MathJax.js"></script>
|
||||
<script type="text/javascript" id="MathJax-script" async="async" src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-chtml.js"></script>
|
||||
<link href="../../doxygen.css" rel="stylesheet" type="text/css" />
|
||||
<link href="../../doxygen-awesome.css" rel="stylesheet" type="text/css"/>
|
||||
</head>
|
||||
<body>
|
||||
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
|
||||
@@ -33,10 +49,11 @@ MathJax.Hub.Config({
|
||||
<table cellspacing="0" cellpadding="0">
|
||||
<tbody>
|
||||
<tr id="projectrow">
|
||||
<td id="projectlogo"><img alt="Logo" src="../../project_logo.png"/></td>
|
||||
<td id="projectalign">
|
||||
<div id="projectname">Algorithms_in_C++<span id="projectnumber"> 1.0.0</span>
|
||||
<div id="projectname">TheAlgorithms/C++<span id="projectnumber"> 1.0.0</span>
|
||||
</div>
|
||||
<div id="projectbrief">Set of algorithms implemented in C++.</div>
|
||||
<div id="projectbrief">All the algorithms implemented in C++</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
@@ -119,7 +136,9 @@ Include dependency graph for successive_approximation.cpp:</div>
|
||||
<div class="dyncontent">
|
||||
<div class="center"><iframe scrolling="no" frameborder="0" src="../../d0/dcc/successive__approximation_8cpp__incl.svg" width="215" height="126"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe></div>
|
||||
</div>
|
||||
</div><table class="memberdecls">
|
||||
</div>
|
||||
<p><a href="../../df/dc8/successive__approximation_8cpp_source.html">Go to the source code of this file.</a></p>
|
||||
<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:a79c1d08919ff7780a5d7723172602389" id="r_a79c1d08919ff7780a5d7723172602389"><td class="memItemLeft" align="right" valign="top">static float </td><td class="memItemRight" valign="bottom"><a class="el" href="#a79c1d08919ff7780a5d7723172602389">eq</a> (float y)</td></tr>
|
||||
@@ -131,6 +150,8 @@ Functions</h2></td></tr>
|
||||
</table>
|
||||
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
|
||||
<div class="textblock"><p>Method of successive approximations using <a href="https://en.wikipedia.org/wiki/Fixed-point_iteration" target="_blank">fixed-point iteration</a> method. </p>
|
||||
|
||||
<p class="definition">Definition in file <a class="el" href="../../df/dc8/successive__approximation_8cpp_source.html">successive_approximation.cpp</a>.</p>
|
||||
</div><h2 class="groupheader">Function Documentation</h2>
|
||||
<a id="a79c1d08919ff7780a5d7723172602389" name="a79c1d08919ff7780a5d7723172602389"></a>
|
||||
<h2 class="memtitle"><span class="permalink"><a href="#a79c1d08919ff7780a5d7723172602389">◆ </a></span>eq()</h2>
|
||||
@@ -157,8 +178,9 @@ Functions</h2></td></tr>
|
||||
<p>equation 1 </p><p class="formulaDsp">
|
||||
\[f(y) = 3y - \cos y -2\]
|
||||
</p>
|
||||
<div class="fragment"><div class="line"><span class="lineno"> 12</span>{ <span class="keywordflow">return</span> (3 * y) - <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/numeric/math/cos.html">cos</a>(y) - 2; }</div>
|
||||
<div class="ttc" id="acos_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/numeric/math/cos.html">std::cos</a></div><div class="ttdeci">T cos(T... args)</div></div>
|
||||
|
||||
<p class="definition">Definition at line <a class="el" href="../../df/dc8/successive__approximation_8cpp_source.html#l00012">12</a> of file <a class="el" href="../../df/dc8/successive__approximation_8cpp_source.html">successive_approximation.cpp</a>.</p>
|
||||
<div class="fragment"><div class="line"><span class="lineno"> 12</span>{ <span class="keywordflow">return</span> (3 * y) - cos(y) - 2; }</div>
|
||||
</div><!-- fragment -->
|
||||
</div>
|
||||
</div>
|
||||
@@ -187,7 +209,9 @@ Functions</h2></td></tr>
|
||||
<p>equation 2 </p><p class="formulaDsp">
|
||||
\[f(y) = \frac{\cos y+2}{2}\]
|
||||
</p>
|
||||
<div class="fragment"><div class="line"><span class="lineno"> 17</span>{ <span class="keywordflow">return</span> 0.5 * (<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/numeric/math/cos.html">cos</a>(y) + 2); }</div>
|
||||
|
||||
<p class="definition">Definition at line <a class="el" href="../../df/dc8/successive__approximation_8cpp_source.html#l00017">17</a> of file <a class="el" href="../../df/dc8/successive__approximation_8cpp_source.html">successive_approximation.cpp</a>.</p>
|
||||
<div class="fragment"><div class="line"><span class="lineno"> 17</span>{ <span class="keywordflow">return</span> 0.5 * (cos(y) + 2); }</div>
|
||||
</div><!-- fragment -->
|
||||
</div>
|
||||
</div>
|
||||
@@ -206,38 +230,33 @@ Functions</h2></td></tr>
|
||||
</table>
|
||||
</div><div class="memdoc">
|
||||
<p>Main function </p>
|
||||
|
||||
<p class="definition">Definition at line <a class="el" href="../../df/dc8/successive__approximation_8cpp_source.html#l00020">20</a> of file <a class="el" href="../../df/dc8/successive__approximation_8cpp_source.html">successive_approximation.cpp</a>.</p>
|
||||
<div class="fragment"><div class="line"><span class="lineno"> 20</span> {</div>
|
||||
<div class="line"><span class="lineno"> 21</span> <span class="keywordtype">float</span> y, x1, x2, x3, <a class="code hl_function" href="../../d8/d77/namespacemachine__learning.html#a6f1c98c016ad34ff3d9f39372161bd35">sum</a>, s, a, f1, f2, gd;</div>
|
||||
<div class="line"><span class="lineno"> 22</span> <span class="keywordtype">int</span> i, n;</div>
|
||||
<div class="line"><span class="lineno"> 23</span> </div>
|
||||
<div class="line"><span class="lineno"> 24</span> <span class="keywordflow">for</span> (i = 0; i < 10; i++) {</div>
|
||||
<div class="line"><span class="lineno"> 25</span> <a class="code hl_function" href="../../d8/d77/namespacemachine__learning.html#a6f1c98c016ad34ff3d9f39372161bd35">sum</a> = <a class="code hl_function" href="#a79c1d08919ff7780a5d7723172602389">eq</a>(y);</div>
|
||||
<div class="line"><span class="lineno"> 26</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">"value of equation at "</span> << i << <span class="stringliteral">" "</span> << <a class="code hl_function" href="../../d8/d77/namespacemachine__learning.html#a6f1c98c016ad34ff3d9f39372161bd35">sum</a> << <span class="stringliteral">"\n"</span>;</div>
|
||||
<div class="line"><span class="lineno"> 26</span> std::cout << <span class="stringliteral">"value of equation at "</span> << i << <span class="stringliteral">" "</span> << <a class="code hl_function" href="../../d8/d77/namespacemachine__learning.html#a6f1c98c016ad34ff3d9f39372161bd35">sum</a> << <span class="stringliteral">"\n"</span>;</div>
|
||||
<div class="line"><span class="lineno"> 27</span> y++;</div>
|
||||
<div class="line"><span class="lineno"> 28</span> }</div>
|
||||
<div class="line"><span class="lineno"> 29</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">"enter the x1->"</span>;</div>
|
||||
<div class="line"><span class="lineno"> 30</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_istream.html">std::cin</a> >> x1;</div>
|
||||
<div class="line"><span class="lineno"> 31</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">"enter the no iteration to perform->\n"</span>;</div>
|
||||
<div class="line"><span class="lineno"> 32</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_istream.html">std::cin</a> >> n;</div>
|
||||
<div class="line"><span class="lineno"> 29</span> std::cout << <span class="stringliteral">"enter the x1->"</span>;</div>
|
||||
<div class="line"><span class="lineno"> 30</span> std::cin >> x1;</div>
|
||||
<div class="line"><span class="lineno"> 31</span> std::cout << <span class="stringliteral">"enter the no iteration to perform->\n"</span>;</div>
|
||||
<div class="line"><span class="lineno"> 32</span> std::cin >> n;</div>
|
||||
<div class="line"><span class="lineno"> 33</span> </div>
|
||||
<div class="line"><span class="lineno"> 34</span> <span class="keywordflow">for</span> (i = 0; i <= n; i++) {</div>
|
||||
<div class="line"><span class="lineno"> 35</span> x2 = <a class="code hl_function" href="#ae89c36add7c55298c5195d0a83de1456">eqd</a>(x1);</div>
|
||||
<div class="line"><span class="lineno"> 36</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">"\nenter the x2->"</span> << x2;</div>
|
||||
<div class="line"><span class="lineno"> 36</span> std::cout << <span class="stringliteral">"\nenter the x2->"</span> << x2;</div>
|
||||
<div class="line"><span class="lineno"> 37</span> x1 = x2;</div>
|
||||
<div class="line"><span class="lineno"> 38</span> }</div>
|
||||
<div class="line"><span class="lineno"> 39</span> <span class="keywordflow">return</span> 0;</div>
|
||||
<div class="line"><span class="lineno"> 40</span>}</div>
|
||||
<div class="ttc" id="abasic_istream_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/io/basic_istream.html">std::cin</a></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="anamespacemachine__learning_html_a6f1c98c016ad34ff3d9f39372161bd35"><div class="ttname"><a href="../../d8/d77/namespacemachine__learning.html#a6f1c98c016ad34ff3d9f39372161bd35">machine_learning::sum</a></div><div class="ttdeci">T sum(const std::vector< std::valarray< T > > &A)</div><div class="ttdef"><b>Definition</b> vector_ops.hpp:232</div></div>
|
||||
<div class="ttc" id="asuccessive__approximation_8cpp_html_a79c1d08919ff7780a5d7723172602389"><div class="ttname"><a href="#a79c1d08919ff7780a5d7723172602389">eq</a></div><div class="ttdeci">static float eq(float y)</div><div class="ttdef"><b>Definition</b> successive_approximation.cpp:12</div></div>
|
||||
<div class="ttc" id="asuccessive__approximation_8cpp_html_ae89c36add7c55298c5195d0a83de1456"><div class="ttname"><a href="#ae89c36add7c55298c5195d0a83de1456">eqd</a></div><div class="ttdeci">static float eqd(float y)</div><div class="ttdef"><b>Definition</b> successive_approximation.cpp:17</div></div>
|
||||
</div><!-- fragment --><div class="dynheader">
|
||||
Here is the call graph for this function:</div>
|
||||
<div class="dyncontent">
|
||||
<div class="center"><iframe scrolling="no" frameborder="0" src="../../df/dc8/successive__approximation_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.svg" width="151" height="86"><p><b>This browser is not able to show SVG: try Firefox, Chrome, Safari, or Opera instead.</b></p></iframe></div>
|
||||
</div>
|
||||
|
||||
<div class="ttc" id="anamespacemachine__learning_html_a6f1c98c016ad34ff3d9f39372161bd35"><div class="ttname"><a href="../../d8/d77/namespacemachine__learning.html#a6f1c98c016ad34ff3d9f39372161bd35">machine_learning::sum</a></div><div class="ttdeci">T sum(const std::vector< std::valarray< T > > &A)</div><div class="ttdef"><b>Definition</b> <a href="../../d8/d95/vector__ops_8hpp_source.html#l00232">vector_ops.hpp:232</a></div></div>
|
||||
<div class="ttc" id="asuccessive__approximation_8cpp_html_a79c1d08919ff7780a5d7723172602389"><div class="ttname"><a href="#a79c1d08919ff7780a5d7723172602389">eq</a></div><div class="ttdeci">static float eq(float y)</div><div class="ttdef"><b>Definition</b> <a href="../../df/dc8/successive__approximation_8cpp_source.html#l00012">successive_approximation.cpp:12</a></div></div>
|
||||
<div class="ttc" id="asuccessive__approximation_8cpp_html_ae89c36add7c55298c5195d0a83de1456"><div class="ttname"><a href="#ae89c36add7c55298c5195d0a83de1456">eqd</a></div><div class="ttdeci">static float eqd(float y)</div><div class="ttdef"><b>Definition</b> <a href="../../df/dc8/successive__approximation_8cpp_source.html#l00017">successive_approximation.cpp:17</a></div></div>
|
||||
</div><!-- fragment -->
|
||||
</div>
|
||||
</div>
|
||||
</div><!-- contents -->
|
||||
|
||||
Reference in New Issue
Block a user