Questions tagged [accuracy]

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

Filter by
Sorted by
Tagged with
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 ...
0 votes
1 answer
57 views

Oscillation in non-linear porous flow solved by finite difference

I am trying to solve numerically the flow of a gas through a porous, spherically symmetric body. The non-dimensional equations read: $$ \frac{\partial\rho}{\partial t}+\tau\frac{1}{r^2}\frac{\partial}{...
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 ...
0 votes
0 answers
44 views

B-spline abscissa values for numerical stability

I am working with spline functions using the B-spline basis, $$ f(x) = \sum_{i=1}^n c_i B_i(x;\mathbf{t}) $$ where the $B_i$ are cubic B-splines with a knot vector $\mathbf{t}$. For my application, ...
1 vote
2 answers
312 views

What is the rationale of second-order finite volume discretization?

When it comes to a second-order accurate finite volume discretization of Navier-Stokes equations, which one of the two following rationales is adopted? 1- Second-order accuracy is a direct consequence ...
0 votes
1 answer
159 views

How to correctly plot Order of accuracy for different finite difference schemes

I have implemented Upwind, Lax, Lax-Wendroff, Leapfrog and macCormak method for the linear advection equation with Dirichlet boundary conditions. I am trying to create the order of accuracy plots for ...
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.
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 ...
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\...
0 votes
1 answer
1k views

Intuition for relative error for vectors

I'm trying to understand the notion of relative error for vectors in $\mathbb{R}^n$, but it's not "clicking" somehow. $$\operatorname{\varepsilon-rel}(x_\text{approx}, x) = \frac{||x_\text{...
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 ...
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 ...
1 vote
0 answers
112 views

Comparison between stability and accuracy of various Finite Difference schemes

I`m Analyzing the 1D convection equation (PDE) for stability, consistency, and accuracy. I know Both upwind schemes (explicit and implicit) show better stability with a higher number of waves for ...
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 ...
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+\...
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}}$ ...
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 ...
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}...
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 ...
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 ...
0 votes
1 answer
63 views

Training accuracy improves but test set accuracy remains the same

I have built an ANN model with 5 hidden layers and 100 nodes in each layer to solve a multilabel classification problem. After the first run, I get a training accuracy of ~66% and a test set accuracy ...
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 ...
0 votes
0 answers
21 views

Cost functions to judge time/memory/accuracy tradeoffs

I am working on an interesting algorithm: Its absolute error is exponential in a parameter $j \in \mathbb{N}$, and for a given $j$, I have complete freedom to choose between an $\mathcal{O}(1)$ time-...
1 vote
1 answer
149 views

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

I am using an Adam Bashforth 4 method to solve an IVP problem so I need other numerical method to estimate the first 3 values. I am very much interested in finding a way to estimate the first 3 values ...
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 ...
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 ...
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 ...
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: ...
1 vote
0 answers
57 views

Decrease in slope during convergence analysis

I am using the method of manufactured solutions to perform the order of accuracy testing. I am using a cube for the testing. The cube is size 1m on all sides. I used 5 refinements: $dx = dy = dz = ...
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}\...
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 ...
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 ...
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 ...
1 vote
1 answer
182 views

Debugging an implemented numerical method: which term gives the drop in accuracy?

I have a numerical scheme to solve an hyperbolic system of equations of this type (this a more simple version just for clarity): $$\frac{\partial u}{\partial t}+u\frac{\partial u}{\partial x}+v\frac{\...
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 ...
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$ ...
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 ...
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/...
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 :) ...
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 ...
0 votes
2 answers
80 views

Accuracy between ill-conditioned matrix-free vs. matrix-based operators

As far as I know, precision errors become larger as the condition number of a matrix increases. Consider a matrix-based operator: $$A = \nabla \bullet k \nabla $$ And a matrix-free operator: $$\...
0 votes
1 answer
109 views

2nd order accurate finite difference method variable material properties near boundary

I'm aware that a 2nd order accurate finite-difference method using variable properties for central differencing can be written in a finite-volume type way: $$ \nabla \bullet (k \nabla f) = \frac{\...
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)\...
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 ...
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 ...
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 ...
0 votes
1 answer
848 views

Order of accuracy of DGFEM or FEM

I know that it is possible to determine the theoretical order of accuracy (B) of numerical solutions in FVM (for instance for a steady problem in which only the central differencing scheme (CDS) is ...
0 votes
0 answers
53 views

Order of accuracy of linearised vs non-linear system

Does the order of accuracy of a combination of schemes applied to solve a system of non-linear equations, match those of the same schemes applied to the linearised version of the system? In other ...
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: $$ ...
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 ...