Skip to main content
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Code code:"if (foo != bar)"
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Saves in:saves
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with
Search options answers only not deleted user 919

Also known as Numerical Analysis, Numerics aims to provide methods and algorithms for numerical computations.

12 votes
Accepted

How to properly handle Infs in a statistical function?

In this case the NaN (not a number) is returned because the calculation of the exponential overflows in double precision arithmetic. An algebraically equivalent expression, expanded in a MacLaurin se …
whuber's user avatar
  • 334k
6 votes

log(1 - softmax(X))?

Usually these values are not computed alone: the entire collection of $v_i$ and $\log(1 - \exp(v_i))$ is needed. That changes the analysis of computational effort. To this end, let $$\bar x = \log\ …
whuber's user avatar
  • 334k
3 votes

What would be a reliable way to check if a square matrix is computationally singular?

Why not use a procedure that will both check the matrix for invertibility and find its inverse? A QR decomposition will do that. This is a numerically stable algorithm (employed by many least square …
whuber's user avatar
  • 334k
23 votes
Accepted

Weird correlations in the SVD results of random data; do they have a mathematical explanatio...

This is not a bug. As we have explored (extensively) in the comments, there are two things happening. The first is that the columns of $U$ are constrained to meet the SVD requirements: each must have …
whuber's user avatar
  • 334k
4 votes

plotting a factorial function in R

Probability calculations can produce formulas involving astronomically large or small numbers, especially when factorials are involved. Often there's extensive cancellation. The problem is that inte …
whuber's user avatar
  • 334k
2 votes

How to plot $x^{1700}(1-x)^{300}$?

You can plot this curve accurately, on a linear scale. Let $a=1700$ and $b=300$ be the parameters. The largest value of $f(x)=x^a(1-x)^b$ for $0\lt x \lt 1$ is attained at $x_m=(a-1)/(a+b-2)$ (the mod …
whuber's user avatar
  • 334k
5 votes
Accepted

Approximating the standard normal density with the logistic density: How to numerically opti...

Just do a little graphing and carry out the analysis suggested by the graphs. Here are plots of the reference standard Normal density and, on the right, several logistic densities superimposed on the …
whuber's user avatar
  • 334k
4 votes
Accepted

Does rounding introduce variance into estimates?

It depends. But not on much, and you can predict what is likely to occur. In many situations, rounding adds $1/12$ to the variance. Consider any random variable $X$. Write $[X]$ for its rounded …
whuber's user avatar
  • 334k
10 votes
Accepted

Get accurate eigenvectors, when eigenvalues are minuscule

The problem is due to "leakage" from the large eigenvectors. I will present a brief analysis and then offer a solution, with code, followed by some remarks about the nature and limitations of the sol …
whuber's user avatar
  • 334k
6 votes
Accepted

Is there a closed form approximation for the composition of the Gamma CDF with the inverse N...

A solid implementation of $F$ will directly return the complementary value $1-F$ (the survival function) when requested. Exploit the symmetry of $G$ to compute $$H(x) = G^{-1}(F(x)) = -G^{-1}(1-F(x)) …
whuber's user avatar
  • 334k