All Questions

0
votes
1answer
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$: ...
0
votes
0answers
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 ...
0
votes
1answer
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 ...
0
votes
1answer
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-...
0
votes
1answer
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 ...
1
vote
1answer
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 ...
2
votes
1answer
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 ...
0
votes
0answers
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 (...
9
votes
3answers
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 ...
7
votes
1answer
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 ...
1
vote
1answer
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 ...
1
vote
2answers
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 ...
0
votes
0answers
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: ...
1
vote
1answer
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$ ...
2
votes
1answer
101 views

Poorly conditioned, easily evaluated sum for unit testing

I am looking for examples of poorly conditioned sums which can rapidly be evaluated, for the purposes of unit testing. I'm currently using the series representation for $\ln(2)$: $$ \sum_{n=1}^{\...
7
votes
1answer
170 views

Lack of quadratic convergence in Newton's method

It is well-known that Newton's method can converge quadratically, if initial guess is close enough and if the arising linear systems are solved accurately. I am applying Newton's method to highly ill-...
1
vote
1answer
89 views

Relation between conjugate gradient method and finite elements method

What is difference beetwen this two method? Are these methods far from each other or are these methods complement each other? Could you take an example?
0
votes
0answers
39 views

Correct order of convergence

I have a sequence of points which was obtained from an iterative algorithm, and I computed the order of convergence $p$ of the method using the formula $$ p \approx \frac{\log({\rm err}(k+2))-\log({\...
3
votes
1answer
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 ...
2
votes
0answers
40 views

Unusual boundary conditions on Matlab

I'm trying to solve the following PDE by Matlab, $$ u_t-\Delta u = 0, \quad \text{in}\quad \Omega\times (0,T) \tag{1} $$ $$ u_t-\Delta_\Gamma u + \partial_\nu u=0,\quad \text{on}\quad \Gamma\times(0,...
-1
votes
1answer
31 views

Tabulting potencial LAMMPS [closed]

I have a potential for a molecule which depends on (r, theta, phi), also at different part cell has different variable, is it possible to tabulate such potential in LAMMPS? Thanks for your help.
2
votes
1answer
131 views

Which C++ linear algebra library is probably the fastest on solving huge sparse [square matrix] linear system?

I am developing a 2D CFD solver for fluid-particle interaction. To solve Navier-Stokes equations on a grid of size $10000\times 10000$ cells (or >1 million cells), a large linear system $Ax=b$ with $A$...
0
votes
0answers
11 views

Finding Duplicate Pixel/Objects along Image seams

I have a seam of two images joined by merging algorithm that on occasion generates duplicated pixels/objects/artifacts on both sides of the seam. The images are large and currently the seams are ...
-1
votes
0answers
33 views

Can I solve a non-negative non-linear least squares problem by solving for the square root of my desired solution and squaring it?

I'm hoping to use the Gauss-Newton method to solve a non-linear least squares problem where the solution $\boldsymbol x$ must be non-negative. To do this can I instead solve for $\pm \sqrt{\...
1
vote
1answer
53 views

Correct weighting in least squares fitting

I am trying to fit some data points $d_i$ to a non-linear model function $m_i$, which depends on a number of fit parameters $f_k$ (I want to determine these) and also on some known, constant values $...
-1
votes
0answers
21 views

Is this linear programming formulation with indicator constraint correct?

I would like formulate a modified version of the multicommodity flow problem that for a flow $f$ the sum of all the weights $w_{ij}$ of the edges for which $x^f_{i,j} \gt 0$ should be less than $W^f$. ...
4
votes
1answer
82 views

Numerically find the nearest positive semi definite matrix to a symmetric matrix

I have a symmetric matrix $M$ which I want to numerically project onto the positive semi definite cone. To do so, I decompose it into $M = QDQ^T$ and transform all negative eigenvalues to zero. (...
-1
votes
0answers
36 views

Sign of arithmetic expression in 4 integer variables

I need to find the sign of this expression: $$ 2(a+4b)-(c+9d) $$ where $a$, $b$, $c$, and $d$ are integers such that $$ \begin{align} 0&\leq a\leq 6,\\ 0&\leq b\leq 3,\\ 0&\leq c\leq 3,\...
1
vote
0answers
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 ...
-1
votes
0answers
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 (...
-1
votes
0answers
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 ...
3
votes
0answers
78 views

WENO5 scheme in a staggered grid

I'm trying to use the finite-difference WENO scheme to solve the 2D density conservation law with axial symmetry (coordinates $r,z$): $\frac{\partial \rho}{\partial t}+\nabla \cdot (\rho \vec{v}) = \...
1
vote
0answers
55 views

Speeding up the solution of a large set of nonlinear algebraic equations in `sympy`

I have a quite large algebraic equation system to solve, the system is so large, I can't post the example here, so I am posting it to pastebin. The sympy.solve is ...
5
votes
1answer
88 views

Nullspace calculation of large matrix with rational numbers without round-off errors (exact)

I need to calculate a basis of the nullspace of large (up to a thousand columns and rows) matrices. For my application, it is very important that no round-off errors occur during the computation, so I ...
2
votes
0answers
76 views

Can I take advantage of a nearly banded A in AX=b?

I am working on a 1D drift-driffusion problem in a finite-difference (FD) approach. I hade 3 equations per node ($3N$ in total): electron continuity $E_i$, Poisson $P_i$, hole continuity $H_i$. With ...
-1
votes
0answers
13 views

Image Processing - 2D Convolution Time complexity (with filter)?

For processing of an image, what would be the time/space complexity for convolution? The number of operations required for performing 2D convolution? Now, if we add a separate filter, what would ...
-1
votes
0answers
50 views

DG discretisation for first order Helmholtz equation

I am trying to implement a DG scheme for a first order wave (Helmholtz) equation in Fenics. The problem is: find $(u,P)$ in $\Omega = [0,1] \times [0,1]$ unit square domain, such that $$ \frac{\...
0
votes
1answer
29 views

Langevin Thermostat and overdamped Langevin Equations

I'm having some difficulties understanding the Langevin thermostat (MD). In my notes, there is written that the Langevin equation is $$ m\dot{v} = F - m\gamma v + f_R, \tag{1} \label{1}$$ where $...
3
votes
1answer
119 views

Is this the correct way for solving coupled 1d PDEs using finite difference methods?

I am trying to solve the following coupled PDEs: $$C_e\frac{\partial u(x,t)}{\partial t} = k_{ed}\frac{\partial^2u(x,t)}{\partial^2x} - G_{el}(u(x,t) - v(x,t)) + S(x,t)$$ $$C_l\frac{\partial v(x,t)...
1
vote
0answers
25 views

Hydrogen-like wavefunction as starting guess for atomic solver?

I've been looking into radial solvers for quantum wave equations (Schroedinger and Dirac). In both cases, the suggestion seems to be to go with the "shooting method", with integration schemes of ...
0
votes
1answer
37 views

Formulate and solve a simple conic programs in cvxpy language [closed]

Let $r,\epsilon > 0$ and $a, b \in \mathbb R^n$ with $\|a\|_2 \le r$. Define $C(a) := \{x \in \mathbb R^p | \|x+a\|_2 \le r,\;\|x\|_\infty \le \epsilon\}$, and assume it is non-empty. Question (A)...
0
votes
1answer
61 views

Approximation of ODE solution using Taylor series methods

This is my first post on here, so please excuse mistakes if any. I am trying to plot out the difference between two ODE solvers based on Taylor series: 1st order acccurate: $x(t_0 + h) = x(t_0) + ...
0
votes
0answers
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 ...
0
votes
0answers
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 ...
3
votes
3answers
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=...
-1
votes
0answers
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 "...
2
votes
2answers
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 ...
2
votes
2answers
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, ...
1
vote
0answers
84 views

How to simulate water, falling under gravity, and impinging on a curved surface, which is kept/present in a domain, containing air?

TL;DR: How do I simulate a hole, at the bottom of a (full) water tank? I am attempting to simulate water, flowing out of a hole/slit, at the bottom of a tank (Water Domain) (under the influence of ...
1
vote
0answers
32 views

Computing a Flux Integral in Paraview

I am currently looking into post-processing of simulation data using Paraview. I would like to compute certain integrals of field quantities. As an example, consider the following surface integral of ...

15 30 50 per page