All Questions
10,664
questions
1
vote
1
answer
51
views
Lanczos memory complexity for dense matrices
Does the Lanczos algorithm remain memory efficient even if the original Hermitian matrix is dense?
0
votes
0
answers
67
views
One of the variables in scipy.optimize.minimize does not get solved
Three variables are declared in the function but scipy.optimize.minimize only solves the first two under the minimization of objective, don't know why.
The original ...
0
votes
1
answer
33
views
Which type of RNG can I use together with a MT RNG in a simulation?
This question arises from my attempt to mix two different RNGs. I'd like to mix them choosing the best of the two according to the operations I need to carry out to achieve better performance. I'm ...
0
votes
1
answer
40
views
Integration of a singular kernel function over a triangle
Problem:
I am currently trying to integrate a singular kernel function of the type
$$G(x,y)=\frac{\exp(ik||x-y||_2)}{4\pi ||x-y||_2}$$
which lies at the centre of a triangle, over this triangle. $i$ ...
0
votes
0
answers
71
views
discrete definition of curl $ \nabla \times \vec{A}$ on a 3D grid?
I have the data for 3D vector field $\vec{A}$ (with components $\vec{A_1}$, $\vec{A_2}$ and $\vec{A_3}$) sampled on a 3D grid with integer indices i, j and k.
Assuming that only the third component $\...
0
votes
0
answers
57
views
Discretization of Poisson's equation with 2d permittivity tensor
I have to discretize a generalized Poisson equation in 2D which is
$$\nabla\cdot(\varepsilon \nabla \phi )=-\rho$$
My problem is that here $\varepsilon$ is $2\times2$ permittivity tensor
where
$$\...
0
votes
2
answers
51
views
Numerical code to solve LLG is not preserving norm
I am new to this thread. I am trying to do a simple exercise on solving the LLG equation. The equation reads:
$\frac{d\vec{m}}{dt} = -\gamma(\vec{m} \times\vec{H})$.
Given a normalized input state ($...
0
votes
0
answers
67
views
Can the Crank-Nicolson Method Be used to Solve The Schrodinger Equation with a Time Varying Potential?
I have been following an excellent article about how to use the Crank-Nicolson method to solve the Schrodinger equation. In the article it starts with a $V(x, y, t)$ but the potential seems to become ...
0
votes
0
answers
33
views
Numerov Method with Time Varying Potential
Is it possible to use the Numerov method to solve the Time Dependent Schrodinger Equation ($\frac{i\partial\Psi(x, y, z, t)}{\partial t} = \nabla^2\Psi(x, y, z, t) + \Psi(x, y, z, t)V(x, y, z, t)$) ...
0
votes
0
answers
25
views
Translating poisson equation to sfepy code
As the title suggests, I am trying to convert the Poisson equation:
Into sfepy code that can solve the differential euqation problem numerically.
I am trying to modify the tutorial on lienar ...
3
votes
1
answer
88
views
Eigenvalues of diagonal plus rank-one
I need to compute an eigendecomposition of an $n\times n$ matrix
$$
D + c vv^\top = Q\Lambda Q^\top \tag{1}
$$
in MATLAB, where $D$ is a real diagonal matrix, $c$ is a scalar, and $v$ is a real vector....
-1
votes
0
answers
44
views
How to compute this hamiltonian in Python or Mathematica [closed]
The topic is Artificial Gauge fields
I trying to solve this problem, I already have the fock basis but I don't have the clear idea how to write this hamiltonian in the matrix formalism code, someone ...
2
votes
1
answer
110
views
Parallelize pseudo inverse of a matrix using Lapacke
I am currently using the protocol described in
https://stackoverflow.com/questions/55599950/computation-of-pseidoinverse-with-svd-in-c-using-blas-and-lapacke to compute the pseudo inverse of a matrix.
...
0
votes
0
answers
57
views
Is it possible to globally solve a general coordinate-wise monotone nonlinear system 3x3?
Consider a system
$$
F_i(x, y, z) = 0, \quad i = 1, 2, 3
$$
with $F_i$ monotonic w.r.t. $x, y$ and $z$.
The system 2x2 can be easily solved with alternating direction method that will find all its ...
0
votes
0
answers
29
views
Efficiently compute the Fourier series coefficients of a piecewise trigonometric function
I am searching for the most efficient algorithm to compute the Fourier series coefficients of a number of given functions $f(\theta)$
$$a_k = \int_0^{2\pi} f(\theta)\cos(k\theta) \\
b_k = \int_0^{2\pi}...
0
votes
0
answers
14
views
Consering numerical implementation of gradient based method for control system
I'm trying to reproduce the results in Optimal consensus control of the Cucker-Smale model by Bailo et al. The system is the following,
the adjoint variables,
and the algorithm,
I tried to ...
2
votes
1
answer
81
views
Cell-based vs face-based finite element methods
Notation:
Denote $T_{h} = \left\{K\right\}$ to be a face-conforming triangulation of a domain $\Omega$ such that $K_{i} \cap K_{j} = \emptyset$ for $i \neq j.$ Additionally, denote $\mathcal{V}_{h} = ...
0
votes
0
answers
57
views
2D wave equation is numerically unstable using Finite Difference Method
I'm working with simulating both the heat and wave equation in 2D in a Python code. When simulating the heat equation, I learned about the CFL which I used to get a numerical stable solution.
I found ...
0
votes
0
answers
23
views
GNU Octave toolbar icons [closed]
Is it possible to customize the toolbar icons, i.e. change the default icons with something different? An example could be the use of Fluent icons instead of the default Tango icons.
3
votes
0
answers
107
views
Numerical integration of a rapidly varying complex exponential
I have a function $f : \mathbb{R}^2 \mapsto \mathbb{R}^+$ and I wish to numerically evaluate the integral below over a finite domain $\Omega \subset \mathbb{R}^2$
$$
I = \int_\Omega e^{i k \cdot f(\...
0
votes
0
answers
54
views
Solving 2D Heat Equation with Input using central finite difference method
So I have implemented central finite difference method for solving the 2D heat equation. When I leave all initial and boundary conditions as 0s, but apply an input uniform across the entire space or ...
1
vote
1
answer
97
views
Non-Uniform Grids: Approximation Quality: First Order Finite Difference vs. First Order Finite Volume
Consider the advection/transport equation in 1D with constant velocity $a(x) \equiv 1$
$$u_t(t,x) + u_x(t,x) = 0$$
on a, say, periodic domain.
On uniform grids $$ \{x_i\}_{i = 1, \dots, N}, \quad x_{i ...
3
votes
1
answer
96
views
unconditionally stable schemes better than conditionally stable ones in accuracy?
Let's consider two finite difference schemes for PDEs/ODEs. One is conditionally stable, the other is unconditionally stable. People always prefer unconditionally stable ones to conditionally stable ...
2
votes
0
answers
39
views
Delaunay-based isosurface extraction vs marching cubes
I recently tried the isosurface extraction algorithm provided by the C++ library CGAL. This is new to me. It is based on Delaunay triangulations.
I have some experience with the marching cubes, I ...
0
votes
1
answer
32
views
In "scipy.integrate.odeint", what does the option "col_deriv : bool, optional" imply?
For example, if I have a matrix differential equation; $\frac{\partial y}{\partial t}=A(t).y$. Here my jacobian is the A(t) matrix. But what is derivative across the column or derivative across the ...
1
vote
0
answers
77
views
Conceptual doubt regarding 2D conjugate heat transfer modelling (COMSOL and Mathemtica)
I have been dealing with some conceptual flaws in my understanding of modelling, which I will elaborate herein. I am modelling conjugate heat transfer of a reciprocating fluid, which flows with ...
0
votes
0
answers
23
views
snappyHexMesh not meshing correct region
I created a simple model of cylindrical container to perform heat transfer simulation using FreeCAD for CAD modelling. I exported the model in stl format along with domain boundaries and faces. I have ...
0
votes
0
answers
46
views
Fortran - Lid-Driven Cavity Boundary Conditions Error when using SIMPLE method
I am studying Numerical Methods for incompressible flows. part of the tasks is to model the lid driven cavity problem in 2D using the SIMPLE method.
I have been provided with Fortran code that is ...
0
votes
0
answers
33
views
books/paper recommendation on computational thermal-turbulence by using FEM
I have just learned basic FEM for 2D N-S euqation, now my teacher let me to do the following problem, the document of this problem is in large fluid problem, the system of equations is listed in that ...
3
votes
1
answer
206
views
Is it really necessary to solve a system of linear equations in the Finite Element Method?
When we solve some boundary value problem by Finite Element Method, the appropriate system of linear equations is built, $$Ax=b.$$
Usually we use the solution x just for plugging it into some ...
1
vote
0
answers
50
views
Exponential Integrator to solve PDE with Stiff term
I wish to solve an equation like the following,
$$\frac{\partial f}{\partial t}+\frac{\partial}{\partial x}\left(A(x)f\right)=S(x,t)f$$
where $A(x,f)f$ and $S(x,t)f$ are the advection and the source ...
0
votes
0
answers
28
views
What is the boundary condition of $\varepsilon $ for $k-\varepsilon $ turbulence model?
I'm working on the numerical solution of systems of equations, you can use this link to access it, the system of equations is
$\begin{aligned} \partial_t \theta+u \nabla \theta-\nabla \cdot\left(\...
0
votes
0
answers
47
views
solve a coupled PDE system with some discontinuity by a mixed FEM
$$
\begin{cases}
u_t=f(u,v,\nabla{v}),\\
\Delta{[g(u)v]}=0.
\end{cases}$$
I want to solve the above PDE system by a mixed FEM, that is, $u_t=f(u,v,\nabla{v})$ by discontinuous Galerkin (DG), where $f$...
0
votes
0
answers
84
views
navier-stokes equations in semi-discrete form
Can someone point me to where the Navier-Stokes equations in 2D, both compressible and incompressible are written in semi-discrete form? I'm doing reduced order modelling and I need to write them down ...
0
votes
0
answers
51
views
generating multivariate Gaussian samples with constraints
Using GRFs, one generates samples $x \sim N(m,K)$ with arbitrary mean $m$ and covariance matrix $K$ using a scalar Gaussian generator as
$x = m + Lu$,
where $L$ is a lower triangular matrix, such that ...
1
vote
0
answers
61
views
Why can we remove the half-step velocity in velocity Verlet
Eliminating the half-step velocity, this algorithm may be shortend to
Why can we eliminate the half-step velocity and all the math behind the velocity Verlet to what Wikipedia shows?
2
votes
1
answer
91
views
Numerical solution of an advection equation, $\frac{\partial P}{\partial t}+\frac{\partial}{\partial x}\left(P^{5/3}\right)=0$, with finite volume
I was trying to solve the following equation numerically,
$$\frac{\partial P}{\partial t}+\frac{\partial}{\partial x}\left(P^{5/3}\right)=0$$
I adopted the Godunov approach for discretising the ...
0
votes
1
answer
78
views
How can I solve this PDE system by discontinuous Galerkin method?
As is known to all, the discontinuous Galerkin method (DG) was first used to solve the equation $u_t+u_x=0$. Now I have the following system of PDEs:
$$
\begin{cases}
u_t=f(u,v,\nabla{v}),\\
\Delta{v}...
0
votes
0
answers
34
views
Why do BVP solvers' APIs only allow "unknown" parameters in the derivative and residual functions but not "known" parameters?
I recently needed to solve a second order boundary value problem and noticed that both scipy.integrate.solve_bvp and Matlab's ...
0
votes
0
answers
60
views
SUNDIALS using Python Interface tutorial
I am attempting to solve differential algebraic equations using SUNDIALS with a Python interface. I am having trouble learning to actually use sundials, and cannot seem to find any tutorials online ...
0
votes
1
answer
69
views
Gmsh Python: Specify mesh regularity conditons
I am using python API of Gmsh to generate a mesh for a rectangular domain. I am really new at this. My code looks like this,
...
1
vote
0
answers
44
views
Vehicle passenger assignment with capacity constraint
Problem Background
I'm trying to find a solution to the following passenger matching problem:
The network is represented by graph $G=(V,E)$. $V$ is the set of nodes/stations. $p_{ij}$ is the profit of ...
2
votes
0
answers
51
views
Compact Finite Differences for the Heat Equation with Robin Boundary Conditions
I am trying to solve the Heat equation with Robin Boundary condition:
$$ u_t(x,t) = u_{xx}(x,t), \\ u(x,0) = g(x), \\ u(0,t) + u_x(0,t) = h_0(t), \\ u(1,t) + u_x(1,t) = h_1(t)$$
for $ 0\leq x\leq1$ ...
0
votes
0
answers
44
views
Over-specification of conjugate heat transfer coupling conditions
I am trying to implement steady state conjugate heat transfer using a monolithically coupled scheme. In this simulation, the computational domain is divided into fluid and solid subdomains. Over time, ...
6
votes
2
answers
122
views
Method to compute $a^n - b^n$
Given two floating point numbers $a,b$ with $a > b$ and an integer $n$, what is the most accurate way to compute
$$
a^n - b^n
$$
? We can assume both $a,b$ are between 1 and 2. Lets assume both $a^...
1
vote
1
answer
65
views
Simulating First Order Hyperbolic PDE with Finite Difference Scheme
I am trying to simulate a hyperbolic PDE with some control given by the following:
$$u_t(x, t) = u_x(x, t) + \theta(x) u(0, t)$$
with boundary conditions:
$$u(1, t) = U(t) = \int_0^1 k(1-y) u(y, t)dy$$...
5
votes
2
answers
157
views
What is the best method of computing $a^{(k)}/k!$?
I have the following expression
$$
\frac{a^{(k)}}{k!}
$$
where $a^{(k)}$ is the rising factorial. Is it better to evaluate it using floating-point arithmetic separately, that is, call a function that ...
2
votes
0
answers
51
views
Losing memory on each call to scalapack solve function
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 ...
0
votes
1
answer
27
views
Dimensionality reduction between discrete wavelet families
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 ...
0
votes
0
answers
51
views
Looking for a specific version of the Quasi-Minimal Residual (QMR) method
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$.
...