All Questions

Filter by
Sorted by
Tagged with
4
votes
1answer
36 views

Value of $\gamma$ in the H-infinity norm

Suppose I have the system: $$\dot{x} = Ax+Bu\\ y=Cx+Du$$ and the following Hamiltonian matrix: $$H=\begin{pmatrix} A & \frac{1}{2}B^TB\\ -CC^T&-A \end{pmatrix}$$ I want to find the ...
1
vote
0answers
39 views

Finite element lemma proof

I was curious if anyone could help or provide a reference for the proof to the following lemma Lemma: Let $P_{1}$ be the set of polynomials of the first degree and let $W = w(x) : w \in C([0,1]), ...
3
votes
1answer
460 views

Numerical Sensitivity in Density of States of Tight-binding model

I'm working with the tight-binding model, and I'm trying to learn the basics of how to compute the Density of States (DOS) $N(E)$ numerically. The DOS is given by $$N(E) = \frac{1}{N}\sum_k \delta(...
1
vote
0answers
23 views

Book Recommendation: Analysis and design of mechanistic models - such as pharmacokinetics or hydrology models

I have been looking at an interesting book "Pharmacokinetic-Pharmacodynamic Modeling and Simulation" by Peter Bonate on pharmacokinetic models: the models of how medical drugs work their way through ...
3
votes
1answer
65 views

Poisson image blending artifacts

I am trying to implement Poisson image blending as in the paper Poisson Image Editing. This is the task of filling in a masked region of an image by minimizing $$\min_f\int_\Omega \left | \nabla f - \...
2
votes
1answer
15 views

How To Interpret PCA Points Labeled With Specific Data Dimensions

I've done some PCA on my own, and am familiar with the basic concepts of how PCA components are calculated and applied. However, I'm working on a research project and am confused as to how to ...
0
votes
1answer
64 views

Implementing structured grid boundary conditions using NumPy arrays?

I am making a toy code in Python to solve the advection equation $$u_t + cu_x = 0$$ with, for example, periodic boundary conditions. Background information The numerical grid is specified like this: ...
2
votes
1answer
66 views

How to find a pair of divisors as close as possible to each other?

For a given integer $n\in\mathbb{N}^*$, I want to find a pair $(x,y)\in{\mathbb{N}^*}^2$ such that $x*y=n$ and $|y-x|$ is as small as possible. A naive algorithm I found is : ...
1
vote
1answer
46 views

Monotonicity preserving interpolant in 1D

I have a dataset $\{x_i, y_i\}_{i=0}^{n-1}$ where $x_0 < x_1 < \cdots x_{n-1}$ (not uniformly spaced), and, in addition $y_0 < y_1 < \cdots y_{n-1}$. So it feels natural to assume that $...
1
vote
1answer
49 views

Should the derivative of an array be calculated array by array or element by element in CFD codes?

I am making my own finite difference computational magnetohydrodynamic code in Fortran 90. Looking at other codes they appear to calculate for example their $x$-derivatives, bb of their variables, e.g....
1
vote
0answers
31 views

BicgStab is not able to solve while Jacobi or GaussSeidel Methods can

I am trying to solve the 2D laplace equation, $\frac{\partial^2 T}{\partial x^2} + \frac{\partial^2 T}{\partial y^2} = 0; \qquad 0 \lt x \lt 1, \quad0 \lt y \lt 1$ Subjected to the boundary ...
1
vote
1answer
69 views

Using LAPACK to compute $B^{-1}AB^{-T}$ for thin $B$

How can I use BLAS/LAPACK to compute $$ B^{-1}AB^{-T} $$ where $A\in\mathbb{R}^{n,n}$, $B\in\mathbb{R}^{m,n}$ is full rank matrix with $m>n$, and $B^{-1}y:=\arg \min_{x} \|Bx-y\|_{2}$. In theory, ...
0
votes
1answer
23 views

Dealing neighbor list in NVT Monte Carlo (MC) simulation

I'm making a NVT Monte Carlo (MC) simulation code with only short range interaction. I found many MC tutorial codes (usually Lennard-Jones system) in online. However, most of them are doing energy ...
2
votes
1answer
84 views

Efficiently finding binary vectors satisfying multiple conditions

I am trying to solve the following problem: Given a binary matrix $\mathbf{A} \in \{0,1\}^{m \times n}$ and a vector $\mathbf{b} \in \mathbb N^n$, does there exist a binary vector $\mathbf{c} \in \{...
2
votes
0answers
19 views

Riemann solvers for metastable phases

Most Riemann solvers I've come across can solve the Riemann problem only under certain conditions such as convexity of the equation of state. But what happens if the fluid enters a metastable state or ...
2
votes
1answer
50 views

Python-accessible industry-standard for unconstrained minimization that converges to machine precision?

I have an unconstrained minimization problem of many variables for which I know the gradient exactly. I turned to the conjugate gradient method contained in ...
0
votes
0answers
29 views

host vs nodes vs sockets vs thread vs processors vs cores in cluster computing [duplicate]

I am new to the computer cluster and I am so confused with these terms, could you please explain them? Regards, Vricc
3
votes
1answer
47 views

Reconstructing statistics of $x\otimes y$ from E[XX'], E[YY'] and E[XY']

I'm looking at random vectors $z$ of size $d^2$ which can be written as $z=x\otimes y$ where $x$,$y$ are random vectors in $\mathbb{R}^d$ with following second moments known -- $E[XX']$, $E[YY']$ and $...
0
votes
0answers
17 views

How to start coding for posterior inference

I am trying to implement the model given in http://proceedings.mlr.press/v84/andersen18a/andersen18a.pdf where they have used mean-field variational inference for posterior inference, but I want to ...
4
votes
2answers
400 views

overflow upper incomplete gamma function

I want to calculate the following equation: $$\frac{\theta \Gamma \left(\kappa+1,\frac{o}{\theta }\right)-o \Gamma \left(\kappa,\frac{o}{\theta }\right)}{\Gamma (\kappa)}+o+s$$ with $s>0, o>0, ...
1
vote
0answers
46 views

Numerical Method for Equation System of two depending Equation Systems

I am searching a solution method for the following equation system of equation systems: Let $A \in \mathbb{R}^{n \times n}$ be an invertible Matrix, $f, b_1, b_2 \in\mathbb{R}^n$ given vectors and $ ...
1
vote
2answers
47 views

Numerical integral with symbolic integral in exponent

Many times in fourier approximation we come across integrals such as $$\int_0^1 e^{-\gamma\int_0^xu_0(\eta)d\eta}dx$$ where $\gamma$ is a constant and the data for $u_0$ is provided as a discretely ...
1
vote
1answer
77 views

How to compute turbulent energy cascade

I need to compute the kinetic energy cascade using a finite volume solution in an equally spaced grid. I wonder if it is more correct to first compute the kinetic energy in the space (or time) domain, ...
2
votes
1answer
99 views

Is it possible to remesh with gmsh?

I am currently working on remeshers for my simulations (academic purpose) and I try to find a method to remesh previous meshes using Gmsh. The first mesh (normalMesh.msh) was created using a .geo file ...
1
vote
2answers
40 views

Evaluation of slope at iteration ith - Newton-Raphson method

I'd like to know how Ansys computes the slope (=stiffness matrix) at point x1 in figure. I'm studying the way in which Ansys uses the Newton-Raphson method when there are nonlinearities. In the slide ...
13
votes
3answers
5k views

Memory usage in fortran when using an array of derived type with pointer

In this sample program I'm doing the same thing (at least I think so) in two different ways. I'm running this on my Linux pc and monitoring the memory usage with top. Using gfortran I find that in the ...
1
vote
1answer
114 views

Minimize cost with Levenberg-Marquart method

I want to minimize a cost function of the form, $$ \min_{q,t}\left(q^T\left(\mathcal A + \mathcal B\right)q + t^T\mathcal C t+\delta t+\varepsilon Q(q)^TW(q)t+\lambda\left(1-q^Tq\right)^2\right) $$ ...
3
votes
0answers
38 views

Is it possible to retain sets (physical tags) after remeshing the model in Gmsh?

I am currently working on a remeshing algorithm for Abaqus using Gmsh as part of my Bachelors thesis and I seem to be stuck at some point. I am able to remesh .geo and .msh files using the script ...
6
votes
1answer
102 views

Computing square root of diag(u)-uu'?

I need an efficient way to take square root of a matrix which is a sum of diagonal matrix and rank-1 matrix. More specifically it's the following matrix $$A=D-uu'=\text{diag}(u)-uu'$$ Where entries ...
2
votes
1answer
199 views

Which SciPy nonlinear solver when Jacobian is analytically known and sparse?

I have a nonlinear function fun with n inputs and n outputs. I also have a function jac which calculates the Jacobian, which is ...
3
votes
1answer
52 views

Bounding error of float32 matrix multiplication

Some numerical debugging led me to the minimal example below. I'm observing relative error of 0.75 on individual elements. Is there a way to estimate/bound this error without resorting to higher ...
0
votes
1answer
35 views

R function or package for carrying out maximum likelihood techniques in random effect models

I am applying optim() function in R to obtain maximum likelihood estimates of the fixed effects and random effects in a model with bivariate random effects. The ...
0
votes
1answer
106 views

seminorm of solutions of Laplace equation

If $u_1$ and $u_2$ are solutions of (weak-form) Laplace equation on a connected domain $\Omega$, with Dirichlet boundary values $u_{\partial\Omega, 1}$ and $u_{\partial\Omega, 2}$, respectively. If $$...
0
votes
1answer
116 views

Converting ROOT Tree to HDF5

I have a TTree in ROOT with 1000 events and 15 variables associated to each of them. I would like to convert this in its entirety to an hdf5 dataset. How do I organise my data in HDF5 Groups such that ...
1
vote
0answers
38 views

Compute the function between two images

Take an image $f$ with some characters on it (below, hjFu3). Let's apply a filter $h$ on it to obtain a second image $g$ where the text is not visible. Is there a way to compute what kind of filter $...
2
votes
1answer
44 views

Passing data as arguments in ODE45

I need to import data from file in order to describe the structure of a network. I used the following: weights = readtable('weights192.txt'); W = weights{:,:}; ...
0
votes
0answers
42 views

Problems with function in python

I'm doing homework, which I have to build a code that resolves a system of linear equations. But I'm having a problem. I have to use a matrix and a column matrix in the 3 functions. But, when I do a ...
1
vote
1answer
51 views

How to avoid unnecessary checks when inverting this LU decomposition

Background for the question I am currently working on a Matlab code in which the systems of linear equations $Ax_1 = b_1$, $Ax_2 = b_2$, ... have to be solved. As the matrix $A$ is constant during ...
2
votes
1answer
53 views

Givens rotation vs 2x2 Householder reflection

The usual story of Givens rotations vs Householder reflections is that Householder reflections are better if you want to map a long vector to $e_1$, while Givens is better if you want to map a 2-...
1
vote
0answers
28 views

How to avoid gsl root finder evaluate function outside its domain

When I use the newton's method or hybrid solver in the GSL package to deal with 1-D or multidimensional root solving problems, the code frequently crashes when the solver requests function value ...
0
votes
0answers
28 views

GNU Octave - display numeric approximation of expression [migrated]

I have a derivative of a function, and Octave displays it as an expression: 10____ ⎛ 10 ⎞ ╲╱ 11 ⋅⎜- ── + log(11)⎟ ⎝ 11 ⎠ This is ...
1
vote
1answer
225 views

Reformulate a strictly convex QP problem containing absolute value term

Can the following strictly convex optimization problem be reformulated into a standard form that is also a strictly convex problem? $$\begin{align} &\text{Minimize }\frac{1}{2} x^T Q x + a^T x + ...
3
votes
2answers
90 views

When Using Taylor Expansion for a Simple Function is a better way to compute?

Let's say that we have the function $$f(x) = 1- \frac{\sqrt{1 + x^2}}{1 + x^2/2}$$ for small $x$. What I am asking is the following: I am going to solve this function numerically for $10^{-10}<...
1
vote
1answer
61 views

Problem about rotation matrix of elastic matrix

I have a transformation matrix $K$ which transfers elastic constitutive matrix $C$ between two coordinate systems. According to textbooks such as T.C.T. Ting's "Anisotropic Elasticity", the elastic ...
22
votes
10answers
5k views

Which algorithm is more accurate for computing the sum of a sorted array of numbers?

Given is an increasing finite sequence of positive numbers $z_{1} ,z_{2},.....z_{n}$. Which of the following two algorithms is better for computing the sum of the numbers? ...
1
vote
0answers
43 views

Implementing adaptive timestepping in CUDA

I want to implement a CUDA solver for the 2D shallow water equations using adaptive timestepping with a Courant number fixed by the user. The algorithm pseudocode looks something like this: ...
2
votes
0answers
36 views

Monte Carlo domain not-so-dense

I already posted it on Physics SE, but maybe this is a better place: I have a 5D integral being calculated with a Monte Carlo uniform random sampling. The issue is that the region of integration is ...
3
votes
1answer
50 views

Weighted QR Implementation

Say I want a QR decomposition of matrix $A$, where orthogonality of $Q$ is with respect to a generic non-degenerate positive-definite bilinear form $\phi$ (in my case, $\phi$ is "defined" by a finite-...
11
votes
1answer
360 views

How should errors be reported in scientific libraries?

There are many philosophies in different software engineering disciplines about how libraries should cope with errors or other exceptional conditions. A few of the ones I've seen: Return an error ...
4
votes
3answers
91 views

Maximize a function of an orthogonal matrix

I'm trying to write up a small code that, given a set of normal vibrational modes for a molecule, will convert them to localized vibrational modes. To do this I'm following the procedure from J. Chem. ...

15 30 50 per page