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++: math/sqrt_double.cpp File Reference</title>
|
||||
<title>TheAlgorithms/C++: math/sqrt_double.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>
|
||||
@@ -120,7 +137,9 @@ Include dependency graph for sqrt_double.cpp:</div>
|
||||
<div class="dyncontent">
|
||||
<div class="center"><iframe scrolling="no" frameborder="0" src="../../d0/dfc/sqrt__double_8cpp__incl.svg" width="171" height="111"><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="../../da/d24/sqrt__double_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:ae662282ad0740d2063ac404ca3bd74fc" id="r_ae662282ad0740d2063ac404ca3bd74fc"><td class="memItemLeft" align="right" valign="top">double </td><td class="memItemRight" valign="bottom"><a class="el" href="#ae662282ad0740d2063ac404ca3bd74fc">Sqrt</a> (double a)</td></tr>
|
||||
@@ -132,6 +151,8 @@ Functions</h2></td></tr>
|
||||
<div class="textblock"><p>Calculate the square root of any positive real number in \(O(\log
|
||||
N)\) time, with precision fixed using <a href="https://en.wikipedia.org/wiki/Bisection_method" target="_blank">bisection method</a> of root-finding. </p>
|
||||
<dl class="section see"><dt>See also</dt><dd>Can be implemented using faster and better algorithms like <a class="el" href="../../de/dd3/newton__raphson__method_8cpp.html" title="Solve the equation using Newton-Raphson method for both real and complex solutions.">newton_raphson_method.cpp</a> and <a class="el" href="../../dd/d29/false__position_8cpp.html" title="Solve the equation using false position method, also known as the Secant method.">false_position.cpp</a> </dd></dl>
|
||||
|
||||
<p class="definition">Definition in file <a class="el" href="../../da/d24/sqrt__double_8cpp_source.html">sqrt_double.cpp</a>.</p>
|
||||
</div><h2 class="groupheader">Function Documentation</h2>
|
||||
<a id="ae66f6b31b5ad750f1fe042a706a4e3d4" name="ae66f6b31b5ad750f1fe042a706a4e3d4"></a>
|
||||
<h2 class="memtitle"><span class="permalink"><a href="#ae66f6b31b5ad750f1fe042a706a4e3d4">◆ </a></span>main()</h2>
|
||||
@@ -148,24 +169,18 @@ N)\) time, with precision fixed using <a href="https://en.wikipedia.org/wiki/Bis
|
||||
</table>
|
||||
</div><div class="memdoc">
|
||||
<p>main function </p>
|
||||
|
||||
<p class="definition">Definition at line <a class="el" href="../../da/d24/sqrt__double_8cpp_source.html#l00042">42</a> of file <a class="el" href="../../da/d24/sqrt__double_8cpp_source.html">sqrt_double.cpp</a>.</p>
|
||||
<div class="fragment"><div class="line"><span class="lineno"> 42</span> {</div>
|
||||
<div class="line"><span class="lineno"> 43</span> <span class="keywordtype">double</span> n{};</div>
|
||||
<div class="line"><span class="lineno"> 44</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"> 44</span> std::cin >> n;</div>
|
||||
<div class="line"><span class="lineno"> 45</span> assert(n >= 0);</div>
|
||||
<div class="line"><span class="lineno"> 46</span> <span class="comment">// Change this line for a better precision</span></div>
|
||||
<div class="line"><span class="lineno"> 47</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a>.precision(12);</div>
|
||||
<div class="line"><span class="lineno"> 48</span> <a class="code hl_classRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a> << <a class="code hl_functionRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/manip/fixed.html">std::fixed</a> << <a class="code hl_function" href="#ae662282ad0740d2063ac404ca3bd74fc">Sqrt</a>(n);</div>
|
||||
<div class="line"><span class="lineno"> 47</span> std::cout.precision(12);</div>
|
||||
<div class="line"><span class="lineno"> 48</span> std::cout << std::fixed << <a class="code hl_function" href="#ae662282ad0740d2063ac404ca3bd74fc">Sqrt</a>(n);</div>
|
||||
<div class="line"><span class="lineno"> 49</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="afixed_html"><div class="ttname"><a href="http://en.cppreference.com/w/cpp/io/manip/fixed.html">std::fixed</a></div><div class="ttdeci">T fixed(T... args)</div></div>
|
||||
<div class="ttc" id="asqrt__double_8cpp_html_ae662282ad0740d2063ac404ca3bd74fc"><div class="ttname"><a href="#ae662282ad0740d2063ac404ca3bd74fc">Sqrt</a></div><div class="ttdeci">double Sqrt(double a)</div><div class="ttdef"><b>Definition</b> sqrt_double.cpp:16</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="../../da/d24/sqrt__double_8cpp_ae66f6b31b5ad750f1fe042a706a4e3d4_cgraph.svg" width="184" height="110"><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="asqrt__double_8cpp_html_ae662282ad0740d2063ac404ca3bd74fc"><div class="ttname"><a href="#ae662282ad0740d2063ac404ca3bd74fc">Sqrt</a></div><div class="ttdeci">double Sqrt(double a)</div><div class="ttdef"><b>Definition</b> <a href="../../da/d24/sqrt__double_8cpp_source.html#l00016">sqrt_double.cpp:16</a></div></div>
|
||||
</div><!-- fragment -->
|
||||
</div>
|
||||
</div>
|
||||
<a id="ae662282ad0740d2063ac404ca3bd74fc" name="ae662282ad0740d2063ac404ca3bd74fc"></a>
|
||||
@@ -183,6 +198,8 @@ Here is the call graph for this function:</div>
|
||||
</table>
|
||||
</div><div class="memdoc">
|
||||
<p>Bisection method implemented for the function \(x^2-a=0\) whose roots are \(\pm\sqrt{a}\) and only the positive root is returned. </p>
|
||||
|
||||
<p class="definition">Definition at line <a class="el" href="../../da/d24/sqrt__double_8cpp_source.html#l00016">16</a> of file <a class="el" href="../../da/d24/sqrt__double_8cpp_source.html">sqrt_double.cpp</a>.</p>
|
||||
<div class="fragment"><div class="line"><span class="lineno"> 16</span> {</div>
|
||||
<div class="line"><span class="lineno"> 17</span> <span class="keywordflow">if</span> (a > 0 && a < 1) {</div>
|
||||
<div class="line"><span class="lineno"> 18</span> <span class="keywordflow">return</span> 1 / <a class="code hl_function" href="#ae662282ad0740d2063ac404ca3bd74fc">Sqrt</a>(1 / a);</div>
|
||||
@@ -207,13 +224,8 @@ Here is the call graph for this function:</div>
|
||||
<div class="line"><span class="lineno"> 37</span> }</div>
|
||||
<div class="line"><span class="lineno"> 38</span> <span class="keywordflow">return</span> -1;</div>
|
||||
<div class="line"><span class="lineno"> 39</span>}</div>
|
||||
<div class="ttc" id="acomposite__simpson__rule_8cpp_html_a6d8df83a6f26ce24a75d3b358b7f5b8a"><div class="ttname"><a href="../../d4/d18/composite__simpson__rule_8cpp.html#a6d8df83a6f26ce24a75d3b358b7f5b8a">numerical_methods::simpson_method::l</a></div><div class="ttdeci">double l(double x)</div><div class="ttdoc">Another test function.</div><div class="ttdef"><b>Definition</b> composite_simpson_rule.cpp:119</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="../../da/d24/sqrt__double_8cpp_ae662282ad0740d2063ac404ca3bd74fc_cgraph.svg" width="56" height="60"><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="acomposite__simpson__rule_8cpp_html_a6d8df83a6f26ce24a75d3b358b7f5b8a"><div class="ttname"><a href="../../d4/d18/composite__simpson__rule_8cpp.html#a6d8df83a6f26ce24a75d3b358b7f5b8a">numerical_methods::simpson_method::l</a></div><div class="ttdeci">double l(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#l00119">composite_simpson_rule.cpp:119</a></div></div>
|
||||
</div><!-- fragment -->
|
||||
</div>
|
||||
</div>
|
||||
</div><!-- contents -->
|
||||
|
||||
Reference in New Issue
Block a user