Hot answers tagged

9 votes
Accepted

FEM for vector valued problems: reference request

Short answer: Just replicate the vector of interpolation functions into a block-diagonal matrix, as showed e.g. on page 5 in this lecture note. Detailed answer: Mathematically oriented texts typically ...
user avatar
8 votes

Direct Numerical Simulation of reacting flows

Like WolfgangBangerth, I strongly recommend that you reconsider your motivation (or your supervisor's motivation) for this goal. First, look at Center for Exascale Simulation of Combustion in ...
user avatar
7 votes
Accepted

Reconciling vector and scalar notation

The formula still applies for vectors - I find it helpful to use index notation. If $(\nabla u) = u_{,i}$, where $i$ implicitly refers to the $i$th entry of the gradient (i.e. $\frac{\partial u}{\...
user avatar
  • 2,961
6 votes

Angular Velocity by Vector - 2D

A cross product will tell you both the magnitude and the sign of your angular velocity. In general, angular velocity is defined by a vector as $$\vec{\omega} = \dfrac{\vec{r}\times\vec{v}}{|\vec{r}|^...
user avatar
5 votes

k nearest neighbors dictionary for vectors?

What you're describing is also a critical step in the k-nearest-neighbours method. So no need to reinvent the wheel, we can just look how other people have sped up that algorithm. I don't know about ...
user avatar
  • 1,169
4 votes

In Eigen, can a sparse matrix contain vectors/objects instead of simple scalar values?

Certainly. There are a few things you have to define for your type that are listed on this page in the documentation: https://eigen.tuxfamily.org/dox/TopicCustomizing_CustomScalar.html It basically ...
user avatar
  • 1,522
4 votes

Direct Numerical Simulation of reacting flows

What you suggest is a multi-year research program. Don't even think about doing this yourself, you will not within several years achieve anything that comes close to the current research. Rather, ...
user avatar
4 votes

FEM for vector valued problems: reference request

We can show how it works on the example of linear elasticity. In classical finite elements formulations, on every node, we will have a scalar shape (base) function to which we have associated number ...
user avatar
  • 906
3 votes

How can one produce a proper streamline plot?

You can calculate the stream function yourself, and from it you can draw contours or streamlines of constant $\psi$. Let us assume you are on a two-dimensional incompressible flow $\mathbf{u}=(u,v,0)^...
user avatar
  • 261
3 votes

How to compute the Helmholtz decomposition of 2D and 3D vector fields?

The short answer is "It depends". Certainly, you can try to find the Helmholtz decomposition on your sampled data, and find your irrotational and solenoidal components. However, there are certain ...
user avatar
  • 8,287
2 votes

Plot vector field in matlab

For plotting, it is easier in my opinion to not use meshgrid if you want to scale the arrows. You have a vector field $(E_X, E_Z)$ and you can simply normalize it like in the code below: ...
user avatar
  • 187
2 votes

Arranging variable ranges into a cell MATLAB

you just need to add output to your min() function, e.g.: [value, ind] = min(v) ind is ...
user avatar
  • 137
2 votes
Accepted

Vector characterization of cylinder displacements in a box

You're correct, if the orientational vector is unitary. Otherwise you must calculate the unitary vector in the direction of $\vec{O}_1$ and then perform the projection (just divide by the norm of the ...
user avatar
2 votes
Accepted

How to deal with numerical errors in electrostatic field calculations

I will try to answer the part of the question regarding the accuracy of the calculation, which certainly affects all the other things. Integrals of the type ($T_j$ denoting the $j$th triangle in the ...
user avatar
  • 8,287
2 votes
Accepted

Find representatives of vector-space in set of vectors?

You can think of each vector as a point in your linear space. As such, we can use a simple quadtree/octree-like algorithm to map your points into boxes, with "nearby" vectors assigned to the same or ...
user avatar
  • 653
2 votes

In Lanczos algorithm, can we choose the staring vector to be the first eigenvector of the input matrix A?

Of course you can! The starting vector is completely arbitrary. You'll get breakdown at step 1 if you do though. Be sure to check what it entails. This will typically happen by a "happy accident&...
user avatar
2 votes
Accepted

Algorithm to merge two polygons (using connectivities)?

Easy: Decompose the polygons into (unoriented) line segments each of which is sorted by vertex index: $$ A = \{[1,2], [2,3], [3,4], [4,5], [1,5]\}, \\ B = \{ [1,6], [6,7],[7,8],[3,8], [2,3], [1,2]...
user avatar
1 vote
Accepted

Computing excited states using itensor (with DMRG)

For anyone interested in this problem, I found the following solution: ...
user avatar
1 vote
Accepted

Solving Vectorial Poisson Equation in FENICS

Ok I will answer my own question: The problem is in the line solve(L==a,A,bc) which needs to be replaced by solve(a==L,A,bc). ...
user avatar
1 vote

Plotting or Visualizing a Higher dimensional vector field

Somehow I have to use t-sne, but I really don't know how. Since you have a PhD my answer will be brief, it's quite a lengthy subject. The aim of dimensionality reduction is to preserve as much of ...
user avatar
  • 111
1 vote

What is the best method to combine multiple vectored results into one chart?

If you know how the x-axis relates from one dataset to the next, the best solution I can think of would be to use the command 'interp1' in matlab. I've compiled a small script with output to show you ...
user avatar
  • 243
1 vote

Find representatives of vector-space in set of vectors?

Initialize the cluster centers as your subset $V\in X$, where $V=\{x_i\}$. Then run a couple of K-mediods iterations. After that you will see that the certain vectors will come closer, essentially ...
user avatar
  • 2,139
1 vote

Find representatives of vector-space in set of vectors?

Sounds like you want to thin your data where it is dense, and learn the support of your data summarized by data points. If you don't have too many points, you can generate a distance matrix, and prune ...
user avatar
  • 870
1 vote
Accepted

Software/code to extract a solenoidal (a.k.a. divergence-free) field from a 2D vector field numerically

After some searching I found a C/C++ function called project() in the article 'Real-Time Fluid Dynamics for Games' by Jos Stam http://www.dgp.toronto.edu/people/stam/reality/Research/pdf/GDC03.pdf I ...
user avatar
  • 141
1 vote
Accepted

two level iterators C++

While I don't state this to be an optimal implementation or one taking into account the all edge cases, below is a sample implementation I put together for your task that can give you an idea of how ...
user avatar
  • 3,673
1 vote

Find a permutation matrix (using the Matlab's function $symrcm$) of a matrix $A(2:end, 2:end)$

From your comment "The plot emphasises expectedly the connections of node 1", I guess that maybe the idea is showing that node 1 is connected not only to a set of nodes that are "one close to the ...
user avatar
1 vote

Efficiently approximating sum of 2-norms

If you just want an approximation to the sum of their norms, you can choose a random sample of $m$ of the indices (i.e., a random set $S \subseteq \{1,2,\dots,N\}$ of size $m$) and compute $$f(\...
user avatar
  • 350
1 vote
Accepted

Vector and index notation equivalence

Is it possible to tell in index notation whether a vector is a row or column vector, or is that supposed to be clear based on context? It seems the answer is actually lurking in your question itself ...
user avatar
1 vote
Accepted

Sparse matrix vector product using PETSC

I assume that you are comparing multiplication with an assembled PETSc matrix with your hand-coded matrix-free method. The latter may indeed be faster, but this could be because no entries of ...
user avatar

Only top scored, non community-wiki answers of a minimum length are eligible