bug-gsl
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug-gsl] [bug #51240] Bessel functions for nu < 0


From: Patrick Alken
Subject: [Bug-gsl] [bug #51240] Bessel functions for nu < 0
Date: Thu, 15 Jun 2017 05:59:58 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.36

URL:
  <http://savannah.gnu.org/bugs/?51240>

                 Summary: Bessel functions for nu < 0
                 Project: GNU Scientific Library
            Submitted by: psa
            Submitted on: Thu 15 Jun 2017 09:59:56 AM UTC
                Category: Runtime error
                Severity: 3 - Normal
        Operating System: 
                  Status: None
             Assigned to: None
             Open/Closed: Open
                 Release: 
         Discussion Lock: Any

    _______________________________________________________

Details:

recently I needed some of the Bessel functions Y_nu, but noticed that
the GSL-implementation raises a domain error for nu < 0. I'm not sure
why this is the case, maybe there are good reasons I have overlooked,
but to me it seems we could use the rotation between Bessel functions of
first and second kind to cover all values of nu. We would only need to
replace (in bessel_Ynu.c) the block

  if(x <= 0.0 || nu < 0.0) {
    DOMAIN_ERROR(result);
  }

by something like

  if(x <= 0.0) {
    DOMAIN_ERROR(result);
  }
  else if (nu < 0.0) {
    int Jstatus = gsl_sf_bessel_Jnu_e(-nu, x, result);
    double Jval = result->val;
    double Jerr = result->err;
    int Ystatus = gsl_sf_bessel_Ynu_e(-nu, x, result);
    double Yval = result->val;
    double Yerr = result->err;
    double s = sin(M_PI*nu), c = cos(M_PI*nu);
    result->val = c*Yval - s*Jval;
    result->err = fabs(c*Yerr) + fabs(s*Jerr);
    return (Jstatus != GSL_SUCCESS ? Jstatus : Ystatus);
  }

What do you think? I've attached a possible patch for the Bessel
functions Y_nu and also J_nu. It compiles without problems, but I
haven't written tests for this case yet, as I first wanted to see why
the case nu < 0 was originally excluded.




    _______________________________________________________

File Attachments:


-------------------------------------------------------
Date: Thu 15 Jun 2017 09:59:56 AM UTC  Name: bessel.patch  Size: 2kB   By: psa

<http://savannah.gnu.org/bugs/download.php?file_id=40920>

    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?51240>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]