Questions tagged [numerical-analysis]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
19
votes
2answers
2k views

Computing inverse matrix when an element changes

Given an $n \times n$ matrix $\mathbf{A}$. Let the inverse matrix of $\mathbf{A}$ be $\mathbf{A}^{-1}$ (that is, $\mathbf{A}\mathbf{A}^{-1} = \mathbf{I}$). Assume that one element in $\mathbf{A}$ is ...
14
votes
5answers
3k views

Is 2**x faster to compute than exp(x)?

Forgive the naïveté that will be obvious in the way I ask this question as well as the fact that I'm asking it. Mathematicians typically use $\exp$ as it's the simplest/nicest base in ...
13
votes
1answer
773 views

Overflow safe summation

Suppose I am given $n$ fixed width integers (i.e. they fit in a register of width $w$), $a_1, a_2, \dots a_n$ such that their sum $a_1 + a_2 + \dots + a_n = S$ also fits in a register of width $w$. ...
13
votes
1answer
454 views

Floating point rounding

Can an IEEE-754 floating point number < 1 (i.e. generated with a random number generator which generates a number >= 0.0 and < 1.0) ever be multiplied by some integer (in floating point form) to ...
11
votes
0answers
1k views

Alternatives to SVD for rank factorization

I have rank-deficient matrix $M \in \mathbb{R}^{n\times m}$ with $\text{rank}(M) = k$ and I want to find a rank factorization $M = PQ$ with $P \in \mathbb{R}^{n \times k}$ and $Q \in \mathbb{R}^{k \...
9
votes
0answers
1k views

Does Automatic Differentiation handle conditional branches, if yes how?

I'm trying to understand how Automatic Differentiation (AD) works. For simple algebraic operation, I get the chain rule thing. But, when the code contains conditional statement like ...
8
votes
2answers
683 views

Detecting overflow in summation

Suppose I am given an array of $n$ fixed width integers (i.e. they fit in a register of width $w$), $a_1, a_2, \dots a_n$. I want to compute the sum $S = a_1 + \ldots + a_n$ on a machine with 2's ...
8
votes
2answers
800 views

Is “ternary search” an appropriate term for the algorithm that optimizes a unimodal function on a real interval?

Suppose that I want to optimize a unimodal function defined on some real interval. I can use the well-known algorithm as described in Wikipedia under the name of ternary search. In case of the ...
7
votes
2answers
135 views

numerical integral vs counting roots

I have a problem that can be viewed in two different ways: Compute an $n$-dimensional integral, numerical context. The domain of integration is an $n$-dimensional hyper-cube of side $L$. Count (just ...
6
votes
1answer
742 views

Reception of numerical infinities

A group of computer scientists associated with numerical analyst Yaroslav Sergeyev have published numerous publications recently on a scheme proposed by Sergeyev that uses terms like Infinity Computer,...
5
votes
3answers
2k views

Why is computation of this function numerically unstable? [closed]

Why is computing the function at certain ranges of h $$f(x) = \dfrac{\sqrt{-x+a} - \sqrt{2x+a}}{ 4a}$$ unstable? How would I rewrite this function so that it is stable?
5
votes
5answers
317 views

fast and stable x * tanh(log1pexp(x)) computation

$$f(x) = x \tanh(\log(1 + e^x))$$ The function (mish activation) can be easily implemented using a stable log1pexp without any significant loss of precision. Unfortunately, this is computationally ...
5
votes
2answers
270 views

Big O notation: removing big O from denominator

In A First Course in the Numerical Analysis of Differential Equations (page 26) Arieh Iserles gives the following derivation: \begin{equation} \frac{\rho(w)}{\ln(w)}=\frac{\xi+\xi^2}{\xi-\frac{1}{2}\...
5
votes
1answer
707 views

Fast Poisson quantile computation

I am seeking a fast algorithm to compute the following function, a quantile of the Poisson distribution: $$f(n, \lambda) = e^{-\lambda} \sum_{k=0}^{n} \frac{\lambda^k}{k!} $$ I can think of an ...
5
votes
4answers
417 views

Is order of matrix multiplication affecting numerical accuracy of the result?

I have to multiply three matrices of floats: A (100x8000), B (8000x27) and C (27x1). Is ...
5
votes
0answers
60 views

Testing whether an analytic function vanishes identically

I have an application that basically reduces to testing whether a given function vanishes identically. The function is given symbolically, using unary and binary operators on complex numbers. For ...
5
votes
0answers
707 views

Arc-Length parameterization of a cubic bezier curve

I like to implement an arc-length Parameterization of a cubic bezier curve. So far I have implemented the method of calculating the arc length of the curve and now I'm stuck at calculating the times ...
4
votes
2answers
109 views

“Compressing” rationals given error bounds

I'm working on implementing some exact real arithmetic operations for fun. I've got the rough outline of how I want to do things as well and have figured out how to write most of the important ...
4
votes
2answers
475 views

Proof that (x-y)(x+y) is more accurate than x²-y²

I was carrying on my reading of What Every Computer Scientist Should Know About Floating-Point Arithmetic but got stuck on the proof of Theorem 2 (page 34). At some point it says: \begin{align} (x \...
4
votes
1answer
99 views

A good-enough version of good-enough? When should I stop iterating?

I am studying Abelson and Sussman's Structure and Interpretation of Computer Programs, 2/e. I solved the exercise 1.7, which asks for a better stopping criteria for an iterative function to calculate ...
3
votes
1answer
480 views

The stability of log(1+x)

I am trying to understand why the formula $$ \frac{\log(1+x)}{(1+x)-1} \times x,$$ which simply reduces down to $\log(1+x)$, is considered as more stable to compute than $\log(1+x)$. In my head it ...
3
votes
2answers
92 views

How can I compute logarithm when comparison is undecidable?

In Haskell, I have the following datatypes that encodes arbitrary real numbers and arbitrary complex numbers, respectively: ...
3
votes
1answer
83 views

Do formulas involving fewer repetitions of variables give higher numerical precision?

I'm having some trouble doing SICP exercise 2.15. Please note that this question is not closed related to Lisp. Instead, it's closely related to numerical analysis. Exercise 2.15. Eva Lu Ator, ...
3
votes
2answers
118 views

How much can we trust mathematical software when working with large numbers, and how much memory it needs to work with these numbers?

For example, I want to evaluate the expression: $3^{3^{{3}^{3}}}$ so I used wolframalpha.com (it's free, and I don't own any software), which returned the scientific notation of the number above, ...
3
votes
1answer
252 views

Robust two lines/segments intersection point in 2D

Given two line segments the problem is to find an intersection point of corresponding lines (assuming that they are not parallel or coincide). There is a Wikipedia article which gives us exact ...
3
votes
1answer
29 views

Rigorous error bounds for eigenvalue solvers

I computed the first four eigenvalues of a quite large ($2^{24}\times 2^{24}$) but very sparse matrix. I used pythons in-build function sparse.linalg.eigsh to compute them. I need a validation that ...
3
votes
1answer
134 views

An argument for error accumulation during complex DFT

I am doing FFT-based multiplication of polynomials with integer coefficients (long integers, in fact). The coefficients have a maximum value of $BASE-1, \quad BASE \in \mathbb{n},\quad BASE > 1$. ...
3
votes
1answer
194 views

Understanding truncation and rounding error in IEEE floating point system?

I'm trying to understand the theory behind finding the optimal $h$ value for differentiation in this definition: $$ \frac{f(x+h) - f(x)}{h}$$ as $h$ tends to 0. Here is my understanding: ...
3
votes
0answers
282 views

Stable and fast computation of the squared euclidean distance matrix

Let's say I want to compute the matrix $M$ of the squared euclidean distances between each pair of vectors $(x, y)$ belonging to two sets $X$ and $Y$ respectively. The sets of vectors $X$ and $Y$ have ...
3
votes
0answers
383 views

Cyclic coordinate method: how does it differ from Hook & Jeeves and Rosenbrock?

I have trouble understanding the cyclic coordinate method. How does it differ with the Hook and Jeeves method and the Rosenbrock method? From a past exam text: Describe the cyclic coordinate ...
2
votes
3answers
260 views

Gap between numbers in fixed-point vs. floating point arithmetic

If $r$ is a machine-representable number and $f(r)$ is the next larger machine representable number, are the following true or false? In fixed-point arithmetic, the distance between $r$ and $f(r)$ is ...
2
votes
1answer
505 views

Will floating point code return the same arithmetical results on two different computers?

Say I am using boost or the built-in float or double mathematical libraries of my C++ compiler. I distribute the program. Will the execution of my C++ program on different machines given different ...
2
votes
1answer
182 views

numerically stable log1pexp calculation

What are good approximations for computing log1pexp for single precision and double precision floating point numbers? Note: ...
2
votes
1answer
767 views

Avoiding overflows while computing $e^x$ by Taylor series

I'm coding a program to calculate the value of $e^x$ by using the Taylor expansion, that is: $$ e^x =\sum_{k=0}^\infty \frac{x^k}{k!} $$ ...
2
votes
1answer
47 views

Avoiding overflow in computing the ratio of two large numbers

Is there a trick for computing the expression $x + (exp(x)-x)/(exp(2*x) + 1)$ while avoiding an overflow? Currently, computation seems to fail for any $x \geq 710$, presumably because computing $exp(...
2
votes
2answers
2k views

How to estimate floating-point precision of function?

Let's say I have a function that consists solely of floating-point operations where the last operation rounds the computed value to a predefined number of digits. And I feed this function with a range ...
2
votes
1answer
60 views

Converge to unknown number with oracle

I'm playing a game where I'm trying to estimate an unknown real number $x$. An oracle exists that will answer the question of "Is a number $y$ greater than or equal to $x$?", to which the oracle will ...
2
votes
1answer
109 views

Why aren't Grobner bases more common?

I have only heard of / seen Grobner bases in passing, but my understanding is that they are much like vector bases but for polynomials instead of linear systems. I know polynomials are used in CAD and ...
2
votes
1answer
257 views

Numerical issues in solving linear systems

There was an exam in the class. The course is "High Performance Scientific Computing". One of the question in the exam is as follows: Consider the linear system $$ \begin{bmatrix} a & b ...
2
votes
1answer
72 views

Proof that a guard digit bound the error of subtraction

I was reading What Every Computer Scientist Should Know About Floating-Point Arithmetic, which is extremely interesting. But I have some troubles understanding the proof of Theorem 9 (page 33). First ...
2
votes
1answer
192 views

Generating Pairs of Random Numbers

Please consider the following probability density function of two variables. \begin{eqnarray*} f(x_1,x_2) &=& \begin{cases} 2(x_1+x_2) & \text{for} \,\, 0 \le x_1 \le x_2 \le 1\\ 0 ...
2
votes
2answers
334 views

$e^{-5}$ error using Taylor's series

I am a student and I was reading Numerical Analysis by Burden. In one of the exercises, I have to calculate $e^{-5}$ in two ways. The first is using the Taylor's series for $x=-5$, $( e^{-5} = 1 - 5/...
2
votes
1answer
1k views

Difference between order of convergence and order of consistency?

I understand that, as the time step is reduced: Consistency: The local error must approach zero. Convergence: The global error must approach zero. But why are both the order of convergence and ...
2
votes
1answer
271 views

What are the drawbacks of using an algorithm that is not backwards stable?

(This question might be legitimately crossposted to stackoverflow or mathoverflow or programming StackExchanges.) Preface I'm reading this paper on solving linear systems of equations ...
2
votes
0answers
113 views

Avoiding loss of significance without series expansion

I have a problem on an assignment where I have to reduce the loss of significance due to subtraction for a function $$\frac{\sin(x)}{x-\sqrt{x^2-1}}$$ without using a series expansion. I can get ...
2
votes
0answers
67 views

0 error interpolation for discrete finite value points

I am working on an algorithm that requires me to interpolate a couple trillion positive discrete points with f(x) having low finite value (for example 0 - 5). It there a specialized algorithm specific ...
1
vote
1answer
53 views

Why do I get different results from two calculation methods?

I am wondering what the reason for the following is We know that , exponential has a taylor representation : $$exp(x)=1+x+\frac{x^{2}}{2!}+\frac{x^{3}}{3!}+...$$ Using the first n terms , in R , ...
1
vote
1answer
33 views

What is the machine epsilon and number of mantissa bits for TI-83?

I am trying to determine how many bits the TI-83 Plus uses to store floating point numbers. I am using the algorithm for approximating the machine epsilon given in "Numerical Mathematics and ...
1
vote
1answer
59 views

Cancellation in C++

I am trying to figure out what the problem with the following expression in C++ is: y=std::log(std::cosh(x)); My first intention was that there might occure a ...
1
vote
1answer
453 views

Which method for ODE instead of Euler's?

I need a super-fast method for ordinary differential equations. Should I use the midpoint method? I need this for a reaction-diffusion system (Gray-Scott).