Menu

#93 Add imaginary part of spherical harmonics

v1.0.x
closed
None
v1.0.9
Change Request
2016-08-27
2016-08-27
Erik Hänel
No

For reasons of completeness, NumeRe should also know the imaginary part of the spherical harmonics, e.g. through imY(l,m,theta,phi).

Analysis:
The following function has to be implemented with sin(m*phi)

value_type parser_SphericalHarmonics(value_type vl, value_type vm, value_type theta, value_type phi)
{
    if (isinf(vl) || isnan(vl)
        || isinf(vm) || isnan(vm)
        || isinf(theta) || isnan(theta)
        || isinf(phi) || isnan(phi))
        return NAN;
    int l = (int)fabs(vl);
    int m = (int)vm;
    if (abs(m) > l)
    {
        return NAN;
    }
    else
    {
        return sqrt((double)(2.0*l+1.0) * parser_Faculty(l-m) / (4.0 * M_PI * parser_Faculty(l+m)))*parser_AssociatedLegendrePolynomial(l,m,cos(theta))*cos(m*phi);
    }
    return 0.0;
}

Implementation:
Implementation was done as proposed by the analysis.

Documentation:
Function was added to the documentation.

Tests:
Not needed as direct derivation from tested function, where only one standard function was changed.

Discussion

  • Erik Hänel

    Erik Hänel - 2016-08-27
    • status: open --> accepted
     
  • Erik Hänel

    Erik Hänel - 2016-08-27
    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -1 +1,9 @@
     For reasons of completeness, NumeRe should also know the imaginary part of the spherical harmonics, e.g. through `imY(l,m,theta,phi)`.
    +
    +**Analysis:**
    +
    +**Implementation:**
    +
    +**Documentation:**
    +
    +**Tests:**
    
    • status: accepted --> analyzing
     
  • Erik Hänel

    Erik Hänel - 2016-08-27
    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -1,6 +1,28 @@
     For reasons of completeness, NumeRe should also know the imaginary part of the spherical harmonics, e.g. through `imY(l,m,theta,phi)`.
    
     **Analysis:**
    +The following function has to be implemented with `sin(m*phi)`
    +~~~C
    +value_type parser_SphericalHarmonics(value_type vl, value_type vm, value_type theta, value_type phi)
    +{
    
    +    if (isinf(vl) || isnan(vl)
    +        || isinf(vm) || isnan(vm)
    +        || isinf(theta) || isnan(theta)
    +        || isinf(phi) || isnan(phi))
    +        return NAN;
    +    int l = (int)fabs(vl);
    +    int m = (int)vm;
    +    if (abs(m) > l)
    +    {
    +        return NAN;
    +    }
    +    else
    +    {
    +        return sqrt((double)(2.0*l+1.0) * parser_Faculty(l-m) / (4.0 * M_PI * parser_Faculty(l+m)))*parser_AssociatedLegendrePolynomial(l,m,cos(theta))*cos(m*phi);
    +    }
    +    return 0.0;
    +}
    +~~~
    
     **Implementation:**
    
    • status: analyzing --> implementing
     
  • Erik Hänel

    Erik Hänel - 2016-08-27
    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -25,6 +25,7 @@
     ~~~
    
     **Implementation:**
    +Implementation was done as proposed by the analysis.
    
     **Documentation:**
    
     
  • Erik Hänel

    Erik Hänel - 2016-08-27
    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -28,5 +28,6 @@
     Implementation was done as proposed by the analysis.
    
     **Documentation:**
    +Function was added to the documentation.
    
     **Tests:**
    
    • status: implementing --> testing
     
  • Erik Hänel

    Erik Hänel - 2016-08-27
    • Description has changed:

    Diff:

    --- old
    +++ new
    @@ -31,3 +31,4 @@
     Function was added to the documentation.
    
     **Tests:**
    +Not needed as direct derivation from tested function, where only one standard function was changed.
    
    • status: testing --> closed
     

Anonymous
Anonymous

Add attachments
Cancel





MongoDB Logo MongoDB