Questions tagged [accuracy]

For questions about characterizing or improving the accuracy of a computational method.

Filter by
Sorted by
Tagged with
25 votes
5 answers
773 views

Is there software that can autogenerate numerically-accurate floating point C routines from symbolic formulae?

Given a real function of real variables, is there software available that can automatically generate numerically-accurate code to calculate the function over all inputs on a machine equipped with IEEE ...
Daniel Trebbien's user avatar
24 votes
4 answers
2k views

When is a high order method useful for computational fluid dynamics simulations?

Many numerical approaches to CFD can be extended to arbitrarily high order (for instance, discontinuous Galerkin methods, WENO methods, spectral differencing, etc.). How should I choose an ...
David Ketcheson's user avatar
19 votes
2 answers
3k views

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

I am aware about that inverting a matrix to solve a linear system is not a good idea, since it is not as accurate and as efficient as directly solving the system or using LU, Cholesky or QR ...
Manu's user avatar
  • 449
17 votes
1 answer
3k views

How can I avoid catastrophic cancellation?

I have the following formula that I need to rewrite in order to avoid catastrophic cancellation. $$y =\sqrt{\frac{1}{2}\left(1-\sqrt{1-x^{2}}\right)}$$ As $x$ becomes smaller, $\sqrt{1-x^{2}}$ ...
Tim's user avatar
  • 273
13 votes
2 answers
8k views

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

I simply want to know whether the Dormand-Prince Numerical Method or the Cash-Karp Numerical Method is more accurate.
ABBC's user avatar
  • 233
11 votes
1 answer
305 views

Are there Improved ways of computing $p \log(p)$?

Most math libraries have a number of versions of logarithm functions. Most of the time we assume them to be perfect, but actually quite a lot of them just offer a certain number of digits of precision....
Has QUIT--Anony-Mousse's user avatar
11 votes
2 answers
2k views

How do you improve the accuracy of a finite difference method for finding the eigensystem of a singular linear ODE

I am attempting to solve an equation of the type: $ \left( -\tfrac{\partial^2}{\partial x^2} - f\left(x\right) \right) \psi(x) = \lambda \psi(x) $ Where $f(x)$ has a simple pole at $0$, for the ...
Andrew Spott's user avatar
  • 1,155
10 votes
4 answers
4k views

Fast and accurate double precision implementation of incomplete gamma function

