# All Questions

7,559 questions
34 views

### ISING2D with Mathematica. Searching a correct way to compute the heat capacity (mean values over several iterations)

I'm trying compute the heat capacity $C_v$ out of my simulation for the 2D-Ising model which is given by $C_v = \frac{\langle E^2 \rangle - \langle E \rangle^2}{T^2N^2}$ ($E$: Energy, $T$: ...
16 views

### Interface area with a simple VoF method

I am dealing with an high Reynolds high Weber number incompressible two phase flow. My numerical model for this kind of flow is a simple VoF, so I have a transport equation for the liquid volume ...
37 views

### Visualizing a trajectory in VMD

So, I've written a short python program simulating diffusion in 2D; in essence each particle is behaving like a random walker. The output is a 3D tensor, which for 4 particles and 10 timesteps, looks ...
50 views

### Debugging Newton-method used in a CG-approach

I am currently proof-checking my program, which is intended to use Newton's method for solving nonlinear equations, using a continuous galerkin approach. Thus, as first step I checked it using a time-...
111 views

### Heat diffusion - Is this the correct approach to include Newmann boundary conditions?

Thank you for looking at this problem. Is this the correct approach to include neumann boundary conditions? With this solution temperature is not correct, and there´s no diffusion. The model seems ...
38 views

### How to choose the parameters for a collision free comet trajectory

I implemented a simple simulation of a comet flying through space being deflected by the gravity of randomly generated planets for art purposes. My problem with that simulation is, that there are many ...
57 views

### Numerical integration of Fokker-Planck equation allowing for negative drift?

The Fokker-Planck equation (a.k.a Kolmogorov forward equation or Smoluchowski equation) describes the evolution of a probability density function and numerical integration of the FPE should conserve ...
154 views

### Convergence of lognormal survival MLE

I'm looking for someone to give me a hand with a calculus / max. likelihood problem & Python. I can't seem to get a MLE to converge, and I suspect it's because my gradient calculations are wrong (...
148 views

### What is the reason that LAPACK uses $\tau$ in QR decomposition (instead of normalizing the reflection vector)?

LAPACK's QR routine stores Q as Householder reflectors. It scales the reflection vector $v$ with $1/v_1$, so the first element of the result becomes $1$, so it doesn't have to be stored. And it stores ...
170 views

### Size of jump for piecewise discontinuous approximations

If one has a sufficiently smooth function $u$ that is approximated by a piecewise constant function $u_h=\Pi^0_h u$ on a mesh of cell size $h$ (where $\Pi^0_h$ is the $L_2$ projection onto the ...
71 views

### Node renumbering in a 2D mesh

I have a 2D domain which is discretized using Q4 elements. I have the nodal positions and the element connectivity matrix. I would now like to renumber the nodes in such a way that all the interior ...
81 views

### How I could calculate L2 norm of an unstructured grid?

I want to calculate L2 norm of a 3D unstructured grid to compare my simulation results in two different mesh sizes as coarse and fine. I read this answer and it seems in three-dimensional space, I ...
14 views

### Signal delay in phase interferometry? [migrated]

I want to write program for phase interferometry to understand how its work. For the beginning I generate signal, which arrives on two antennas with delay. Matlab code: ...
84 views

### How to generate a face list from vertices?

I have a little background in writing toy finite volume CFD codes. In 2D Cartesian scenarios, I typically take $x_{\min}$, $x_{\max}$, $y_{\min}$, $y_{\max}$, and the number of points in $x$ and $y$ ...
101 views

64 views

### Minimize a function with sparse Hessian

The problem I am trying to solve involves minimising a function with respect to a large number (probably 10,000+) of parameters. I can cheaply compute both its Jacobian and its Hessian. The Hessian is ...
40 views

32 views

### GMRES algorithm and Krylov base

I have a question about the precision of the GMRES algorith and its variation a s a function of the size of the Krylov subspace. I want to solve a Poisson equation using a spectral method. My problem ...
42 views

### Is my approach for this third order Eigenvalue BVP correct?

I (with help from a MSE user) used the following substitution to seperate variables in a second order linear PDE $$\theta_w = e^{-\beta_hx}F'(x)e^{-\beta_cy}G'(y)$$ The following two ODEs (...
42 views

### Self-Study: What is wrong with my Metropolis Monte Carlo integration implementation?

I am trying to integrate $e^{-x^2}$ from $0$ to $1$ using Metropolis sampling. While plain Monte Carlo integration gives the right result, Metropolis sampling grossly underestimates it. I have tried ...
78 views

23 views

### Determining the pseudo-time period of a system of $n$-pendulums via Kane's method in Python

We can use Kane's method to integrate the equations of motion for a system of $n$ pendulums with arbitrary masses and lengths (see derivation). In particular, if $(x_i,y_i)$ denotes the Cartesian ...
31 views

### In-exact line search

In my class notes, the author says: "If $f:\mathbb{R}^n \to \mathbb{R}$ is bounded below and $p_k$ is a descent direction and the $\alpha-\beta$ also known as Armijo-Goldstein condition is met then ...
115 views

### $H^1$-convergence rate of finite element method for Poisson equation, depending on element order

I wanted to verify my FEM-program by applying the method of manufactured solutions, while solving the Poisson equation in two dimensions using the continuous Galerkin method $$-\nabla^2u=f$$ with u=...
21 views

### How to model a hysteresis behavior using MILP on CPLEX?

The question is below: 1: y[t]=10,if x[t]>=2; 2: y[t]=-1,if x[t]<1; 3: y[t]=y[t-1],if 1<=x[t]<2. How to model the function in cplex using c++? Thank you very much! My model is added as "...
131 views

### Generate high n quantum harmonic oscillator states numerically

How can I generate the higher $n$ quantum harmonic oscillator wavefunction (in position space) numerically? Here, higher means around $n=500$, or say $n=2000$, where $n$ is the $n$th oscillator ...
171 views

### C standard for computational science

Which C standard should be used for computational science code ? Should we keep compatibility with C89/90/ANSI or jump to C99 or C11 ? Context: Code will use third-party : BLAS, LAPACK, MKL, ...