Documentation for 9a58357372

This commit is contained in:
github-actions
2022-01-19 15:37:46 +00:00
parent 2cab28c905
commit dfedbcef8a
219 changed files with 2538 additions and 1699 deletions

View File

@@ -91,16 +91,24 @@ $(document).ready(function(){initNavTree('dd/d47/namespacemath.html','../../');
<div class="header">
<div class="summary">
<a href="#nested-classes">Classes</a> &#124;
<a href="#func-members">Functions</a> </div>
<div class="headertitle"><div class="title">math Namespace Reference</div></div>
</div><!--header-->
<div class="contents">
<p>for M_PI definition and pow()
<p>for <a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/numeric/random/rand.html">std::rand</a>
<a href="../../dd/d47/namespacemath.html#details">More...</a></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="nested-classes" name="nested-classes"></a>
Classes</h2></td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../de/d4f/structmath_1_1_point.html">Point</a></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</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:abf7f2a6d91f1ca6c89698792aea3f188"><td class="memItemLeft" align="right" valign="top">double&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="../../dd/d47/namespacemath.html#abf7f2a6d91f1ca6c89698792aea3f188">approximate_pi</a> (const <a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector</a>&lt; <a class="el" href="../../de/d4f/structmath_1_1_point.html">Point</a> &gt; &amp;pts)</td></tr>
<tr class="separator:abf7f2a6d91f1ca6c89698792aea3f188"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a971ce57e368f2f631cf1f4ff3f864049"><td class="memTemplParams" colspan="2">template&lt;typename T &gt; </td></tr>
<tr class="memitem:a971ce57e368f2f631cf1f4ff3f864049"><td class="memTemplItemLeft" align="right" valign="top">T&#160;</td><td class="memTemplItemRight" valign="bottom"><a class="el" href="../../dd/d47/namespacemath.html#a971ce57e368f2f631cf1f4ff3f864049">square_area</a> (T length)</td></tr>
<tr class="memdesc:a971ce57e368f2f631cf1f4ff3f864049"><td class="mdescLeft">&#160;</td><td class="mdescRight">area of a <a href="https://en.wikipedia.org/wiki/Square" target="_blank">square</a> (l * l) <a href="../../dd/d47/namespacemath.html#a971ce57e368f2f631cf1f4ff3f864049">More...</a><br /></td></tr>
@@ -188,7 +196,7 @@ Functions</h2></td></tr>
<tr class="separator:abde24398be43538c62e4a496968e60ca"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p >for M_PI definition and pow() </p>
<div class="textblock"><p >for <a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/numeric/random/rand.html">std::rand</a> </p>
<p >for <a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_istream.html">std::cin</a> and <a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a></p>
<p >for <a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/io/basic_ostream.html">std::cout</a></p>
<p >for io operations</p>
@@ -197,6 +205,9 @@ Functions</h2></td></tr>
<p >Math algorithms.</p>
<p >for <a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector</a></p>
<p >for IO operations</p>
<p >for M_PI definition and pow()</p>
<p >for IO operations for <a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector</a></p>
<p >Mathematical algorithms</p>
<p >for assert for uint16_t datatype for IO operations</p>
<p >Mathematical algorithms</p>
<p >for assert for int32_t type for atoi</p>
@@ -224,6 +235,49 @@ Algorithm</h3>
<p >for assert for <a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/numeric/math/pow.html">std::pow</a> for <a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/types/integer.html">std::uint32_t</a></p>
<p >Mathematical algorithms </p>
</div><h2 class="groupheader">Function Documentation</h2>
<a id="abf7f2a6d91f1ca6c89698792aea3f188" name="abf7f2a6d91f1ca6c89698792aea3f188"></a>
<h2 class="memtitle"><span class="permalink"><a href="#abf7f2a6d91f1ca6c89698792aea3f188">&#9670;&nbsp;</a></span>approximate_pi()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">double math::approximate_pi </td>
<td>(</td>
<td class="paramtype">const <a class="elRef" target="_blank" href="http://en.cppreference.com/w/cpp/container/vector.html">std::vector</a>&lt; <a class="el" href="../../de/d4f/structmath_1_1_point.html">Point</a> &gt; &amp;&#160;</td>
<td class="paramname"><em>pts</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p >This function use the points pts (drawn at random) to return an estimate of the number π using the given points </p><dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">pts</td><td>Each item of pts contains a point. A point is represented by a structure containing exactly two numbers, respectively x and y such that 0 ≤ x ≤ 1 and 0 ≤ y ≤ 1. pts always contains at least one item </td></tr>
</table>
</dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>an estimate of the number π</dd></dl>
<div class="fragment"><div class="line"><span class="lineno"> 35</span> {<span class="comment"></span></div>
<div class="line"><span class="lineno"> 36</span><span class="comment"> /**</span></div>
<div class="line"><span class="lineno"> 37</span><span class="comment"> * This function use the points pts (drawn at random) to return an estimate of the number π using the given points</span></div>
<div class="line"><span class="lineno"> 38</span><span class="comment"> * @param pts Each item of pts contains a point. A point is represented by a structure containing exactly </span></div>
<div class="line"><span class="lineno"> 39</span><span class="comment"> * two numbers, respectively x and y such that 0 ≤ x ≤ 1 and 0 ≤ y ≤ 1. </span></div>
<div class="line"><span class="lineno"> 40</span><span class="comment"> * pts always contains at least one item</span></div>
<div class="line"><span class="lineno"> 41</span><span class="comment"> * @return an estimate of the number π</span></div>
<div class="line"><span class="lineno"> 42</span><span class="comment"> */</span></div>
<div class="line"><span class="lineno"> 43</span> {</div>
<div class="line"><span class="lineno"> 44</span> <span class="keywordtype">int</span> count =0; <span class="comment">// Points in cercle</span></div>
<div class="line"><span class="lineno"> 45</span> <span class="keywordflow">for</span>(<a class="code hl_struct" href="../../de/d4f/structmath_1_1_point.html">Point</a> p:pts)</div>
<div class="line"><span class="lineno"> 46</span> <span class="keywordflow">if</span>(p.x * p.x + p.y*p.y &lt;= 1)</div>
<div class="line"><span class="lineno"> 47</span> ++count;</div>
<div class="line"><span class="lineno"> 48</span> </div>
<div class="line"><span class="lineno"> 49</span> <span class="keywordflow">return</span> 4.0*count/pts.size();</div>
<div class="line"><span class="lineno"> 50</span> }</div>
<div class="line"><span class="lineno"> 51</span> }</div>
<div class="ttc" id="astructmath_1_1_point_html"><div class="ttname"><a href="../../de/d4f/structmath_1_1_point.html">math::Point</a></div><div class="ttdef"><b>Definition:</b> approximate_pi.cpp:30</div></div>
</div><!-- fragment -->
</div>
</div>
<a id="ae1ca505751f5a6d3977b86372cfe75ea" name="ae1ca505751f5a6d3977b86372cfe75ea"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ae1ca505751f5a6d3977b86372cfe75ea">&#9670;&nbsp;</a></span>binomialCoeffSum()</h2>

View File

@@ -27,6 +27,8 @@ var namespacemath =
[ "cross", "df/d66/vector__cross__product_8cpp.html#a225732399c5c076976eae5b180a9f8c9", null ],
[ "mag", "df/d66/vector__cross__product_8cpp.html#a4b2a9757a87c18e1642d72410ecfaba8", null ]
] ],
[ "Point", "de/d4f/structmath_1_1_point.html", null ],
[ "approximate_pi", "dd/d47/namespacemath.html#abf7f2a6d91f1ca6c89698792aea3f188", null ],
[ "binomialCoeffSum", "dd/d47/namespacemath.html#ae1ca505751f5a6d3977b86372cfe75ea", null ],
[ "circle_area", "dd/d47/namespacemath.html#a40e36c67da78d2131408c57ee091ad75", null ],
[ "cone_volume", "dd/d47/namespacemath.html#a3fe35440c27758ecc2287e08217d63a7", null ],