gsl_sf_dilog.h 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. /* specfunc/gsl_sf_dilog.h
  2. *
  3. * Copyright (C) 1996, 1997, 1998, 1999, 2000, 2004 Gerard Jungman
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation; either version 3 of the License, or (at
  8. * your option) any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful, but
  11. * WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  13. * General Public License for more details.
  14. *
  15. * You should have received a copy of the GNU General Public License
  16. * along with this program; if not, write to the Free Software
  17. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  18. */
  19. /* Author: G. Jungman */
  20. #ifndef __GSL_SF_DILOG_H__
  21. #define __GSL_SF_DILOG_H__
  22. #include "gsl_sf_result.h"
  23. #undef __BEGIN_DECLS
  24. #undef __END_DECLS
  25. #ifdef __cplusplus
  26. # define __BEGIN_DECLS extern "C" {
  27. # define __END_DECLS }
  28. #else
  29. # define __BEGIN_DECLS /* empty */
  30. # define __END_DECLS /* empty */
  31. #endif
  32. __BEGIN_DECLS
  33. /* Real part of DiLogarithm(x), for real argument.
  34. * In Lewin's notation, this is Li_2(x).
  35. *
  36. * Li_2(x) = - Re[ Integrate[ Log[1-s] / s, {s, 0, x}] ]
  37. *
  38. * The function in the complex plane has a branch point
  39. * at z = 1; we place the cut in the conventional way,
  40. * on [1, +infty). This means that the value for real x > 1
  41. * is a matter of definition; however, this choice does not
  42. * affect the real part and so is not relevant to the
  43. * interpretation of this implemented function.
  44. */
  45. int gsl_sf_dilog_e(const double x, gsl_sf_result * result);
  46. double gsl_sf_dilog(const double x);
  47. /* DiLogarithm(z), for complex argument z = x + i y.
  48. * Computes the principal branch.
  49. *
  50. * Recall that the branch cut is on the real axis with x > 1.
  51. * The imaginary part of the computed value on the cut is given
  52. * by -Pi*log(x), which is the limiting value taken approaching
  53. * from y < 0. This is a conventional choice, though there is no
  54. * true standardized choice.
  55. *
  56. * Note that there is no canonical way to lift the defining
  57. * contour to the full Riemann surface because of the appearance
  58. * of a "hidden branch point" at z = 0 on non-principal sheets.
  59. * Experts will know the simple algebraic prescription for
  60. * obtaining the sheet they want; non-experts will not want
  61. * to know anything about it. This is why GSL chooses to compute
  62. * only on the principal branch.
  63. */
  64. int
  65. gsl_sf_complex_dilog_xy_e(
  66. const double x,
  67. const double y,
  68. gsl_sf_result * result_re,
  69. gsl_sf_result * result_im
  70. );
  71. /* DiLogarithm(z), for complex argument z = r Exp[i theta].
  72. * Computes the principal branch, thereby assuming an
  73. * implicit reduction of theta to the range (-2 pi, 2 pi).
  74. *
  75. * If theta is identically zero, the imaginary part is computed
  76. * as if approaching from y > 0. For other values of theta no
  77. * special consideration is given, since it is assumed that
  78. * no other machine representations of multiples of pi will
  79. * produce y = 0 precisely. This assumption depends on some
  80. * subtle properties of the machine arithmetic, such as
  81. * correct rounding and monotonicity of the underlying
  82. * implementation of sin() and cos().
  83. *
  84. * This function is ok, but the interface is confusing since
  85. * it makes it appear that the branch structure is resolved.
  86. * Furthermore the handling of values close to the branch
  87. * cut is subtle. Perhap this interface should be deprecated.
  88. */
  89. int
  90. gsl_sf_complex_dilog_e(
  91. const double r,
  92. const double theta,
  93. gsl_sf_result * result_re,
  94. gsl_sf_result * result_im
  95. );
  96. /* Spence integral; spence(s) := Li_2(1-s)
  97. *
  98. * This function has a branch point at 0; we place the
  99. * cut on (-infty,0). Because of our choice for the value
  100. * of Li_2(z) on the cut, spence(s) is continuous as
  101. * s approaches the cut from above. In other words,
  102. * we define spence(x) = spence(x + i 0+).
  103. */
  104. int
  105. gsl_sf_complex_spence_xy_e(
  106. const double x,
  107. const double y,
  108. gsl_sf_result * real_sp,
  109. gsl_sf_result * imag_sp
  110. );
  111. __END_DECLS
  112. #endif /* __GSL_SF_DILOG_H__ */