# Tag Info

Accepted

### Which Runge-Kutta method is more accurate: Dormand-Prince or Cash-Karp?

Since I just finished optimizing a lot of them in software, DifferentialEquations.jl, I decided to just lay out a comparison of the main Order 4/5 methods. The Fehlberg method was left out because it'...
Accepted

### How can I avoid catastrophic cancellation?

Take \begin{align} 1-\sqrt{ 1-x^2} &= (1-\sqrt{ 1-x^2})\frac{1+\sqrt{ 1-x^2}}{1+\sqrt{ 1-x^2}}\\ &= \frac{x^2}{1+\sqrt{ 1-x^2}} \end{align} So \begin{align} y = x\sqrt{\frac{1}{2+2\sqrt{1-x^2}}...

### Matrix multiplication accuracy Matlab vs Python

First, see Mark L. Stone's answers, which is completely correct. Second, realize that this is the reason why people told you to use relative errors in your numerical analysis class. :) Third, the ...

### Practical example of why it is not good to invert a matrix

Here is a quick example which is very practical related to memory usage in PDEs. When one discretizes the Laplace operator, $\Delta u$, for example, in the Heat Equation $$u_t = \Delta u + f(t,u) .$$...
Accepted

### Whittaker-Shannon interpolation: Accuracy dies with speedup; can it be fixed?

I was able to reproduce the behavior reported in the question, and traced the observed inaccuracies to the following line: ...

### Matrix multiplication accuracy Matlab vs Python

Here is R1, as computed in MATLAB: ...
Accepted

### Accurate and efficient computation of the inverse Langevin function

The inverse Langevin function $\mathcal{L}^{-1}(x)$ is an odd function. Therefore one needs to consider only approximation on the interval $[0, 1]$; the negative half-plane is treated via symmetry ...
Accepted

### Practical example of why it is not good to invert a matrix

Normally there are some principal reasons to prefer solve a linear system respect to use the inverse. Briefly: problem with the conditional number (@GoHokies comment) problem in the sparse case (@...
Accepted

Accepted

### Fast and accurate double precision implementation of incomplete gamma function

The integral in question is also known as the Boys function, after the British chemist Samuel Francis Boys who introduced its use in the early 1950s. A few years ago, I needed to compute this function ...

### What is the best method of computing $a^{(k)}/k!$?

Njuffa already answered satisfactorily, but let me comment that dealing with large numbers does not cause loss of precision in floating-point arithmetic: the error is a relative one, corresponding to ...
Accepted

### Accuracy of finite differences

I think you probably already know all this, and maybe it's just the wording that is confusing. I'm going to rephrase what they're doing to make it more explicit. It's exactly the same calculation of ...

### Intuition for relative error for vectors

You are overthinking relative error in one-dimension, and I expect that is the source of your confusion. If I measure the length of an ant, and I am off by 1mm, its a big deal. However, if I were ...
Accepted

### General approach to infinite sums

Note the identity for the modified Bessel functions of the first kind, $e^z = I_0(z) + 2 \sum_{k=1}^{\infty} I_k(z)$ (Abramowitz and Stegun, Eq. 9.6.34, https://personal.math.ubc.ca/~cbm/aands/...
Accepted

### Adam Bashforth 4 method: how to determine starting values and stil keep the the order of accuracy

What you are looking for is called "bootstrapping". It is a common problem of all multistep ODE integrators and is discussed in many books on the topic. Among your options are to use a lower-order ...

### What is a good definition of "accuracy to N digits"?

Short version In scientific computing, the notion of relative error is way more popular than accuracy to $N$ digits. Whenever we present the results, we usually plot the obtained (scaled) data and ...
Accepted

### Does the IEEE-754 standard mandate that exp2 is rounded correctly?

According to : "However, the IEEE-754 standard specifies nothing for elementary functions" and "Indeed, the mathematical libraries (libm) provided by operating systems do not guarantee correct ...

Accepted

### When writing a research article, how to deal with deviations from theoretical expectations due to numerical errors?

If you have theoretical expectations for some observables of simulations, I see two general ways of dealing with them: You exploit them to get more accurate results, e.g., you make your algorithm use ...
Accepted

### Automatic finite differences

This is what Griewank et al. call "Piecewise linearization in secant mode", see for instance https://opus4.kobv.de/opus4-zib/files/6164/newton_secant_approx_paper.pdf. The aim of that ...

### How to find the optimum finite difference method for derivatives?

The choice of finite-difference scheme depends on several factors, such as the smoothness of your data, how uniformly-spaced the data actually is, etc. You may also want to consider just how accurate ...
Accepted

### Training accuracy improves but test set accuracy remains the same

I think you experience the implications of overtraining. From this question and this paper: Since a neural network with a sufficient number of neurons in the hidden layer can exactly implement an ...
I want to add that in addition to Carl Christian's suggestion of using a running error bound, you can also take the general relative error bound  \frac{|\hat p(x)-p(x)|}{|p(x)|} \leq \gamma_{2n}\,\...