kyosu v0.1.0
Complex Without Complexes
 
Loading...
Searching...
No Matches

◆ ellint_rg

kyosu::ellint_rg = eve::functor<ellint_rg_t>
inlineconstexpr

Computes the Carlson's elliptic integral \( \mathbf{R}_\mathbf{G}(x, y) = \frac1{4\pi} \int_{0}^{2\pi}\int_{0}^{\pi} \scriptstyle\sqrt{x\sin^2\theta\cos^2\phi +y\sin^2\theta\sin^2\phi +z\cos^2\theta} \scriptstyle\;\mathrm{d}\theta\;\mathrm{d}\phi\).

Header file

#include <kyosu/kyosu.hpp>

Callable Signatures

namespace eve
{
// Regular overload
constexpr auto ellint_rg(auto x, auto y, auto z) noexcept; // 1
// Lanes masking
constexpr auto ellint_rg[conditional_expr auto c](/*all previous overloads*/) noexcept; // 2
constexpr auto ellint_rg[logical_value auto m](/*all previous overloads*/) noexcept; // 2
}
constexpr auto ellint_rg
Computes the Carlson's elliptic integral .
Definition: ellint_rg.hpp:88

Parameters

  • x, y, z: complex or real arguments.
  • c: Conditional expression masking the operation.
  • m: Logical value masking the operation.

Return value

  1. the value of the \(\mathbf{R}_\mathbf{G}\) Carlson elliptic integral: \(\frac14 \int_{0}^{\infty}[(t+x)(t+y)(t+z)]^{-1/2}\left(\frac{x}{t+x}+\frac{y}{t+y}+\frac{z}{t+z}\right)t\;\mathrm{d}t\) is returned. All of x, y, z may be 0 and those that are nonzero must lie in the complex plane cut along the nonpositive real axis
  2. The operation is performed conditionnaly

External references

Example

// revision 1
#include <eve/module/elliptic.hpp>
#include <iostream>
using wide_t = eve::wide <double, eve::fixed<4>>;
using r_t = double;
wide_t re1 = { 3.0, 2.0, 1.0, 0.5};
wide_t im1 = { 2.0, -1.0, -5.0, 0.0};
wide_t re2 = { 0.0, 1.0, 4.0, 3.0};
wide_t im2 = { 1.0 , -4.0, 0.0, 0.0};
wide_t re3 = { 0.1, -1.0, 2.0, 4.0};
wide_t im3 = { 2.0 , -4.0, -3.0, 0.0};
auto p = kyosu::complex_t<wide_t>(re1, im1);
auto q = kyosu::complex_t<wide_t>(re2, im2);
auto r = kyosu::complex_t<wide_t>(re3, im3);
int main()
{
std::cout << "<- p = " << p << "\n";
std::cout << "<- q = " << q << "\n";
std::cout << "<- r = " << r << "\n";
std::cout << "-> ellint_rg(p, q, r) = " << kyosu::ellint_rg(p, q, r) << "\n";
std::cout << "-> ellint_rg[ignore_last(2)](p, q, r)= " << kyosu::ellint_rg[eve::ignore_last(2)](p, q, r) << "\n";
std::cout << "-> ellint_rg[q != 4.0](p, q, r) = " << kyosu::ellint_rg[q != 4.0](p, q, r) << "\n";
}
as_cayley_dickson_n_t< 2, T > complex_t
Type alias for complex numbers.
Definition: complex.hpp:27