# All Questions

8,917 questions
Filter by
Sorted by
Tagged with
8k views

### Robust algorithm for $2 \times 2$ SVD

What is a simple algorithm for computing the SVD of $2 \times 2$ matrices? Ideally, I'd like a numerically robust algorithm, but I'll like to see both simple and not-so-simple implementations. C code ...
6 views

### Explanation of Givens rotation in Jacobi Rotation SVD

I'm trying to implement Singular Value Decomposition (homework of sorts) via the Jacobi Rotation method (more info here, pages 11 and 12). I am stuck at the bullet saying (sorry for the picture, but I'...
4 views

### Is the Immersed Boundary (IB) method a Direct Numerical Simulation?

Is the IB method considered a Direct Numerical Simulation? A DNS code is the most detailed type of simulation and the most accurate but computationally expensive, right? What makes a simulation not a ...
80 views

### For traditional FEM and FVM, why can't we use mesh to represent geometry and use the mesh which represent the geometry to do the computation directly?

Isogeometric analysis [1] has the advantage of integrating geometric and mesh models using NURBS or Spline. At the same time, I would like to ask a question to my friends: for traditional FEM and FVM, ...
69 views

### How to debug segmentation faults in large problems?

I am sorry if this question seems like off topic or opinion based, but I was not sure how to go about it. I am currently working on a 100k x 100k positive definite linear system and trying to solve it ...
24 views

323 views

31 views

### Why is Time evolving block decimation so efficient?

I have a short question about Time evolving block decimation (TEBD). During a lecture I was told that this method is very efficient in evolving 1D quantum spin systems with only nearest neighbor ...
227 views

### Jacobians with automatic differentiation

I have an objective function F: Nx1 -> Nx1, where N>30000. There are many sparse matrix/tensor multiplications in this function, so taking an analytic Jacobian by paper and pen is cumbersome. ...
67 views

### Computing Series of $ke^{-(x - h)^2}$

I asked this question on the Computer Science stack exchange (https://cs.stackexchange.com/questions/128710/faster-computation-of-ke-x-h2), but it appears that it is more appropriate in Computational ...
30 views

### What is the generalization of the resource allocation problem I'm dealing with here?

I'm dealing with a problem as follows: I have a finite set of money 𝑚 to spend over 𝑟 different raffles, and I need to spend approximately to my budget, with the goal of maximizing my probability ...
88 views

### Why is $1/r^2$ force law giving spiral trajectory?

I have written a program to solve for Newton's 2nd Law of motion for a given force law, in 2D polar coordinates. It is known that if the force law is of the form $k/r^2$,we get conic sections as ...
70 views

### GPGPU/FPGA programming for Combinatorial Analysis

Recently, I have taken an interest in performing combinatorial analysis for the game of 21 (blackjack) and attempted to use my AMD APU to try and thread the program via the 4 cores on the chip. ...
49 views

### FEM Meshing artifact at nodes with fewer neighbors

I wrote a 2D-FEM solver to solve some diffusion process and wanted to verify my code with a test problem. The input was $f(x,y) = x^2+y^2$ and I applied the stiffness matrix on it to get $\Delta f = 4$...
47 views

### Implementation of sparse matrix SVD for GPU

I have a sparse matrix $W$ which is almost-squared ($N+1 \times N$) and I would like to know the eigenvalues of $A = W^T W$. $A$ is Hermitian so the eigenvalues are real-positive valued. The usual ...
63 views

### How do I speed up this function evaluation in matlab?

Half the run time of my code right now is evaluating a big function over many, many points, it takes maybe about 20 seconds per evaluation The function consists of a bunch of simple operations that ...
334 views

### When and when not to use automatic differentiation

I am just learning (more) about automatic differentiation (AD) and at this stage it kind of seems like black magic to me. The second paragraph of its Wikipedia article makes it sound too good to be ...
29 views

### Image segmentation network to extract questions from an image of a test paper?

This is the sample document -> I want to extract questions along with the options. There are other question papers as which have questions with diagrams in them. I want to be able to extract them ...
29 views

### Numerical simulation for a bounded process. Is slight deviation a “normal” fact?

Suppose I have to numerically simulate a process $\{y_t\}$ such that $y_t\geq0$ $\forall t\in\mathbb{N}$, with $t$ denoting time-step. Let's suppose I use MonteCarlo with $\mathscr{N}$ simulation ...
29 views

### Discretization formula for a system of two differential equations. “Solution to one of these is the initial condition of the other”. In which sense?

Consider the following stochastic differential equation $$dy=\left(A-\left(A+B\right)y\right)dt+C\sqrt{y\left(1-y\right)}dW\tag{1}$$ where $A$, $B$ and $C$ are parameters ...
30 views

### How do you construct a self-similar binary structured-tree?

Please excuse me if this question somehow looks trivial or not really interesting, but I recently have a hard time to convince someone else that my algorithm for constructing a self-similar binary ...
31 views

### Integrating Matrix Elements TypeError: f() takes 1 positional argument but 3 were given

I'm working on a linear variational problem for a general PIB and I keep encountering the same problem, and I know its a rather simple solution. Any suggestions? ...
66 views

### How to determine global stiffness matrix is constrained or not

Background In solid fem, we often solve $$\mathbf{Ku}=\mathbf{p}$$ where $\mathbf{K}$ is global stiffness matrix, $\mathbf{u}$ is displacement, $\mathbf{p}$ is global load vector. If displacement not ...
56 views

### OpenMP inconsistently segfaulting

I parallelized my code with openMP, and now have this bug in my code that's really odd. If it's the first time I run on a computer, it segfaults, but if I run the program again it runs fine. I've ...
168 views

### Different questions about “Inverse Physics problems”

I am in a context of forecasts in astrophysics. Don't be too rude if questions seem to you stupid or naive but rather indulgent, I am just looking for better undertsand all these numerical methods of ...
I tried to write a code for the alternating direction implicit (ADI) method in 2D, but I got stuck. My equation is: \frac{\partial U(t,x,y)}{\partial t} = 2\Delta U(t,x,y) -10(\frac{\partial U(t,x,y)...