# All Questions

8,360 questions
Filter by
Sorted by
Tagged with
4 views

### Propagation of a Gaussian beam using FFT

I am trying to simulate the propagation of a gaussian beam through a lens using an FFT approach. I tried to implement the approach described by Couairon in this paper at page 43: https://link....
1k views

...
37 views

### How to choose between compact finite differences and spectral methods

For a project in my advanced numerical method class I have to solve the 1D Kuramoto-Sivashinsky equation. $$u_t + u u_x + \lambda u_{xx} + \eta u_{xxxx} = 0.$$ As explained here I will solve it ...
18 views

### How to implement the gmres method using Householder transformation instead of the Gram-Schmidt?

For Generalized Minimal Residual method GMRES, we usually use the Modified Gram-Schmidt MGS to generate an orthonormal basis of ...
38 views

### Type of Rosenbrock method by its coefficients

A Fortran code that solves stiff PDE systems contains the following arrays of Rosenbrock-Wanner method coefficients: ...
44 views

### evaluating $\coth(x) - 1/x$ for real x, on 2 “pieces”

The function $\coth(x) - 1/x$ has a removable singularity at 0. Its Taylor series is: $$\coth(x) - 1/x = \frac{x}{3} - \frac{x^3}{45} + \frac{2x^5}{945} + \ldots$$ I would like to evaluate the ...
50 views

### Why Householder transformation can not be chosen to be an identity matrix?

For Householder transformation, we know that $H = I-uu^T$, where $\|u\|_2=\sqrt{2}$. When it acts on any vector $x$, $Hx$ and $x$ is symmetric with respect to $span(u)^T$. But I have read a ...
40 views

### Initial condition for Kuramoto-Sivashinsky

For a project in my advanced numerical method class I have to solve the 1D Kuramoto-Sivashinsky equation of which I know little. I just know that it was derived the equation to model the diffusive ...
39 views

### Solving saddle point problem having non-invertible top-left block with a PETSc nested matrix

My system is a symmetric FE problem with lagrange multipliers: $Z=\begin{pmatrix}A & C^T \\ C & 0\end{pmatrix}$ The matrix $A$ is positive semi-definite, non-invertible. The whole matrix is ...
28 views

### Hit-n-Run Monte Carlo on convex polytope

So, I'm currently trying to implement a MCMC to uniformly sampling hyper-points from the polytope defined as $\mathbb{K}=\{x\in\mathbb{R}^{n}\;\;\text{s.t.}\;\; A\,x=b \}$ in the specific case where, ...
101 views

### Efficient ways to numerically evaluate matrix exponentials

What are some computationally efficient ways to solve matrix exponentials, i.e. functions of the form : f(X)=$e^{X}$, where X is a square matrix ? So far I have been able to diagonalise some ...
37 views

### HSS preconditioner with gmres [closed]

I have a question about HSS preconditioner with GMRES method. For implementing the HSS preconditioner with GMRES, we need to solve the linear system of the form (I + H)(I + S)z =r, for a given r at ...
48 views

### Using adolc for the sign function in c++

Here is an implementation of the sign function in C++ using Adolc librairy for automatic differentiation. ...
30 views

### Determinant of a matrix after removing or adding lines and columns

In quantum mechanics, the wavefunction of N electrons is given by a determinant. I am working on a Monte Carlo algorithm. At each Monte Carlo step, I need to add or remove an electron, which means ...
66 views

### Inverting really big symmetric block matrix

I have a really big symmetric 7.000.000 X 7.000.000 matrix that i would like to invert. The matrix is extremely sparse and it can be rearranged as to become a block matrix. The biggest blocks are ...
44 views

### Why the two Gram-Schmidt algorithms produce different results for qr factorization?

For the qr factorization using classic Gram-Schmidt algorithm, I found the 2 different implementations below. The first one uses the for loop to compute the upper ...
48 views

### pdepe or Crank-Nicolson? How much is pdepe good?

I am beginner in MATLAB and similar. I sow and discussed with my professors doing simulations some times: they wrote down a lot of calculus, most of them using Crank-Nicolson Method and so implement ...
145 views

### How to simulate over 1 billion particles?

I want to simulate human erythrocytes in capillaries. I calculated, that for a 1 meter long and 1 mm in diameter capillary there are about 3 billion blood cells. Erythrocytes are actually discs, but ...
58 views

### Why the solid FEM problem can not be solved after constraining 3 degrees of freedom?

I write a simple MATLAB code for solving solid FEM problem. The problem looks like that (1) (2) x-------x | / | | / | | / | x-------x (3) (4) ...
11k views

### why is A*v+B*v faster than (A+B)*v?

$A$ and $B$ are $n \times n$ matrices and $v$ is a vector with $n$ elements. $Av$ has $\approx 2n^2$ flops and $A+B$ has $n^2$ flops. Following this logic, $(A+B)v$ should be faster than $Av+Bv$. Yet,...
81 views

### Is the similar subdivision of a delaunay mesh still delaunay?

I have a delaunay triangulation for a 2d box with say an airfoil inside. If I uniformly refine this mesh by subdividing each triangle in the mesh into 4 triangles by halving each edge, is the ...
28 views

### How to compute the gradient of T with Armadillo library [closed]

I am using the Armadillo library to solve a 3d heat conduction problem on 3d unstructured grid system,the gradient of the T field is determined by the least square method. I have created a matrix ...
49 views

### Is it possble to do this complex symbolic calculation with Matlab?

Sorry it's bit abrupt, but recently I am caught up in some symbolic calcualtion which is tedious and almost impossible with mere human hands, so just wondering is it possible to solve the double ...
5 views

### Change value of dependent sweep varietals

I am using Comsol to model a really hard problem. I am using the sweep for one variable (width), and as the problem state (Length=2*width). When I use the sweep the value of Length does not update. ...
669 views

### Example where autodiff works but symbolic differentiation will not?

According to the survey paper on autodiff (linked) Autodiff works on inputs that cannot be specified in closed form but can be described by a sequence of code, each component of which is ...
110 views

142 views

### How to compute numerical fluxes in the local discontinuous galerkin method for poisson equation 1D

Some days ago I began to study the local discontinuous galerkin (LDG) method, this is my first time working with a discontinuous method, so I decided to solve the poisson equation in 1D to learn the ...