What is the state of the art way of implementing double precision special functions? I need the following integral: $$ F_m(t) = \int_0^1 u^{2m} e^{-tu^2} d u = {\gamma(m+{1\over 2}, t)\...
Ondřej Čertík's user avatar
10 votes
2 answers
2k views

Are 8 Gauss points required for second order hexahedral finite elements?

Is it possible to get second order accuracy for hexahedral finite elements with fewer than 8 Gauss points without introducing unphysical modes? A single central Gauss point introduces an unphysical ...
Geoffrey Irving's user avatar
9 votes
2 answers
2k views

numerical integration with possible division by 'zero'

I am trying to integrate $$\int^1_0 t^{2n+2}\exp\left({\frac{\alpha r_0}{t}}\right)dt$$ which is a simple transformation of $$\int^{\infty}_1 x^{2n}\exp(-\alpha r_0 x)dx$$ using $t = \frac1{x}$ ...
drjrm3's user avatar
  • 2,119
9 votes
0 answers
516 views

Updating matrix diagonal with Woodbury matrix identity and maintaining numerical accuracy

I have a dense matrix A and its corresponding inverse $A^{-1}$. The Woodbury matrix identity states: $$ (A + UCV)^{-1} = A^{-1} - A^{-1}U(C^{-1} + VA^{-1}U)^{-1}VA^{-1} $$ I wish to perform small ...
Costis's user avatar
  • 1,320
8 votes
1 answer
632 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,825
8 votes
1 answer
739 views

Demonstrating that the time step size is small enough in a code with automatic step size selection

I recently inherited a large body of legacy code that solves a very stiff, transient problem. I would like to demonstrate that the spatial and temporal step sizes are small enough that the ...
Godric Seer's user avatar
  • 4,617
7 votes
1 answer
591 views

What is the numerical difference between abs(z)^2 and z x z*, where z is a complex number

I am doing research in electromagnetics (a branch of physics) and I deal with complex numbers in my computing tasks (I use MATLAB). Let's say $z$ is a complex number. To calculate the square of the ...
aesrth's user avatar
  • 73
7 votes
1 answer
353 views

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

Let's say I have two numbers $x$ and $y$ which I'd like to compare to see whether they are equal up to their first $N$ digits. For instance $ 1.002 \approx 1.001$ and $1002 \approx 1001$ up to 3 ...
user357269's user avatar
6 votes
2 answers
2k views

Matrix multiplication accuracy Matlab vs Python

I am translating some Matlab code into Python and I having some problems regarding matrix multiplication accuracy. Assuming we have following data: ...
Octavio Castillo's user avatar
6 votes
1 answer
273 views

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

With a truncated Whitaker-Shannon series (cardinal series) $$ f(t) = \sum_{j = 0}^{n-1} y_{j} \frac{\sin\left(\pi( \frac{t-t_0}{h} -j)\right)}{\pi\left(\frac{t-t_0}{h}-j\right)} $$ we can naively ...
user14717's user avatar
  • 2,125
6 votes
1 answer
246 views

Is it possible to proof a-b+b = a for all double floating-point numbers?

I want to know whether the equation : a-b+b = a is always true for a, b belongs to double precision floating-point number and |a|>=|b|. If the equation is true, how can I proof it? If not, what ...
Star's user avatar
  • 63
6 votes
1 answer
221 views

General approach to infinite sums

My question is specific to algorithms and models of computation. I would like to write code to evaluate the following expression quickly and accurately: $$\log \left( \sum_{i=1}^{\infty}{I_{\nu+i}(2\...
Lewkrr's user avatar
  • 163
6 votes
3 answers
177 views

Accurate evaluation of the sign of a polynomial

Let $p$ be a polynomial with floating-point coefficients and let $a$ be a floating-point value. Is there a method for accurately evaluating the sign of $p(a)$ in floating-point arithmetic? I don't ...
lhf's user avatar
  • 966
6 votes
1 answer
205 views

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

The IEEE Standard for Floating-Point Arithmetic section "9.2 Recommended correctly rounded functions" lists functions that are recommended (but not required) by a language standard to provide, among ...
Ondřej Čertík's user avatar
5 votes
2 answers
171 views

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

I have the following expression $$ \frac{a^{(k)}}{k!} $$ where $a^{(k)}$ is the rising factorial. Is it better to evaluate it using floating-point arithmetic separately, that is, call a function that ...
nougako's user avatar
  • 185
5 votes
1 answer
156 views

Accurate computation of Gauss-Kuzmin entropy

The Gauss-Kuzmin distribution gives the probability of an integer appearing as a partial denominator in the continued fraction of a real number $x$ as $$ P(a_k = k) = -\log_2\left(1 - \frac{1}{(k+1)^2}...
user14717's user avatar
  • 2,125
5 votes
1 answer
242 views

Accuracy of finite differences

I'm currently reading this paper, and I'm a bit confused about how they compute the accuracy of their algorithm. In the aforementioned paper, they investigate the regularized long-wave equation: $$ ...
Hunter's user avatar
  • 265
5 votes
3 answers
233 views

Automatic finite differences

Given numbers $x, y \in \mathbb{R}$ where $$\frac{|y-x|}{|x|}$$ is small, and code that implements the function $f$ with a sequence of arithmetic operations, I would like to compute to high accuracy ...
Federico Poloni's user avatar
5 votes
0 answers
709 views

Order of accuracy of FVM discretization

I've recently got interested in CFD and started a small project by solving the radial Reynoldsequation. Why the Reynoldsequation? I recently encountered it through my studies and somehow got stuck :) ...
Rover's user avatar
  • 128
5 votes
0 answers
84 views

Order of convergence of Scrodinger eq. with CN scheme

I'm trying to solve numerically the 1-dim time dependent Schrodinger equation using the Crank Nicolson scheme and the Thomas algorithm to solve the tridiagonal matrix. The physical system consists of ...
the_elder's user avatar
  • 151
4 votes
2 answers
595 views

Numerical differentiation of non-linear functions

In my efforts to write a code for a calculation I have encountered a problem of numerically differentiating a non-linear function at different points on a grid. I used the simple forward finite ...
user avatar
4 votes
2 answers
369 views

Intervals where the sign of a polynomial can be computed reliably

This is a follow-up of a previous question. Let $p$ be a polynomial with floating-point coefficients. Is there a method for finding intervals where evaluating $p$ in floating-point arithmetic always ...
lhf's user avatar
  • 966
4 votes
1 answer
386 views

Finite differences vs. elements: Accuracy and implementation

I am trying to solve the 2D Poisson equation numerically: $ \frac{\partial ^2 \phi}{\partial x^2} + \frac{\partial ^2 \phi}{\partial y^2} = 1 $ with the Dirichlet boundary condition $\phi = 0$. I ...
jan's user avatar
  • 41
4 votes
2 answers
627 views

Accuracy of numerical methods in finding eigenvalues

I have a problem with assesing the accuracy of my numerical calculation. I have a 2nd order ODE. It is an eigenvalue problem of the form: $$ y'' + ay' + \lambda^2y = 0, $$ and the boundary condiations ...
Glo's user avatar
  • 59
4 votes
0 answers
82 views

Numerical algorithms made stable by unums which are unstable on IEEE floats

For unums, there is good evidence (see figure 5) that accuracy is better than IEEE floats. (Note: I use the term "unum" broadly to refer to any of the various iterations and revisions to the ...
user14717's user avatar
  • 2,125
3 votes
1 answer
156 views

How to get a more accurate cancelation

I shall try to get to the point, so let me know if there is something left and you need more details. I am solving a couple of equations that are not coupled explicitly, but their corresponding ...
user avatar
3 votes
1 answer
270 views

How to find the optimum finite difference method for derivatives?

Related to: What are the negatives of using higher order finite diference schemes? Problem: I have some discrete data of a trajectory $x_t$ with errors $\delta x_t$ of a physical system sampled at ...
Puco4's user avatar
  • 131
3 votes
1 answer
6k views

Why a finite difference scheme would give second order of accuracy in norm L2 but 1.5 with L1 (while 1 with Linf)?

My finite difference scheme for the 2D Euler equations is second order accurate in theory, since all the terms are second order accurate, with the advective terms being third order. So I expect a rate ...
Millemila's user avatar
  • 435
3 votes
1 answer
196 views

Achieving high relative accuracy (vs. absolute accuracy) using spectral methods

Problem I have a PDE that I'm trying to solve with spectral methods. The solution $y$ is always positive, and decays as $y \propto e^{-ax}$ for large $x$. The domain is $[0, \infty)$. (There are ...
Josh Burkart's user avatar
3 votes
0 answers
159 views

Derivative of Whittaker-Shannon interpolant

Last time we looked at how to improve the accuracy of Whittaker-Shannon interpolation, where user njuffa demonstrated that judicious use of sin_pi could greatly ...
user14717's user avatar
  • 2,125
3 votes
0 answers
126 views

How can I evaluate the accuracy of my n-body simulation?

I am making an n-body simulation in python. There are many different methods to numerically solve the system of differential equations governing the gravitational interactions between the $n$ ...
math_lover's user avatar
3 votes
0 answers
242 views

Computing accuracy of my finite difference scheme for uniform grid on a non-uniform grid

I have a ADI finite difference scheme for the 2D Navier-Stokes equations that uses a second order accurate (central) approximation for the advective terms. I am ignoring the diffusive terms for now. I ...
Millemila's user avatar
  • 435
3 votes
1 answer
39 views

Known Algorithm to compute errors of given nature

I have three sets of data, measured by three different devices: A,B and C of air balloon whose fall is influenced by wind and ...
user59756's user avatar
  • 133
3 votes
0 answers
182 views

How to accurately decompose positive semidefinite matrix and use the lower triangular part in linear equations

I have $n$ arbitrary $p\times 1$ vectors $x_i$, and $p\times k$ matrices $A_i$, and $n$ $p \times p$ positive semidefinite matrices $S_i$, where some (often most) of the $S_i$'s are same (for example ...
Jouni's user avatar
  • 131
2 votes
1 answer
6k views

Correct way of computing norm $L_2$ for a finite difference scheme

I am computing the rate of convergence of my finite difference scheme in norm $L_2$. Which is the correct way to compute it? This: \begin{align} L_2 &= \frac{1}{N}\sqrt{\sum_{j=1}^N(u^{...
Millemila's user avatar
  • 435
2 votes
1 answer
134 views

Accuracy gap for apparently stable solution

I was reasoning about the behaviour of the methods I'm using for my simulation and I noticed that, considering $h_s$ as the timestep over which I have unstable solutions and $h_a$ as the timestep ...
Zebx's user avatar
  • 101
2 votes
1 answer
99 views

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

We research the aerodynamics of the vehicle. Usually, there exists turbulence, which will cause the time-varying measurement of the force. The unsteady flow field determines we could not get a ...
PureLine's user avatar
  • 123
2 votes
3 answers
284 views

Compute accuracy order as mesh gets refined?

I have implemented a FVM code and now I need to plot the accuracy of the method as the mesh gets refined. Having a very fine mesh, my idea is to compare what is the error between the coarser and fine ...
BRabbit27's user avatar
  • 1,019
2 votes
2 answers
199 views

Accelerating convergence of a generalized continued fraction

I wish to compute $$ \frac{1}{1 + \frac{1^3}{1 + \frac{2^3}{1 + \frac{3^3}{1+\cdots} } } } $$ to high accuracy. To start, I tried computing $$ \frac{1}{1 + \frac{1^2}{1 + \frac{2^2}{1 + \frac{3^2}{1+\...
user14717's user avatar
  • 2,125
2 votes
2 answers
558 views

Precision loss in Matrix-Vector product when applying Finite-Difference scheme

I am applying a 6th order Finite-Difference differentiation scheme as seen in http://www.scholarpedia.org/article/Method_of_lines/example_implementation/dss006 There seems to be severe numerical/...
Dr Krishnakumar Gopalakrishnan's user avatar
2 votes
1 answer
294 views

Order of Accuracy Measurements on 1D Advection Methods

I am trying to learn about basics of computational fluid dynamics, at the moment on the simple example of linear advection in 1D. I am am currently testing the theoretical predictions of the order of ...
mivkov's user avatar
  • 203
2 votes
1 answer
258 views

Computational Fluid Dynamics: Question on a third-order accurate finite difference approximation

According to this paper the following finite difference approximation is third-order accurate: $$\frac{d\rho_j}{dx}\approx\frac{2-\eta}{3}\frac{\rho_{j+1/2}-\rho_{j-1/2}}{\Delta x}+\frac{1+\eta}{3}\...
Peanutlex's user avatar
  • 219
2 votes
0 answers
52 views

Quick evaluation of floating point Absolute Error

I need to to find a quick and dirty way to estimate the absolute error introduced by a series of agebraic operations of IEEE single precision floating point numbers, a pessimistic result is ok. The ...
Francesco Gianni's user avatar