Files
hustoj/web/cppreference-zh/chmhelp/cpp-numeric-special_math-comp_ellint_2.html
2025-08-01 12:57:54 +08:00

120 lines
11 KiB
HTML

<!DOCTYPE html>
<html lang="zh" dir="ltr" class="client-nojs" xmlns="http://www.w3.org/1999/xhtml" xml:lang="zh">
<head><meta http-equiv="x-ua-compatible" content="ie=edge">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>std::comp_ellint_2, std::comp_ellint_2f, std::comp_ellint_2l</title>
<link rel="stylesheet" href="ext.css" />
<link rel="stylesheet" href="site_modules.css" />
</head>
<body class="mediawiki ltr sitedir-ltr ns-0 ns-subject page-cpp_numeric_special_functions_comp_ellint_2 skin-cppreference2 action-view cpp-navbar">
<div id="cpp-content-base">
<div id="content"><a id="top"></a>
<h1 id="firstHeading" class="firstHeading"><span style="font-size:0.7em; line-height:130%">std::</span>comp_ellint_2, <span style="font-size:0.7em; line-height:130%">std::</span>comp_ellint_2f, <span style="font-size:0.7em; line-height:130%">std::</span>comp_ellint_2l</h1>
<div id="bodyContent">
<div id="contentSub"><span class="subpages">&lt; <a href="cpp.html">cpp</a>&lrm; | <a href="cpp-numeric.html">numeric</a>&lrm; | <a href="cpp-numeric-special_functions.html">special functions</a></span></div>
<div id="mw-content-text" lang="zh" dir="ltr" class="mw-content-ltr" xml:lang="zh">
<table class="t-dcl-begin">
<tbody>
<tr class="t-dsc-header">
<td>
<div>&#23450;&#20041;&#20110;&#22836;&#25991;&#20214; <code><a href="cpp-header-cmath.html">&lt;cmath&gt;</a></code></div>
</td>
<td></td>
<td></td>
</tr>
<tr class="t-dcl t-since-cxx17">
<td>
<div><span class="mw-geshi cpp source-cpp"><span class="kw4">double</span> &nbsp; &nbsp; &nbsp;comp_ellint_2<span class="br0">(</span> <span class="kw4">double</span> k<span class="br0">)</span><span class="sy4">;</span><br /></span>
<p><span class="kw4">float</span> &nbsp; &nbsp; &nbsp; comp_ellint_2<span class="br0">(</span> <span class="kw4">float</span> k <span class="br0">)</span><span class="sy4">;</span><br />
<span class="kw4">long</span> <span class="kw4">double</span> comp_ellint_2<span class="br0">(</span> <span class="kw4">long</span> <span class="kw4">double</span> k <span class="br0">)</span><span class="sy4">;</span><br />
<span class="kw4">float</span> &nbsp; &nbsp; &nbsp; comp_ellint_2f<span class="br0">(</span> <span class="kw4">float</span> k <span class="br0">)</span><span class="sy4">;</span><br /></p>
<span class="kw4">long</span> <span class="kw4">double</span> comp_ellint_2l<span class="br0">(</span> <span class="kw4">long</span> <span class="kw4">double</span> k <span class="br0">)</span><span class="sy4">;</span></div>
</td>
<td>(1)</td>
<td><span class="t-mark-rev t-since-cxx17">(C++17 &#36215;)</span></td>
</tr>
<tr class="t-dcl t-since-cxx17">
<td>
<div><span class="mw-geshi cpp source-cpp"><span class="kw4">double</span> &nbsp; &nbsp; &nbsp;comp_ellint_2<span class="br0">(</span> IntegralType k <span class="br0">)</span><span class="sy4">;</span></span></div>
</td>
<td>(2)</td>
<td><span class="t-mark-rev t-since-cxx17">(C++17 &#36215;)</span></td>
</tr>
<tr class="t-dcl-sep">
<td></td>
<td></td>
<td></td>
</tr>
</tbody>
</table>
<div class="t-li1"><span class="t-li">1)</span> &#35745;&#31639; <code>k</code> &#30340;<a href="https://en.wikipedia.org/wiki/Elliptic_integral#Complete_elliptic_integral_of_the_second_kind" class="extiw" title="enwiki:Elliptic integral">&#31532;&#20108;&#31867;&#23436;&#20840;&#26925;&#22278;&#31215;&#20998;</a>&#12290;</div>
<div class="t-li1"><span class="t-li">2)</span> &#25509;&#21463;&#20219;&#24847;<a href="cpp-types-is_integral.html">&#25972;&#25968;&#31867;&#22411;</a>&#21442;&#25968;&#30340;&#37325;&#36733;&#38598;&#25110;&#20989;&#25968;&#27169;&#26495;&#12290;&#31561;&#20215;&#20110;&#23558;&#21442;&#25968;&#36716;&#22411;&#21040; <span class="t-c"><span class="mw-geshi cpp source-cpp"><span class="kw4">double</span></span></span> &#21518;&#30340; <span class="t-v">(1)</span> &#12290;</div>
<h3><span class="mw-headline" id=".E5.8F.82.E6.95.B0">&#21442;&#25968;</span></h3>
<table class="t-par-begin">
<tr class="t-par">
<td>k</td>
<td>-</td>
<td>&#26925;&#22278;&#27169;&#25110;&#31163;&#24515;&#29575;&#65288;&#28014;&#28857;&#25110;&#25972;&#25968;&#31867;&#22411;&#20540;&#65289;</td>
</tr>
</table>
<h3><span class="mw-headline" id=".E8.BF.94.E5.9B.9E.E5.80.BC">&#36820;&#22238;&#20540;</span></h3>
<p>&#33509;&#26080;&#38169;&#35823;&#21457;&#29983;&#65292;&#21017;&#36820;&#22238; <code>k</code> &#30340;&#31532;&#20108;&#31867;&#23436;&#20840;&#26925;&#22278;&#31215;&#30340;&#20540;&#65292;&#21363; <span class="t-lc">ellint_2(k,&pi;/2)</span> &#12290;</p>
<h3><span class="mw-headline" id=".E9.94.99.E8.AF.AF.E5.A4.84.E7.90.86">&#38169;&#35823;&#22788;&#29702;</span></h3>
<p>&#21487;&#33021;&#25253;&#21578; <a href="cpp-numeric-math-math_errhandling.html"><tt>math_errhandling</tt></a> &#20013;&#25351;&#23450;&#30340;&#38169;&#35823;&#12290;</p>
<ul>
<li>&#33509;&#21442;&#25968;&#26159; NaN &#65292;&#21017;&#36820;&#22238; NaN &#19988;&#19981;&#25253;&#21578;&#23450;&#20041;&#22495;&#38169;&#35823;</li>
<li>&#33509; <span class="texhtml" style="white-space: nowrap;">|k|&gt;1</span> &#65292;&#21017;&#21487;&#33021;&#21457;&#29983;&#23450;&#20041;&#22495;&#38169;&#35823;</li>
</ul>
<h3><span class="mw-headline" id=".E6.B3.A8.E8.A7.A3">&#27880;&#35299;</span></h3>
<p>&#19981;&#25903;&#25345; C++17 &#65292;&#20294;&#25903;&#25345; <a href="cpp-experimental-special_functions.html">ISO 29124:2010</a> &#30340;&#23454;&#29616;&#20250;&#25552;&#20379;&#27492;&#20989;&#25968;&#65292;&#33509;&#23454;&#29616;&#23450;&#20041;&#20102; <code>__STDCPP_MATH_SPEC_FUNCS__</code> &#20026;&#33267;&#23569; 201003L &#30340;&#20540;&#65292;&#19988;&#29992;&#25143;&#22312;&#21253;&#21547;&#20219;&#20309;&#26631;&#20934;&#24211;&#22836;&#25991;&#20214;&#21069;&#23450;&#20041;&#20102; <code>__STDCPP_WANT_MATH_SPEC_FUNCS__</code> &#12290;</p>
<p>&#19981;&#25903;&#25345; ISO 29124:2010 &#20294;&#25903;&#25345; TR 19768:2007 (TR1) &#30340;&#23454;&#29616;&#65292;&#22312;&#22836;&#25991;&#20214; <code>tr1/cmath</code> &#21450;&#21629;&#21517;&#31354;&#38388; <code>std::tr1</code> &#20013;&#25552;&#20379;&#27492;&#20989;&#25968;&#12290;</p>
<p>&#27492;&#20989;&#25968;&#30340;&#19968;&#31181;&#23454;&#29616;&#20134;<a rel="nofollow" class="external text" href="http://www.boost.org/doc/libs/release/libs/math/doc/html/math_toolkit/ellint/ellint_2.html">&#21487;&#29992;&#20110; boost.math</a></p>
<p>&#31163;&#24515;&#29575;&#20026; <code>k</code> &#21322;&#38271;&#36724;&#20026; <span class="texhtml" style="white-space: nowrap;">a</span> &#30340;&#26925;&#22278;&#30340;&#21608;&#38271;&#31561;&#20110; <span class="texhtml" style="white-space: nowrap;">4aE(k)</span> &#65292;&#20854;&#20013; <span class="texhtml" style="white-space: nowrap;">E</span> &#20026; <code>std::comp_ellint_2</code> &#12290;&#31163;&#24515;&#29575;&#31561;&#20110; <span class="texhtml" style="white-space: nowrap;">0</span> &#26102;&#65292;&#26925;&#22278;&#36864;&#21270;&#20026;&#21322;&#24452;&#20026; <span class="texhtml" style="white-space: nowrap;">a</span> &#30340;&#22278;&#65292;&#32780;&#21608;&#38271;&#31561;&#20110; <span class="texhtml" style="white-space: nowrap;">2&pi;a</span> &#65292;&#25925; <span class="texhtml" style="white-space: nowrap;">E(0) = &pi;/2</span> &#12290;&#31163;&#24515;&#29575;&#31561;&#20110; <span class="texhtml" style="white-space: nowrap;">1</span> &#26102;&#65292;&#26925;&#22278;&#36864;&#21270;&#25104;&#38271;&#24230;&#20026; 2a &#30340;&#32447;&#27573;&#65292;&#20854;&#21608;&#38271;&#20026; <span class="texhtml" style="white-space: nowrap;">4a</span> &#65292;&#25925; <span class="texhtml" style="white-space: nowrap;">E(1) = 1</span> &#12290;</p>
<h3><span class="mw-headline" id=".E7.A4.BA.E4.BE.8B">&#31034;&#20363;</span></h3>
<div class="t-example">
<div class="t-example-live-link"></div>
<div dir="ltr" class="mw-geshi" style="text-align: left;">
<div class="cpp source-cpp">
<pre class="de1"><span class="co2">#include &lt;cmath&gt;</span>
<span class="co2">#include &lt;iostream&gt;</span>
<span class="kw4">int</span> main<span class="br0">(</span><span class="br0">)</span>
<span class="br0">{</span>
<span class="kw4">double</span> hpi <span class="sy1">=</span> <a href="cpp-numeric-math-acos.html"><span class="kw1337">std::<span class="me2">acos</span></span></a><span class="br0">(</span><span class="sy2">-</span><span class="nu0">1</span><span class="br0">)</span><span class="sy2">/</span><span class="nu0">2</span><span class="sy4">;</span>
<a href="cpp-io-cout.html"><span class="kw1758">std::<span class="me2">cout</span></span></a> <span class="sy1">&lt;&lt;</span> <span class="st0">&quot;E(0) = &quot;</span> <span class="sy1">&lt;&lt;</span> <a href="cpp-numeric-special_math-comp_ellint_2.html"><span class="kw1399">std::<span class="me2">comp_ellint_2</span></span></a><span class="br0">(</span><span class="nu0">0</span><span class="br0">)</span> <span class="sy1">&lt;&lt;</span> <span class="st0">&#39;<span class="es1">\n</span>&#39;</span>
<span class="sy1">&lt;&lt;</span> <span class="st0">&quot;&pi;/2 = &quot;</span> <span class="sy1">&lt;&lt;</span> hpi <span class="sy1">&lt;&lt;</span> <span class="st0">&#39;<span class="es1">\n</span>&#39;</span>
<span class="sy1">&lt;&lt;</span> <span class="st0">&quot;E(1) = &quot;</span> <span class="sy1">&lt;&lt;</span> <a href="cpp-numeric-special_math-comp_ellint_2.html"><span class="kw1399">std::<span class="me2">comp_ellint_2</span></span></a><span class="br0">(</span><span class="nu0">1</span><span class="br0">)</span> <span class="sy1">&lt;&lt;</span> <span class="st0">&#39;<span class="es1">\n</span>&#39;</span>
<span class="sy1">&lt;&lt;</span> <span class="st0">&quot;E(1, &pi;/2) = &quot;</span> <span class="sy1">&lt;&lt;</span> <a href="cpp-numeric-special_math-ellint_2.html"><span class="kw1420">std::<span class="me2">ellint_2</span></span></a><span class="br0">(</span><span class="nu0">1</span>, hpi<span class="br0">)</span> <span class="sy1">&lt;&lt;</span> <span class="st0">&#39;<span class="es1">\n</span>&#39;</span><span class="sy4">;</span>
<span class="br0">}</span></pre></div>
</div>
<p>&#36755;&#20986;&#65306;</p>
<div dir="ltr" class="mw-geshi" style="text-align: left;">
<div class="text source-text">
<pre class="de1">E(0) = 1.5708
&pi;/2 = 1.5708
E(1) = 1
E(1, &pi;/2) = 1</pre></div>
</div>
</div>
<h3><span class="mw-headline" id=".E5.A4.96.E9.83.A8.E9.93.BE.E6.8E.A5">&#22806;&#37096;&#38142;&#25509;</span></h3>
<p><a rel="nofollow" class="external text" href="http://mathworld.wolfram.com/CompleteEllipticIntegraloftheSecondKind.html">Weisstein, Eric W. &ldquo;&#31532;&#20108;&#31867;&#23436;&#20840;&#26925;&#22278;&#31215;&#20998;&rdquo;</a>&#26469;&#33258; MathWorld--A Wolfram Web Resource &#12290;</p>
<h3><span class="mw-headline" id=".E5.8F.82.E9.98.85">&#21442;&#38405;</span></h3>
<table class="t-dsc-begin">
<tr class="t-dsc">
<td>
<div class="t-dsc-member-div">
<div><a href="cpp-numeric-special_functions-ellint_2.html"><span class="t-lines"><span>ellint_2</span><span>ellint_2f</span><span>ellint_2l</span></span></a></div>
<div><span class="t-lines"><span><span class="t-mark-rev t-since-cxx17">(C++17)</span></span><span><span class="t-mark-rev t-since-cxx17">(C++17)</span></span><span><span class="t-mark-rev t-since-cxx17">(C++17)</span></span></span></div>
</div>
</td>
<td>&#31532;&#20108;&#31867;&#65288;&#19981;&#23436;&#20840;&#65289;&#26925;&#22278;&#31215;&#20998;<br />
<span class="t-mark">(&#20989;&#25968;)</span></td>
</tr>
</table>
</div>
<div class="visualClear"></div>
</div>
</div>
</div>
</body>
</html>