Math::GSL::SF(3pm)
π Math::GSL::SF π
welcome to the Math::GSL::SF page, straight out of the User Contributed Perl Documentation part of the manual, bestie π«Ά this is where the Special Functions live and there are so many of them. buckle up, hydrate, we're doing this. π
β¨ NAME β¨
Math::GSL::SF β Special Functions. that's the name, that's the whole vibe, iconic. π
π¦ SYNOPSIS π¦
use Math::GSL::SF qw/:all/;
πΈ DESCRIPTION πΈ
okay so first things first: this module ships a data structure called gsl_sf_result, and if you wanna manifest a brand new one you literally just go:
$r = Math::GSL::SF::gsl_sf_result_struct->new;
and then you can reach into its little guts like this:
my $val = $r->{val};
my $error = $r->{err};
slay. that's val and err, right there, no cap.
now here's the full list of every single function included π β yes, all of them, we are NOT skipping anybody:
"gsl_sf_airy_Ai_e($x, $mode)"
"gsl_sf_airy_Ai($x, $mode, $result)"
these routines compute the Airy function Ai($x) with an accuracy specified by $mode. and $mode should be $GSL_PREC_DOUBLE, $GSL_PREC_SINGLE or $GSL_PREC_APPROX. $result is a gsl_sf_result structure. β¨
"gsl_sf_airy_Bi_e($x, $mode, $result)"
"gsl_sf_airy_Bi($x, $mode)"
same energy but for the Airy function Bi($x), accuracy specified by $mode. $mode should be $GSL_PREC_DOUBLE, $GSL_PREC_SINGLE or $GSL_PREC_APPROX. $result is a gsl_sf_result structure.
"gsl_sf_airy_Ai_scaled_e($x, $mode, $result)"
"gsl_sf_airy_Ai_scaled($x, $mode)"
these compute a scaled version of the Airy function, S_A($x) Ai($x). for $x>0 the scaling factor S_A($x) is \exp(+(2/3) $x**(3/2)), and it's 1 for $x<0. $result is a gsl_sf_result structure. π¦
"gsl_sf_airy_Bi_scaled_e($x, $mode, $result)"
"gsl_sf_airy_Bi_scaled($x, $mode)"
scaled Airy again, this time S_B($x) Bi($x). for $x>0 the scaling factor S_B($x) is exp(-(2/3) $x**(3/2)), and it's 1 for $x<0. $result is a gsl_sf_result structure.
"gsl_sf_airy_Ai_deriv_e($x, $mode, $result)"
"gsl_sf_airy_Ai_deriv($x, $mode)"
these compute the Airy function derivative Ai'($x) with an accuracy specified by $mode. $result is a gsl_sf_result structure. π
"gsl_sf_airy_Bi_deriv_e($x, $mode, $result)"
"gsl_sf_airy_Bi_deriv($x, $mode)"
the Airy function derivative Bi'($x), accuracy specified by $mode. $result is a gsl_sf_result structure.
"gsl_sf_airy_Ai_deriv_scaled_e($x, $mode, $result)"
"gsl_sf_airy_Ai_deriv_scaled($x, $mode)"
scaled Airy function derivative S_A(x) Ai'(x). for x>0 the scaling factor S_A(x) is \exp(+(2/3) x^(3/2)), and it's 1 for x<0. $result is a gsl_sf_result structure.
"gsl_sf_airy_Bi_deriv_scaled_e($x, $mode, $result)"
"gsl_sf_airy_Bi_deriv_scaled($x, $mode)"
scaled Airy function derivative S_B(x) Bi'(x). for x>0 the scaling factor S_B(x) is exp(-(2/3) x^(3/2)), and it's 1 for x<0. $result is a gsl_sf_result structure.
"gsl_sf_airy_zero_Ai_e($s, $result)"
gsl_sf_airy_zero_Ai($s)
these routines compute the location of the s-th zero of the Airy function Ai($x). $result is a gsl_sf_result structure. π
"gsl_sf_airy_zero_Bi_e($s, $result)"
gsl_sf_airy_zero_Bi($s)
same deal, but the location of the s-th zero of the Airy function Bi($x). $result is a gsl_sf_result structure.
"gsl_sf_airy_zero_Ai_deriv_e($s, $result)"
gsl_sf_airy_zero_Ai_deriv($s)
the location of the s-th zero of the Airy function derivative Ai'(x). $result is a gsl_sf_result structure.
"gsl_sf_airy_zero_Bi_deriv_e($s, $result)"
gsl_sf_airy_zero_Bi_deriv($s)
the location of the s-th zero of the Airy function derivative Bi'(x). $result is a gsl_sf_result structure.
and now we slide into Bessel territory π§
"gsl_sf_bessel_J0_e($x, $result)"
gsl_sf_bessel_J0($x)
these compute the regular cylindrical Bessel function of zeroth order, J_0($x). $result is a gsl_sf_result structure.
"gsl_sf_bessel_J1_e($x, $result)"
gsl_sf_bessel_J1($x)
the regular cylindrical Bessel function of first order, J_1($x). $result is a gsl_sf_result structure.
"gsl_sf_bessel_Jn_e($n, $x, $result)"
"gsl_sf_bessel_Jn($n, $x)"
the regular cylindrical Bessel function of order n, J_n($x). π₯
"gsl_sf_bessel_Jn_array($nmin, $nmax, $x)"
this one computes the values of the regular cylindrical Bessel functions J_n($x) for n from $nmin to $nmax inclusive, and hands the results back in an array reference. heads up though: the values are computed using recurrence relations for efficiency, so they may differ slightly from the exact values. π
"gsl_sf_bessel_Y0_e($x, $result)"
gsl_sf_bessel_Y0($x)
these compute the irregular spherical Bessel function of zeroth order, y_0(x) = -\cos(x)/x.
"gsl_sf_bessel_Y1_e($x, $result)"
gsl_sf_bessel_Y1($x)
the irregular spherical Bessel function of first order, y_1(x) = -(\cos(x)/x + \sin(x))/x.
"gsl_sf_bessel_Yn_e"($n, $x, $result)
"gsl_sf_bessel_Yn($n, $x)"
these compute the irregular cylindrical Bessel function of order $n, Y_n(x), for x>0. π
"gsl_sf_bessel_Yn_array($nmin, $nmax, $x)"
values of the irregular cylindrical Bessel functions Y_n(x) for n from $nmin to $nmax inclusive, returned in an array reference. the domain of this function is $x>0. and again, recurrence relations for efficiency, so they may differ slightly from the exact values.
"gsl_sf_bessel_I0_e($x, $result)"
gsl_sf_bessel_I0($x)
the regular modified cylindrical Bessel function of zeroth order, I_0(x). β¨
"gsl_sf_bessel_I1_e($x, $result)"
gsl_sf_bessel_I1($x)
(no further deets given, she's mysterious π)
"gsl_sf_bessel_In_e($n, $x, $result)"
"gsl_sf_bessel_In($n, $x)"
the regular modified cylindrical Bessel function of order $n, I_n(x).
"gsl_sf_bessel_In_array($nmin, $nmax, $x)"
computes the values of the regular modified cylindrical Bessel functions I_n(x) for n from $nmin to $nmax inclusive, results in an array reference. important: the start of the range nmin must be positive or zero. and yeah β recurrence relations for efficiency, so they may differ slightly from the exact values. π«Ά
"gsl_sf_bessel_I0_scaled_e($x, $result)"
gsl_sf_bessel_I0_scaled($x)
the scaled regular modified cylindrical Bessel function of zeroth order, \exp(-|x|) I_0(x).
"gsl_sf_bessel_I1_scaled_e($x, $result)"
gsl_sf_bessel_I1_scaled($x)
the scaled regular modified cylindrical Bessel function of first order, \exp(-|x|) I_1(x).
"gsl_sf_bessel_In_scaled_e($n, $x, $result)"
"gsl_sf_bessel_In_scaled($n, $x)"
the scaled regular modified cylindrical Bessel function of order $n, \exp(-|x|) I_n(x).
"gsl_sf_bessel_In_scaled_array($nmin, $nmax, $x)"
computes the values of the scaled regular cylindrical Bessel functions exp(-|$x|) I_n($x) for n from $nmin to $nmax inclusive, returned in an array reference. the start of the range nmin must be positive or zero. and, as ever, recurrence relations for efficiency, so they may differ slightly from the exact values.
"gsl_sf_bessel_K0_e($x, $result)"
gsl_sf_bessel_K0($x)
the irregular modified cylindrical Bessel function of zeroth order, K_0(x), for x > 0. π
"gsl_sf_bessel_K1_e($x, $result)"
gsl_sf_bessel_K1($x)
the irregular modified cylindrical Bessel function of first order, K_1(x), for x > 0.
"gsl_sf_bessel_Kn_e($n, $x, $result)"
"gsl_sf_bessel_Kn($n, $x)"
the irregular modified cylindrical Bessel function of order $n, K_n(x), for x > 0.
"gsl_sf_bessel_Kn_array($nmin, $nmax, $x)"
computes the values of the Irregular Modified Cylindrical Bessel Functions K_n($x) for n from $nmin to $nmax inclusive, results in an array reference. recurrence relations for efficiency, so slight differences from the exact values are possible. also this function is ONLY defined for positive $x β anything else and it will throw an exception, so don't play yourself. π¨
"gsl_sf_bessel_K0_scaled_e($x, $result)"
gsl_sf_bessel_K0_scaled($x)
the scaled irregular modified cylindrical Bessel function of zeroth order, \exp(x) K_0(x) for x>0.
"gsl_sf_bessel_K1_scaled_e($x, $result)"
gsl_sf_bessel_K1_scaled($x)
(no extra tea in the docs for this one π)
"gsl_sf_bessel_Kn_scaled_e($n, $x, $result)"
"gsl_sf_bessel_Kn_scaled($n, $x)"
(also glossed over in the source, we move π«Ά)
"gsl_sf_bessel_Kn_scaled_array($nmin, $max, $x) "
computes the values of the scaled irregular cylindrical Bessel functions exp(x) K_n(x) for n from nmin to nmax inclusive, storing the results in the array result_array. the start of the range nmin must be positive or zero. the domain of the function is x>0. values are computed using recurrence relations for efficiency, so they may differ slightly from the exact values. π
lowercase era, let's go π¦
"gsl_sf_bessel_j0_e($x, $result)"
gsl_sf_bessel_j0($x)
(no description in the original, just vibes)
"gsl_sf_bessel_j1_e($x, $result)"
gsl_sf_bessel_j1($x)
(still no description)
"gsl_sf_bessel_j2_e($x, $result)"
gsl_sf_bessel_j2($x)
(you guessed it, no description)
"gsl_sf_bessel_jl_e($l, $x, $result)"
"gsl_sf_bessel_jl($l, $x)"
(no description here either, she's keeping it cute and quiet)
"gsl_sf_bessel_jl_array($lmax, $x)"
this one computes the values of the regular spherical Bessel functions j_l(x) for l from 0 to $lmax inclusive, for $lmax >= 0 and $x >= 0, returning the results in an array reference. recurrence relations for efficiency, so they may differ slightly from the exact values. β¨
"gsl_sf_bessel_jl_steed_array($lmax, $x)"
this one uses Steed's method to compute the values of the regular spherical Bessel functions j_l(x) for l from 0 to $lmax inclusive, for $lmax >= 0 and $x >= 0, storing the results in the array result_array. the Steed/Barnett algorithm is described in Comp. Phys. Comm. 21, 297 (1981). Steed's method is more stable than the recurrence used in the other functions, but it's also slower. pick your fighter. βοΈ
"gsl_sf_bessel_y0_e($x, $result)"
gsl_sf_bessel_y0($x)
(no description given)
"gsl_sf_bessel_y1_e($x, $result)"
gsl_sf_bessel_y1($x)
(no description given)
"gsl_sf_bessel_y2_e($x, $result)"
gsl_sf_bessel_y2($x)
(no description given)
"gsl_sf_bessel_yl_e($l, $x, $result)"
"gsl_sf_bessel_yl($l, $x)"
(no description given)
"gsl_sf_bessel_yl_array($lmax, $x)"
computes the values of the irregular spherical Bessel functions y_l(x) for l from 0 to $lmax inclusive, for lmax >= 0, returning the results in an array reference. recurrence relations for efficiency, so they may differ slightly from the exact values. π
"gsl_sf_bessel_i0_scaled_e($x, $result)"
gsl_sf_bessel_i0_scaled($x)
(and no description for this last one either β mysterious to the very end π)
okay bestie, continuing the DESCRIPTION section like we never left π here's the rest of the function menu, and it's giving "I know a guy" energy. no cap, every single one is here. periodt.
gsl_sf_bessel_i1_scaled_e($x, $result)andgsl_sf_bessel_i1_scaled($x)β no description in the source, just floating here. β¨gsl_sf_bessel_i2_scaled_e($x, $result)andgsl_sf_bessel_i2_scaled($x)β again, no description. πgsl_sf_bessel_il_scaled_e($l, $x, $result)andgsl_sf_bessel_il_scaled($x)β no description, keep scrolling.gsl_sf_bessel_il_scaled_array($lmax, $x)β this routine computes the values of the scaled regular modified spherical Bessel functionsexp(-|x|) i_l(x)forlfrom0to$lmaxinclusive for$lmax >= 0, returning the results in an array reference. The values are computed using recurrence relations for efficiency, and therefore may differ slightly from the exact values. π§β¨gsl_sf_bessel_k0_scaled_e($x, $result)andgsl_sf_bessel_k0_scale($x)β no description. (and yes, it's_scalenot_scaled, we respect the source π)gsl_sf_bessel_k1_scaled_e($x, $result)andgsl_sf_bessel_k1_scaled($x)β no description.gsl_sf_bessel_k2_scaled_e($x, $result)andgsl_sf_bessel_k2_scaled($x)β no description.gsl_sf_bessel_kl_scaled_e($l, $x, $result)andgsl_sf_bessel_kl_scaled($l, $x)β no description.gsl_sf_bessel_kl_scaled_array($lmax, $x)β this routine computes the values of the scaled irregular modified spherical Bessel functionsexp($x) k_l($x)forlfrom0tolmaxinclusive for$lmax >= 0and$x>0, returning the results in an array reference. The values are computed using recurrence relations for efficiency, and therefore may differ slightly from the exact values. π₯gsl_sf_bessel_Jnu_e($nu, $x, $result)andgsl_sf_bessel_Jnu($nu, $x)β no description.gsl_sf_bessel_sequence_Jnu_eβ just a name, no description.gsl_sf_bessel_Ynu_e($nu, $x, $result)andgsl_sf_bessel_Ynu($nu, $x)β no description.gsl_sf_bessel_Inu_scaled_e($nu, $x, $result)andgsl_sf_bessel_Inu_scaled($nu, $x)β no description.gsl_sf_bessel_Inu_e($nu, $x, $result)andgsl_sf_bessel_Inu($nu, $x)β no description.gsl_sf_bessel_Knu_scaled_e($nu, $x, $result)andgsl_sf_bessel_Knu_scaled($nu, $x)β no description.gsl_sf_bessel_Knu_e($nu, $x, $result)andgsl_sf_bessel_Knu($nu, $x)β no description.gsl_sf_bessel_lnKnu_e($nu, $x, $result)andgsl_sf_bessel_lnKnu($nu, $x)β no description.gsl_sf_bessel_zero_J0_e($s, $result)andgsl_sf_bessel_zero_J0($s)β no description.gsl_sf_bessel_zero_J1_e($s, $result)andgsl_sf_bessel_zero_J1($s)β no description.gsl_sf_bessel_zero_Jnu_e($nu, $s, $result)andgsl_sf_bessel_zero_Jnu($nu, $s)β no description.gsl_sf_clausen_e($x, $result)andgsl_sf_clausen($x)β no description.gsl_sf_hydrogenicR_1_e($Z, $r, $result)andgsl_sf_hydrogenicR_1($Z, $r)β no description.gsl_sf_hydrogenicR_e($n, $l, $Z, $r, $result)andgsl_sf_hydrogenicR($n, $l, $Z, $r)β no description.gsl_sf_coulomb_wave_FG_e($eta, $x, $L_F, $k, $F, gsl_sf_result * Fp, gsl_sf_result * G, $Gp)β this function computes the Coulomb wave functionsF_L(\eta,x),G_{L-k}(\eta,x)and their derivativesF'_L(\eta,x),G'_{L-k}(\eta,x)with respect to$x. The parameters are restricted toL, L-k > -1/2,x > 0and integer$k. Note thatLitself is not restricted to being an integer. The results are stored in the parameters$F,$Gfor the function values and$Fp,$Gpfor the derivative values.$F,$G,$Fp,$Gpare allgsl_resultstructs. If an overflow occurs,$GSL_EOVRFLWis returned and scaling exponents are returned as second and third values. πgsl_sf_coulomb_wave_F_arrayβ just a name, no description.gsl_sf_coulomb_wave_FG_arrayβ just a name, no description.gsl_sf_coulomb_wave_FGp_arrayβ just a name, no description.gsl_sf_coulomb_wave_sphF_arrayβ just a name, no description.gsl_sf_coulomb_CL_e($L, $eta, $result)β this function computes the Coulomb wave function normalization constantC_L($eta)for$L > -1. β¨gsl_sf_coulomb_CL_arrayiβ just a name, no description. (yes,arrayi, not our typo π)gsl_sf_coupling_3j_e($two_ja, $two_jb, $two_jc, $two_ma, $two_mb, $two_mc, $result)andgsl_sf_coupling_3j($two_ja, $two_jb, $two_jc, $two_ma, $two_mb, $two_mc)β these routines compute the Wigner 3-j coefficient,
(ja jb jc
ma mb mc)
where the arguments are given in half-integer units, ja = $two_ja/2, ma = $two_ma/2, etc. π«
gsl_sf_coupling_6j_e($two_ja, $two_jb, $two_jc, $two_jd, $two_je, $two_jf, $result)andgsl_sf_coupling_6j($two_ja, $two_jb, $two_jc, $two_jd, $two_je, $two_jf)β these routines compute the Wigner 6-j coefficient,
{ja jb jc
jd je jf}
where the arguments are given in half-integer units, ja = $two_ja/2, ma = $two_ma/2, etc. π
gsl_sf_coupling_RacahW_eandgsl_sf_coupling_RacahWβ no description.gsl_sf_coupling_9j_e($two_ja, $two_jb, $two_jc, $two_jd, $two_je, $two_jf, $two_jg, $two_jh, $two_ji, $result)andgsl_sf_coupling_9j($two_ja, $two_jb, $two_jc, $two_jd, $two_je, $two_jf, $two_jg, $two_jh, $two_ji)β these routines compute the Wigner 9-j coefficient,
{ja jb jc
jd je jf
jg jh ji}
where the arguments are given in half-integer units, ja = two_ja/2, ma = two_ma/2, etc. (note: no $ on two_ja here, we keep it real π
)
gsl_sf_dawson_e($x, $result)andgsl_sf_dawson($x)β these routines compute the value of Dawson's integral for$x. π¦gsl_sf_debye_1_e($x, $result)andgsl_sf_debye_1($x)β these routines compute the first-order Debye functionD_1(x) = (1/x) \int_0^x dt (t/(e^t - 1)). πgsl_sf_debye_2_e($x, $result)andgsl_sf_debye_2($x)β these routines compute the second-order Debye functionD_2(x) = (2/x^2) \int_0^x dt (t^2/(e^t - 1)). πgsl_sf_debye_3_e($x, $result)andgsl_sf_debye_3($x)β these routines compute the third-order Debye functionD_3(x) = (3/x^3) \int_0^x dt (t^3/(e^t - 1)). πgsl_sf_debye_4_e($x, $result)andgsl_sf_debye_4($x)β these routines compute the fourth-order Debye functionD_4(x) = (4/x^4) \int_0^x dt (t^4/(e^t - 1)). πgsl_sf_debye_5_e($x, $result)andgsl_sf_debye_5($x)β these routines compute the fifth-order Debye functionD_5(x) = (5/x^5) \int_0^x dt (t^5/(e^t - 1)). πgsl_sf_debye_6_e($x, $result)andgsl_sf_debye_6($x)β these routines compute the sixth-order Debye functionD_6(x) = (6/x^6) \int_0^x dt (t^6/(e^t - 1)). πgsl_sf_dilog_e ($x, $result)andgsl_sf_dilog($x)β these routines compute the dilogarithm for a real argument. In Lewin's notation this isLi_2(x), the real part of the dilogarithm of a realx. It is defined by the integral representationLi_2(x) = - \Re \int_0^x ds \log(1-s) / s. Note that\Im(Li_2(x)) = 0forx <= 1, and-\pi\log(x)forx > 1. Note that Abramowitz & Stegun refer to the Spence integralS(x)=Li_2(1-x)as the dilogarithm rather thanLi_2(x). πgsl_sf_complex_dilog_xy_eβ just a name, no description.gsl_sf_complex_dilog_e($r, $theta, $result_re, $result_im)β this function computes the full complex-valued dilogarithm for the complex argumentz = r \exp(i \theta). The real and imaginary parts of the result are returned in the$result_reand$result_imgsl_resultstructs. πgsl_sf_complex_spence_xy_eβ just a name, no description.gsl_sf_multiplyβ just a name, no description.gsl_sf_multiply_e($x, $y, $result)β this function multiplies$xand$ystoring the product and its associated error in$result. βοΈgsl_sf_multiply_err_e($x, $dx, $y, $dy, $result)β this function multiplies$xand$ywith associated absolute errors$dxand$dy. The productxy +/- xy \sqrt((dx/x)^2 +(dy/y)^2)is stored in$result. βοΈgsl_sf_ellint_Kcomp_e($k, $mode, $result)andgsl_sf_ellint_Kcomp($k, $mode)β these routines compute the complete elliptic integralK($k)to the accuracy specified by the mode variablemode. Note that Abramowitz & Stegun define this function in terms of the parameterm = k^2. π₯gsl_sf_ellint_Ecomp_e($k, $mode, $result)andgsl_sf_ellint_Ecomp($k, $mode)β no description.gsl_sf_ellint_Pcomp_e($k, $n, $mode, $result)andgsl_sf_ellint_Pcomp($k, $n, $mode)β no description.gsl_sf_ellint_Dcomp_eandgsl_sf_ellint_Dcompβ no description.gsl_sf_ellint_F_e($phi, $k, $mode, $result)andgsl_sf_ellint_F($phi, $k, $mode)β these routines compute the incomplete elliptic integralF($phi,$k)to the accuracy specified by the mode variablemode. Note that Abramowitz & Stegun define this function in terms of the parameterm = k^2. π₯gsl_sf_ellint_E_e($phi, $k, $mode, $result)andgsl_sf_ellint_E($phi, $k, $mode)β these routines compute the incomplete elliptic integralE($phi,$k)to the accuracy specified by the mode variablemode. Note that Abramowitz & Stegun define this function in terms of the parameterm = k^2. π₯gsl_sf_ellint_P_e($phi, $k, $n, $mode, $result)andgsl_sf_ellint_P($phi, $k, $n, $mode)β these routines compute the incomplete elliptic integral\Pi(\phi,k,n)to the accuracy specified by the mode variablemode. Note that Abramowitz & Stegun define this function in terms of the parametersm = k^2and\sin^2(\alpha) = k^2, with the change of signn \to -n. π₯gsl_sf_ellint_D_e($phi, $k, $n, $mode, $result)andgsl_sf_ellint_D($phi, $k, $n, $mode)β these functions compute the incomplete elliptic integralD(\phi,k)which is defined through the Carlson formRD(x,y,z)by the following relation,D(\phi,k,n) = (1/3)(\sin(\phi))^3 RD (1-\sin^2(\phi), 1-k^2 \sin^2(\phi), 1). The argument$nis not used and will be removed in a future release. π₯gsl_sf_ellint_RC_e($x, $y, $mode, $result)andgsl_sf_ellint_RC($x, $y, $mode)β these routines compute the incomplete elliptic integralRC($x,$y)to the accuracy specified by the mode variable$mode. π₯gsl_sf_ellint_RD_e($x, $y, $z, $mode, $result)andgsl_sf_ellint_RD($x, $y, $z, $mode)β these routines compute the incomplete elliptic integralRD($x,$y,$z)to the accuracy specified by the mode variable$mode. π₯gsl_sf_ellint_RF_e($x, $y, $z, $mode, $result)andgsl_sf_ellint_RF($x, $y, $z, $mode)β these routines compute the incomplete elliptic integralRF($x,$y,$z)to the accuracy specified by the mode variable$mode. π₯gsl_sf_ellint_RJ_e($x, $y, $z, $p, $mode, $result)andgsl_sf_ellint_RJ($x, $y, $z, $p, $mode)β these routines compute the incomplete elliptic integralRJ($x,$y,$z,$p)to the accuracy specified by the mode variable$mode. π₯gsl_sf_elljac_e($u, $m)β this function computes the Jacobian elliptic functionssn(u|m),cn(u|m),dn(u|m)by descending Landen transformations. The function returns0if the operation succeeded,1otherwise and then returns the result ofsn,cnanddnin this order. π₯gsl_sf_erfc_e($x, $result)andgsl_sf_erfc($x)β these routines compute the complementary error functionerfc(x) = 1 - erf(x) = (2/\sqrt(\pi)) \int_x^\infty \exp(-t^2). πgsl_sf_log_erfc_e($x, $result)andgsl_sf_log_erfc($x)β these routines compute the logarithm of the complementary error function\log(\erfc(x)). πgsl_sf_erf_e($x, $result)andgsl_sf_erf($x)β these routines compute the error functionerf(x), whereerf(x) = (2/\sqrt(\pi)) \int_0^x dt \exp(-t^2). πgsl_sf_erf_Z_e($x, $result)andgsl_sf_erf_Z($x)β these routines compute the Gaussian probability density functionZ(x) = (1/\sqrt{2\pi}) \exp(-x^2/2). πgsl_sf_erf_Q_e($x, $result),gsl_sf_erf_Q($x)β these give you the upper tail of the Gaussian probability function,Q(x) = (1/\sqrt{2\pi}) \int_x^\infty dt \exp(-t^2/2). The hazard function for the normal distribution, aka the inverse Mill's ratio, is defined ash(x) = Z(x)/Q(x) = \sqrt{2/\pi} \exp(-x^2 / 2) / \erfc(x/\sqrt 2). It decreases rapidly asxapproaches-\inftyand asymptotes toh(x) \sim xasxapproaches+\infty. It's giving dramatic exits and chill entrances, honestly. π«gsl_sf_hazard_e($x, $result),gsl_sf_hazard($x)β these compute the hazard function for the normal distribution. That's it, that's the whole job.gsl_sf_exp_e($x, $result),gsl_sf_exp($x)β an exponential function\exp(x)with GSL semantics and error checking baked in. Standardexpbut with β¨standardsβ¨.gsl_sf_exp_e10_eβ the page lists this one and moves on, no blurb attached.gsl_sf_exp_mult_e,gsl_sf_exp_multβ listed together, no description on this page.gsl_sf_exp_mult_e10_eβ also listed with no blurb. iykyk.gsl_sf_expm1_e($x, $result),gsl_sf_expm1($x)β computes\exp(x)-1using an algorithm that's accurate for smallx. Because subtracting 1 from something tiny is where naive code literally falls apart.gsl_sf_exprel_e($x, $result),gsl_sf_exprel($x)β computes(\exp(x)-1)/xwith an algorithm accurate for smallx. For smallxthe algorithm is based on the expansion(\exp(x)-1)/x = 1 + x/2 + x^2/(2*3) + x^3/(2*3*4) + \dots. No division-by-basically-zero shenanigans. πgsl_sf_exprel_2_e($x, $result),gsl_sf_exprel_2($x)β computes2(\exp(x)-1-x)/x^2, again with a small-x-accurate algorithm. For smallxit uses the expansion2(\exp(x)-1-x)/x^2 = 1 + x/3 + x^2/(3*4) + x^3/(3*4*5) + \dots.gsl_sf_exprel_n_e($x, $result),gsl_sf_exprel_n($x)β computes the N-relative exponential, the n-th generalization of the functionsgsl_sf_exprelandgsl_sf_exprel2. It's defined as:
exprel_N(x) = N!/x^N (\exp(x) - \sum_{k=0}^{N-1} x^k/k!)
= 1 + x/(N+1) + x^2/((N+1)(N+2)) + ...
= 1F1 (1,1+N,x)
gsl_sf_exp_err_e($x, $dx, $result)β exponentiates$xwith an associated absolute error$dx. Errors are part of the whole personality here.gsl_sf_exp_err_e10_eβ listed, no blurb.gsl_sf_exp_mult_err_e($x, $dx, $y, $dy, $result)β listed, no blurb.gsl_sf_exp_mult_err_e10_eβ listed, no blurb.
gsl_sf_expint_E1_e($x, $result),gsl_sf_expint_E1($x)β computes the exponential integralE_1(x),E_1(x) := \Re \int_1^\infty dt \exp(-xt)/t.gsl_sf_expint_E2_e($x, $result),gsl_sf_expint_E2($x)β computes the second-order exponential integralE_2(x),E_2(x) := \Re \int_1^\infty dt \exp(-xt)/t^2.gsl_sf_expint_En_e($n, $x, $result),gsl_sf_expint_En($n, $x)β computes the exponential integralE_n(x)of ordern,E_n(x) := \Re \int_1^\infty dt \exp(-xt)/t^n.gsl_sf_expint_E1_scaled_e,gsl_sf_expint_E1_scaledβ listed, no blurb.gsl_sf_expint_E2_scaled_e,gsl_sf_expint_E2_scaledβ listed, no blurb.gsl_sf_expint_En_scaled_e,gsl_sf_expint_En_scaledβ listed, no blurb.gsl_sf_expint_Ei_e($x, $result),gsl_sf_expint_Ei($x)β computes the exponential integralEi(x),Ei(x) := - PV(\int_{-x}^\infty dt \exp(-t)/t)wherePVdenotes the principal value of the integral. Principal value, main character energy. πgsl_sf_expint_Ei_scaled_e,gsl_sf_expint_Ei_scaledβ listed, no blurb.gsl_sf_Shi_e($x, $result),gsl_sf_Shi($x)β computes the integralShi(x) = \int_0^x dt \sinh(t)/t.gsl_sf_Chi_e($x, $result),gsl_sf_Chi($x)β computes the integralChi(x) := \Re[ \gamma_E + \log(x) + \int_0^x dt (\cosh[t]-1)/t], where\gamma_Eis the Euler constant (available as$M_EULERfrom theMath::GSL::Constmodule). Cute little cameo from another module, love that for us. π«Άgsl_sf_expint_3_e($x, $result),gsl_sf_expint_3($x)β computes the third-order exponential integralEi_3(x) = \int_0^xdt \exp(-t^3)forx >= 0.gsl_sf_Si_e($x, $result),gsl_sf_Si($x)β computes the Sine integralSi(x) = \int_0^x dt \sin(t)/t.gsl_sf_Ci_e($x, $result),gsl_sf_Ci($x)β computes the Cosine integralCi(x) = -\int_x^\infty dt \cos(t)/tforx > 0.
π Fermi-Dirac gang π
gsl_sf_fermi_dirac_m1_e($x, $result),gsl_sf_fermi_dirac_m1($x)β computes the complete Fermi-Dirac integral with an index of-1, given byF_{-1}(x) = e^x / (1 + e^x).gsl_sf_fermi_dirac_0_e($x, $result),gsl_sf_fermi_dirac_0($x)β computes the complete Fermi-Dirac integral with an index of0, given byF_0(x) = \ln(1 + e^x).gsl_sf_fermi_dirac_1_e($x, $result),gsl_sf_fermi_dirac_1($x)β computes the complete Fermi-Dirac integral with an index of1,F_1(x) = \int_0^\infty dt (t /(\exp(t-x)+1)).gsl_sf_fermi_dirac_2_e($x, $result),gsl_sf_fermi_dirac_2($x)β computes the complete Fermi-Dirac integral with an index of2,F_2(x) = (1/2) \int_0^\infty dt (t^2 /(\exp(t-x)+1)).gsl_sf_fermi_dirac_int_e($j, $x, $result),gsl_sf_fermi_dirac_int($j, $x)β computes the complete Fermi-Dirac integral with an integer index ofj,F_j(x) = (1/\Gamma(j+1)) \int_0^\infty dt (t^j /(\exp(t-x)+1)).gsl_sf_fermi_dirac_mhalf_e($x, $result),gsl_sf_fermi_dirac_mhalf($x)β computes the complete Fermi-Dirac integralF_{-1/2}(x).gsl_sf_fermi_dirac_half_e($x, $result),gsl_sf_fermi_dirac_half($x)β computes the complete Fermi-Dirac integralF_{1/2}(x).gsl_sf_fermi_dirac_3half_e($x, $result),gsl_sf_fermi_dirac_3half($x)β computes the complete Fermi-Dirac integralF_{3/2}(x).gsl_sf_fermi_dirac_inc_0_e($x, $b, $result),gsl_sf_fermi_dirac_inc_0($x, $b, $result)β computes the incomplete Fermi-Dirac integral with an index of zero,F_0(x,b) = \ln(1 + e^{b-x}) - (b-x).
π§ Legendre polynomials π§
gsl_sf_legendre_Pl_e($l, $x, $result),gsl_sf_legendre_Pl($l, $x)β evaluates the Legendre polynomialP_l(x)for a specific value ofl,x, subject tol >= 0,|x| <= 1.gsl_sf_legendre_Pl_array,gsl_sf_legendre_Pl_deriv_arrayβ listed, no blurb.gsl_sf_legendre_P1_e($x, $result),gsl_sf_legendre_P2_e($x, $result),gsl_sf_legendre_P3_e($x, $result),gsl_sf_legendre_P1($x),gsl_sf_legendre_P2($x),gsl_sf_legendre_P3($x)β these evaluate the Legendre polynomialsP_l(x)using explicit representations forl=1,2,3. Hardcoded and proud of it.gsl_sf_legendre_Q0_e($x, $result),gsl_sf_legendre_Q0($x)β computes the Legendre functionQ_0(x)forx > -1,x != 1.gsl_sf_legendre_Q1_e($x, $result),gsl_sf_legendre_Q1($x)β computes the Legendre functionQ_1(x)forx > -1,x != 1.gsl_sf_legendre_Ql_e($l, $x, $result),gsl_sf_legendre_Ql($l, $x)β computes the Legendre functionQ_l(x)forx > -1,x != 1andl >= 0.gsl_sf_legendre_Plm_e($l, $m, $x, $result),gsl_sf_legendre_Plm($l, $m, $x)β computes the associated Legendre polynomialP_l^m(x)form >= 0,l >= m,|x| <= 1.gsl_sf_legendre_Plm_array,gsl_sf_legendre_Plm_deriv_arrayβ listed, no blurb.gsl_sf_legendre_sphPlm_e($l, $m, $x, $result),gsl_sf_legendre_sphPlm($l, $m, $x)β computes the normalized associated Legendre polynomial$\sqrt{(2l+1)/(4\pi)} \sqrt{(l-m)!/(l+m)!} P_l^m(x)$, suitable for use in spherical harmonics. The parameters must satisfym >= 0,l >= m,|x| <= 1. These routines avoid the overflows that occur for the standard normalization ofP_l^m(x). Anti-overflow protection: iconic behavior. πgsl_sf_legendre_sphPlm_array,gsl_sf_legendre_sphPlm_deriv_arrayβ listed, no blurb.gsl_sf_legendre_array_sizeβ listed, no blurb.
π Gamma, factorials and friends π
gsl_sf_lngamma_e($x, $result),gsl_sf_lngamma($x)β computes the logarithm of the Gamma function,\log(\Gamma(x)), subject toxnot being a negative integer or zero. Forx<0the real part of\log(\Gamma(x))is returned, which is equivalent to\log(|\Gamma(x)|). Computed using the real Lanczos method. So like, negative integers and zero are a hard no. π«gsl_sf_lngamma_sgn_e($x, $result_lg)β returns the sign of the gamma function and the logarithm of its magnitude into this order, subject to$xnot being a negative integer or zero. Computed using the real Lanczos method. You can reconstruct the value of the gamma function with the relation\Gamma(x) = sgn * \exp(result_lg).gsl_sf_gamma_e,gsl_sf_gammaβ listed, no blurb.gsl_sf_gammastar_e,gsl_sf_gammastarβ listed, no blurb.gsl_sf_gammainv_e,gsl_sf_gammainvβ listed, no blurb.gsl_sf_lngamma_complex_eβ listed, no blurb.gsl_sf_gamma_inc_Q_e,gsl_sf_gamma_inc_Qβ listed, no blurb.gsl_sf_gamma_inc_P_e,gsl_sf_gamma_inc_Pβ listed, no blurb.gsl_sf_gamma_inc_e,gsl_sf_gamma_incβ listed, no blurb.gsl_sf_taylorcoeff_e,gsl_sf_taylorcoeffβ listed, no blurb.gsl_sf_fact_e,gsl_sf_factβ listed, no blurb.gsl_sf_doublefact_e,gsl_sf_doublefactβ listed, no blurb.gsl_sf_lnfact_e,gsl_sf_lnfactβ listed, no blurb.gsl_sf_lndoublefact_e,gsl_sf_lndoublefactβ listed, no blurb.gsl_sf_lnchoose_e,gsl_sf_lnchooseβ listed, no blurb.gsl_sf_choose_e,gsl_sf_chooseβ listed, no blurb.gsl_sf_lnpoch_e,gsl_sf_lnpochβ listed, no blurb.gsl_sf_lnpoch_sgn_eβ listed, no blurb.gsl_sf_poch_e,gsl_sf_pochβ listed, no blurb.gsl_sf_pochrel_e,gsl_sf_pochrelβ listed, no blurb.gsl_sf_lnbeta_e,gsl_sf_lnbetaβ listed, no blurb.gsl_sf_lnbeta_sgn_eβ listed, no blurb.gsl_sf_beta_e,gsl_sf_betaβ listed, no blurb.gsl_sf_beta_inc_e,gsl_sf_beta_incβ listed, no blurb.
Heads up bestie: those pairs above really do show up in the page with zero description attached β not me being lazy, that's just what's there. π
πΈ Orthogonal-adjacent and hypergeometric era πΈ
gsl_sf_gegenpoly_1_e,gsl_sf_gegenpoly_2_e,gsl_sf_gegenpoly_3_e,gsl_sf_gegenpoly_1,gsl_sf_gegenpoly_2,gsl_sf_gegenpoly_3β listed, no blurb.gsl_sf_gegenpoly_n_e,gsl_sf_gegenpoly_nβ listed, no blurb.gsl_sf_gegenpoly_arrayβ listed, no blurb.gsl_sf_hyperg_0F1_e,gsl_sf_hyperg_0F1β listed, no blurb.gsl_sf_hyperg_1F1_int_e,gsl_sf_hyperg_1F1_intβ listed, no blurb.gsl_sf_hyperg_1F1_e,gsl_sf_hyperg_1F1β listed, no blurb.gsl_sf_hyperg_U_int_e,gsl_sf_hyperg_U_intβ listed, no blurb.gsl_sf_hyperg_U_int_e10_eβ listed, no blurb.gsl_sf_hyperg_U_e,gsl_sf_hyperg_Uβ listed, no blurb.gsl_sf_hyperg_U_e10_eβ listed, no blurb.gsl_sf_hyperg_2F1_e,gsl_sf_hyperg_2F1β listed, no blurb.gsl_sf_hyperg_2F1_conj_e,gsl_sf_hyperg_2F1_conjβ listed, no blurb.gsl_sf_hyperg_2F1_renorm_e,gsl_sf_hyperg_2F1_renormβ listed, no blurb.gsl_sf_hyperg_2F1_conj_renorm_e,gsl_sf_hyperg_2F1_conj_renormβ listed, no blurb.gsl_sf_hyperg_2F0_e,gsl_sf_hyperg_2F0β listed, no blurb.gsl_sf_laguerre_1_e,gsl_sf_laguerre_2_e,gsl_sf_laguerre_3_e,gsl_sf_laguerre_1,gsl_sf_laguerre_2,gsl_sf_laguerre_3β listed, no blurb.gsl_sf_laguerre_n_e,gsl_sf_laguerre_nβ listed, no blurb.gsl_sf_lambert_W0_e,gsl_sf_lambert_W0β listed, no blurb.gsl_sf_lambert_Wm1_e,gsl_sf_lambert_Wm1β listed, no blurb.gsl_sf_conicalP_half_e,gsl_sf_conicalP_halfβ listed, no blurb.gsl_sf_conicalP_mhalf_e,gsl_sf_conicalP_mhalfβ listed, no blurb.gsl_sf_conicalP_0_e,gsl_sf_conicalP_0β listed, no blurb.gsl_sf_conicalP_1_e,gsl_sf_conicalP_1β listed, no blurb.gsl_sf_conicalP_sph_reg_egsl_sf_conicalP_sph_reggsl_sf_conicalP_cyl_reg_egsl_sf_conicalP_cyl_reggsl_sf_legendre_H3d_0_egsl_sf_legendre_H3d_0gsl_sf_legendre_H3d_1_egsl_sf_legendre_H3d_1gsl_sf_legendre_H3d_egsl_sf_legendre_H3dgsl_sf_legendre_H3d_arraygsl_sf_log_egsl_sf_loggsl_sf_log_abs_egsl_sf_log_absgsl_sf_complex_log_egsl_sf_log_1plusx_egsl_sf_log_1plusxgsl_sf_log_1plusx_mx_egsl_sf_log_1plusx_mxgsl_sf_mathieu_a_arraygsl_sf_mathieu_b_arraygsl_sf_mathieu_agsl_sf_mathieu_bgsl_sf_mathieu_a_coeffgsl_sf_mathieu_b_coeffgsl_sf_mathieu_allocgsl_sf_mathieu_freegsl_sf_mathieu_cegsl_sf_mathieu_segsl_sf_mathieu_ce_arraygsl_sf_mathieu_se_arraygsl_sf_mathieu_Mcgsl_sf_mathieu_Msgsl_sf_mathieu_Mc_arraygsl_sf_mathieu_Ms_arraygsl_sf_pow_int_egsl_sf_pow_intgsl_sf_psi_int_egsl_sf_psi_intgsl_sf_psi_egsl_sf_psigsl_sf_psi_1piy_egsl_sf_psi_1piygsl_sf_complex_psi_egsl_sf_psi_1_int_egsl_sf_psi_1_intgsl_sf_psi_1_egsl_sf_psi_1gsl_sf_psi_n_egsl_sf_psi_ngsl_sf_result_smash_egsl_sf_synchrotron_1_egsl_sf_synchrotron_1gsl_sf_synchrotron_2_egsl_sf_synchrotron_2gsl_sf_transport_2_egsl_sf_transport_2gsl_sf_transport_3_egsl_sf_transport_3gsl_sf_transport_4_egsl_sf_transport_4gsl_sf_transport_5_egsl_sf_transport_5gsl_sf_sin_egsl_sf_singsl_sf_cos_egsl_sf_cosgsl_sf_hypot_egsl_sf_hypotgsl_sf_complex_sin_egsl_sf_complex_cos_egsl_sf_complex_logsin_egsl_sf_sinc_egsl_sf_sincgsl_sf_lnsinh_egsl_sf_lnsinhgsl_sf_lncosh_egsl_sf_lncoshgsl_sf_polar_to_rectgsl_sf_rect_to_polargsl_sf_sin_err_egsl_sf_cos_err_egsl_sf_angle_restrict_symm_egsl_sf_angle_restrict_symmgsl_sf_angle_restrict_pos_egsl_sf_angle_restrict_posgsl_sf_angle_restrict_symm_err_egsl_sf_angle_restrict_pos_err_egsl_sf_atanint_egsl_sf_atanintβ okay bestie these ones compute the Arctangent integral, which is defined asAtanInt(x) = \int_0^x dt \arctan(t)/t. πgsl_sf_zeta_int_egsl_sf_zeta_intgsl_sf_zeta_egsl_sf_zetagsl_sf_zetam1_egsl_sf_zetam1gsl_sf_zetam1_int_egsl_sf_zetam1_intgsl_sf_hzeta_egsl_sf_hzetagsl_sf_eta_int_egsl_sf_eta_intgsl_sf_eta_egsl_sf_eta
This module also contains the following constants, and they get used as the mode in a bunch of those functions up there π :
GSL_PREC_DOUBLEβ Double-precision, a relative accuracy of approximately2 * 10^-16. πGSL_PREC_SINGLEβ Single-precision, a relative accuracy of approximately10^-7.GSL_PREC_APPROXβ Approximate values, a relative accuracy of approximately5 * 10^-4. β¨
So how do you actually get at these functions, you ask?? π«Ά You import the ones you want by handing Math::GSL::SF a space separated list when you use the package. And yes, you can absolutely just pull in everything:
use Math::GSL::SF qw/:all/
to use all available functions of the module. π Heads up though β the tag names begin with a colon. There are other tags available too, and here is the complete list of all the tags for this module, no gatekeeping:
"airy""bessel""clausen""hydrogenic""coulumb""coupling""dawson""debye""dilog""factorial""misc""elliptic""error""hypergeometric""laguerre""legendre""gamma""transport""trig""zeta""eta""vars"
For more info on the functions themselves, we refer you to the GSL official documentation: http://www.gnu.org/software/gsl/manual/html_node/ π
β¨ EXAMPLES β¨
Okay this example computes the dilogarithm of 1/10, watch this π:
use Math::GSL::SF qw/dilog/;
my $x = gsl_sf_dilog(0.1);
print "gsl_sf_dilog(0.1) = $x\n";
There's also an example using Math::GSL::SF and gnuplot chillin' in the examples/sf folder of the source code. π
π AUTHORS π
Jonathan "Duke" Leto jonathan@leto.net and Thierry Moisan thierry.moisan@gmail.com β legends, fr fr. π«Ά
π COPYRIGHT AND LICENSE π
Copyright (C) 2008-2024 Jonathan "Duke" Leto and Thierry Moisan
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
And that's the whole page bestie, we literally made it to the end π β credit where it's due: this is perl v5.42.3, dated 2026-08-20, and the page you just read is Math::GSL::SF(3pm). Go forth and compute, main character π
πβ¨
π¦ where this page comes from
- ubuntu stonking: libmath-gsl-perl 0.49-1build1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms