instruction stringlengths 43 28.1k |
|---|
To use newer accelerators like this, I need to perform matmul in 4-bit precision. How do I tell whether this operation is stable? Wondering if there well common heuristics in terms of properties of matrices $\{A_i\}$.
For classification tasks, matrix multiplication is stable if $\langle y, y_{\text{4-bit}}\rangle>0$ w... |
I have the raw data of $X$, $Y$, $Z$, where $X$ and $Y$ are inputs and $Z$ is the output. Plotting the surface gives the red curve:
The surface seems to be a simple function involving trigonometric functions. For example, plotting the equation $\cos(X)^2 + \cos(Y)^2$ gives the blue surface and it looks similar to the r... |
I am using ARPACK to find the smallest eigenvalue of a matrix. I use the shift and invert method. That is, looking for the largest eigenvalue of
$$
(A-\sigma I)^{-1}.
$$
However, I do not know $\sigma$ beforehand and have to adjust its value during the iteration process. Therefore, I need to do compute $(A-\sigma I)^{-... |
Where can one find Prof A. Stanoyevitch's finite difference based PDE matlab code? They have a book on such a topic but can't find the accompanying code.
Is it well received? It's not commonly talked about.
|
I wasn't sure if I should post this on stackoverflow rather than here, but because I have to construct a specific tensor I think here is more suitable.
I have 2 tensors, $x \in \mathbb{R}^{M \times N \times L}$, and $d\in \mathbb{R}^{M \times L}$ my goal is to construct a new tensor defined as
$(\cdot,\cdot) : \mathbb{... |
I'm currently in the process of computing a differential cross-section for the scattering of a 420 MeV electron by an O-16 nucleus (with a Wood-Saxon charge distribution). The problem is that the resulting graphs don't look anything like they should. I first calculated the form factor for the wood-saxon charge distribu... |
Heat and Burgers equations for example are both conservation laws
$du/dt+dq/dx=0$, where $q=-u_x$
$du/dt+df/dx=0$, where $f=u^2$
The former is usually solved by common finite differences and finite elements while the latter usually by those specially designed for conservative PDEs like DG and finite volumes. Though hea... |
So I am trying to model a dispersive dielectric using the Lorentz model in Julia, more specifically I am trying to obtain the frequency-dependent reflectivity of the material. I am ultimately trying to replicate the results in this paper.
I have the set of update equations:
along with the coefficients:
I am trying to... |
How should I evaluate the overall mass and moments of inertia (polar and transverse) of a finite elements model, having its mass matrix?
Given that the global mass matrix is composed of symmetric mass submatrices (let's call these $m_{i,j}$, with $i,j = 1,2,3,\ldots, N$, $N$ = [number of nodes]) carrying information on... |
I'm relatively new to the FSI world, and I'm dealing with some benchmark FSI problems at first; such as the example of a flap in a channel. (googling fsi benchmark flap 2D leads me to the example immediately)
Currently I'm testing alternatives to mesh movement methods, i.e., not using a PDE to resolve the mesh movemen... |
I am solving a system of the form
$$ \begin{pmatrix}
A & b^T \\
b & 0
\end{pmatrix}
\begin{pmatrix}
x \\ \ell
\end{pmatrix}
= \begin{pmatrix}
c\\
0
\end{pmatrix}
$$
Where $A$ is a symmetric matrix with a one dimensional kernel. $A$ is positive definite on the orthogonal of the kernel. $b$ is a vector and $c$ is such ... |
Suppose I have two tensors $A_{i_1,\ldots,i_M}$ and $B_{j_1,\ldots,j_N}$ where $M \neq N$ in general. We can define a tensor $C_{i_1,\ldots,i_M,j_1,\ldots,j_N}$ by
$$
C_{i_1,\ldots,i_M,j_1,\ldots,j_N} = A_{i_1,\ldots,i_M} + B_{j_1,\ldots,j_N}
$$
I thought I could use torch.einsum to construct such a tensor in pytorch b... |
For my variable $U(t,x)$, I have implemented the thomas algorithm with $U_j^i$:
$$ a(x)U_{j-1}^{i+1}+ b(x)U_j^{i+1} + c(x)U_{j+1}^{i+1} = d(x)U_j^{i} $$
Then $\textbf{A}$ is a tridiagonal vector with coefficients $a,b,c$ and I solve using $Au=d$. I can get this working fine. The issue is that I want to implement the bo... |
I'm trying to fit a few X-Y points that look like exponential.
I used the following scipy code:
import numpy as np
import scipy
import scipy.optimize
def custom_exponential(x, k, h):
return np.exp(k * x) / h
x_data = np.array([10, 20, 30, 40, 50, 60, 70, 80, 90, 99])
y_data = np.array([6, 25, 88, 243, 560, 1177, ... |
I want to understand the time complexity of scipy.linalg.solve_triangular, which calls trtrs from LAPACK under the hood, so I wrote the following benchmarking script:
from time import perf_counter
import numpy as np
import scipy
def benchmark(p):
L = np.ones((p, p))
b = np.zeros((p))
start_time = perf_c... |
TLDR; I can keep matrix variables approximately orthogonal by taking a single gradient step in the direction of "effective rank" of matrix at each step of iterative solver, is there a more effective method with similar cost?
I have an iterative solver that's minimizing a problem over $d\times d$ matrices of the form $... |
I would appreciate it if you could help me solve the following coupled equation numerically
$$
[-\frac{1}{2} \partial_r^2 + v_0(r) -E]\psi_{\ell} + v_1(r) \psi_{1-\ell}(r) = 0,
$$
where $\ell = 0 , 1$ with initial conditions
$$
\partial_r \psi_0(0) = 0,\\
\psi_1(0) = 0.
$$
I do not know how to determine the initial sta... |
I have two coupled ordinary differential equations in the steady state:
The following code solves, using the Jacobi finite difference method, in 1d using Dirichlet boundary conditions for function $s$ and Neumann boundary conditions for function $n$.
from pylab import imshow,gray,show, plot, xlim
import time
# Const... |
I have set up Newtonian Gravity in my Game Engine, allowing me to simulate the gravitational attraction between celestial bodies.
I have the following variables defined:
btScalar whiteHoleMass = 5e+28;
btScalar whiteHoleRadius = 500'000.0;
btScalar sunRadius = 100'000;
btScalar sunOrbitRadius = 50000;
btScalar sunMass ... |
I am trying to simulate the following 1-dimensional wave equation with trivial initial conditions and a inhomogeneous Dirac delta function:
$u_{tt} - c^2 u_{xx} = \delta(x - x')\delta(t - t'), \ u(0, x) = u'(0, x) = 0.$
My finite difference scheme on the grid is found by the typical central difference formulas
$u_{tt} ... |
I am using cvxpy to maximize a function f(x) given the constraints -1 <= x <= 1. Let's call the solution x0. Now, I define a region around the optimal value f(x0) and want to find another solution x that lies within the defined region and that is maximally different from x0.
The problem statement looks as follows:
cons... |
I have found many libraries for reducing filling when dong Cholesky factorisation on sparse matrices. However, I want to do fill-reduction for a different reason - given a $m\times n$ matrix $A,$ I want to find a permutation matrices $P,Q$ such that $B=PAQ$ satisfy the property that $B^\ast B$ is as sparse as possible.... |
I am trying to solve a matrix equation in the following discrete form:
$$
\frac{K^{n+1}-K^n}{\Delta t} = [(K^{n+1} (V^{n})^T).^3 - K^{n+1} (V^{n})^T]V^n.
$$
where $K^{n+1} \in \mathbb{R}^{m \times r}, V \in \mathbb{R}^{n \times r}$, $V^T V = I$(identity matrix) and $.^3$ are elementwise operations.
I am attempting to s... |
Cross-posted on Stats.SE and on MMSE.
In the case of Monte Carlo simulations:
Autocorrelation Time ($\tau_{\text{int}}$): A measure of how many steps are needed for the correlations in the chain to become small; it affects the variance of estimators based on the Markov chain.
Relaxation Time ($\tau_{\text{relax}}$): ... |
I am concerned looking for an exact Riemann solver for compressible 1D multi-component Euler equations, supplied with the ideal gases equation of state and under the assumptions:
Mechanical equilibrium
Thermal equilibrium
For example for the form used by Gouasmi et al. 2020 [1]. In a question [2] of this forum, it is... |
We have a large sparse symmetric positive-definite matrix $A \in \mathbb R^{N \times N}$ and a vector $x \in \mathbb R^N$. How do I practically compute the inner product $x^T A x$ when the matrix $A$ is ill-conditioned?
In my applications, this is a stiffness or mass matrix of a finite element code.
There is an obvious... |
Cross-posted in CrossValidated.SE and MMSE
I am experimenting with a new MCMC protocol and new research.
In the context of Monte Carlo simulation, a "state of equilibrium" refers to a condition where the system being simulated has reached a stable configuration or distribution of properties that does not significantly ... |
""we aim for a consistent variational-monolithic coupling scheme in which we need all equations defined in the same domain; therefore, $\mathrm{ALE}_{f x}$ was introduced. In variational monolithic coupling, Neumann-like interface conditions, like the continuity of normal stresses are fulfilled exactly in a weak sense ... |
I want to simulate how a Gaussian beam would look like at the receiver plane when propagated through an atmospheric turbulence. For this I am using AO package. Since I didn't see any function for multipropagation i.e. choosing multiple phase screens between the distance and propagating partially. Taking reference from ... |
The Debye functions are defined like so: ${D_n\left(x\right)} = {\frac{n}{x^n} \cdot {\int_0^x{\frac{t^n}{e^t - 1}dt}}}$.
I'm trying to evaluate the functions for $n$ from one to four and for $\left\lvert x \right\rvert < 10$. The required number of evaluations is great, and I require hundreds of bits of accuracy.
Usin... |
Problem
I am using finite difference method to solve classic problem of flow around cylinder, for validation of my group's immersive boundary method.
The common way to validate numerical method is calculating drag and lift coefficient. But my result is far form other's results. So it must be error in my force calculati... |
Recently I am reading a paper. In it, after they achieve eq(15), which is
$$ \operatorname{Tr}(\boldsymbol{Q})-\sqrt{2 \ln (1 / \rho)} \sqrt{\|\boldsymbol{Q}\|_F^2+2\|\boldsymbol{r}\|^2}+\ln (\rho) \cdot \lambda^{+}(\boldsymbol{Q})+s \geq 0 $$
Then they said "By introducing suitable slack variables, one can easily show... |
Let us say I want to solve a large sparse linear system. It is said that iterative solvers should be better than direct solvers in this case. But how large is large? What is the exact threshold beyond which I must use iterative solvers? A thousand by thousand matrix? A million by million matrix? I understand this might... |
I'm currently facing the problem of efficiently detecting (special) ellipses in edge images. These images are given (i.e. previous image processing is impossible) and contain quite some noise. I need to detect those ellipses which are completely contained in another ellipsis. The following images gives a reduced exampl... |
I was solving the dimensionless wave equation:
$$ u_{xx} = u_{tt} \tag 1$$
with the initial conditions:
$$ u(x,0) = 0 \tag 2 $$
$$ u_t(x=0,0) = v_0 \tag 2 $$
$$ u_t(x>0,0) = 0 \tag 3 $$
and the boundary conditions:
$$ u(1,t) = 0 \tag 4 $$
$$ mu_{tt}(0, t) + u_x(0, t) = 0 \Leftrightarrow mu_{xx}(0, t) + u_x(0, t) = 0 \t... |
I would like to report an issue which may be interesting in computational physics. Sometimes, to save time and memory, we use eigs() to calculate the first several eigenvalues of a sparse matrix. However, I find that the eigenvectors calculated in this way is not always accurate, especially only few eigenvalues are cal... |
Is it true that ENO/WENO schemes are the "goat" and they completely supplanted the older methods such as Godunov, approximate Riemann solvers, flux limiters etc? Are these old methods only important in classrooms to motivate and pave the way for the ultimate "boss" ENO/WENO?
|
I am trying to understand how the relationship between Butcher tables for Runge-Kutta methods and their generalization to general linear methods matrices (by Butcher also).
Runge-Kutta methods can be specified by the nodes $c_i$, the weights $b_j$ and the coefficients $a_{ij}$ under the form of Butcher tables (see Wik... |
I'm interested in sampling from a Gaussian with zero-mean and covariance given by:
$$
\Sigma = \begin{bmatrix}
\Sigma_{11} & \Sigma_{12} & \cdots &\Sigma_{1,100}\\
\Sigma_{21} & \Sigma_{22} & \cdots &\Sigma_{2,100}\\
\vdots & \vdots & \cdots &\vdots \\
\Sigma_{100,1} & \Sigma_{100,2} & \cdots &\Sigma_{100,100}
\end{bma... |
For a matrix $Y(t) \in \mathbb{R}^{m \times n}$, its rank-r approximation could be represented in a factorized SVD-like form.
$$
Y(t) = U(t) S(t) V^T(t),
$$
where $U^{T}U = I_m$, $V^{T}V = I_n$ and $S \in \mathbb{R}^{r \times r}$.
I want to integrate the matrix $Y$ and have obtained the following iterative format:
$$
U... |
abaqus documentation only shows generalized models and their formulae. What are the prony series in abaqus for the simplest maxwell and kelvin models?
|
The Wikipedia article on Runge-Kutta Methods lists several examples of each order. My question is, are there any particular advantages using one particular scheme over another of the same order?
I wanted to complete a convergence test of the Advection Equation, which is as follows:
$$ \frac{\partial \theta}{\partial t}... |
I would really appreciate if you could recommend me some textbooks that explain FEM process well and have many exercises to solidify the knowledge. So far, Brenner and Zienkiewicz seem to be a bit hard, although, I would like to switch to Zienkiewicz, once I get the grasp of the basics. Any input would be greatly appre... |
As exercise I am implementing few fundamental networks.
Specifically right now I am implementing VGG
The code I've got at the moment is the following:
class MyVGG(nn.Module):
def __init__(self):
super(MyVGG, self).__init__()
self.arch = nn.Sequential(
nn.Conv2d(3, 64, 3,padding=1),
nn.MaxPool2d(... |
I would like to calculate the surface area of a 6-noded triangle element, i.e., the face of a 10-noded tetrahedral element in 3D space. A typical solution is to calculate the surface integral of the Jacobian of such an element, however I can only find derivations of the shape functions and thus the Jacobian for the 2D ... |
I am attempting to solve the differential equation $\ddot\phi + 3H\dot\phi + \dfrac{dV}{d\phi} = 0.$
For $V(\phi) = V_{0}e^{-\lambda\phi}$, where $V_{0} = 0.7$, $\lambda = 0.1$ and $V'(\phi) = \dfrac{dV}{d\phi}$
Attempt to solve second-order ODE.
def DSDX(S,T):
phi,deri_phi = S
Declaring some important constants r... |
Say I have a mixed integer linear program in variables $x \in \mathbb{Z}^a, y \in \mathbb{Z}^b, z \in \mathbb{R}^c$ together with linear constraints on $(x,y,z)$. I want to count the number of values of $x \in \mathbb{Z}^a$ s.t. a solution $(x,y,z)$ exists.
Is there existing software to solve problems of this type? T... |
I have a 3D Laplace problem on quite a complicated geometry where I am using Discontinuous Galerkin method. My mesh is composed by hexas, hence I am employing classical tensor product basis functions $\mathcal{Q}^p$.
The mesh is not very fine, it is made by $1600$ elements. For every polynomial degree I am solving the ... |
I have been looking in detail into one of the many "meta-heuristic" optimization algorithms and became suspicious at how well it appeared to perform (compared to other methods like Nelder-Mead, Multi-Directional search, and Spiral optimization) on a "pathological" test function, Rastrigin.
If any of you good people are... |
I am currently working on my bachelor thesis, which aims to enhance the multigrid preconditioned conjugate gradient algorithm proposed by Tatebe in 1993 using Deep Learning.
Currently, I am implementing it on a 2D lid-driven cavity problem. However, I have encountered an issue where the algorithm from Tatebe is produci... |
If we want to use variable preconditioning in Conjugate Gradient, we can replace the Fletcher–Reeves by the Polak–Ribière formula (https://en.wikipedia.org/wiki/Conjugate_gradient_method#The_flexible_preconditioned_conjugate_gradient_method). Is there a similar formulation when the update is performed as in the Conjug... |
I solved the 2D heat equation using the finite element method. It all went well first with the adiabatic case, however problems occured when I introduced cooling with the enviroment.
I modeled the process with newton's law of cooling:
$$
q = h (T - T_{\infty})
$$
Using the term
$$
q = k \nabla T
$$
Assuming that $k=1$... |
I've seen references to the "unit torus" in papers such as this (Start of Sec 3.3, page 5). So, what exactly is a unit torus? Is it just a square or cube in d-dimensions with periodic boundary conditions? I've seen this picture and this mathematical definition but neither seem to provide much clarity.
|
I want to generate a triangular mesh over a rectangle domain in order to solve Euler equations. Most mesh generator generate a mesh while providing node connectivity for each element. This is convenient for finite element codes. Whereas finite volume codes for unstructured grids requires the center of each element, the... |
I have a sparse, undirected and unweighted graph $G$ of size $n$, with $n$ on the order of say several million. I would like to compute the Fiedler vector $f$ of $G$, which is the eigenvector associated to the smallest nonzero eigenvalue of the associated Laplacian matrix $W$.
My current method is to compute the larges... |
I have a computational graph (DAG) consisting of element-wise operations (potentially with broadcasting) and reshape/reduce operations (reshaping/sum/max). I'm trying to understand how vertical kernel fusion is performed and whether it's something that can be done without developing/using external tools like a linear a... |
I am exploring Higham's excellent Accuracy and Stability of Numerical Algorithms and chapter 4 is dedicated to summation.
So I decided to test the most basic thing. Summing positive random numbers uniformly distributed between $0$ and $1$ (exactly $2^{20}$ of them). I was expecting that first sorting (increasing order ... |
In the first-order upwind scheme, numerical diffusion can be quantified as:
$$\frac{dT}{dt} = -w\left(\frac{dT}{dz}\right) + \left(\frac{wdz}{2}\right)\left(\frac{d^2T}{dz^2}\right)$$
For Lax-Wendroff, it is:
$$\frac{dT}{dt} = -w\left(\frac{dT}{dz}\right) + \left(\frac{w^2dt}{2}\right)\left(\frac{d^2T}{dz^2}\right)$$
I... |
I am studying DG and I've seen that it's possible to define a multigrid method. Let's consider two nested grids $\Omega_{l-1}$ and $\Omega_{l}$ and $V_{l-1}$ and $V_l$ classical DG spaces, both of order $p$, with basis $\left\{\varphi_1^l, \dots, \varphi_{n_{l}}^l\right\}$ and $\left\{\varphi_1^{l-1}, \dots, \varphi_{n... |
I would like to ask Python to compute the determinant of a large symmetric matrix where all off diagonal entries are known. The diagonal entries could vary. Since I need to compute the determinant many times with different diagonal entries, it seems a waste of time when the computation involves the multiplications of a... |
I am trying to solve below ODE equations for Raman model but I am having errors, mostly overflow in multiply and add. Please I need your help. Below is the code I have written so far. I am new to Python thought. Thanks
import numpy as np
import math
import matplotlib.pyplot as plt
# Solving Raman model equations using... |
Constructing Modified Euler
Using the same strategy as done in the construction of Modified Euler. Starting from Trapezoidal Method
$$y_1 = y_0 + \dfrac{h}{2}\left(f(x_0,y_0) + f(x_1,y_1)\right)$$
then approximating $f(x_1,y_1)$ using the explicit euler $y_1 = y_0 + hf(x_0,y_0)$ , thereby constructing the modified eule... |
I am looking for comprehensive literature (papers, books, reports etc..) on iterative solvers for solid and structural mechanics problems to understand the best iterative solvers and preconditioners for general problems consisting of anisotropic and unstructured meshes with elements with large aspect ratios and multi-p... |
Consider a bi-linear form
$a(u,v) = \int_\Omega A\nabla u \cdot \nabla v - \sum_e \int_e${$\nabla u$} $ \cdot [A u]$
defined on a discrete polynomial space $V_h \subset H^1_0(\Omega)$ with {.} and [.] are the mean and jump which are well defined on the interface $e$, and $A$ is an elliptic and piecewise constant matri... |
In this study, (Hidden Fractals in the Dynamics of the Compound Double Pendulum) the authors provide various fliptime fractals (of a double pendulum) for different length combinations. However, when I tried to replicate their results, the shapes (for $3l_1 = l_2$ in particular) did not match up. I used a fourth order R... |
a) Here how to prove if f is strictly convex function because hessian positive definiteness doesn't imply that f is strictly convex.
d) Here on picture I have a problem because when gamma is greater than 1/2 I cannot guess if it is greater than 1/2 because there is s^TCs which is greater than 0 but it can be also bet... |
We are trying to solve the following optimization problem using ADMM:
$$
\begin{aligned}
& \min _{\left\{y_{i j}^{m}\right\}} \sum_{i \in I_{m}} f_{i j}^{m}\left(y_{i j}^{m}\right)+\sum_{j \in J} \Phi^{m}\left(z_{i j}^{m}\right) \\
& \text { subject to } y_{i j}^{m}-z_{i j}^{m}=0 \quad \forall i, j, m
\end{aligned}
$$
... |
After reading the Wikipedia page for Monte-Carlo integration, I have understood the basic idea but I am having trouble implementing it for a general case.
The integration that I am trying to do is
$$
\int_{-\infty}^{\infty} \frac{\cos x}{x^2}- \frac{\sin x}{x^3} dx
$$
This integral is equal to $-\frac{\pi}{2}$, but I d... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.