Questions tagged [special-functions]
For questions about evaluating or implementing special functions, e.g. Bessel, hypergeometric, gamma, Lambert W.
62
questions
1
vote
1
answer
116
views
Calculating Hypergeometric1F1 for large arguments
Cross posted on StackOverflow
I am trying to use the gsl library for calculating 1F1. I have some C code.
The following works and matches Mathematica's results for ...
-1
votes
1
answer
125
views
Solving Transcendental equation involving special functions becoming nightmare any one can help?
Simply i want to solve for schrodinger equation for finite potential well problems in spherical coordinates. For case in which l=0 . It is simple but when l changes. The solution are spherical ...
2
votes
1
answer
191
views
Numerical evaluation of Fourier transform of a scaling function
Given a set of filter taps $\{h_n\}_{n=0}^{m-1}$, define a scaling function $\phi$ by $$\phi(x) = \sqrt{2}\sum_{n} h_n \phi(2x-n).$$
In keeping with the notation from Daubechies "Ten Lectures on ...
3
votes
1
answer
272
views
What problems does softmax() solve and when should I think of using it - in simple terms
I just for the first time saw the function softmax() in this SO answer to How do I use a minimization function in scipy with constraints and was intrigued.
Another way of weighting variables where ...
3
votes
1
answer
84
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
314
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
91
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
478
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
160
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(\...
2
votes
1
answer
467
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
76
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
51
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 ...
1
vote
3
answers
285
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
777
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
714
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
118
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 ...
3
votes
2
answers
680
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
111
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
318
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
124
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
176
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
461
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
635
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
771
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
1
answer
3k
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][1].
EDITED:...
0
votes
1
answer
242
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
361
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
256
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
114
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
243
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
333
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
117
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
563
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
2k
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
164
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
486
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
669
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 ...
9
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
571
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
69
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
209
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
490
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
201
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
953
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
127
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 ...