instruction
stringlengths
43
28.1k
In the code that my group is writing (Lethe) we use a stabilized approach to solve the Navier-Stokes equation. The GLS stabilized method we use has a stabilisation term which contains a stabilization parameter such as: $$\tau =\left[\left( \frac{2\rho |\mathbf{u}|}{h} \right)^2+\left( \frac{4 \mu}{\gamma h^2} \right) \...
We are working on the solution of large non-linear PDE (say the Navier-Stokes equation) which we solve using Newton's method with an analytical formulation of the jacobian. For very large systems, we are interested in optimally choosing the tolerance of our iterative linear solver to maximise our use of the Newton's me...
This question may be too basic, but I was wondering if it is possible to implement simple methods such as gradient descent or its variations to find the minimum of barrier functions in constrained optimization problems. If possible, what would be the problems with this approach and is it recommended? For example: $$\t...
I'm interested in solving the following 1D-advection equation using method of lines. $$\frac{\partial C}{\partial t} = - v\frac{\partial C}{\partial x}$$ The spatial domain has been discretized into N nodes.Using forward difference for discretizing the spatial domain gives, $$\frac{dC}{dt} = - v\frac{C_{i+1} - C_i}{\D...
I have a function whose main bottleneck is finding a(ny) singular vector pair in the space of the largest singular value, along with the singular value itself. This is done a huge number of times. This is the structure I know about: Tiny. 4x4 is the most common case, but anything less than 100x100 could be possible De...
I am interested in minimizing $$min_{x \in R^{n^l}} f^l(x),$$ where $f^l(x)$ is nonlinear objective function arising from discretization of PDE. I would like to use nonlinear multilevel minimization techniques, such as MG-opt (Nash, A multigrid approach to discretized optimization problems, https://www.tandfonline.com...
I am fitting some B-splines to data, but the data has a "gap" region where the spline is less constrained by the data. I want to devise a regularization scheme to help prevent the spline from deviating too much from where it should be. One standard approach to spline regularization, is to minimize the curvature of the ...
I need to evaluate the following indefinite integral: $$I=\int\frac{x^5+2ax^3+a^2x-4a}{x^7+ax^5+2ax^4}dx=\int\frac{x^5+2ax^3+a^2x-4a}{x^4(x^3+ax+2a)}dx$$ The solution that I obtained while evaluating the integral in SageMath is $$\frac{{\left(a^{2} + 10a + 8\right)} \log\left(x\right)}{8a} - \frac{\int \frac{a^{3} + {\...
I am trying to simulate 1D advection and convection of a solute in the following blood vessel segment. I would like to know if this system can be simulated in COMSOL or MATLAB. I have used pdepe solver in MATLAB for simulating flows in 1D pipes without branches. However, I am not aware of a tool that can be used for si...
when I minimize a function using scipy.optimize.minimize I get a big list of things as a result, but I would like to only get the value of my variable, this is my code : import scipy.optimize as so def func_AC(r): return 1/((r**2)+1) guess = 0 minimo = so.minimize(func_AC,guess) print(minimo) and this is what ...
In a diverging pipe section like the following, the pipe of radius $r$ splits into two pipes of radius $r/2$. Consider a solute transported by convection from node 1. $$\frac{\partial C}{\partial t} = - v\frac{\partial C}{\partial x}$$ According to Gauss divergence theorem, "The flux out of each region is equal to th...
let's say I have a set of geographic locations (lat, lng) resulting from a query. Those locations have some kind of internal ranking, my set is sorted by this number in a descending order. Now I'm trying to interpolate this data by eliminating all locations in a certain distance from each other. For example, starting w...
For any iteration method from A=M-N, e.g., $$ Mx_{k+1}=Nx_{k}+b,\quad k=0,1,... $$ we know that it converges iff $\rho(M^{-1}N)<1$. And when it converges, there exists a concept called asymtotic convergence rate $R = -\ln(\rho M^{-1}N)$. So, we usually call $\rho$ the convergence factor. I also heard that a concept cal...
For Poisson equation with Dirichlet boundary conditions in 2 dimension: $$ -\Delta u=f, $$ using FDM (centered difference) or FEM discretization, we can obtain a SPD system of linear equations as follows: $$ Ax=b. $$ And if the step size is $h$, then the spectral condition number of matrix $A$ is $O(h^{-2})$. A conclus...
I'm attempting to solve the Poisson equation in 3D for a magnetic vector potential in the presence of a current source. To validate my code, I'm initially looking to reproduce the model described in the following pair of papers: N. Demerdash, T. Nehl and F. Fouad, "Finite element formulation and analysis of three dim...
The energy equation for a spherically symmetric system is given by $$\mathscr{E}=\frac{v^2(r)}{2}+\frac{c_s^2(r)}{\gamma-1}+\phi(r)$$ where $\mathscr{E}$ is the total energy, $v$ is the velocity of fluid, $c_s$ is the speed of sound and $\phi$ is the potential energy. The radial force is obtained as the derivative of t...
I am working on the estimation of tumor extent outside of the region which is visible in MRT/CT/DTI images. I want to compare two methods, which approximate the tumor density profile. Lets say the tumor visible on the image is Region A. The gold standard Region which I want to find is marked with B, and my approximatio...
I have to solve the following PDE-ODE system $$ \displaystyle{\partial_{t} n = \bigl[a(s) - b(s)(y - h(s))^{2} - d\int_{\mathbb{R}} n \, dy \; + \; \beta \, \partial^2_{yy} n \;} \\\\ \displaystyle{s' = -\int_{\mathbb{R}} \bigl[\eta_{s}(g(y,s))_{+}n \bigl] \, dy - \lambda_{s}s + S0 \;} $$ where $n = n(t,y)$ is the ...
I'm working on a optimization problem and using GA algorithm (in MATLAB, ga function). As you know MATLAB plots GA result with two curves, one for the best values and other to show the mean values and when this two curves touch each others it means algorithm has been converged. On my cause these two curves don't get al...
I works on a project where I need to compute a modal analysis of an acoustic cavity. The cavity is rigid which translates the problem to the following equation $$\frac{\partial^2p}{\partial{}x^2}+\frac{\partial^2p}{\partial{}y^2}+k^2p=0$$ and the boundary conditions $$\partial_xp(y=0)=0,\quad\partial_xp(y=L_y)=0,\quad\...
I works on a project where I need to compute a modal analysis of an acoustic cavity. The cavity is rigid which translates the problem to the following equation $$\frac{\partial^2p}{\partial{}x^2}+\frac{\partial^2p}{\partial{}y^2}+k^2p=0$$ and the boundary conditions $$\partial_xp(y=0)=0,\quad\partial_xp(y=L_y)=0,\quad\...
I want to implement the upwind finite difference scheme for the 1D linear advection equation using a finite difference matrix in python: $$ A =\begin{pmatrix} 1-a\cfrac{\Delta t}{\Delta x} & 0 & 0 & \cdots & a\cfrac{\Delta t}{\Delta x}\\ a\cfrac{\Delta t}{\Delta x} & 1-a\cfrac{\Delta t}{\Delta x} & 0 & \cdots & 0 \\...
I have read about papers in the last 20 years that have solved this problem. Many are mentioned in http://jamiemorgenstern.com/teaching/s18-6550/notes/notes-lec4-dgc.pdf Unfortunately the only implementations I have found are also 20 years old and no longer compile due to changing LEDA and C++ (from the ACM DL). Can an...
Please point me to an answer if one already exists, but after some searching, I still can't find the answer to what seems like a very simple question. There are plenty of references out there for solving the Euler equations with FVM. I am using the Toro (1997) book, Riemann Solvers and Numerical Methods for Fluid Dynam...
For stokes problems, $$ -\Delta \vec{u} + \nabla p =\vec{f},\qquad \nabla . \vec{u} = 0; $$ with appropriate boundary conditions which guarantee there is a unique solution. Using FDM or FEM, discretization, we can obtain a saddle point system $$Ax = \begin{bmatrix} B&E\\ E^T&O \end{bmatrix}\begin{bmatrix}u\\p\end{bmat...
I am considering the following diffusion equation: $$\frac{\partial f}{\partial t} = \frac{\partial}{\partial x}[D(x,t)\frac{\partial f}{\partial x}]$$ over a grid x=[1,...,6] with the following boundary conditions: $$f|_{x=1} = 0 \quad \forall t$$ $$\partial f|_{x=6} = 0 \quad \forall t$$ To test for convergence, I am...
The governing equation of the transient heat transfer problem is $$C \frac{dT}{dt}+K T = Q$$ $C$ is the heat capacity matrix. $K$ is the thermal conductivity matrix. $T$ is the temperature vector. $Q$ is the heat flux vector. I know that it is possible to use a lumped capacity matrix in thermal finite element analysis ...
I built the stiffness matrix for the Poisson equation on a 2-dimensional domain with the shape of "almost" an octagon, using pyramid basis functions. I used almost to intend the fact that I have an "irregular" shape. The mesh has been given to me by a point matrix $P$ and a connectivity matrix $T$. In $P$ I have the po...
I am considering a dynamic linear elasticity problem applied to a simple structure such as a beam. In system form, the PDE can be written as $M \ddot{X} + D \dot{X} + XK = F$ where $X$ represents the vector of deflections along the $x$ and $y$ directions of various points on the beam. According to one repository I foun...
I work on fluid-related simulations. I have used FFT for fluid simulation. I want to use discrete cosine transform (DCT) and discrete sine transform (DST) to transform my velocity field to wavenumbers. I am using REDFT00 and RODFT00 as DCT and DST respectively (so the inverse are themselves). I understand that the no...
I have two n-by-3 blocks contiguous in memory ("n vectors of length 3") and I'd like to compute the dot product between each of the rows as fast as possible. In numpy, using einsum is the fastest variant to the best of my knowledge (einsum("ij,ij->i", a, b)). I've compared this to the transposed variant (also contiguou...
Suppose I know that a function from $[0,\pi] \to \mathbb{R}$ may be written as $$ \sum_{k=0}^\infty A_l \frac{2l+1}{4\pi} P_l(r) $$ where $A_l$ all are known. Is there a way in which I may very quickly approximate the value of the function? My naive implementation is very slow and also suffers problems with numerical ...
Suppose you are solving a system of equations numerically that possesses an attractor (no matter the initial conditions set, all the different solutions will approach a specific set of values that comprise the so-called attractor). The numerical method employed is a fourth-order Runge-Kutta one. Now suppose you take th...
I'm writing some code to calculate $\int_0^1 e^{ax} \mathrm{d} x$. Annoyingly there does not seem to be a way of doing this without if statements: def my_integral(a): if a == 0: return 1. else: return expm1(a)/a (I know comparing to zero looks worrying, but this correctly returns 1 for values l...
In the original paper of Conjugate Gradients, the authors mention that if we pick the canonical basis $\{e_1,e_2,\ldots,e_n\}$, to obtain A-orthonormal vectors, we end up with the Gaussian elimination method (section $12$). My question is the following: Apart from this canonical basis and of-course the Krylov subspace,...
It is quite easy to implement multigrid on a rectangular grid but what about an non-rectangular?How to coarse a non-rectangular grid and apply multigrid(assume an easy non-rectangular grid capital letter L)?What about more complicated geometries?
Good evening, I would like to understand why I do not get the correct result: I assume that I know my function on discrete data points and expand it as a discrete Fourier transform: $\text{sin}(x)=\sum_{k=-m}^m A_ke^{i2\pi kx}$ This I use to calculate an integral: $$\int_{-R}^{R}\text{sin}(x+y)\text{d}x = \sum_{k=-m}^m...
#include<stdio.h> #include<fftw3.h> #include<math.h> #include <stdlib.h> int main(){ int N=2000; int i,j; FILE *filepointer; filepointer=fopen("2DDFT_spacetime.plt","w"); //double in[N][N]; double *in; fftw_complex *out; fftw_plan p; double fx=13.0; double fz=9.0; double x[N...
I am a beginner to PETSc and MPI, so after installing PETSc I was compiling some basic tutorial. But whenever I give the number of processors i.e mpiexec -n 4 ./ex1 the first processor with 0th rank appears 4 times, and not the processor 2,3 and 4 even for a simple hello world program given in petsc/src/sys/examples/tu...
The origin of the question can be found here. I know the details about forward, backward and central differences. If $u$ is the variable, does eight order means it approximates the $u_{xx}$ using $u$ from eight different spatial points? Higher the order, better the approximation? Is the order mentioned here is differe...
I asked this question earlier on StackOverflow, but it's obviously better suited for SciComp: While there seem to be lots of references online which compare automatic differentiation methods and frameworks against each other, I can't seem to find anything on how I should expect automatic differentiation to compare to h...
A typical way of dealing with I/O in MPI parallel programs is to either read all data to a single node and dispatch to the other nodes accordingly, or send all data to a single node and write from this node. I currently use blocking communication. Since the "master" process can only communicate with one node at a time,...
I want to solve a problem numerically in python like this: $$ y(t)' = \mathbf{M}(t)y ,\\ y(0) = (1,0,0,0 ...) $$ where $y$ is an $n$-dimensional vector and $\mathbf{M}(t)$ is a time-dependant $n \times n$ matrix. The matrix $\mathbf{M}(t)$ is of the shape $$ \mathbf{M}(t)= \left[ \begin{array}{ccccc} 0 & T_1(t) & 0 & ...
in my quest to understand how I can use FFT to compute integrals (see my other question click, still no answer there), I came across the fact that a convolution of two functions can be calculated by multiplying the Fourier transforms of the functions and taking the inverse transform of that product. Now suppose I want ...
I have some difficulty in implementing RODFT00 and REDFT00. I want to use them for fluid simulations. I would really appreciate some help with my following problems: I have read the documentation (http://www.fftw.org/fftw3_doc/Real-even_002fodd-DFTs-_0028cosine_002fsine-transforms_0029.html#Real-even_002fodd-DFTs-_002...
Let's consider the following 1D diffusion equation: $\frac{\partial u}{\partial t} = xk \frac{\partial}{\partial x}(\frac{1}{x}\frac{\partial u}{\partial x})$ where we assume that the diffusion coefficient $k$ is constant. In order to discretize this equation, let us define the following: $x_i = 1 + i\Delta x, \forall ...
I've read a few papers in dynamical systems where the model equations are sets of ODEs, with the state space, say, the spatial variables x, y, z, and an angle variable phi all evolving forward in time. The simulations match the 3D lab experiments very well too. Why does this happen? I would think that 3D phenomenon ne...
I'm doing simulations of 2 coupled PDE's with Comsol Multiphysics. I want to fit some data (using the Application method, whose language is Java) to those simulations. In order to answer my question you don't need to know what is Comsol Multiphysics or what is an Application Builder don't worry :) So basically the equa...
I have two formulations to solve a problem (both give dense, complex and symmetric system). They are solved multiple times in a loop. I am trying to predict which is better to use. The first one builds a coefficient matrix $W$ of size $3n \times 3n$. Through reduction of that system, we get the second formulation: a co...
I want to do some numerical examples solving large sparse linear system Ax=b. And I want to use some data from Maltab itself because this experiments are easily reproduced any time using Matlab. For example, load west0479.mat A = west0479; b = sum(A,2); gmres(A,b); bicgstab(A,b); Using these codes, I can obtain a sp...
I'm interested in problems around probability, statistics, and statistical mechanics, and often I find it useful to perform simulations to get some sense of the underlying phenomena. Example computations include Monte Carlo, finding the eigenvalues of large random matrices (repeatedly, to get a sense of various distrib...
In https://www.johndcook.com/blog/2012/02/21/care-and-treatment-of-singularities, the author explains the subtraction method to get rid of singularities when performing numerical integration. The example he gives is the integral $\int_{0}^{1}\frac{1}{\sqrt{\sin x}}dx$. To accurately compute this integral numerically, o...
I am using MATLAB to simulate a 1D Ising Chain. I am running into an issue where when trying to find heat capacity, my system has a tremendous amount of noise. I'll post my code and an image of the heat capacity (as well as it smoothed 1000 times). I have tried to smooth the energies first, I've tried having the "equil...
For solving linear system $$ Ax=b, $$ using iterative mehods, we often use the terminate criterion as follows: $$ \frac{\|r_k\|}{\|r_0\|}=\frac{\|b-Ax_k\|}{\|b-Ax_0\|}<eps. $$where $x_0$ is the initial guess and $x_k$ is the $k$-th step iterate. My question is why do not we use the real terminate criterion instead as ...
I'm pretty new to the DG method and have been writing a 1D code to help me understand the coding aspect. With respect a reference, I've been following these notes https://www3.nd.edu/~zxu2/acms60790S15/DG-general-approach.pdf. Where my confusion is comes from how to define the computational cells. In the notes the a...
I am trying to solve a differential equation with discretized variable coefficients which are calculated from a time serie. In this case the Runge-Kutta step size is fixed by the frequency in the time serie. Is there any Python Runge-Kutta RK4, RK5 solvers suitable for fixed step?
I got a lot of elements in Material Browser of Comsol Multiphysics of Optics section. Unfortunately, all data looks identical and similar to stub. Each element has the same expression, which can be seen on screenshot. How this should be used?
I am trying to plot a sinewave with a bit of 3d perspective along the ZX axis instead of the XY axis. I have so far been unable to get anything that works, and have been unable to locate any examples. I have tried a few different things with plot3() but that has all resulted in either parallel lines (no longer a sine...
*Concern highlighted in yellow *Solution at bottom I have a differential equation to solve for the motion of an electron: $$ \frac{d^2v}{dt^2} = \frac{1}{\gamma^6}\left( \frac{eE}{\tau m} - \left( \frac{\gamma}{\tau} \frac{dv}{dt} + \frac{\gamma^3}{\tau c^2} v^2 \frac{dv}{dt} + 6\frac{\gamma^8}{c^2} v \left( \frac{dv}{...
For Poisson or Convection-diffusion equation as follows: $$ -\Delta u=f,\qquad u|_\Omega = g. $$ or $$ -\Delta u +\vec{w}.\nabla u=f,\qquad u|_\Omega = g. $$ using FDM or FEM discretization, we can get $$ Ax=b. $$ I have known that Multigrid method is a very efficient method for these equations and I have done some nu...
I am diving into some literature to understand which is the best algorithm for computing the log-determinant of a PSD matrix. More generally, I am interested in a list of resources to read, which cover all the possible cases of matrix (i.e. sparse, dense, low rank, etc..) with all the probability of failure and error (...
Will it be possible to simulate a complete (at least simple) bacteria atom by atom on an exascale supercomputer? or is it possible already today with the largest systems? Here, I've read that scientists can simulate an organelle of bacteria. For that, they modeled a system consisting of 100M atoms. How to know which c...
I would like to solve an ODE for multiple values of the parameter p and most importantly, save all the solutions for all the different values. Till now, I have been using this: p = -200:+1:300; time = 0:.01:10; y0 = [0 0 0 0 0 0 0 0]; y = NaN(length(time),length(y0),length(p)); for i=1:length(p) [t,y(:,:,i)] = o...
Due to my previous question, where I asked about flux calculation in lattice Boltzmann (LB) method here, I have more or less same question for deviatoric stress tensor calculation due to pseudo-compressibility of LB method. In fact, strain rate tensor is calculated in LB by using non-equilibrium part of distribution fu...
I am trying to solve an ode that uses some extremely large numbers and some extremely small numbers, namely $$ e = 1.6\times 10^{-19}\\ E = 10^6\\ \tau = 6\times 10^{-24}\\ m = 9.1\times 10^{-31}\\ c = 3\times10^8\\ $$ I introduced some dimensionless constants, one in particular being $$ \varepsilon = \frac{\tau e}{cm}...
I am trying to use the modified equation to derive the stability condition for the finite difference approximation $$ \frac{u(x,t+\Delta t) - 2 u(x, t) + u(x, t -\Delta t)}{\Delta t^2} = c^2 \frac{u(x+h,t) - 2 u(x,t) + u(x-h,t)}{h^2} $$ to the wave equation $$ u_{tt}(x,t) = c^2 u_{xx}(x,t). $$ I know that the result...
My question is regarding solving the conservative form and the non-conservative form of the governing-equations (GE), like continuity or the navier stokes equation, using finite difference method (FDM) and finite volume method (FVM). When reading about the differences between the conservative form and the non-conservat...
1) I am looking for references for an efficient implementation and usage of TPSA. What sources exist besides Berz's 1989 original paper and the incomplete chapter in Dragt's book? 2) Are there reliable TPSA packages that can be used in Julia or Python?
I'm trying to evaluate the exact solution of heat diffusion in circular plate. I'm not able to use the natural logarithm inside expression. from math import log as ln u_e = Expression("ln(5)") The above line doesn't work. Could anyone help me with the correct syntax?
This semester, I have been studying the most popular iterative methods, i.e., Krylov subspace iteration methods. For a large sparse system linear $$ Ax=b, $$ where $A$ is nonsingular, I know that direct methods are not suitable for this. So a number of iterative methods have been proposed, such as classic stationary it...
Given an N-dimensional matrix A, I want to find an M<N dimensional index array I such that the submatrix A[I, I] has the maximum element sum over all such I vectors. For example for 3-dimensional A = 1 2 3 4 5 6 7 8 9 and 2-dimensional index [1,3] A[(1,3), (1,3)] = 1 3 7 9 So basically this is a discrete op...
I was trying to plot precession of perihelion of Mercury using matlab. For this I am following a book Computational Physics by Nicholas J. Giordano and Hisao Nakanishi 2nd Edition. In that book authors used following force law predicted by general relativity: $$ F \approx \frac{G M_m M_s}{r^2}\left(1+\frac{\alpha}{r^2}...
In principle the PDE Toolbox in MATLAB can handle multi-domain 3D geometries as noted here. This feature and the associated function geometryfromMesh were introduced in MATLAB R2018a. The associated documentation however is virtually non-existent with regards to how to actually implement this multi-domain feature. The ...
I have a sparse system (about 78% of zero entries) that is complex and symmetric (but not Hermitian). The following figure shows the structure of the problem. The off-diagonal blocks are incidence matrices, the diagonal blocks are dense complex matrices with elements whose absolute value ranges from $1 \times 10^{-14}$...
I am trying to find out if the known QR algorithm to find the eigenvalues of a real matrix, which can be found in the book Fundamentals of Matrix Computations, can also be used for complex matrices and still runs in $O(n^3)$? Also, if yes, does anyone know any reference for it?
I have been studying the iterative methods recently. For classical iterative methods solving $Ax=b$, I have seen that the most simplest iteration method is the so-called "Richardson iteration". But I am a little confused that the following names of the "Richardson methods" as follows: Richardson iteration extrapolate ...
For an stationary iteration method solving $Ax=b$ as follows: $$ Mx_k = Nx_{k-1}+b, $$ I have known that when $M = I$, i.e., the Richardson iteration, the k-th solution $x_k = x_{k-1}+r_{k-1}$ is in the k-th Krylov subspace $K_k(A,b)$ with $x_0=0$. So, if we use a Krylov subspace method e.g., GMRES, the k-th solution $...
My problem involves the solution of a second-order ODE with a fixed-step (input and output). Specifically, this ODE is the radial part of Dirac and Schrödinger equation for a spherical symmetric potential. This is for example the ODE of the radial part Schrödinger equation: $$\left(\frac{d^2}{dr^2} +2r\frac{d}{dr} -\f...
I'm trying to understand how convection-diffusion equations are solved in pipe flow modules available in CFD solvers. $$ \frac{\partial C}{\partial t} + \nabla \cdot (\mathbf{v} C) = \nabla \cdot (D \nabla C). $$ Flux is given by $$ N = - D\nabla C + \mathbf{v}C $$ in pipe flow module in COMSOL. If the pipe section wi...
This semster, I have been studying the iterative methods for large sparse matrix system. But I have some questions. For large sparse matrix, we must use an economic storage to store them. The most popular way is the compressed row storage or compressed column storage, i.e., CRS,CCS format which have been proved as the ...
I was wondering what would be an efficient way to produce compatible displacements for mesh nodes/vertices if the computed data is volume shrinkage of each element/cell in the unstructured mesh? Probably similar is done when one calculates thermal expansion of the material, and then has to produce nodal displacements a...
I am looking for a fast algorithm for computing eigenvalues and eigenvectors from sparse stiffness and mass matrices in MATLAB. The eig(K, M) doesn't work with sparse matrices.
Problem statement: Assume that I have an objective function $f(x)$ which takes as input a $D$-dimensional vector $x\in\mathbb{R}^D$, and that $f(x)$ is sufficiently smooth. Assume further that I have a set of $N$ samples $\{x_1,x_2,...,x_N\}$ for which I know the output of the objective functions $\{f(x_1),f(x_2),......
I have a linear system where I am given 2 matrices, $A$ and $B$, and 2 vectors, $v$ and $c$, and I need to solve for the vector $x$. $A$ is $n\times n$, $B$ is $n \times n \times n$, and the vectors $v$, $c$, and $x$, are all $n\times 1$. I need to solve for $x$, which is complicated as you'll see below by the right mu...
I've been reading Albright's Orbital Interactions in Chemistry. In the chapter on solids, he provided a general approach to find the band structure of a solid state system Now if we are to model a one dimensional hydrogen chain, let $|1s(r)\rangle$ denote the $1s$ orbital centered at $r$. The band energy at each $k$ ...
Last week, I have learned the details of the robust iterative methods of PCG, MINRES, GMRES, which will converges to the exact solution $x^*$ of nonsingular system within $N$ steps for $A\in \mathbb{R}^{N\times N}$: $$ Ax=b. $$ And the requirements for the matrix is: SPD matrix for PCG, symmetric matrix for MINRES, no...
I am developing a solver that gets a CAD model as entry and does the topological optimisation calculation on it. My solver is inspired by the open-source codes presented in the literature. Since it is just a solver I need to do the pre-processing and post-processing using a third-party code. I create my geometry and me...
A maximization problem reads as $$ J(y) = \sum_{k=1}^{K} \sigma_k(y)^q \mathop{\rightarrow}^{y} max$$ where $q \in [1,\infty]$ is a user-defined parameter and functions $\sigma_k, k=\{1,\dots,K\}$ satisfy these two conditions for any given $y$: $$ \sigma_1(y) \geq \sigma_2(y) \geq \dots \geq \sigma_K(y) \geq 0.$$ and $...
The quadratic knapsack problem (QKP) $$\max_x x^TPx$$ $$\mathrm{s.t.}\;\;w^Tx\leq c,\; x\in\{0,1\}$$ where $P\geq0, w\geq0$ elementwise, is well studied and has existing solvers. My problem below seems closely related to QKP, but I can't find a way to transform it to a QKP to use existing solvers. $$\min_x x^TPx$$ $$\m...
I have to calculate in numpy the matrix-product of many matrices (~400). Are there common practices to increase numerical stability? If this is relevant, the matrices are $300\times 300$ orthogonal projection matrices.
Consider a square $N \times N$ block-matrix $\mathbf{A}$, where each $n \times n$ block $\mathbf{A}_{ii}$ is either a dense block or a zero-block. So, $N$ denotes the number of blocks, $n$ denotes the size of each square block. Random example for illustration: $$ \mathbf{A}=\left[ \begin{array}{ccccc} \mathbf{A}_{11}...
This semester, I study the Krylov subspace iterative methods (about Ax=b) using the book H. A. Van der Vorst. Iterative Krylov Methods for Large Linear Systems, volume 13. Cambridge University Press, 2003. About choice of the basis of the Krylov subspace, I have some doubts about the saying in this book (section 3.3) a...
I need an explicit Runge-Kutta 14th order formula. If you know about some reference that discusses at least 10th order (or higher, since I'm looking for the 14th) of Runge-Kutta and there is information about the whole formula like $$y=y+\frac{h}{C}\left(c_1 k_1+ c_2 k_2+c_3 k3+\cdots +c_n k_n\right)$$ with defined coe...
I'm trying to educate myself on modelling solute flows through pipe networks. This is a follow up of my previous post here $$\frac{\partial C}{\partial t} = - v\frac{\partial C}{\partial x}$$ While modelling flow through pipe junctions, I understand that the junction is assumed to have complete mixing, negligible volum...
I've been reading this paper recently, which talks about using Lattice Boltzmann methods and two way coupling. Specifically, it outlines fluid solid coupling, and solid fluid coupling, and how simply using both results in two way coupling. The force from the fluid on the ridgid body makes sense, what doesn't make sen...
Suppose I have $$f=\frac x 3+ \frac y 3 +\frac z 3$$ And I want to use collect(f, 1/3) And I wish it will displays $$f=\frac1 3(x+y+z)$$ But it doesn't work.
The above graph represents reduced viscosity as a function of reduced temperature for several values of the reduced pressure. I am writing a code which will estimate the viscosity, in the following steps : Calculating critical viscosity($\mu_c$) by using the formula, $$ \mu_c = 7.70M^{0.5}p_c^{2/3}T_c^{-1/6} $$ ...
On a desktop scale computer, what are the most important bottlenecks (RAM vs. CPU, single vs. multithread) for numerical calculations? I'm specifically most interested in exact diagonalization and other methods (DMRG, DMFT) for strongly-correlated condensed matter systems. What computational resources would pose the st...
What is a good way to sample parameters for performing global sensitivity analysis? Some methods are defined using integrals, some are use Monte Carlo. How do these compare?
I'm looking to find a computationally efficient solution to a large system of nonlinear equations. I'm trying to maximize the following function: $$ f(\vec{x}) = \sum_i^N C_i (x_i-A_i)x_i^{\epsilon_{ii}} \prod_{j\not = i}^N x_j^{\epsilon_{ij}}$$ Subject to the constraints: $$ C_i > 0 \quad\forall\: i$$ $$ x_i > A_i > ...