5
votes
Accepted
How to optimize an approximated matrix multiplication?
This is a linear least squares problem if you just look at it the right way. Write
$$
B = (I-aX)^{-1},
$$
then $X = \frac{1}{a}(I-B^{-1})$ and
$$
(I-aX)^{-1}XA = B\frac{1}{a}(I-B^{-1})A = \frac{1}{...
4
votes
How to sample points in hyperbolic space?
I'm in the middle of doing this for myself. I think the most appropriate analogue to the Gaussian would be the heat kernel in hyperbolic space. Fortunately, this has been figured out before: https://...
4
votes
Accepted
Uniform dots distribution in a sphere
To generate a specified number of random points in a 3D ball, one possibility is to use rejection sampling to have an initial point distribution, then improve the sampling with Lloyd relaxation.
...
3
votes
Accepted
Different questions about "Inverse Physics problems"
As I understand, your ultimate goal is to solve an inverse problem (i.e., infer some parameters from given data / observations). To this end, you want to apply Bayesian Inference, which relates the ...
3
votes
Generating Random Orthogonal Matrices in C++
I've seen in your comment that you want a uniform sampling.
With the Eigen library, you can uniformly generate at random a unit quaternion:
...
3
votes
Accepted
Sampling vector so they will have a given euclidean distances matrix
Multidimensional scaling (MDS) is one algorithm that tries to find such a set of points. It's usually used for visualization, so it's usually used in 2 or 3D spaces, but the optimization procedure ...
3
votes
Estimate information entropy through Monte Carlo sampling
If I understand what information you have available, what you want is not possible: the information available to you is not enough to determine the entropy. It's not even enough to approximate the ...
2
votes
Why are Hamiltonian dynamics used in MCMC?
I'm a little late to reply but I found this review to be really informative. One particularly nice feature of Hamiltonian flows is that they preserve volume in phase space. If we take an infinitesimal ...
2
votes
Accepted
How to choose a good distribution for visualizing phase changes in the nature of the roots of a quadratic equation
Because the polynomial $ax^2+bx+c$ and $x^2+\frac{b}{a}x + \frac{c}{a}$ have the exact same roots, let's first simplify the problem by only considering the roots of the equation
$$
x^2+b'x + c' = 0
$...
2
votes
Rotate a vector by a randomly oriented angle
If you want to use a single random number, you first need to find "a" solution (one vector w that meets the criterion), then rotate that vector about $\mathbf{v}$ by a randomly generated angle.
We ...
2
votes
Accepted
Testing Wiener process splitting in adaptive-step SDE integrators
I discuss the method you describe in more detail in this paper (Rackauckas and Nie 2017) as RSwM2. In that paper I am ever so slightly able to detect that it's sometimes doing something wrong, but ...
2
votes
Estimate information entropy through Monte Carlo sampling
For the second part of your question (estimation of entropy difference between distributions) you may be able to use the identity $$F = \langle E \rangle - T S,$$ where $\langle E \rangle$ is the ...
2
votes
Generating Random Orthogonal Matrices in C++
The example you cited appears to be generating random Householder vectors and multiplying them out using backwards accumulation.
Another simple thing to do would be to generate a random matrix $\...
2
votes
Accepted
How is the D value being updated at simple RRT algorithm?
I don't think $D$ is updated at all. It is just a temporary value for $D_{exp}$ times uniform random value in [0,1].
As a general remark, RRT means Rapidly-exploring Random Tree. Hence, the algorithm ...
2
votes
Accepted
Changing randomly a unit vector
What you’re seeing is a basic acceptance-rejection method. $\Delta S$ generated in that way will be uniform in the ball of radius $\Delta S_{\text{max}}$ centered at the origin.
Added
I imagine you're ...
2
votes
Is there a better way to do run time analysis than this?
Welcome to SE SciComp. First of all, I would suggest using Jupyter so that you have access to IPython and its nice timing magics (see %time and %timeit magic function). These magics take into account ...
2
votes
How to plot random points in 3 dimensions in order to calculate volume of a torus through Monte Carlo integration
You don't need to plot a torus to calculate its volume. Moreover you can analytically compute the volume integral and it's even on wikipedia. With Monte Carlo you can use rejection sampling to figure ...
2
votes
Accepted
Grid walk vs. uniform random weights for bounded grid
Not every method that seems reasonable leads to an algorithm that is competitive. In your case, if you want to draw uniform random numbers from $[0,1]^2$, you could use a method that is based on ...
1
vote
How to sample points uniformly over a region of the unit sphere
So if I correctly understand, you know how to sample in the "vertical" cone, and you ask how to rotate?
Here is some pseudo-code to get the unit quaternion representing a rotation sending a ...
1
vote
Optimization on MCMC codes
The Julia probabilistic programming libraries like Turing.jl work on abstract array types and use the Julia automatic differentiation tooling, so if you write your model as something that uses CUDA.jl ...
1
vote
Generating Random Orthogonal Matrices in C++
If $X$ is a $(n \times m)$-matrix whose entries are independently generated values from the standard normal distribution, then $X(X^{\top}X)^{-\frac12}$ is a uniformly generated random orthogonal ...
1
vote
Monte Carlo - Random Walk Simulation - polyfit the log log data points?
If I understood the first image correctly, you should do a linear fit with $\ln(N)$ being the independent variable and, presumably, $\ln(d)$ the dependent variable.
Furthermore, it seems to me that ...
1
vote
Uniform dots distribution in a sphere
There is a nice document:
M. Deserno, "How to generate equidistributed points on the surface of a sphere"
which basically summarizes the two easiest methods to generate a distribution of points on a ...
1
vote
Sampling simulation steps logarithmically
If you want your sampling over the (a,b) interval to appear uniform when viewed on a log-log scale, linearly interpolate the logarithms: ...
1
vote
Rotate a vector by a randomly oriented angle
Find a vector $\vec a$ such that $\vec v \times \vec a \ne 0$. Define $\hat x = (\vec v\,\times \vec a)/||\vec v \times \vec a||$. By construction, $\hat x$ is a unit vector and is orthogonal to $\vec ...
1
vote
How to choose a good distribution for visualizing phase changes in the nature of the roots of a quadratic equation
Well, for the visualization of the discrete and real/imaginary character of the roots, you can simply do a 3D plot of $$ \frac{-b\pm \sqrt{b^2-4ac}}{2a} $$ against $a$, $b$, and $c$.
This will give ...
1
vote
Accepted
(numpy/scipy) Build a random vector given mean vector and covariance matrix
If random vector $X$ has variance $S$, then $LX$ has variance $LSL^\top$.
So generate whatever random variables with mean 0 and identity covariance matrix, then transform it $LX+\mu$, where $\mu$ is ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
random-sampling × 34monte-carlo × 10
linear-algebra × 4
optimization × 4
algorithms × 3
numerics × 3
computational-geometry × 3
random-number-generation × 3
matlab × 2
python × 2
matrix × 2
discretization × 2
approximation × 2
geometry × 2
probability × 2
sample-statistics × 2
computational-physics × 1
c++ × 1
constrained-optimization × 1
simulation × 1
scipy × 1
numpy × 1
molecular-dynamics × 1
statistics × 1
gpu × 1