instruction
stringlengths
43
28.1k
I have experience with classical linear algebra packages in C++ like Eigen, Blaze, etc. I have never wrote my own PetSC back-end solver but I used/modified several of them. In a new project I would like to use Tpetra with CUDA acceleration (by kokkos?) for a dense linear algebra problem. The initial version of my code ...
Given the Algebratic Riccati Equation (ARE) $$A^T X + XA + XRX + Q = 0$$ where $A,R,Q \in \mathbb R^{n \times n}$, we are interested in the matrix $X$ that solves this equation. If we define the $2n \times 2n$ Hamiltonian matrix $$H = \begin{bmatrix} A & R \\ -Q & -A^T\end{bmatrix}$$ and let $X = X_2 X_1^{-1}$, then $H...
I have just learned Geant4 and recently I tried to simulate photons emitted into lead. After I collected the data and figured out the transmission of photons. I found my data is bigger than the transmission data from XCOM. Here's my PhysicsLists void PhysicsList::ConstructParticle() { G4BosonConstructor pBosonCons...
I am trying to use the Kramers-Kronig algorithm to transform the real and imaginary contributions to the anomalous scattering factor from a diffraction anomalous fine structure (DAFS) experiment. I have fit a smooth curve to my experimental data using the lmfit package, and the following function: def intensity(en, phi...
I am trying to solve a coupled system of ODE's using the solve_ivp function from scipy. The general form of the equation is given via $$\dot{y}(t) = M(t)y(t).$$ The time dependence of matrix is basically sourced by a sum of weighted cosines, and each term (should) be shifted by some random phase factor. The input signa...
I am looking up celestial navigation, and according to https://youtu.be/-ARXW8InStY?t=3320 a specific sun angle reading (sun angle above the horizon) will be the same on a small-circle with the centre point where the sun is at its zenith on earth. I would like to convince myself about that using Stellarium, but I would...
I just for the first time saw the function softmax() in this SO answer to How do I use a minimization function in scipy with constraints and was intrigued. Another way of weighting variables where the sum of the weights is constrained to equal 1, is to use minimize with no constraints, initialize with near-zero values...
I've recently started looking into writing a finite-differences-based solver for the Poisson equation of the form $$\nabla\left(\varepsilon\nabla\varphi\right)=\rho$$ in 2D for arbitrary geometries (some additional details can be found here). However, I've soon discovered that upon imposing pure Neumann boundaries the ...
I have a problem that consists of a linear hyperbolic differential equation with some boundary and initial conditions which leads after discretization in space using finite elements to the following second-order system: \begin{equation} \boldsymbol M \ddot {\boldsymbol d} + \boldsymbol C \dot {\boldsymbol d} + \boldsym...
Given the discrete Lyapunov equation $$AXA^T - X + Q = 0$$ how can I solve for $X$ as a function of the eigenvectors of some matrix $H$? More precisely, in the case of the continuous Lyapunov equation $$AX + XA^T + Q = 0$$ This equation can be re-written as \begin{align} AX + XA^T + Q &= 0 \\ \begin{bmatrix} X & -I\end...
I am trying to write a code for 9 point discrete laplacian. I would like to write a matrix and solve the linear system $AU=F$ with gradient conjugate method. I wrote the matrix this way I=speye(M-1,M-1); E=sparse(2:M-1,1:M-2,1,M-1,M-1);%matrice con 1 sulla sotto diagonale T=E+E'; B=-1/6*(T+4*I); D=1/3*(2*T-10*I); A=(-k...
I would like to collect some test-problems for nonlinear hyperbolic PDEs (Euler Equations, Shallow Water Equations, Ideal MHD, Acoustic Perturbation, ...) for which analytical solutions are known. A famous example of this is the isentropic vortex advection by Shu for the 2D Euler equations. For the Euler equations, som...
I was trying to understand more in detail how a blocking MPI all to all really work. Of course, the actual all to all traffic is pretty straightforward, what I can't understand is how it is able to "keep" blocking until the collective is done. I currently have two theories: For each rank the call is blocking until it ...
When using the backward and forward Euler methods to solve a certain stiff differential equation, what criteria does one look at before drawing the conclusion that one is more stable than the other?
I am trying to numerically solve a differential equation but I am having trouble getting the convergence test to run properly. The problem is as follows: Consider an ODE $$y'(t) \enspace = \enspace f(t,y) \quad , \qquad y(0) \enspace = \enspace y_0 \quad . \tag{1}$$ Let now $y^{h}$ be a numerical solution to $(1)$ wit...
I am currently working on writing a MATLAB code for running a finite element simulation of a hyperelastic material in 2D. Since I am building this simulation as a part of a fluid-structure interaction analysis, the 2D assumption is usually carried out using plane strain conditions. I started from Kim's textbook since h...
My colleague and I are trying to study the three-body problem, with different integration schemes, starting from the two-body problem. We implemented the symplectic Euler scheme and the Runge–Kutta 4th order in C++, and the trajectories obtained are the following. As we can see, they are almost elliptical with Euler ...
I am going to solve this advection equation regarding the flow simulation of an energy tower \begin{equation} Y_t+ v(t) Y_x =0 \end{equation} with the following boundary conditions which depend on the direction of the flow \begin{align} Y(x,0) = Y_0 \end{align} And \begin{align} Y(0,t) = Y_{bot} \text{ if }v(t)>0 \\ ...
I've noticed that a fairly significant number of cycles in one of my programs are being consumed by the logistic function: $$f(x)=\frac{1}{1+e^{-x}}$$ Is there a good approximation I can use to reduce the cost of this function?
Suppose I have 4 processes and each process has $n_i, i=0,1,2,3$ elements. In particular, with rank $0$, we have loc indices list $[0,1,\ldots, n_{0}-1]$ and $1$, we have loc indices list $[0,1,\ldots, n_{1}-1]$ and so on. Now, I want a global list that is a combination of the above local indices. And it should look a...
Consider the following linear PDE: $$\nabla_q V(q) - M_d(q)M^{-1}(q)\nabla_q V_d(q) = 0,$$ where $V(q)$ and $M(q)$ are known and $M_d(q)$ is a grey box function (e.x., $M_d(q)$ is fitted using a neural network). The goal is to find $V_d(q)$. I am able to find a solution for $V_d(q)$ using physics informed neural networ...
This specific question was raised from optimizing parameters of column experiments in the hydrogeological context. I want to optimize a parameter of interest (in this case $D$), based on experimental data (which is a breakthrough curve, an array of $c$ at the efflux-end of the column with corresponding $t$) and some fo...
I am trying to numerically integrate a differential equation using scipy.integrate.RK45 and/or scipy.integrate.LSODA. Now, I am trying to fix the integration step sizes of both solvers. This, however, does not work out. I have tried the following: 1.) Setting the "h_abs" method to my desired step size BEFORE every call...
I am trying to implement a cloth simulation in c++ using verlet integration and I'm getting some odd issues that I can't seem to explain, the points in the cloth seem to fly around and have weird behavior. to investigate I tried to simply place 2 dots next to each other horizontally with a single constraint and to pin ...
I have a cubic lattice $L_1\times L_2 \times L_3$ with the periodic boundary condition. I have to construct the Laplacian matrix in the sparse format. My matlab code is like this L = 30; dim = L^3; COO1 = zeros(2, dim*6); ss = 0; for s1 = 0: L-1 for s2 = 0: L-1 for s3 = 0: L-1 ss = ss + 1; ...
I meet a problem when I try to develop an iterative method for discrete inverse problem $$Ax+e=b$$ where $A\in\mathbb{R}^{m\times n}$ and $e$ is a noise. I want to approximate the true solution $x_{true}$ by using a nonlinear regularization term $R(x)$. Since $m,n$ is very large, the optimal regularization parameter is...
I try to detect interference fringes in a bunch of pictures. I projected on one axis, and I was able to detekt the peaks that indicate one of the fringes. So now I'm having a list with points (e.g. $(100, 165, 220, 275, 341, 461, 519)$. In the choosen example, the sought for periodicity is 60, the points scatter around...
I have not found any relevant information in the literature on the following rather simple problem: How to combine (geometric) multigrid preconditioned conjugate gradient (MGPCG) with an additional jacobi preconditioner ? Background: Large (symmetric, diagonally dominant) linear system A*x=b arising from discretized in...
For the sake of the rest of the question, I'm interested in the porous medium equation $$S\frac{\partial\phi}{\partial t} = \nabla\cdot K\phi\,\nabla\phi$$ where $S$ and $K$ are spatially-variable coefficients and $\phi$ (the hydraulic head) is the field to be solved for. This is a parabolic PDE, but it's degenerate si...
I am looking to compute the derivative of the following expression: $$\frac{\partial}{\partial X}\mathrm{tr}\left[A\exp(X)\right]$$ where $A$ is both a symmetrical and positive-definite matrix and $X$ is a symmetrical matrix. As a result, $\exp(X)$ is symmetrical and definite-positive. Just as a reminder, the matrix ex...
In many cases, an algorithm can be designed and implemented to prove/disprove a mathematical axiom, but could it be accepted as proof or refutation by rigorous mathematicians?
(This is repost of a question first asked on Mathematics. Hopefully there are more people here who have a copy of Golub and Van Loan to hand) In the 4th edition of "Matrix Computations", Golub and Van Loan present "Algorithm 5.1.1 (Householder Vector)". The first couple of lines (translated into MATLAB-syntax) read: m ...
I tried to solve a simple Kepler problem numerically. I have discrete time steps, a starting position $(x_0,y_0)$ and starting velocity $(u_0, v_0)$. I used this iteration by calculating the forces and applying Newton's law: $$F = k/r^2 = k/(x^2+y^2) $$ $$F_x = F \cdot x/\sqrt{x^2+y^2}$$ $$F_y = F \cdot y/\sqrt{x^2+y^2...
In my research on topology optimization of fluid-structure interaction problems (2D), I am using a geometrically nonlinear model to represent the structure. Body/surface forces are extracted from the fluid solver and applied to the structure under plane strain conditions. I am facing a problem with severe, yet localize...
I tried to solve a simple Kepler Problem numerically. I have discrete time steps, a starting position $(x_0,y_0)$ and starting velocity $(u_0, v_0)$. I used this iteration by calculating the forces and apply Newton's law: $$u_{i+1} = u_{i}+ F_x/m \cdot \Delta t$$ $$v_{i+1} = v_{i}+ F_y/m \cdot \Delta t$$ $$x_{i+1} = x_...
I am going to model the moisture air inside an energy tower, therefore. I formulated the following equation to calculate the fraction of water vapor, Y in the moist air, where $\rho_w$ is the water vapor density,$\rho$ is the total density $T$ is the temperature, $R_a, R_w$ are the gas constant in dry air aid water vap...
Once a method is implemented in a computer program, then does learning the theory become less useful use of time? This has confused me. I used to view that all things should be studied from first principles, but lately I've thought that this might well be uneconomical. For example, consider FreeFEM or something. Once i...
CSV (even though once opened it does not contain a traditional CSV format I think it contains JSON data)[![1], when I try to open it as a TXT file I got this as shown in the first screenshot. When I open it in Excel sheet I got this as shown in second screenshot As you may see in a better view (TXT file) I want to conv...
I'm trying to build a DNS so simulate non-Newtonian turbulent channel flow using the Lattice Boltzmann Method. Most of the papers I use initialise the system using the analytical solution of the laminar flow (which describes a parabolic flow profile in the flow direction) and ad divergent free random fluctuations to it...
I have a functional $S$, $$S = \int_{x_0}^{x_b} dx \frac{1}{z(x)^d} \sqrt{1 + \frac{z'(x)^2}{f(z)}}, \qquad f(z) = 1-\left(\frac{z(x)}{z_h}\right)^{d+1} $$ where $d=3$ is the dimension and $z_h$ is some constant. We can solve the equation of motion through the Euler-Lagrange equation which is a nonlinear second-order d...
By reading the CVX users' guide, I frequently came across with the term "atom library", which I suppose to be a set of functions that one must use to construct mathematical expressions on solvers. But this definition is not clear to me, let alone how the atom library relates with the DCP ruleset.
I am currently dealing with exponential decay (of muons). The PDF is the following: https://wikimedia.org/api/rest_v1/media/math/render/svg/fdacadb747bac9932ffd02ee35cf3cbd0bc0b4c8 And I am told that mouns have a theoretical mean lifetime $\tau=2$. Also lifetime below $tmin=1$ or above $tmax=10$ is not possible, becaus...
I am trying to reformulate this optimization problem in order to get a DCP-complaint expression on Julia (I am using the Conjex.jl package) $$ \text{Minimize}\;\;\; \mid\log(x)\mid $$ The code p = Variable() f = abs(log(p)) Prompts to a warning WARNING: Expression not DCP compliant. Trying to solve non-DCP compliant ...
There exists a FFT-based method to solve the poisson equation in inhomogeneous Dirichlet boundary condition using the sine-transform. For example, Which fourier series is needed to solve a 2D poisson problem with mixed boundary conditions using Fast Fourier Transform? I expect similar approach could be applied to Schro...
Whilst googling I see reverse mode automatic differentiation (AD) tends to be used when optimising neural networks. Would it not be better to use forward mode and treat your input as a single variable, then use matrix calculus to optimize the weights. For example: $$u_{1} = x$$ $$u_{2} = W u_{1}$$ $$u_{3} = \sigma(u_2)...
I have a nonlinear boundary ODE, $$y'' + 3 y y' = 0, \qquad y(0) = 0, y(2)=1 $$ I want to solve this using the finite-difference method. I obtained the result for the data set of $y(x)$ (including the boundary points), $$(y_0,y_1,y_2,y_3,y_4,y_5,y_6,y_7,y_8,y_9,y_{10}) = (0, 0.318993138, 0.581636081, 0.7641886486, 0.87...
Given a list of points that were randomly generated around two lines, find two new lines that match the original lines as closely as possible. Here's the function definition: getLinesOfBestFit(x: numpy.array, y: numpy.array) -> Tuple[Line, Line] Line = namedtuple('Line', [('m', float), ('b', float)]) I saw that there...
Almost all FEM libraries are good enough, but I want to start with a FEM package and stick to it for some time. Instead of trying all of them, or going with what everyone else is using, I want to benefit from other user's experiences and know: What are the pros and cons of the FEM libraries you have experience with? H...
I am trying to find the solutions for a probability density $p(x,t)$, governed by, $$ \frac{\partial p(x,t)}{\partial t} =\int_{-\infty}^\infty dx' \; \Lambda(x-x')\frac{\partial^2 p(x',t)}{\partial x'^2} $$ for any function $\Lambda(x)$, which can even be given numerically.
The algorithm for the inverse power iteration works as following : \begin{align} &v^{(0)} =\text{ some vector with }\|v^{(0)}\|=1\\ &\text{for }k = 1, 2, \ldots\\ &\qquad\text{Solve } (A - \mu I)w = v^{(k-1)}\text{ for }w\\ &\qquad v^{(k)}= w/\|w\|\\ &\qquad \lambda^{(k)} = (v^{(k)})^TAv^{(k)}\\ \end{align} However, If...
I try to solve the steady-Stokes equation numerically on , that is \begin{aligned} -\nabla \cdot \mathbb{T}(\mathbf{u}, p) & =\mathbf{f} \quad \text { on } \Omega=[0,1]*[-0.25,0], \\ \nabla \cdot \mathbf{u} & =0 \quad \text { in } \Omega, \\ u_1 & =e^{-y} \text { on } x=0, \\ u_1 & =y^2+e^{-y} \text { on } x=1, \\ u_1 ...
Assume we want to solve the Poisson eq. with the FEM on some Domain $\Omega$, i.e. $$\begin{cases} -\Delta u = f, \; \Omega\\ u = 0, \; \partial \Omega \end{cases}$$ For the sake of the discussion let $\Omega = [0,1] \subset \mathbb {R}$. Let $\Omega_h := \{x_0 =0, \dots, x_N =1 \}$ be some vertices of the discrete mes...
The Setup Using finite differences to discretize the 2d diffusion equation $$\partial_tu=\partial_x\left(A\partial_xu+B\partial_yu\right)+\partial_y\left(B\partial_xu+C\partial_yu\right)$$ we get a block-tridiagonal matrix ($n$ by $n$ blocks), in which each block is a tridiagonal ($m$ by $m$) matrix, with ($x$,$y$ depe...
the equation is $$ \left\{\begin{array}{l} -\nabla \cdot \mathbb{T}(\mathbf{u}, p)=\mathbf{f} \text { in } \Omega, \\ \nabla \cdot \mathbf{u}=0 \text { in } \Omega, \\ \mathbf{u}=\mathbf{g} \text { on } \partial \Omega . \end{array}\right. $$ where $$ \mathbf{u}(x, y)=\left(u_1, u_2\right)^t, \mathbf{g}(x, y)=\left(g_1...
I have two values $a$ and $b$ where $a \ge 0$ and $b \ge 0$ and I have to calculate the formula below. $$ \frac{1}{2}\int_0^1\text{abs}\left[\left( \frac{p_i^{(a - 1)} \times (1 - p_i)^{(b - 1)}}{\beta(a,b)} \right)- 1\right] dp_i $$ I have to calculate above value. I am facing below error while doing that. ... My equ...
Suppose $\mathbf{u}^1\in\mathbb{R}^n$ is an unknown and $\mu^1\in\mathbb{R}$ is a known parameter. Suppose we have solved the non-linear system of equation for $\mathbf{u}^1$ using Newton's iterations. $$ \mathcal{N}(\mathbf{u}^1;\mu^1)=0 $$ Using $\mathbf{u}^1$ as an initial guess for the Newton iterations, it is poss...
I have the following 1D (in space, that is) system of equations I would like to solve: \begin{equation} \rho_{fs}\frac{\partial x_{fs}}{\partial t} = h_m\left(W_a - W_{fs}\right) - D_{eff}\left(\frac{\partial \rho_v(T_{fr})}{\partial x} \right) \end{equation} \begin{equation} \rho_{fr}c_{p,fr}\frac{\partial T}...
I have a nonlinear 2nd order boundary value differential equation where I used finite-difference method (central finite-difference) to solve it. $$z''(x)-\frac{\frac{1}{100} z(x)^4 \left(2 z'(x)^2+12\right)-600 \left(z'(x)^2+1\right)-\frac{3 z(x)^8}{500000}}{20 z(x) \left(10-\frac{z(x)^4}{1000}\right)}=0$$ Boundary con...
My question may be very stupid, and trivial, but looking forward to some suggestions - As a visualization let's consider a rectangle with four vertices represented by [1,2,3,4]. Now I want to find a triplet of numbers from them like (1, 2, 3). ly = [1,2,3,4] triplets = [] for i in ly: for j in ly: for k in ...
Does anyone have any resources I could follow that explains how to compute the Nth derivative using both forward and backward autodiff I understand how to compute the first derivatives Any assistance would be appreciated thanks Edit: Could I compute the derivative normally then pass those values through the autodiff eq...
Consider the following expression: $$f(t) = B+\sum_{k=1}^{N} A_k\cos(\omega_kt)$$ where $A$ and $B$ are known. the frequencies are also known but are not multiples of a fundamental frequency. However, they are written this way (if there is any use in this information): $$\omega_k = a_k\alpha+b_k$$ with $a,b \in \mathbb...
This is related to my previous question How can I express the solution to a discrete Lyapunov equation as an eigenvalue problem?. Given the algebraic Riccati equation (ARE) $$A^T X + XA + XRX + Q = 0$$ The solution $X \in \mathbb R^{n \times n}$ that satisfies this equation is $X = X_2X_1^{-1}$, where $\begin{bmatrix} ...
I am solving a 1D diffusion-type equation with the finite-difference Crank-Nicolson (CN) scheme, and I need to densify the spatial grid around the central point. One could change the spatial variable and re-derive the whole equation in terms of the new variable. Alternatively, in principle it should be possible to do s...
I am solving a 1D diffusion-type equation with the finite-difference Crank-Nicolson (CN) scheme, and I need to densify the spatial grid around the central point. One could change the spatial variable and re-derive the whole equation in terms of the new variable. Alternatively, in principle it should be possible to do s...
It seems that FEMs are never seen to implement time discretization. Is time discretization via FEMs to solve ODEs ever possible?
I'm trying to do FEM for a very basic version of the linear full Stokes equations in two dimensions. Say we are working in the grid $[0,1]\times[0,1]$ in the $xy-$plane. To solve an FEM problem for a scalar function $u(x,y)$ in the past, I have used the 2D FEM basis function definition $\psi_{ab}(x,y) = \phi_{a}(x)\phi...
I am looking for Finite Volume Software that employs a method-of-lines like approach by constructing from the hyperbolic PDE of form $$\partial_t \boldsymbol u(t,\boldsymbol x) + \nabla \cdot \boldsymbol f\big(\boldsymbol u(t,\boldsymbol x)\big) = \boldsymbol 0 \tag{1} $$ the semidiscretized ODE $$ \frac{d }{d t} \bold...
Are there any open source implementations of the medial axis transform for vector shapes? I have searched without finding any useful results. It seems that CGAL library doesn't have it implemented nor the deal.ii library. Are there any impelementation? Note: Some examples of shapes I am interested in: Polygons with ho...
I have a problem where I heavily need to restrict the number of points at which I sample a function based on the values of a different function. I have two functions: $f:{\mathbb{R}\times [0,\infty)\times[0,\infty) }\rightarrow\mathbb{R}$, which is a probability density, generated on a set of data, using Gaussian kern...
The signed volume of the triangle formed by the points $p, q, r$ in the plane is defined to be $$\text{volume}(p, q, r) \equiv \det\left[\begin{matrix}q_1 - p_1 & r_1 - p_1 \\ q_2 - p_2 & r_2 - p_2\end{matrix}\right].\tag{1} \label{eq:1}$$ Whether the signed volume is positive, negative, or zero tells you if the input ...
As far as I understand there are two definitions of the complex inner product: $$(a,b) = b^H a$$ and $$(a,b) = a^H b$$ I know some linear algebra libraries such as BLAS and Eigen uses the second one. However, I've seen some papers, such as this one, that use the first one. I would like to know if using one instead of t...
I am currently adopting a Newmark algorithm, for which the system of equation is $$(M+{\beta}{\Delta}t^2{K}){d_i}=\beta{\Delta}t^2{F_i}+Md_{i-1}+{\Delta}tM\dot{d}_{i-1}+{\Delta}t^2M\left(\frac{1}{2}-\beta\right)\ddot{d}_{i-1}$$ Say I solve the problem for a given time step ${\Delta}t$ and find $d_{i}$. If I want to fin...
I am solving an L1 regularized least squares of the form like: $$ \arg \min_{\boldsymbol{x}} \frac{1}{2} {\left\| A \boldsymbol{x} - \boldsymbol{y} \right\|}_{2}^{2} + \lambda {\left\| \boldsymbol{x} \right\|}_{1} $$ I saw that for the L2 norm case there are several methods to obtain the magnitude of $\lambda$ as seen ...
I am working on tomographic image reconstruction (radar regime) of the dielectric properties of objects. As part of my work, I have programmed a ray tracer. This ray tracer is, in a way, purely "analytical" in that rays are propagated from their current location to the next intersection with a surface of an object or t...
The numerical results may be like this:
I am interpolating a 2D dataset on a hemisphere, and I am currently using scipy.Rbf that I like for its simplicity. I am defining the norm of the interpolator with the haversine formula in order to respect the fact that I am on a hemisphere, and doing a cubic interpolation in order to have a $C^2$ function at the end, ...
Most FEM texts or tutorials apply FEMs on diffusion equations where the 2nd spatial derivative is integrated by parts during weak formulation. For convection diffusion equations, there is also a first spatial derivative term. I saw an example of solving the convection diffusion equation by a FEM where only the second s...
What is the space complexity of a semidefinite program (SDP)? What is the answer to the same question for convex optimization problems in general?
I am looking for an algorithm to select the largest subset of $M$ points from a set of $N$ points ($M < N$) such that no point is within a certain minimal distance d to any other point in $M$? I assume the points are in 3D space. I could exhaustively try every combination but I am wondering if there is a better method....
For my research, I need to evaluate the density of a random vector $\boldsymbol{X} \in \mathbb{R}^p$ using the multivariate inversion formula. Let the density function of $\boldsymbol{X}$ be $f (\boldsymbol{x})$. If the characteristic function of $\boldsymbol{X}$ is given by $$ \phi(\boldsymbol{t}) = \int_{-\infty}^{\i...
I am trying to implement the iTEBD algorithm for the $PXP$ model, i.e, the hamiltonian is $$H = \sum_iP_{i-1}X_iP_{i+1}.$$ Here $P$ is the projector onto the ground state and $X$ is the usual pauli x matrix. I aim to time evolve a certain initial state and record certain observables. To do so, I initialized my iMPS (in...
I am solving an initial value problem using solve_ivp. The problem consists of computing the concentration profile of a set of reactions over time, given the initial concentrations and some of the reaction rate parameters. Furthermore, I have some experimental data of those concentration profiles at different temperatu...
I want to perform monte carlo simulation on a honeycomb lattice. Can someone please help me on how to define a matrix for these interactions and how many terms there will be while sampling the configuration? A honeycomb lattice has 3 first nearest-neighbors, 6 second nearest-neighbors and 3 third nearest-neighbors.
If $u_t+a \cdot u_x=0$ under a periodic boundary condition (to mimic an infinite domain) is solved by Discontinuous Galerkin (DG), how to implement periodic boundary condition and the other details in DG?
I am trying to solve the following complex-valued matrix differential equation backwards (i.e. not starting at $r=0$, but rather at $r > 0$): $F'' = 2ikF' + VF$. Here $F=F(r)$ and $V=V(r)$ are 2x2 matrices. $F$ can have complex entries, $V$ cannot. The boundary conditions are $\lim_{r \to \infty} F(r) = \mathbb{1}_2$ ...
I have solved the Time Independent Schrodinger Equation using the Numerov method and diagonalizing the Hamiltonian, in 1 - 3 dimensions. I suppose I could time-evolve it by multiplying every element in it by $e^{\frac{iEt}{\hbar}}$ to time evolve it (unless I cant). But I need an even more dynamical solution for what I...
Consider the following equation on $(0,1)$, with Dirichlet boundary conditions on both ends. $$ \frac{d}{dx}\left(k(x)\frac{du}{dx}\right) = 0 $$ Let us solve this using simple linear finite elements. The computed displacement $u$ is linear between nodes and is globally piecewise linear. Between nodes, we can take one ...
Given a set of filter taps $\{h_n\}_{n=0}^{m-1}$, define a scaling function $\phi$ by $$\phi(x) = \sqrt{2}\sum_{n} h_n \phi(2x-n).$$ In keeping with the notation from Daubechies "Ten Lectures on Wavelets", define $$m_0(\xi) := \frac{1}{\sqrt{2}} \sum_{n=0}^{m-1} h_{n}\exp(-in\xi).$$ The Fourier transform of the scaling...
I'm a PhD working in the mechanical engineering community. I constantly use open-source FEM libraries to solve my problems. Up to now I didn't really care about the performance of my codes, mainly because I rely on external C++ libraries and I know/assume that the core features were highly optimised. Just to make a pop...
I am using interior penalty discontinuous Galerkin to solve a simple Laplace problem: \begin{align*} \nabla u=0 \end{align*} with prescribed 0 and 1 Dirichlet boundary conditions on opposite edges of a unit square. The other edges have 0 Neumann. You'll see above that I have an image of the solution and it's gradient...
In FEM with bubble functions, the field ($\boldsymbol{u}$) is approximated as a linear combination of the standard one ($\tilde{\boldsymbol{u}}$) plus the bubble field ($\boldsymbol{u}^b$). That is, \begin{equation} \boldsymbol{u} = \tilde{\boldsymbol{u}} + \boldsymbol{u}^b. \end{equation} Considering the addition of n...
If you have a nonlinear second-order boundary value problem where the domain of the problem is $x \in [a,b]$, the boundary conditions imposed are the Robins condition at $x=a$ and the Dirichlet condition at $x=b$, we can use the finite difference method to solve this. For example, \begin{equation} \frac{d^2z}{dx^2} = f...
I'm currently revisiting some FDM schemes for convection-diffusion equations in 1D, 2D and 3D and getting up to speed with the industry-standard methods again. The application is derivatives pricing, the equation is more or less the "Black-Scholes-PDE" in various forms and flavors. In higher dimensions, I'm currently l...
I'm regular with optimization process, but this time, I would like to optimize a multiobjective function with reinforcement learning, using python. Of course I already have some testing functions (mathematical or more realistic), but I have no idea on how to proceed with RL. I would like to compare results with more "t...
Consider a convex polygon in $\mathbb{R}^2$ with multiple convex holes in it and suppose that, for now, we have a 2D triangular mesh of the polygon, which is represented by $\mathcal{T} \equiv\{T_i\}_i$, a set of triangles in $\mathbb{R}^2$. My question is, given a triangle $T$ that lies at the exterior boundary of the...
In discontinuous Galerkin time domain (DGTD) method, a critical concept is the numerical flux that is used to link neighbouring elements. The numerical flux is however not unique. The popular choices include centered and upwind ones. I see in many articles and books describe their different numerical behaviours, but a ...
I've seen that many people are using matrix-free fem codes in my community (mechanical engineering). I have to admit that I googled a bit and I didn't manage to find a good reference for the subject. Even a quick look to the books cited in this question Matrix free finite elements method for visualization in process to...
I'm looking for an alternative formulation of Quasi-Minimal Residual (QMR) from Freund and Nachtigal (1994) based on a Lanczos process for complex valued matrices based on $A^H$ instead of $A^T$. Specifically, I'm not quite sure how algorithm 7.1 would change if one where to use $A^H$ instead of $A^T$. Is there some ar...
I have what it may be a ridiculous question (since I don't know much about wavelets), but here I go. I am using different Discrete Wavelet families to extract texture features from images. I plan to use them to train a ML model to solve some classification problems. My question arises because I have decided to use 10 d...
I am solving a large system of equations using scalapack. Some systems that should run with no problem failed, apparently due to lack of memory in an mpi call. After investigating with execute_command_line("free -m"), I found that I'm losing large amounts of available RAM after every call to PZGETRS. By large, I mean O...