Questions tagged [special-functions]
For questions about evaluating or implementing special functions, e.g. Bessel, hypergeometric, gamma, Lambert W.
58
questions
3
votes
1
answer
76
views
Robust ways of evaluating $j_n(x+iy)/e^y$
For reasons to do with extending the range of applicability of this Mathematica package, I would like to have a good handle on the numerical evaluation of functions of the form
$$
f(x) = \frac{j_n(\...
3
votes
3
answers
158
views
Hypergeometric function $_2F_1(z)$ with $|z| > 1$ in GSL
I need to evaluate the hypergeometric function $_2F_1$ with $|z| > 1$ as in Wolfram Language with GSL but the GSL documentation says the $_2F_1$ needs $|z| < 1$.
Is there any way I can use GSL ...
4
votes
1
answer
83
views
Worst Case complexity of a search engine algorithm
Computer make it possible to find information in large databases. However, the results are often too large to be returned in their entirety to the user who requests them. Computer therefore sort the ...
4
votes
2
answers
197
views
Evaluation of real-valued confluent hypergeometric function with specific complex arguments
In my C++ code, I need to evaluate the confluent hypergeometric function ${}_1F_1(a,b;z)$ with complex arguments in a special case. More precisely, I have to compute
$$
e^{-i\phi}{}_1F_1(\ell+1+iZ,2(\...
2
votes
0
answers
153
views
Best way to compute given functional with accuracy:
I need to plot the following functional with accuracy:
$$
I(x,s) =\int_0^\infty\mathrm dy \frac{F(x + \mathrm iy,s) − F(x −\mathrm iy,s)}{\mathrm e^{2πy}-1},
$$
Where $ F(z,s) = \dfrac{1}{z^s\Gamma(\...
1
vote
1
answer
239
views
Help with modified bessel functions
I'm trying to parse the following expression (Eq. 35 in The Magnetic Field in the Vicinity of Parallel and Twisted Three-Wire Cable Carrying Balanced Three-Phased Current) in Python and calculate its ...
1
vote
0
answers
75
views
Computation of a functional for large values
Consider the following function :
$$f(x) = \sin^2(\frac{π\Gamma(x)}{2x})$$
Now consider the following functional :
$$I(x)=\int_0^\infty \frac{f(x + iy) − f(x − iy)}{e^{2πy}-1} dy$$
I need values for ...
2
votes
0
answers
44
views
To use the confluent hypergeometric function or not to?
I am numerically computing the following integral as a function of positive $k$.
$$I(k) := \int_0^\infty x^b(k+x)^{a-1} e^{-x} dx \tag1$$
It is shown in math.stackexchange.com that this can be ...
2
votes
3
answers
271
views
Comparison of integrals with a function:
Consider the following integral:
$$S(q)=\int_{x=2}^q\sin^2\left(\frac{π\Gamma(x)}{2x}\right)dx$$
And consider the functions :
$$R(q)=\frac{q}{\log(q)}$$
$$T(q)=\int_2^q\frac{1}{\log(x)}dx$$
I ...
2
votes
1
answer
513
views
Coding of the Legendre polynomial and the infinite sum using python
I'm looking to code the following function:
$$|g(\theta)=\frac{1}{2k}\sum_{\ell=0}^{\infty} (2\ell +1)\sin(2\delta_{\ell})P_{\ell}\cos(\theta)|^2$$
...
1
vote
0
answers
532
views
Using Spherical Bessel Functions in Python
My question relates to using spherical Bessel functions in Python.
If my ODE contains a spherical Bessel function of the form $$j_\ell(tx)$$ and similarly $$y_\ell(tx)$$
for given values of $t$ and $...
0
votes
2
answers
113
views
Calculations to constraint a value with only min and max functions
I have an X value that can go from 0.0000001 to infinite.
I want, if this value is less than 0.8, get 0.8
And if that value is equal to or more than 0.8, get 0
How would you do that using only min ...
2
votes
2
answers
392
views
What is an efficient way to calculate zeros of Bessel functions?
One approach is the brute force method of evaluating at all points at fixed intervals and when it nears zero write value, this can be combined with adaptive step size. Another approach is ...
0
votes
2
answers
92
views
Is expm1 the right primitive?
I'm writing some code to calculate $\int_0^1 e^{ax} \mathrm{d} x$. Annoyingly there does not seem to be a way of doing this without if statements:
...
0
votes
2
answers
285
views
How can I calculate the exponential integral?
(I originally asked this in a different exchange.)
I'm writing a program that uses the prime-counting function. Right now, I'm using x/log(x), but I want to ...
3
votes
1
answer
88
views
Robust ways to find zeros of the Tricomi confluent hypergeometric function as a function of its parameters
I'm solving a quantum mechanical problem, and the quantization condition requires me to solve the equation
$$
U\left(\frac12(\ell+1-E), \ell+1, r^2\right) = 0,
$$
where $U(a,b,z)$ is the confluent ...
5
votes
0
answers
120
views
Best way to numerically compute elliptic integrals of the third kind with complex arguments?
I need to compute elliptic integrals of the third kind with complex arguments, preferably in C++. Is there code out there to do this? I have discovered the Arb library, but that does much more than I ...
8
votes
1
answer
351
views
What algorithm does (or did?) Excel use for Bessel functions that is discontinuous at x=8?
Writing this comment reminded me of something I noticed years ago about evaluating Bessel functions of the first kind $J_n(x)$ in Excel. (BESSELJ)
I don't use Excel now but at the time I'd checked ...
8
votes
1
answer
419
views
Accurate and efficient computation of the inverse Langevin function
The Langevin function $\mathcal{L}(x) = \mathrm{coth}(x) - \frac{1}{x}$ occurs in computations related to elastomers and paramagnetic materials. It is easily computed accurately and with high ...
2
votes
2
answers
642
views
Integration of a diverge function in c++ GSL Library
I am trying to perform an Integral of Hypergeometric function 2F1(a,b,c,x) from -1 to 1 for some good values of $a,b,c$ (lets say $a=1,b=2,c=3$) .
I did it in ...
7
votes
3
answers
2k
views
Finding the first N roots of transcendental equation
I need to find the first $n$ roots of the transcendental equation
\begin{equation}
F(k) = J_m'(kr)Y_m'(k)-J'_m(k)Y'_m(kr)
\end{equation}
for integer values of $m$ and any $r \in [0,1)$ where $J'$ ...
1
vote
2
answers
2k
views
Continuum removal algorithm in python
I'm using python 2.7 (on jupyter notebook, win10 64 bit) to perform my analysis. I need to perform continuum removal (CR) on a reflectance spectrum data. I need it to be as described here.
EDITED:
...
0
votes
1
answer
198
views
Normalization of MATLAB HermiteH
I was wandering - what kind of normalization does Matlab use in hermiteH, its implementation of the Hermite polynomials?
It is certainly not the case that they use ...
1
vote
1
answer
335
views
Matlab symbolic differentiation of Legendre polynomials
Consider $f(x)= \sum\limits_{n=0}^N a_n p_n (x)$, where $p_n$ are the Legendre polynomials. If one wants to differentiate $f'$ symbolically, i.e. to compute $$f'(x) = \sum\limits_{n=0}^{N-1} b_n p_n (...
6
votes
1
answer
221
views
Numerical integration of a hypergeometric function
The Task
Let $z_1, z_2, z_3$ be positive real numbers and define
$$
r(\mathbf{z}):= \int_0 ^\infty (t+z_1)^{-3/2}(t+z_2)^{-3/2}(t+z_3)^{-1/2}\text{d}t.
$$
The task is to compute $r$ numerically in ...
3
votes
1
answer
102
views
Numerical evaluation of gaussian-like integral expressible as a recurrence relation
I'm looking to numerically evaluate $\log f_p(z)$ and its derivative $f^\prime_p(z)/f_p(z)$ accurately and efficiently in floating-point, where
$$
f_p(z)=\int_0^\infty r^{p-1} \exp\left(-\tfrac{1}{2} ...
4
votes
1
answer
220
views
Numerical evaluation of the Exponential Integral Ei by rational Chebyshev approximations fails
I am trying to evaluate the Exponential Integral $Ei(x)=-\int^{\infty}_{-x}\frac{e^{-t}}{t}dt$ for $x>0$ (interpreted as the Cauchy principal value) by using rational Chebyshev approximations, ...
10
votes
0
answers
294
views
Numerical integration using interval arithmetic, nowadays
Is there now a package for rigorous numerical integration that uses interval arithmetic and has access to a well-developed library of special functions?
By "well-developed", I mean something that, at ...
6
votes
1
answer
107
views
Numerical computation of the complex elliptic integral $E(k)$ for medium $|k|$
I have implemented Carlson's algorithm for $E(k)$ from Numerical computation
of real or complex elliptic integrals (available from ArXiv eprint, see
also DLMF). It is essentially his formula (46) ...
4
votes
2
answers
473
views
Interpolation with the roots of orthogonal polynomials & Spectral expansion
I'm a bit confused about the relationships between these two approximation methods mentioned in the title.
Does this kind of interpolation also belongs to the field of spectral methods?
Are the ...
5
votes
2
answers
1k
views
I am searching for a C++ code implementing the complex polygamma function
I googled about some code on the complex polygamma function especially C++ code, but can't find anything. Does anyone know where to find such code?
The complex digamma function does exist but not the ...
3
votes
1
answer
8k
views
Python Vectorizing a Function Returning an Array
I have the following function that has been vectorized so that for every element in input array t, an array is output:
...
4
votes
1
answer
158
views
How do I develop numerical routines for the evaluation of my own special functions?
This question was previously posted to Math.SE here and had received no answers at the time of this posting.
When performing computational work, I often come across a univariate function, defined in ...
4
votes
2
answers
460
views
overflow upper incomplete gamma function
I want to calculate the following equation:
$$\frac{\theta \Gamma \left(\kappa+1,\frac{o}{\theta }\right)-o \Gamma \left(\kappa,\frac{o}{\theta }\right)}{\Gamma (\kappa)}+o+s$$
with $s>0, o>0, ...
2
votes
2
answers
1k
views
Kummer's confluent hypergeometric for complex arguments in C/C++?
I need to evaluate Kummer's confluent hypergeometric function for imaginary arguments:
$$_1F_1(a,b;ix)$$
where $i$ is the imaginary unit, $a,b,x$ are real, and $a,b>0$. Is there a routine ...
6
votes
1
answer
558
views
Using Log Gamma function to avoid overflow
I have to do some numerical calculus using gamma functions. I am using the tgamma incluided in the C++ cmath library. The ...
8
votes
3
answers
4k
views
What is the fastest opensource implementation of Bessel functions computation?
I'm looking for an open-source (to use and learn from) software which computes Bessel functions of integer order of real argument to double precision the fastest among all such implementations. ...
8
votes
1
answer
2k
views
Newton iteration for cube root without division
It's a fairly well known trick to avoid division in calculating square-roots to apply Newton's method to finding $1/\sqrt{x}$, and probably better known, using Newton's method to find reciprocals ...
3
votes
2
answers
543
views
Bessel EVP and fzero
I am trying to solve the Eigenvalue problem
$$
x^2 y''+ x y' + x^2 y = \lambda^2 y\,,\quad x\in(0,1)\,,\quad
y(0)=0\,,\quad
y'(1)=y(1)
$$
The differential equation is the Bessel equation. The solution ...
2
votes
0
answers
68
views
Accurate computation of $\frac{\mathrm{B}_{x,y}(\alpha + 1,\beta)}{\mathrm{B}_{x,y}(\alpha,\beta)}$ for large paramers?
I need to calculate these ratios:
$$\frac{\mathrm{B}_{x,y}(\alpha + 1,\beta)}{\mathrm{B}_{x,y}(\alpha,\beta)} \tag{1}$$
where $\alpha,\beta > 0$ and $0\le x\le y \le 1$. Here $\mathrm{B}_{x,y}(\...
0
votes
0
answers
23
views
Compute hypergeometric function ratio: $\frac{_{2}F_{1}(a+1,b;c;x)}{_{2}F_{1}(a,b;c;x)}$, for large positive $a,b,c$? [duplicate]
I need a numerically stable way to compute the following ratio:
$$\frac{_{2}F_{1}(a+1,b;c;x)}{_{2}F_{1}(a,b;c;x)}$$
All the parameters are real positive numbers, with $0 < a,b,c$ and $0 < x &...
4
votes
1
answer
191
views
Compute hypergeometric function ratio: $\frac{_{2}F_{1}(a+1,b;c;x)}{_{2}F_{1}(a,b;c;x)}$?
I need a numerically stable way to compute the following ratio:
$$\frac{_{2}F_{1}(a+1,b;c;x)}{_{2}F_{1}(a,b;c;x)}$$
All the parameters are real numbers, with $a< 0$,$\ $ $b,c > 0$ and $0<x&...
2
votes
1
answer
440
views
Appell function implementation in C++?
Is there a C++/C implementation of the Appell series? GSL and Boost do not seem to have this function.
8
votes
1
answer
188
views
Radial integration of expensive function with Bessel weights
I need to calculate the integral
$$I = \int_0^R f(r)J_n\left(\frac{z_{nm}r}{R}\right)rdr$$
where $J_n$ is the $n^{\mathrm{th}}$ order Bessel functions of the first kind, $z_{nm}$ is its $m^{\mathrm{...
8
votes
1
answer
821
views
Second derivative of the Associated Legendre functions
I would like to compute, as part of the solution of the Laplace equation using the Fast Multipole Method, the second derivative of the associated legendre functions of the first kind .
Specifically, I ...
3
votes
1
answer
123
views
Efficient computation of tangent of fraction of angle
I want to compute $a = \tan(f \theta)$ for $f\in [0,1]$, given $g = \tan\theta$. Obviously, I can compute $a = \tan(f\tan^{-1}g)$, but I'm wondering if there's a more efficient way that avoids having ...
9
votes
3
answers
3k
views
How to use polylogarithm function in c++?
Is there any preprocessor directives that could be used to use the polylog function? Or is it included in cmath? If so, do you call it by Li or by polylog?
EDIT:
What I really am trying to do is give ...
6
votes
5
answers
290
views
Evaluate the sum
I want to evaluate the sum $$\sum_{k=1}^\infty \left(\frac{i+1}{\sqrt{2}}\right)^k\cdot k^{-\alpha}$$ where $i=\sqrt{-1}$ and $\alpha\in[\frac{3}{4},1]$ with 8 digits accuracy.
If I am willing to ...
15
votes
1
answer
332
views
Does transforming $J_0(x)\to\int\cos(x\sin\theta)$ help with numerical integration?
I've heard anecdotally that when one is trying to numerically do an integral of the form
$$\int_0^\infty f(x) J_0(x)\,\mathrm{d}x$$
with $f(x)$ smooth and well-behaved (e.g. not itself highly ...
26
votes
4
answers
10k
views
Method for numerical integration of difficult oscillatory integral
I need to numerically evaluate the integral below:
$$\int_0^\infty \mathrm{sinc}'(xr) r \sqrt{E(r)} dr$$
where $E(r) = r^4 (\lambda\sqrt{\kappa^2+r^2})^{-\nu-5/2} K_{-\nu-5/2}(\lambda\sqrt{\kappa^2+...