Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [numerical-analysis]

The tag has no usage guidance.

2
votes
0answers
49 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 ...
4
votes
2answers
140 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 \...
2
votes
1answer
45 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 ...
3
votes
1answer
24 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 ...
0
votes
0answers
35 views

Application of iterative algorithm $(\theta_n,w_n)$ converging to $\{(\theta,\theta):\theta \in \Bbb R\}$

I have a iterative algorithm $(\theta_n,w_n)$ which I am showing converges to $\{(\theta,\theta):\theta \in \Bbb R\}$. The iterative algorithm is of the form : $\theta_{n+1} = \theta_n + a(n)[h(\...
0
votes
2answers
43 views

How to test for overflow when multiplying floats

I am trying to implement a 3-term recurrence relation: $$ p_{n+1} = ap_n + bp_{n-1} $$ This can be implemented as ...
0
votes
0answers
25 views

Computing $A^{-2}BA^{-3}b$

Let $A,B$ be matrices of $\mathbb{R}^n$ space and $b \in \mathbb{R}^n$. Describe a fast algorithm to compute $A^{-2}BA^{-3}b$. How many computations will the algorithm make? This is an exam question ...
1
vote
1answer
36 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
37 views

Real RAM computational mode

Given a real value $M>0$, I want to compute the greatest value of $\epsilon$ strictly smaller than $M$. Given the assumption that the computational model is Real-RAM, how to find a real number ...
1
vote
0answers
41 views

Accuracy and performance between a division and subtraction for a ratio in decibels

For comparing two images, one can use the Peak Signal-to-Noise Ratio (PSNR) metric, defined as follows: $\mathrm{PSNR} = 10 \cdot \log_{10}\left(\frac{\mathrm{MAX}^2}{\mathrm{MSE}}\right) = 20 \cdot \...
2
votes
1answer
33 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(...
1
vote
0answers
43 views

Sparse Matrix inversion without actual inversion

I want to know what are the efficient way to invert a Sparse Matrix? Are there any algorithm,linear algebra or expansions that make this task easier with out actually inverting the matrix? Thank you ...
5
votes
2answers
110 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}\...
1
vote
0answers
25 views

Construct unitary $Q$ such that $span\{q_1,q_2\} = span\{v_1,v_2\}$ where $v_1,v_2 \in \mathbb{R}^n$ are given as input

Assume also that $v_1,v_2$ are linearly independent, and $q_i \in \mathbb{R}^n$ denotes the $i$-th column of $Q$. This is what I've got so far. First obtain unit vectors $w_1,w_2$ which are orthogonal ...
3
votes
1answer
68 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: ...
1
vote
2answers
43 views

Float type variable uncertainty

I developed an image processing software and I need to do a numerical analysis of it, considering the error propagation associated to its operations and the uncertainty of float type variables caused ...
0
votes
0answers
25 views

Computational cost of using dictionary in floating point opertations

I would like to know the computational cost of using/accessing a dictionary. This should depend on the length of the dictionary. Say a dictionary $D$ has $n$ elements. What would be the cost of ...
0
votes
0answers
46 views

Naviers Stokes equation and machine learning

I am looking for a reference explaining how to solve Navier-Stokes numerically using Machine learning algorithms . Thank you in advance for your help .
1
vote
1answer
29 views

What is a logical approach to developing an algorithm which can find the optimal parameters for a function which make it best fit a given data set?

Consider the highlighted columns in the following table: Starting with 100,000 newborns, $l_{x+2}$ denotes the number of individuals in the sample still alive at age $x+2$. If we consider Makeham's ...
0
votes
0answers
55 views

Inverting an IEEE 754 double

While preparing for an exam I've come across this problem: Let $x$ be an IEEE 754 double precision number. Show that $$ \texttt{fl}(x * \texttt{fl}(1/x)) $$ has only 2 possible results ...
6
votes
1answer
592 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,...
0
votes
0answers
19 views

Numerical analysis - f(x) = f(y)

I am writing a function that can be split into cases (1)$f(x) \leq f(y)$ and $f(x) \geq f(y)$ or into cases (2)$f(x) < f(y), f(x) = f(y), f(x) > f(y)$ If I have f(x) = f(y), it is ...
1
vote
1answer
61 views

Machine error in computer arithmetic

I'm wondering if if is possible to have a function $f$ such that there exists $x,y$ such that we have $f_t(x) > f_t(y)$ where $f_t$ denotes the true value of $f$ and $f_a(x)<f_a(y)$ where $f_a$ ...
1
vote
1answer
32 views

Theoretical precision needed to get $n$-bits of the evaluation of some sum

Let $P,Q$ two integral polynomials of height bounded by let say $H>0$ --- that is every coefficient of $p$ or $Q$ is bounded in absolute value by $H$ --- and degree at most $d$. Let $A$ a set of $...
2
votes
2answers
884 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 ...
1
vote
0answers
105 views

predictor/corrector and gear integration for positive and negative time steps

I have a predictor method that takes differential equations for 214 biological species and integrates them in time using positive time steps. Right now it is able to successfully integrate the ...
1
vote
1answer
83 views

Which implementation for the Maclaurin Series for the cosine function is better?

First, sorry if this post is off-topic. I consider it too analytic for stack overflow. In Numerical Analysis subject I must explain which one is better (has less error). The recursive ...
3
votes
1answer
321 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!} $$ ...
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?
4
votes
1answer
76 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
1answer
121 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
227 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/...
0
votes
1answer
184 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
0answers
94 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 ...
3
votes
1answer
769 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 ...
0
votes
1answer
45 views

Calculating integral without quadratures

Is there any other options of calculating integral instead of using quadratures? I know that also we can calculate spline function or use monte-carlo method but do you know something else?
0
votes
2answers
305 views

Why are transcendental functions of large numbers inaccurate on computers?

For instance, why is it hard to accurately compute sin(1e99)? I suspect it has something to do with rounding error.
2
votes
1answer
56 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 ...
0
votes
0answers
323 views

Most stable algorithm to solve a system of linear equations?

I am doing some image processing involving solving a system of linear equations. I am getting some errors and bits of the image looks corrupted. I would like to know what is the most stable way to ...
4
votes
2answers
105 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
0answers
55 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 ...
4
votes
1answer
96 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 ...
1
vote
0answers
35 views

Conservation Law in Finite difference Scheme [closed]

I am using a Finite Difference scheme to solve a simple PDE in conserved form: $$\partial_t u = \partial_x (\partial_x u +au\partial_x u) = (1+a)\partial_x^2u +a(\partial_x u)^2 $$ $$\frac{u_n+1,j - ...
-3
votes
1answer
2k views

Determine machine epsilon

Consider a base 2 computer that stores floating point numbers using a 6 bit normalized mantissa (x.xxxxx), a 4 digit exponent and a sign for each. a) For this machine, what is machine epsilon? b) ...
2
votes
2answers
205 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 ...
12
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 ...
2
votes
1answer
479 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 ...
0
votes
1answer
2k views

How to logarithmic interpolation? [closed]

I'm trying to interpolate a logarithmic function but it always reaches a singularity due to $\log(0)$ being $-\infty$ is there a correct way to interpolate logarithmic functions? (as in correct ...
2
votes
0answers
65 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 ...
0
votes
1answer
46 views

Can someone interpret what this is asking for

I have this programming problem, but I really cant figure out what it wants me to do. Heres what it is: The cube root of a number can be found based on the observation that, if $t$ is an ...