Skip to main content

Questions tagged [special-functions]

For questions about evaluating or implementing special functions, e.g. Bessel, hypergeometric, gamma, Lambert W.

Filter by
Sorted by
Tagged with
2 votes
0 answers
62 views

Hyperbolic integral of the second kind

The elliptic integral of the second kind is given by $$ E(t,m) = \int_{0}^t \sqrt{1-m \sin(s)^2} \operatorname{ds} $$ and there is for instance a scipy function ellipeinc that computes it. The ...
Strichcoder's user avatar
1 vote
1 answer
121 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 ...
user3236841's user avatar
-1 votes
1 answer
142 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 ...
LEO PHYSICS's user avatar
3 votes
1 answer
200 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 ...
user14717's user avatar
  • 2,155
3 votes
1 answer
319 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 ...
uhoh's user avatar
  • 1,048
3 votes
1 answer
85 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(\...
Emilio Pisanty's user avatar
3 votes
3 answers
368 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 ...
JoséM's user avatar
  • 53
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 ...
user avatar
4 votes
2 answers
557 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(\...
user157765's user avatar
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(\...
bambi's user avatar
  • 119
2 votes
1 answer
516 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 ...
Andreas Schuldei's user avatar
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 ...
bambi's user avatar
  • 119
2 votes
0 answers
52 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 ...
Hans's user avatar
  • 121
1 vote
3 answers
289 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 ...
bambi's user avatar
  • 119
2 votes
1 answer
833 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$$ ...
Student146's user avatar
1 vote
0 answers
721 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 $...
David's user avatar
  • 21
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 ...
Oliver's user avatar
  • 111
3 votes
2 answers
768 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 ...
Manas Dogra's user avatar
0 votes
2 answers
117 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: ...
user357269's user avatar
0 votes
2 answers
329 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 ...
CTMacUser's user avatar
  • 109
3 votes
1 answer
131 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 ...
Emilio Pisanty's user avatar
5 votes
0 answers
178 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 ...
interoception's user avatar
8 votes
1 answer
470 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 ...
uhoh's user avatar
  • 1,048
8 votes
1 answer
680 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 ...
njuffa's user avatar
  • 1,865
2 votes
2 answers
791 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 ...
Kamran Salehi Vaziri's user avatar
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'$ ...
Dipole's user avatar
  • 873
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:...
user88484's user avatar
  • 121
0 votes
1 answer
252 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 ...
Amir Sagiv's user avatar
1 vote
1 answer
368 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 (...
Amir Sagiv's user avatar
6 votes
1 answer
263 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 ...
Eric Kightley's user avatar
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} ...
Pine Tree's user avatar
4 votes
1 answer
250 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, ...
jitter's user avatar
  • 155
10 votes
0 answers
338 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 ...
H A Helfgott's user avatar
6 votes
1 answer
118 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) ...
gammatester's user avatar
4 votes
2 answers
578 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 ...
user123's user avatar
  • 679
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 ...
Silverwhale's user avatar
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: ...
Alex's user avatar
  • 33
4 votes
1 answer
168 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 ...
David Zhang's user avatar
4 votes
2 answers
503 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, ...
cevertje400's user avatar
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 ...
a06e's user avatar
  • 1,729
6 votes
1 answer
693 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 ...
Victor Buendía's user avatar
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. ...
Ruslan's user avatar
  • 204
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 ...
hardmath's user avatar
  • 3,359
3 votes
2 answers
572 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 ...
sebastian_g's user avatar
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}(\...
a06e's user avatar
  • 1,729
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 &...
a06e's user avatar
  • 1,729
4 votes
1 answer
210 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&...
a06e's user avatar
  • 1,729
2 votes
1 answer
505 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.
a06e's user avatar
  • 1,729
8 votes
1 answer
203 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{...
jtravs's user avatar
  • 81
8 votes
1 answer
972 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 ...
rivendell's user avatar
  • 365