mirror of
https://github.com/TheAlgorithms/C-Plus-Plus.git
synced 2026-03-24 13:53:35 +08:00
Documentation for 0931d530ae
This commit is contained in:
@@ -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/bisection_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&dn=expat.txt MIT */
|
||||
var searchBox = new SearchBox("searchBox", "../../search/",'.html');
|
||||
@@ -137,8 +137,8 @@ Functions</h2></td></tr>
|
||||
<tr class="separator:ae66f6b31b5ad750f1fe042a706a4e3d4"><td class="memSeparator" colspan="2"> </td></tr>
|
||||
</table>
|
||||
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
|
||||
<div class="textblock"><p >Solve the equation \(f(x)=0\) using <a href="https://en.wikipedia.org/wiki/Bisection_method" target="_blank">bisection method</a> </p>
|
||||
<p >Given two points \(a\) and \(b\) such that \(f(a)<0\) and \(f(b)>0\), then the \((i+1)^\text{th}\) approximation is given by: </p><p class="formulaDsp">
|
||||
<div class="textblock"><p>Solve the equation \(f(x)=0\) using <a href="https://en.wikipedia.org/wiki/Bisection_method" target="_blank">bisection method</a> </p>
|
||||
<p>Given two points \(a\) and \(b\) such that \(f(a)<0\) and \(f(b)>0\), then the \((i+1)^\text{th}\) approximation is given by: </p><p class="formulaDsp">
|
||||
\[
|
||||
x_{i+1} = \frac{a_i+b_i}{2}
|
||||
\]
|
||||
@@ -169,7 +169,7 @@ x_{i+1} = \frac{a_i+b_i}{2}
|
||||
</tr>
|
||||
</table>
|
||||
</div><div class="memdoc">
|
||||
<p >define \(f(x)\) to find root for </p>
|
||||
<p>define \(f(x)\) to find root for </p>
|
||||
<div class="fragment"><div class="line"><span class="lineno"> 26</span> {</div>
|
||||
<div class="line"><span class="lineno"> 27</span> <span class="keywordflow">return</span> (<a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/numeric/math/pow.html">std::pow</a>(i, 3) - (4 * i) - 9); <span class="comment">// original equation</span></div>
|
||||
<div class="line"><span class="lineno"> 28</span>}</div>
|
||||
@@ -198,7 +198,7 @@ Here is the call graph for this function:</div>
|
||||
</tr>
|
||||
</table>
|
||||
</div><div class="memdoc">
|
||||
<p >main function </p>
|
||||
<p>main function </p>
|
||||
<div class="fragment"><div class="line"><span class="lineno"> 37</span> {</div>
|
||||
<div class="line"><span class="lineno"> 38</span> <span class="keywordtype">double</span> a = -1, b = 1, x, z;</div>
|
||||
<div class="line"><span class="lineno"> 39</span> <span class="keywordtype">int</span> i;</div>
|
||||
@@ -269,7 +269,7 @@ template<typename T > </div>
|
||||
</tr>
|
||||
</table>
|
||||
</div><div class="memdoc">
|
||||
<p >get the sign of any given number </p>
|
||||
<p>get the sign of any given number </p>
|
||||
<div class="fragment"><div class="line"><span class="lineno"> 32</span> {</div>
|
||||
<div class="line"><span class="lineno"> 33</span> <span class="keywordflow">return</span> (T(0) < val) - (val < T(0));</div>
|
||||
<div class="line"><span class="lineno"> 34</span>}</div>
|
||||
@@ -282,7 +282,7 @@ template<typename T > </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="../../d7/d6a/bisection__method_8cpp.html">bisection_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>
|
||||
|
||||
Reference in New Issue
Block a user