Namespaces
Variants

std:: assoc_legendre, std:: assoc_legendref, std:: assoc_legendrel

From cppreference.net
double assoc_legendre ( unsigned int n, unsigned int m, double x ) ;

double assoc_legendre ( unsigned int n, unsigned int m, float x ) ;
double assoc_legendre ( unsigned int n, unsigned int m, long double x ) ;
float assoc_legendref ( unsigned int n, unsigned int m, float x ) ;

long double assoc_legendrel ( unsigned int n, unsigned int m, long double x ) ;
(1)
double assoc_legendre ( unsigned int n, unsigned int m, IntegralType x ) ;
(2)
1) 차수 n , 차수 m , 및 인수 x associated Legendre polynomials 를 계산합니다.
2) 모든 integral type 인자를 받는 오버로드 집합 또는 함수 템플릿. (1) 과 동등하며, 인자를 double 로 캐스팅한 후 적용됩니다.

모든 특수 함수들처럼, assoc_legendre 함수는 구현체가 __STDCPP_MATH_SPEC_FUNCS__ 를 최소 201003L 값으로 정의하고, 사용자가 표준 라이브러리 헤더를 포함하기 전에 __STDCPP_WANT_MATH_SPEC_FUNCS__ 를 정의한 경우에만 <cmath> 에서 사용 가능함이 보장됩니다.

목차

매개변수

n - 다항식의 차수, 부호 없는 정수형 값
m - 다항식의 차수, 부호 없는 정수형 값
x - 인자, 부동소수점 또는 정수형 값

반환값

If no errors occur, value of the associated Legendre polynomial P m
n
of x , that is (1 - x 2
) m/2
d m
dx m
P n (x)
, is returned (where P n (x) is the unassociated Legendre polynomial, std:: legendre ( n, x ) ).

오류 처리

오류는 math_errhandling 에 명시된 대로 보고될 수 있습니다.

  • 인수가 NaN이면, NaN이 반환되고 도메인 오류가 보고되지 않습니다.
  • 만약 |x| > 1 인 경우, 도메인 오류가 발생할 수 있습니다.
  • 만약 n 이 128보다 크거나 같으면, 그 동작은 구현에 따라 정의됩니다.

참고 사항

TR 29124를 지원하지 않지만 TR 19768을 지원하는 구현체들은 이 함수를 tr1/cmath 헤더와 std::tr1 네임스페이스에서 제공합니다.

이 함수의 구현체는 또한 boost.math에서 사용 가능합니다 .

처음 몇 개의 연관 르장드르 다항식은 다음과 같습니다:

  • assoc_legendre(0, 0, x) = 1.
  • assoc_legendre(1, 0, x) = x .
  • assoc_legendre(1, 1, x) = -(1 - x 2
    ) 1/2
    .
  • assoc_legendre(2, 0, x) =
    1
    2
    (3x 2
    - 1)
    .
  • assoc_legendre(2, 1, x) = -3x(1 - x 2
    ) 1/2
    .
  • assoc_legendre(2, 2, x) = 3(1 - x 2
    )
    .

예제

(gcc 6.0에서 표시된 대로 작동합니다)

#define __STDCPP_WANT_MATH_SPEC_FUNCS__ 1
#include <cmath>
#include <iostream>
double P20(double x)
{
    return 0.5 * (3 * x * x - 1);
}
double P21(double x)
{
    return -3.0 * x * std::sqrt(1 - x * x);
}
double P22(double x)
{
    return 3 * (1 - x * x);
}
int main()
{
    // spot-checks
    std::cout << std::assoc_legendre(2, 0, 0.5) << '=' << P20(0.5) << '\n'
              << std::assoc_legendre(2, 1, 0.5) << '=' << P21(0.5) << '\n'
              << std::assoc_legendre(2, 2, 0.5) << '=' << P22(0.5) << '\n';
}

출력:

-0.125=-0.125
-1.29904=-1.29904
2.25=2.25

참고 항목

르장드르 다항식
(함수)

외부 링크

Weisstein, Eric W. "Associated Legendre Polynomial." MathWorld--Wolfram 웹 자원에서 제공.