Questions tagged [numerics]

616 questions
8
votes
2 answers

Compute powers close to zero

What is a simple way to compute $10^x - 1$, where $x$ is close to zero? Using exponentiation and then subtraction isn't good enough, because the fractional part is very small compared to the one that we subtract away.
Tom V
  • 83
  • 2
7
votes
1 answer

evaluating $\coth(x) - 1/x$ for real $x$, on 2 "pieces"

The function $\coth(x) - 1/x$ has a removable singularity at 0. Its Taylor series is: $$ \coth(x) - 1/x = \frac{x}{3} - \frac{x^3}{45} + \frac{2x^5}{945} + \ldots $$ I would like to evaluate the first 3 terms of the Taylor series for $|x| \le…
Glenn Davis
  • 255
  • 1
  • 5
5
votes
1 answer

Scheme to alleviate (numerical?) instability in system of coupled nonlinear ODEs

I'm solving a system of nonlinear ODEs that take the form $Q_{nm} \ddot{y}_m + S_{nkl}\dot{y}_k\dot{y}_l +V_n = 0$ where Einstein summation is assumed, $y_i$ are the dependent (complex) variables, $Q_{nm}$,$S_{nkl}$ and $V_n$ are all low order…
Nick P
  • 385
  • 1
  • 7
3
votes
1 answer

Numerical calculation sum of exponential functions

I have to repeatedly calculate a function which contains a sum of a large number (~100) of exponential terms: $f(x) = \sum_{r=1}^{100} C_r e^{b_r \cdot x}$ There is no relation between the $C_r$ and $b_r$ (i.e. something like $C_{r+1}$ = 2…
KMee
  • 41
  • 2
3
votes
2 answers

C# implementation of the gamma function that produces correct answers at positive integer inputs?

I need a C# implementation of the gamma function that produces correct exact answers at positive integer inputs. I took a look at MathNet.Numerics Meta.Numerics. In both cases, if you calculate something like gamma(5)-4!, evaluating the latter by…
2
votes
1 answer

Computing Series of $ke^{-(x - h)^2}$

I asked this question on the Computer Science stack exchange (https://cs.stackexchange.com/questions/128710/faster-computation-of-ke-x-h2), but it appears that it is more appropriate in Computational Science stack. Essentially, I want to compute…
2
votes
0 answers

Computing Multivariate Cumulative Normal Distribution

I am trying to compute the CDF of a Multivariate Cumulative Normal Distribution in the 1000th dimension (I have a 1000 vectors and their covariance matrix). I haven't been able to find a fast way to compute this, numpy and scipy all take take too…
lee
  • 121
  • 1
1
vote
0 answers

Stability of 4-bit matrix multiplication

To use newer accelerators like this, I need to perform matmul in 4-bit precision. How do I tell whether this operation is stable? Wondering if there well common heuristics in terms of properties of matrices $\{A_i\}$. For classification tasks,…
Yaroslav Bulatov
  • 2,655
  • 11
  • 23
1
vote
1 answer

How can you calculate catastrophic cancellation error?

I'm trying to follow the wikipedia page about catastrophic cancellation but I've hit something that just doesn't make sense to me. They say that subtraction can amplify existing approximation errors (by making relative error of the difference much…
profPlum
  • 149
  • 6
1
vote
0 answers

Scheme Solving CCZ4 Formalism Numerically

For my thesis, I have to implement the CCZ4 formalism into an existing code (I tried to type the evolution equations here but does not seem to work). However, I can't seem to come up with a scheme to solve these equations. For instance, here, the…
Kabouter9
  • 111
  • 2
1
vote
0 answers

How to calculate a product of two real functions of large, but opposite magnitude?

I need to evaluate a product of two real functions, namely $F(x)\cdot G(x)$. The function $F(x)$ is a diverging and obscure member of scipy.special, while $G(x)$ is a gaussian. While the product is a well behaved function and of order ~1, its…
1
vote
0 answers

Solving two field Schrodinger-Poisson system numerically

I want to solve the system of Schrodinger-Poisson equations numerically: \begin{align} \chi_1''(r) + \frac{2}{r}\chi_1'(r)&=2U(r)\chi_1(r) \\ \chi_2''(r) + \frac{2}{r}\chi_2'(r)&=2\left(\frac{m_2}{m_1}\right)^2U(r)\chi_2(r) \\ U''(r)+…
1
vote
1 answer

Dirichlet to Neumann Operator

EDIT: I am trying to specify my Question. Also I am not going to clearify which spaces I use, because I am only interested in the basic idea. I am looking at a standard elliptic second order PDE: \begin{cases} Lu & = f & \text{in} &\Omega \\ \quad…
user29088
1
vote
1 answer

Accurate way for computing a ratio coming from Monte Carlo simulation

I am seeking recommendations on how to compute the Binder ratio numerically accurate when doing Monte Carlo simulation on spin models. Binder ratio is defined as: $$ B = \frac{\langle M^4\rangle}{\langle M^2\rangle^2}. $$ Given a safe method to…
1
vote
1 answer

replace non-smooth discrete values with analytical function

I do have a Diffusion coefficient in a convection diffusion PDE which is discontinuous and looks like (concentration on the x-Axis): For numerical reasons i use the integrated form: I calculate the functions in beforehand and during my…
Moritz
  • 343
  • 1
  • 13
1
2