namespace cpp {}

C++ lernen, kennen, anwenden

Benutzer-Werkzeuge

Webseiten-Werkzeuge


kennen:lib:comp_ellint_3

Unterschiede

Hier werden die Unterschiede zwischen zwei Versionen angezeigt.


kennen:lib:comp_ellint_3 [2018-10-18 11:54] (aktuell) – angelegt - Externe Bearbeitung 127.0.0.1
Zeile 1: Zeile 1:
 +====== comp_ellint_3() ======
 +''#include'' [[..:include:cmath]]
 +
 +<code cpp>
 +  double comp_ellint_3(double k, double nu)  // C++17
 +</code>
 +{{ :kennen:lib:cmath:comp_ellint_3.png?400|}}
 + Liefert Wert des vollständigen [[wpde>Elliptisches_Integral|Elliptischen Integrals]] 3. Art 
 + $\Pi(k,\nu) = \int_0^{\pi/2} \frac{d\theta}{(1-\nu \sin^2 \theta)\sqrt{1-k^2 \sin^2 \theta}} = \Pi'(k,\nu,\pi/2)$.
 +
 +==== Parameter ====
 +| ''k''   | Modul $|k| \leq 1$ |
 +| ''nu''  | Charakteristik |
 +==== Ergebnis ====
 +Rückgabewert: $\Pi(k,\nu)$. 
 +
 +==== Siehe auch ====
 +[[ellint_1]],
 +[[ellint_2]],
 +[[ellint_3]],
 +[[comp_ellint_1]],
 +[[comp_ellint_2]].
 +
 +==== Beispiel ====
 +<code cpp ellint_3.cpp>
 +#include <cmath>
 +#include <iostream>
 +
 +int main()
 +{
 +  std::cout << "# k n=-3 n=-0.5 n=0 n=0.5\n";
 +  
 +  for (int i = 0; i < 100; ++i)
 +  {
 +    double k = 0.01*i;
 +    std::cout << k 
 +      << '\t' << std::comp_ellint_3(k, -3.0) 
 +//       << '\t' << std::comp_ellint_3(k, -1.0)  // inf
 +      << '\t' << std::comp_ellint_3(k, -0.5) 
 +      << '\t' << std::comp_ellint_3(k, 0.0) 
 +      << '\t' << std::comp_ellint_3(k, 0.5)
 +//      << '\t' << std::comp_ellint_3(k, 1.0) // domain error
 +//      << '\t' << std::comp_ellint_3(k, 3.0) // domain error
 +      << '\n';
 +  }
 +}
 +</code>
 +
 +Anmerkung:
 +Die gcc-Bibliothek verwendete bis gcc 7.2.0 das entgegengesetzte Vorzeichen für die Charakteristik $\nu$ 
 +([[https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66689|GCC bug report 66689]]).
 +Ab gcc 8.0.0 HEAD 201711 scheint dies behoben (C++2a, [[https://wandbox.org/permlink/hHkO3aTeYJFiyjUL|Wandbox]]):
 +<code cpp ellint3_test.cpp>
 +#include <cmath>
 +#include <iostream>
 +
 +int main()
 +{
 +    const auto pi = std::acos(-1.0);
 +    const auto k  = 0.0;
 +    
 +    std::cout << "nu\tincomp.\tcompl.\texpect\n";
 +    for (auto nu : {-0.9, -0.5, 0.0, 0.5, 0.9})
 +    {
 +        auto expected = pi/(2*std::sqrt(1-nu));
 +        std::cout 
 +            << nu << '\t' 
 +            << std::ellint_3(k, nu, pi/2) << '\t'
 +            << std::comp_ellint_3(k, nu) << '\t'
 +            << expected << '\n';                
 +    }
 +}
 +</code>
 +
 +
 +
  
kennen/lib/comp_ellint_3.txt · Zuletzt geändert: 2018-10-18 11:54 von 127.0.0.1

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki