All Questions

Filter by
Sorted by
Tagged with
1
vote
0answers
52 views

Radial Hartree and exchange-correlation potentials

According to [1] the one-dimensional Kohn-Sham equation is given by $$ \left( -\frac{1}{2} \frac{d^2}{dr^2} + \frac{l(l+1)}{2r^2} + V[\rho;r]\right) rR_{nl}(r) = \varepsilon_{nl} rR_{nl}(r) $$ where $$...
1
vote
0answers
79 views

Solve a nonlinear system of equations with condition symbolically

Consider the following system of nonlinear non-dimensional ODE : \begin{align*} \frac{d\bar{x}(\tau)}{d\tau}=\quad&\bar{x}\left[1-\bar{x}-\frac{\bar {y}_{1}}{\bar{m}_{1}\bar {y}_{1}+\bar{x}}-\...
0
votes
0answers
42 views

Troullier-Martins pseudopotential with nonzero angular momentum quantum number

According to [1] the Troullier-Martins pseudopotential for quantum number $l$ is computed by $$ V^{\textrm{KB}}_{\textrm{nonlocal},l}(r) = \frac{\vert{}V_{\textrm{nonlocal},l}(r)\Phi^{\textrm{PP},0}_l(...
2
votes
1answer
59 views

Optimization with the constraint of rank=1

I have the following matrix $$ A = [x_1, x_2, ..., x_n], $$ where $x_i \in \mathbb R^n$. But I know the relationship that \begin{align} x_2 = s_2 x_1 \\ x_3 = s_3 x_3 \\ ... \end{align} where $s_i$...
2
votes
1answer
88 views

Solving system equation

Given matrix $K_{n \times n}, H_{n \times n},M_{n \times n}$, I want to solve for $B_{n \times n} $ and $V_{n \times 1}$ from the nonlinear system of equations: \begin{aligned} &H_{i j}=\frac{B_{i ...
0
votes
1answer
61 views

Singularity in gradient caused by Dirichlet boundary condition

I am looking for a mathematical explanation for the singularity caused by a Dirichlet boundary condition partially imposed at a boundary. For instance $$ \nabla^2u=0 ~ \text{in}~\Omega $$ where $\...
11
votes
3answers
4k views

How much more work is it to code math models in Python, compared to working with Matlab?

If one had to code up a new dynamical system for a research group at a university, and the university has a Matlab total headcount license so that one could code in Matlab, are there any benefits to ...
5
votes
1answer
90 views

How to know which LAPACK's function is used by Scipy's eig function?

As far as I understood, scipy.linalg.eig use wrappers from scipy.lapack to compute the eigenvalues and eigenvectors of a matrix. ...
2
votes
0answers
33 views

How to account for a corner node with zero-flux condition at an extrapolated distance

I am trying to implement a numerical solver and am having troubles dealing with boundary conditions, especially in the corners. I have a 2D mesh, and on the left I have a Dirichlet condition, on the ...
14
votes
1answer
951 views

Conserving Energy in Physics Simulation with imperfect Numerical Solver

I am creating a C++ Physics Simulation where I need to move an rigid body through an acting force field. Problem: simulation does not conserve energy. Quesiton: abstractly, how is conservation of ...
5
votes
1answer
115 views

Fastest way to calculate the $2$-norm (or an upper bound for the $2$-norm) of the inverse of a matrix $A\in \mathbb{C}^{N\times N}$

I have a matrix $A\in \mathbb{C}^{N\times N}$ and I need to calculate $||A^{-1}||_{2}$ efficiently. Can it be done without having to evaluate the inverse explicitly? In general, I am looking for ...
2
votes
0answers
52 views

Processing time steps in chunks with Fortran [closed]

My PDE simulation program written in Fortran has to make about 2 million variable time steps. But with each time step it slows down more and more, so that if it initially makes 1000 time steps per ...
2
votes
1answer
40 views

Could the convex problem be tackled by CVX?

I want to solve the convex optimization as follows: \begin{align} \underset{X_1,X_2}{\min} &\ -\frac{1}{N}\sum_{i=1}^N\log\det\left(I+H_i^HX_2H_i\right)-\log\left[1+h^H(X_1+X_2)h\right]\\ &\...
2
votes
0answers
27 views

Computing convolution of two characteristic function over a 1D Cartesian mesh

I am trying to compute the convolution of two characteristic functions over a Cartesian mesh. First, I define my Cartesian mesh of the interval $[0,1]$ as follows $$ x_{i} = i \Delta x, i = 0, 1, 2\...
2
votes
2answers
47 views

Implementing Gelfand’s formula for the spectral radius in Python - lack of convergence

For context: Gelfand's formula for the spectral radius is $\lim_{k\rightarrow \infty}|A^k|^{1/k}$ where $|\cdot|$ is any well-defined operator norm. I naively coded a function to calculate the $k$th ...
-1
votes
0answers
17 views

Correct Back-propagation implementation

I am trying to write a neural network from scratch for the purposes of having the entire architecture available for me to mess around with. In doing so, I am trying to completely understand back-...
2
votes
0answers
28 views

Fitting a plane with the Prewitt gradient operator

Prewitt gradient operator Show that the Prewitt gradient operator can be obtained by fitting the least-squares plane through the 3 × 3 neighborhood of the intensity function. Hint: Fit a plane to ...
3
votes
0answers
60 views

Computation of Troullier-Martins pseudowavefunctions

The computation of Troullier-Martins pseudowavefunctions has been described in [1]. The pseudowavefunction $R^{\textrm{PP}}_l$ is defined by $$ R^{\textrm{PP}}_l(r) = \left\{ \begin{array}{ll} R^{\...
2
votes
1answer
135 views

How to implement flexible gmres in matlab?

About the flexible GMRES (fgmres), we know that it is a variant of right preconditioned gmres. And the robust command gmres in matlab as follows: ...
1
vote
1answer
78 views

Disciplined convex programming expression of $x\sqrt{1-x}$

Anyone have an idea for a DCP (disciplined convex programming) representation of the concave function $x\sqrt{1-x}$, which is has domain $[0,1]$? The Taylor series about $x=0$ is $$x - \frac{x^2}{2}...
0
votes
0answers
82 views

Numerically solving a partial differential equation in python with Runge Kutta 4

I'm supposed to solve the following partial differential equation in python using Runge-Kutta 4 method in time. $$ \frac{\partial}{\partial t}v(y,t)=Lv(t,y) $$ where $L$ is the following linear ...
2
votes
1answer
55 views

Testing a block tridiagonal system of equations

In 1D problems, tridiagonal systems of equations are obtained when we use finite-difference or finite-volumes in a structured mesh. A wide solver is the TDMA algorithm here. In two-dimensional ...
2
votes
2answers
98 views

What is an efficient way to calculate zeros of Bessel functions?

One approach is the brute force method of evaluating at all points at fixed intervals and when it nears zero write value, this can be combined with adaptive step size. Another approach is ...
4
votes
1answer
95 views

What is the difference between Methods of Weighted Residuals and Spectral Methods?

Methods of Weighted Residuals (MWR) [1] usually include Galerkin, collocation, method of moments, least-squares and subdomain methods. Spectral methods [2] usually include Galerkin, tau and ...
2
votes
1answer
51 views

Numerical Solution to Rayleigh Plesset Equation in Python

I have been trying to numerically solve the Rayleigh-Plesset equation for a sonoluminescence bubble in Python. You can read about this phenomenon here: https://iopscience.iop.org/article/10.1088/0143-...
2
votes
0answers
58 views

Nodal and Element Equilibrium in FEM Solution

I am learning FEM from KJ Bathe's textbook and it is mentioned that for a general FEM solution, nodal and element equilibrium is satisfied. The explanation takes steps that I don't understand. At ...
10
votes
3answers
367 views

Linear algebraic research direction that's not to do with differential equations and physics?

So I've found some interesting linear algebraic research areas that's both pure-ish, with a numerical bent to it, too -- e.g. inverse eigenvalue problems have both interesting theoretical and ...
4
votes
1answer
235 views

Computation of diffusion time

While simulating the diffusion of a substance in 1D, $$ \frac{\partial C}{\partial t} = \nabla \cdot (D \nabla C). $$ I'd like to compute the diffusion time In this link, the diffusion time is given ...
0
votes
0answers
133 views

Ising model simulation offset critical temperature and interal ernergy

I'm writing a code for the Ising model using WHAM (the weighted histogram analysis method),But it seems to produce critical temperature and internal energy wrong. (newest rewritten code is below) <...
3
votes
1answer
74 views

Numerical solution of zero-potential time-dependent Schrödinger equation in 1D

I want to solve numerically the one-dimensional time-dependent Schrödinger equation $$i \psi_t(x,t)=-\frac{\hbar}{2m} \psi''(x,t)$$ My issue is that I don't have the physical background to understand ...
1
vote
0answers
40 views

How to compute the computational cost and storage of the Full Orthogonalization Method?

About the analysis of Full Orthogonalization Method (FOM) in Prof. Saad's book, wrote as follows: Algorithm 6.4 (FOM): \begin{array}{l} r_0=b-Ax_0,\beta=\|r_0\|_2,v_1 = r_0/\beta\\ Define \quad H_m ...
2
votes
1answer
56 views

How to divide points on a 3D complex surface into two regions based on a closed curve defined on this surface?

My problem seems simple but I can't find an algorithm that will do that for me for any 3D complex surface. I have a really complex shape 3D surface and a closed curve on it defined by some points (...
5
votes
1answer
75 views

How do I globally change the precision of a piece of code in Python to debug it?

I am solving a system of non-linear equations using the Newton-Raphson method in Python. This involves using the solve(Ax,b) function (...
1
vote
0answers
24 views

Multibody Systems modeling disadvantages [closed]

Multibody Systems modeling is a very systematic approach usually results in large sparse Jacbian matrix. I am working to model a system consisting of 11 bodies and 63 constraint equations as soon as i ...
10
votes
3answers
324 views

Should benchmarkings be done at all? What is the point?

I am reading a paper which compares algorithm A versus algorithm B. It shows that algorithm A is faster than algorithm B via benchmarking that shows the CPU time. What is the point of this? Any ...
1
vote
0answers
53 views

Stably solve transport equation with source term

I am trying to solve a transport equation of the form for the variable $\psi(t,r)$ \begin{equation} \partial_t\psi-\alpha(r)\partial_r\psi-\beta(r)^2\psi-f(t,r)=0 , \end{equation} where I am solving ...
0
votes
1answer
82 views

Solution of thermal analysis using finite element

I want to solve a thermal analysis using finite elements. The governing equation is $$C \frac{dT}{dt}+K T = Q$$. When using backward differencing for time, the resulting equation is quite straight ...
4
votes
0answers
39 views

Nonlinear least squares optimized Jacobian calculation

I have a nonlinear least squares problem, in which I am trying to minimize residuals which can be divided into four classes: $$ \min_x ||\epsilon(x)||^2 + ||\xi(x)||^2 + ||\delta(x)||^2 + ||s(x)||^2 $$...
1
vote
0answers
23 views

How to simulate a PDF using data samples like this?

I know two methods to simulate a PDF from random data samples using MATLAB : 1) Using a histogram where I use this command histogram(data,'Normalization','pdf'), it gives PDF like bins. 2) Another ...
2
votes
0answers
55 views

How to reproduce the numerical examples in Prof. Saad's Book about Krylov subspace methods?

After reading Prof. Saad' Book, "Iterative methods for Sparse Linear Systems, 2nd version", I want to do the numerical examples about the Krylov subspace methods not only to reproduce the results in ...
1
vote
0answers
74 views

Immersed boundary method in FEniCS?

I have looked at the FEniCS tutorials and documentation but I cannot find any mention to the possibility of implementing an immersed boundary method (IBM) for fluid dynamics. In particular, I want ...
5
votes
1answer
458 views

Why MATLAB chooses the Householder in its built-in function gmres.m?

Recently, I have studied how to construct an orthonormal basis for Krylov subspace to solve $Ax=b$, where $A\in \mathbb{R}^{n\times n}$ is nonsingular. As we know, there are usually 4 ways to ...
1
vote
2answers
62 views

Solving a 1D diffusion equation with linear and nonlinear source terms

I would like to numerically solve the following equation: $$\frac{\partial \rho (z,t)}{\partial t} = B(N_D \rho (z,t) + \rho(z,t)^2) + D \frac{\partial^2 \rho (z,t)}{\partial z^2}$$ with the boundary ...
3
votes
0answers
66 views

Large-scale optimization of nonlinear equations

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_{...
3
votes
1answer
134 views

How to optimize sampling for global sensitivity analysis

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?
1
vote
1answer
84 views

Numerical bottlenecks

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 ...
3
votes
1answer
49 views

Estimation of viscosity from critical properties

The above graph represents reduced viscosity as a function of reduced temperature for several values of the ...
-1
votes
1answer
14 views

How to Collect fraction in Maple 18? [closed]

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....
1
vote
0answers
35 views

How to avoid density getting “deleted” in two way rigid body coupling with LBM CFD?

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 ...
4
votes
1answer
81 views

Modelling flow through pipe networks

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 ...

15 30 50 per page