Questions tagged [accuracy]

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

Filter by
Sorted by
Tagged with
0 votes
1 answer
56 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}{...
MaximeMaurice'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
0 votes
0 answers
43 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, ...
vibe's user avatar
  • 1,038
0 votes
1 answer
143 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 ...
nyaki's user avatar
  • 1
4 votes
0 answers
81 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
6 votes
1 answer
210 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
0 votes
1 answer
895 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{...
user357269's user avatar
1 vote
2 answers
297 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 ...
Naghi's user avatar
  • 235
3 votes
1 answer
237 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
5 votes
3 answers
226 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
1 vote
0 answers
94 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 ...
Abdelrahman Mabrouk's user avatar
2 votes
1 answer
132 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
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
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
2 votes
2 answers
194 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
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
2 votes
1 answer
283 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
3 votes
0 answers
155 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
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 ...
Chayan Chatterjee's user avatar
6 votes
1 answer
269 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
0 votes
0 answers
20 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-...
user14717's user avatar
  • 2,125
1 vote
1 answer
147 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 ...
k.dkhk's user avatar
  • 255
8 votes
1 answer
602 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,755
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
6 votes
1 answer
245 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
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
1 vote
0 answers
56 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 = ...
user27504's user avatar
  • 321
2 votes
1 answer
227 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
7 votes
1 answer
341 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
1 answer
198 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
4 votes
2 answers
353 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
6 votes
3 answers
176 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
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
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
18 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
  • 439
2 votes
2 answers
553 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
5 votes
0 answers
702 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
4 votes
2 answers
583 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
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: $$\...
Charles's user avatar
  • 609
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{\...
Charles's user avatar
  • 609
12 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
  • 223
3 votes
1 answer
194 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
0 votes
1 answer
826 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 ...
melody's user avatar
  • 301
0 votes
0 answers
51 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 ...
melody's user avatar
  • 301
4 votes
2 answers
621 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
5 votes
1 answer
239 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
1 vote
1 answer
181 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{\...
Millemila's user avatar
  • 435
7 votes
1 answer
586 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
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
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