namespace cpp {}

C++ lernen, kennen, anwenden

Benutzer-Werkzeuge

Webseiten-Werkzeuge


Action disabled: source
kennen:lib:comp_ellint_3

comp_ellint_3()

#include <cmath>

  double comp_ellint_3(double k, double nu)  // C++17

Liefert Wert des vollständigen 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

Beispiel

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';
  }
}

Anmerkung: Die gcc-Bibliothek verwendete bis gcc 7.2.0 das entgegengesetzte Vorzeichen für die Charakteristik $\nu$ (GCC bug report 66689). Ab gcc 8.0.0 HEAD 201711 scheint dies behoben (C++2a, Wandbox):

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';                
    }
}
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