Questions tagged [vector]
The vector tag has no usage guidance.
43
questions
3
votes
0
answers
95
views
Helmholtz decomposition of a vector field in Fourier space with Python
I have a 3D vector field and I want to extract its divergence-free part (also called transverse component), using the Helmholtz decomposition.
In principle, this can be done in the Fourier space, as ...
0
votes
0
answers
41
views
Describing a vector field
I am currently making use of a 2D vector field that I would like to be able to describe and characterize. I thought of a few metrics that I could use, but they seem limited for both a qualitative and ...
10
votes
2
answers
613
views
FEM for vector valued problems: reference request
I'm a PhD working in a computational mechanics lab. I come from a Math department, and I have a good background for what concerns the basics of finite elements, like inf-sup conditions, DG, non-...
0
votes
1
answer
88
views
In Lanczos algorithm, can we choose the staring vector to be the first eigenvector of the input matrix A?
In Lanczos algorithm, can we choose the staring vector $v$ to be the first eigenvector of the input matrix $A$? How can we select it? and why $v$ need to have norm 1?
1
vote
1
answer
115
views
k nearest neighbors dictionary for vectors?
Does there exists a data structure with these properties
Stores vectors in a dictionary
When given a key that is also a vector, returns the k nearest vectors using a similarity metric (e.g. Euclidean,...
5
votes
1
answer
1k
views
Algorithm to merge two polygons (using connectivities)?
I am struggling with implementing an algorithm that does one simple thing:
Consider two polygons (one can just draw any two polygons and number their vertices), whose connectivities in a node list are:...
2
votes
1
answer
43
views
In Eigen, can a sparse matrix contain vectors/objects instead of simple scalar values?
I need to have a sparse matrix whose elements are not simple numbers, but objects, e.g. a couple of floating point values and a bunch of integer indices.
I am wondering if Eigen has something similar, ...
2
votes
0
answers
147
views
If dot product is commutative, why does MATLAB give different answers?
Why does the dot() function in MATLAB return different expressions based on the order in which I pass vectors?
2
votes
0
answers
207
views
Lexicographically order matrix into a vector
I am trying to implement the algorithm contained in this article here. It is about solving a 2 and 2.5D Fredholm integral, focused on bidimensional NMR experiments. I've made significant progress, ...
0
votes
1
answer
375
views
Computing excited states using itensor (with DMRG)
I am trying to compute first few excited states of some Hamiltonian (I am using itensor and its DMRG algorithm). To do so, I am ...
1
vote
0
answers
48
views
How to integrate the contents of a vector using an adaptive quadrature routine [duplicate]
I have a function which requires the return type to be a container. The problem is that I need to integrate the contents of the container as efficiently as possible and was hoping to use adaptive ...
0
votes
1
answer
320
views
Solving Vectorial Poisson Equation in FENICS
I am trying to solve the following, "test problem" involving a vectorial Poisson equation:
$$-\nabla^2 \vec{A}=\vec{J} \quad \forall x\in\Omega=[-1,1]^3$$
$$ \vec{A}=\vec{0} \quad \forall x\in\...
3
votes
1
answer
995
views
Calculate xyz velocity vectors for circular orbit
I'm trying to calculate the xyz velocity vectors for a circular orbit given a set of position vectors, but I can't seem to get it right.
The formula for obtaining the velocity magnitude is the ...
4
votes
1
answer
456
views
Plotting or Visualizing a Higher dimensional vector field
I am trying to visualize a higher dimensional vector field. Is there a way to do this. I asked this question here, I was told to post it here.
As an example, one can use
$$\begin{eqnarray}
\dot{x}...
2
votes
1
answer
75
views
Vector characterization of cylinder displacements in a box
We have a cylinder of length $l$ (in units of its radius $d,$ as basic unit of length set to $d=1.$) in a box, and we consider an orthonormal Cartesian coordinate system with its origin placed at the ...
2
votes
1
answer
141
views
How to deal with numerical errors in electrostatic field calculations
I want to trace electrostatic field lines emerging from 2D surfaces in 3D space. Eventually I want to find their intersection with an (uncharged) mesh.
The charge distribution $\sigma(x), x \in \...
4
votes
4
answers
721
views
Find representatives of vector-space in set of vectors?
Suppose I have a multi-dimensional vector space $X$, and a collection of $n$ vectors $\{x_i\}_{i=1}^n \subset X$, which are not evenly "spaced-out" in $X$. I am searching for $m<<n$ of these $...
6
votes
1
answer
4k
views
How to compute the Helmholtz decomposition of 2D and 3D vector fields?
I have a sample of 100 particles with their 3D positions and velocities. I want to decompose the velocity vector field to its curl free and divergence free components.
Is it a feasible to do so for ...
3
votes
1
answer
321
views
Software/code to extract a solenoidal (a.k.a. divergence-free) field from a 2D vector field numerically
Can somebody point me to software/code to extract a solenoidal (a.k.a. divergence-free) field from a 2D vector field numerically?
There are a plethora of papers and documents describing how to do ...
0
votes
1
answer
3k
views
two level iterators C++ [closed]
I am trying to implement a two level iterator as I will now describe. Basically I have a "vector of vectors" and I want a single iterator that will loop over all the objects in the vector of vectors.
...
0
votes
1
answer
100
views
Regarding solution vector of the wave equation
I am simulating the wave equation using FEM. For a 2D wave equation, when I visualise my output in Paraview, I see a separate solution in 'x' and 'y' direction for each node on the mesh. Therefore, if ...
1
vote
2
answers
759
views
Find a permutation matrix (using the Matlab's function $symrcm$) of a matrix $A(2:end, 2:end)$
I've the following Matlab code:
r = symrcm(A(2:end, 2:end));
prcm = [1 r + 1];
spy(A(prcm, prcm));
where A should be sparse ...
0
votes
1
answer
80
views
Efficiently approximating sum of 2-norms
Suppose I have a real vector $\bf x$ of length $KN$, where $K<<N$. Let's say I break this vector $\bf x$ up into $N$ vectors each of length $K$,
$${\bf x}_1,...{\bf x}_n.$$
Now I would like ...
0
votes
2
answers
6k
views
Plot vector field in matlab
I have the function of an electric dipole expressed in cartesian coordinates and I want to create the vector field using Matlab .
The function is
$$E_z= \frac{p}{4\pi\epsilon_0} \cdot \left(\...
5
votes
0
answers
615
views
Numerically calculating the divergence of a set of oriented points
Say I have a set of oriented points at locations $\vec{v_i}$ with each some direction $\vec{n_i}$, in practice they represent the normals of some surface that has been non uniformly sampled. How would ...
1
vote
2
answers
56
views
Arranging variable ranges into a cell MATLAB
I have the following simple code
v=[];
for i=10:-1:1
for j=0:0.2:5
v(end+1)=i+j;
end
end
min(v)
It returns the minimum of vector $v$ whose length in this ...
0
votes
2
answers
195
views
Vector and index notation equivalence
Given 2 vectors $\mathbf{u}$ and $\mathbf{v}$ the following are equivalent:
$\mathbf{u}\cdot\mathbf{v}$
$\mathbf{u}^T \mathbf{v}$
$u_i v_i$
$v_i u_i$
$\mathbf{v}\cdot\mathbf{u}$
$\mathbf{v}^T\...
3
votes
1
answer
438
views
Sparse matrix vector product using PETSC
I am trying to do a simple parallel sparse matrix vector multiplications using PETSC. My sparse matrix is a simple tridiagonal laplacian matrix, which is distributed over multiple processors using ...
0
votes
2
answers
855
views
Rotate 2D shape around origin in a 3D space
I have a 2D square ABCD in a 3D space, with side length 2s, that is represented by four vectors (one for each vertex) and a fifth vector ...
4
votes
2
answers
335
views
Direct Numerical Simulation of reacting flows
I need to write a DNS code for simulating reacting flows in turbulent conditions. The code has to be highly scalable, because the computational cost of simulations is expected very large.
My idea is ...
0
votes
0
answers
422
views
3D animation of a vector field (ParaView) [duplicate]
I am trying to create an animation of a 3d vector field in ParaView.
All my data is in three matrices (201 x 201 x 201) corresponding to vectors components in x,y,z directions. And it's calculated in ...
1
vote
0
answers
494
views
Get a single value from a global Vec in petsc [closed]
I don't understand the concept with local and global vec's in petsc when it come to DMDAVecGetArray and VecGetValues. I'm creating some DMDA Vec in parallel which works well. Now I want to access ...
0
votes
1
answer
115
views
What is the best method to combine multiple vectored results into one chart?
Currently I am working on my research report where I've done a lot of measurements. For now I have uploaded everything into Matlab and visualise each on chart. Each one consists of 4 lines drawn with ...
6
votes
2
answers
4k
views
How can one produce a proper streamline plot?
I recently had trouble producing a proper streamline plot in Mathematica, and apparently the problem is a good bit harder than I appreciated. I would like to know if there exist general algorithms to ...
4
votes
1
answer
139
views
Reconciling vector and scalar notation
I am trying to derive Galerkin type weak formulation for the Stokes equations. I'm having a bit of a problem reconciling the notation in the integration by parts. I know that the answer I'm looking ...
1
vote
0
answers
87
views
Understanding the use of Minimum Translation Vector (MTV) for an elastic collision response
So, I'm trying to simulate polygon rigid body physics, both linear and angular.
To calculate the MTV is easy in SAT (Minimum Translation Vector), and to use it to adjust position is also easy:
...
1
vote
1
answer
98
views
Accurate dot-product of fields with only knowing normals
I am trying to accurately calculate $\vec{j} \cdot \vec{E}$ for an electron energy equation on a finite-volume mesh. $\vec{j}$ is the electron current density, and $\vec{E}$ is the electric field. ...
2
votes
1
answer
4k
views
Angular Velocity by Vector - 2D
This is originally a problem in programming, but since almost no one on Stackoverflow know how to solve this I went here instead; https://stackoverflow.com/questions/23003612/javascript-angular-...
1
vote
1
answer
1k
views
Coding complex equations into C++
I have here equations from a paper by E. Bradlow. They're for counting the events in a Weibull-distributed data set.
$$\begin{align}
\Pr(N(t)=n) &= \sum_{j=n}^\infty{\frac{(-1)^{j+n}(\lambda t^c)^...
2
votes
1
answer
146
views
How can I efficiently position the different segments of a large vector in Eigen C++?
I have a very large(up to 9 000 000) VectorXi vector defined in Eigen C++ which is read from a data file.
The vector consists of 0, 1, 2, ...n segments with ...
2
votes
1
answer
150
views
combine $n$ vectors using $L2-normalization$
Suppose that I have the following vectors $v_1$, $v_2$, $v_3$ $\in R^n$,$n= 9$. What I want to do exactly is to combine these $3$ vectors into $1$ representative vector $V$.
According to the ...
3
votes
1
answer
5k
views
How to change the dimensions of an Eigen Matrix in a loop?
I have a while loop, in which I use a Matrix A, vectors B and x with varying dimensions:
<...
2
votes
1
answer
195
views
Numerically efficient way to compute sparse-matrix arithmetic on GPU?
Can anyone tell me some very good/efficient numerial algorthims for GPU/CUDA to compute multiplication/ between sparse matrices (its good if you can recommend me some research papers)?
I googled ...