Questions tagged [numerical-analysis]
99 questions
19
votes
2 answers
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 changed (let's say $a _{ij}$ to $a' _{ij}$). The…
AJed
- 2,432
- 19
- 25
14
votes
1 answer
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 \times m}$.
A popular approach is to compute the…
Artem Kaznatcheev
- 4,872
- 2
- 28
- 57
14
votes
1 answer
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 get a number equal to or larger than that integer due…
Cade Roux
- 323
- 2
- 7
13
votes
1 answer
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$.
It seems to me that we can always permute the…
Aryabhata
- 6,291
- 2
- 36
- 47
12
votes
5 answers
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 theory (due to calculus). But computers seem to do everything in…
isomorphismes
- 237
- 2
- 5
11
votes
0 answers
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
1: test_sign = x*y < 0
2: if test_sign :
3: biggest =…
user10018
8
votes
2 answers
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 algorithm that repeatedly halving intervals, it is…
Pteromys
- 181
- 4
8
votes
2 answers
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 complement arithmetic, which performs additions…
Gilles 'SO- stop being evil'
- 44,159
- 8
- 120
- 184
7
votes
2 answers
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 count) the roots of an $n$-dimensional function…
labotsirc
- 383
- 2
- 9
6
votes
1 answer
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, numerical infinitesimal and numerical infinity,…
Mikhail Katz
- 63
- 10
6
votes
2 answers
Numerical methods: why doesn't this python code return 1.0?
I typed the following into the python console:
>>>from numpy import float64
>>>x=float64(1.98682855148322934369)
>>>x
np.float64(1.9868285514832293)
>>>y=float64(1)/x
>>>x*y
np.float64(0.9999999999999999)
My argument for why the above code should…
Beatnik Dopa
- 61
- 3
5
votes
2 answers
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…
Simon Dirckx
- 51
- 1
5
votes
3 answers
Why is computation of this function numerically unstable?
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?
John
- 67
- 4
5
votes
1 answer
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 to divide the original curve into equal arc length…
user39558
- 51
- 1
5
votes
0 answers
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 example, we might want to test the function…
user20095