instruction stringlengths 43 28.1k |
|---|
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(\mathbf{x})} \mathrm{d} \mathbf{x}
$$
where $k \in \mathbb{R}$ is a large positive real constant, for example typically $k ... |
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 CFL for the 2D wave equation as well, but my solution keeps being numerically unstable no matter how I change the time i... |
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} = \left\{v \in L^{2}(\Omega) : v\big\lvert_{K} \in \mathcal{P}^{k}, K \in T_{h} \right\}$ to be a space of discontinuous ... |
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} f(\theta)\sin(k\theta)$$
for $k \in {1,...,N}$. The functions $f(\theta)$ are continuous piecewise trigonometric funct... |
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 roots.
The problem is to find all roots of the 3x3 system with monotonic coordinate functions. Is it possible in a general ... |
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.
Clearly when dealing with large matrices (e.g. 10000 x 10000) the process is extremely expensive and the run becomes qu... |
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. As is detailed in section 5.3.3 of Demmel's Applied Numerical Linear Algebra, this can be achieved in $\mathcal{O}(n^2... |
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 elasticity which is similar but I am just causing it to crash.
|
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)$) with a time varying potential $V(x, y, z, t)$? If so, how?
Thanks!
|
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 constant later on. Am I able to recompute the potential at a new time value, take, the previous wave function, and plug... |
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 ($m_x$, $m_y$, $m_z$) = (1,1,1) and $\vec{H} = 2\vec{z}$, the expected output should preserve $m_z$ while $m_x$ and $m_y$ s... |
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
$$\varepsilon = \begin{bmatrix} \varepsilon_{xx} & \varepsilon_{xy} \\ \varepsilon_{yx} & \varepsilon_{yy} \end{bmatrix}$$
Can ... |
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 $\vec{A_3}$ is non-zero, I have the expression for the components of curl: $\vec{B} = \nabla \times \vec{A}$ as:
B1 = -(A3... |
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$ is the imaginary unit, $k$ denotes the wavenumber. There is some literature on this in the context of potential problems ... |
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 restricted to use a Mersenne Twister (MT19937) RNG with any other RNG listed here:
PCG-64
PCG-64 DXSM
MT19937
Philox
SFC64... |
Does the Lanczos algorithm remain memory efficient even if the original Hermitian matrix is dense?
|
I am trying to solve $\frac{u''}{1+u'^2} - \frac{1}{2(1-u)} = 0$ subject to $u(0)=1, u(1)=0$.
If I understand how to do this properly, I first do the variable substitutions:
$u = y$, $y_1 = y; y_2 = y'$
yielding:
$$\frac{y_2'}{1+y_2^2} - \frac{1}{2(1-y_1)} = 0 \iff y'_2 = \frac{1 + y_2^2}{2(1-y_1)}$$
And the boundary c... |
Even though this method is more widely used than the simple Verlet method mentioned above, it unfortunately has an error term of O(Δt^2)
, which is two orders of magnitude worse. That said, if you want to have a simulation with many objects that depend on one another --- like a gravity simulation --- the Velocity Ver... |
I have coded a simple program for a root finding problem using Halley's method. Here is the code:
function [x,n] = root_finder_Halley(f0,f1,f2,x)
i = true;
n = 0;
while i
n = n + 1;
x(n+1) = x(n) - ( 2*f0(x(n))*f1(x(n)) )/...
( 2*f1(x(n))^2 - f0(x(n))*f2(x(n)) );
dx(n) = abs(x(n+1) - x(n));
i = dx(n) > eps(x(n+1... |
Are there MIP solvers that allow certain constraints to be toggled based on the value of a binary variable? My current situation is that I'm approximating the desired behavior by using constraints of the form $$A_{i}x\leq b_i + C\delta_{i}$$ where $x$ and $\delta$ are decision variables, $\delta_{i}\in{0,1}$, and $C$ i... |
Consider system of ordinary differential equations
$$
\begin{align}
\frac{dx}{dt}&=\sigma(y-x)\\
\frac{dy}{dt}&=\rho x-y-xz\\
\frac{dz}{dt}&=xy-\beta z
\end{align}
$$
with $\sigma=10$, $\rho=28$ and $\beta=\frac{8}{3}$ and with initial condition $(x_0,y_0,z_0)=(1.508870, -1.531271, 25.246091)$
I am trying to embed the ... |
Let's define scaling, as how linear the speedup of using more than one GPU or CPU is. For example, having 2 GPUs gives you 2x faster execution time.
I have noticed that in many software (e.g. Molecular Dynamics, Gromacs, AMBER, OPENMM), it scales very badly for more than 2 GPUs, but it is not a problem for CPUs (you ca... |
I want to numerically solve integrals of the form,
$$
I = \int_a^b x^k f(x) dx
$$
where $k$ is a given integer, and $f(x)$ is a cubic polynomial, expressed as,
$$
f(x) = c_0 + c_1 (x - a) + \frac{c_2}{2} (x-a)^2 + \frac{c_3}{6} (x-a)^3
$$
When $k \geq 0$, the integrand is a polynomial of degree $k+3$ and a standard Gau... |
I am currently coding a solution to the following PDE:
$\frac{\partial T }{\partial t} =\frac{\partial}{\partial \theta}(A(\theta ,\phi )\frac{\partial T }{\partial \theta}) +\frac{\partial }{\partial \phi}(B(\theta ,\phi )\frac{\partial T}{\partial \phi}) + F(\theta ,\phi)T$ with periodic boundary conditions in polar ... |
I want to run a block Lanczos block-tridiagonalization on a hermitian, sparse matrix (of relatively small size $\sim 10^2 \times 10^2$). However the matrix typically has many eigenvalues that are highly degenerate, and the eigenvalues are closely spaced. I only care about the invariant subspace of the initial vectors, ... |
Let a function $u \in H^1_0(\Omega)$ defined by its values at the mesh nodes. Can we compute its Laplacian using the matrix resulting from the finite elements discretization of Laplace's equation? I know this may be done using $\Delta u = \sum_i u_i \Delta \phi_i$ where $\phi_i$ are the shape functions (well defined)... |
How do I solve the following evolution equation numerically:
$$
\dot{\boldsymbol{\mathcal A}} = -\lambda A_1|\boldsymbol{s}-\boldsymbol{\alpha}|^2\left[(\boldsymbol{n}_r:\boldsymbol{\alpha})\boldsymbol{n}_r\otimes\boldsymbol{n}_r+\frac{3}{2}A_2\boldsymbol{\mathcal A}\right]
$$
Here $\boldsymbol{\mathcal A}$ is a fourth... |
Consider the following 1D problem
\begin{align*}
\begin{cases}
\displaystyle
-\frac{d^2u}{dx^2} = f(x), \hspace{0.5cm} x\in (a,b) \\[4mm]
u(a) = u_{a}, \ \ u(b) = u_{b}
\end{cases}
\end{align*}
I know how to compute a finite element approximation $u_{h}$ of this problem. I'm working in an h-adaptive method, it works f... |
I was looking at the matlab function pinv.m for the compuation of the pseudoinverse. The code uses the singular values decomposition.
$$
A = U D V
$$
When looking for non-zero diagonal elements it sets a threshold using the formula:
$$max(n,m) * eps(d_{max}) $$
where $n$ is number of rows $m$ number of columns of $A$, ... |
What are some reasons for approximating a (e.g. parabolic) PDE using the space-time method, with continuous finite elements in time, vs discontinuous finite elements in time?
Are there e.g. significant differences in accuracy, or stability/spurious oscillations...?
I'm particularly interested in a comparison taking int... |
Finite element exterior calculus helps to furnish nice stable elements for many common elliptic PDE by looking at the de Rham complex
$$\Lambda^0(\Omega) \stackrel{d_1}{\to} \Lambda^1(\Omega) \stackrel{d_2}{\to} \ldots \stackrel{d_n}{\to} \Lambda^n(\Omega)$$
where $\Lambda^k(\Omega)$ are the $k$-forms on the domain $\O... |
I am computing the following quantity:
$$
\text{lhs} := ||a+b||^2 = ||a||^2 + 2a^\top b + ||b||^2 =: \text{rhs}
$$
for $a=c-d$, where $a,b,c,d$ are $n$-vectors.
Is there a rule of thumb for when I should have my program compute $\text{lhs}$ vs $\text{rhs}$ in floating point arithmetic? It seems that if $a,b,c,d$ are al... |
This is a general question: In this blog post, the author points out that under a unitarily invariant norm, the closest symmetric matrix to the square matrix $M$ is $\frac 1 2 (M + M^T)$. The general question I have is: When might a matrix which ought to be symmetric lose symmetry? I understand generally that this may ... |
I am trying to create a sweeping surface, for which I need the frenet frame of a curve. I am trying to compute this for arbitrary curves but for testing I am just using the parametric unit half circle. i.e. $C(t) = (\cos(t), \sin(t), 0)$
I am computing my derivatives using central differences, i.e.:
pub fn frenet_trihe... |
I need to write a for loop that tests multiple values in a function until the output is a multiple of 180.
i.e. it starts the number i'm testing at zero, checks if the result is a multiple of 180 or very close to one, and if it isn't, it increases the number i'm testing by some small increment and tests again, printing... |
I am trying to learn about 2D FEM methods. I am trying to understand the generalization of Lagrange polynomial basis from 1D into 2 variable polynomials over triangle domains.
The most basic element if I understand correctly is piece Wise linearity, obtained through barycentric coordinates.
What would the quadratic ele... |
For my thesis, I have to implement the CCZ4 formalism into an existing code (I tried to type the evolution equations here but does not seem to work).
However, I can't seem to come up with a scheme to solve these equations. For instance, here, the authors give an explicit scheme on how to solve the ADM equations (see pa... |
I have an operator $H$. I express $H$ as a matrix in the orthonormalized $\{ |e > \}$ basis. Then I diagonalize it to obtain eigenvalues, let's say for example $H$ is $6 \times 6$ and the eigenvalues are $1, 5, 7, 9, 3, 8$. Now I express $H$ as a matrix in a different orthonormalized $\{ |f > \}$ basis obtained through... |
I'm learning scipy.optimize.minimize. I thought of a simple function to see how it works:
$$f(x) = x$$
With the goal to minimise $f(x)$, subject to the constraint that:
$$x \ge 0.1$$
Without the constraint, there is no solution (except in the limit $\lim_{x\to -\infty} f(x) = \infty$). But with the constraint $x \ge ... |
I want to understand the data structure of elements, elements around elements, and so on, and various other data structures in FEM, could you please recommend some books?
|
I am a beginner in computational physics but have a background in physics, math, and programming (from online courses, videos, and textbooks) and I would like to know how should I:
Approach and think of any general computational physics problem and how I might find a solution and apply it to a real-world physical expe... |
In this resource the linear (barycentric) elements are explicitly given:
The geometry placement of higher order elements is also given but not expression for the polynomial of $P_2$ is given. I am hoping someone can tell me what the 6 polynomials look like.
|
First we need to present the details of what makes that cut possible. The issue is linked to the sum of squares $1^2+2^2+3^2+4^2+...+n^2$.
We consider the two cases:
1-the case of a sum of even squares
2-the case of a sum of odd squares.
However both sums lead to practically the same result which is a cut of the number... |
I'm, in the context of FEM. Let's say I have a discrete function $g$ living on the boundary of my domain $D$. I need to compute numerically $||g||_{1/2,\partial D}$.
The definition I know is the following:
$$\iint_{\partial D \times \partial D} \frac{\vert g(x)-g(y) \vert^2}{\vert x -y \vert^2} d s_xd s_y$$
However, I'... |
I am considering to solve complexed PDE systems, like in this post, using Comsol MultiPhysics. The PDEs are different from the General Form provided by Comsol. The Weak Form module may be worth a shot.
But I am no export in FEM theory. Even if I become one after learning, there might be a distance from FEM theory to C... |
This question is a duplicate of this question that I asked on dsp stack exchange. However, nobody had the answer there but the question seems more appropriate on this forum (If not feel free to tell me, it's my first post here).
The question is the following :
I've got my state space representation
$$ \dot{X} = AX+BU $... |
I'm using a numeric root-finder to find $k$ satisfying $\|A^k x\|=c$ where $A$ is a symmetric $d\times d$ diagonal + rank-1 matrix. How to compute $A^k x$ efficiently?
For integer $k$, I can get the answer in $O(k d)$ time using iterated products.
For general $k$, can use dense eigendecomposition of $A$ in $O(d^3)$ ti... |
I've been trying to solve the following equation
$$
y(t)=-A\cdot\frac{\mathrm{d} y}{\mathrm{d} t}+B\cdot\left(\frac{\mathrm{d} y}{\mathrm{d} t}\right)^{2}+C
\\
y(t=0)=y_{0}\\
$$
where $A$, $B$, and $C$ are positive numbers. The derivative at $t=0$ is also known but not really needed. I tried to solve it using scipy.int... |
I have to solve numerically an equation of the following form:
$$
\sum_{n=0}^m c_n x^n = f(x) x^k
$$
Where the $c_n$ are real values, $k$ is an integer and $f$ can only be evaluated numerically.
The current implementation in our code is using a numerical approach (specifically using scipy.optimize.brentq) but I wondere... |
I have all the constants set to the same values for each set of code, G, the timestep, the masses of the planets etc. But using Velocity Verlet doesn't work unless I lower the gravitational constant because otherwise the gravitational pull is too high.
The code is the same for both simulations up until the actual Veloc... |
I am using Levenberg-Marquardt to solve a nonlinear least squares problem with 16 million residuals and about a million variables. I have a fast matrix vector product for both the Jacobian and its transpose, and I can also compute the norms of the columns of the Jacobian. To compute the step, I am using LSQR. This sche... |
I need to solve the differential equation:
$$u_t = \Delta u + \sin t$$
On a 2D domain with homogeneous Dirichlet boundary conditions. Tod o this I am trying to use the python package getfem.
I am struggling quite a bit trying to set things up especially the parts of $u_t$ and $\sin t$ as I am not sure how to define the... |
In my application, I have a sum of diagonal $A$ and rank-1 $B$
$$T=\underbrace{\text{diag}(1-2\alpha h+2\alpha^2 h^2)}_A + \underbrace{\alpha^2 hh^T}_B$$
Where $h$ is a vector $\in \mathbb{R}^d$ with positive entries decaying faster than $1/i$, $\alpha>0$ and $\|T\|<1$.
Can eigenvalues of $T$ be approximated faster tha... |
Following some comments from another question I wanted to ask: does an explicit method always require some sort of analytical function/solution?
Let's take Euler for example. You have a function $f$ which takes $y$ and $t$ and is equal to $y'$. But there is no "generic" or one $f$ as far as I know, you need an analytic... |
I am interested in solving this set of nonlinear couples advection-diffusion equations using a finite volume scheme:
$$
\frac{\partial f(x,y)}{\partial t}=-(\boldsymbol{u}+\nabla\eta)\cdot\nabla f +\nabla\cdot(\eta\nabla f)+s_f(g),
$$
$$
\frac{\partial g(x,y)}{\partial t}=-\nabla\cdot(\boldsymbol{u}g)+\nabla\cdot(\eta\... |
The quantity I am interested in is not the rotation rate $\Omega$, but I will use this quantity nonetheless to make the problem clearer. I am interested in a spherically-symmetric system and in the boundary condition of the rotation rate $\Omega=u/r\sin\theta$. Now, at $\theta=0$, we have an undetermined form $0/0$ and... |
I want to implement a 1D Helmholtz equation with jump condition. The domain is $x=[0,1]$ and both ends have Dirichlet boundaries($p$=0). The 1D strong formulation is;
$$c^2\nabla^2p + w^2p=0 \qquad \mathrm{in} \quad \Omega,$$
and
$$\nabla p(0)=\nabla p(1)=0 \qquad \mathrm{at} \quad \partial \Omega,$$
$$\nabla p^-(0.8)=... |
I have been reading a bit about Quantum Field Theory and Photons, I read that the equation(s) for spin 1 massless particles (photons) in Quantum Field Theory are just Maxwell's Equations described in terms of 4-vectors under a Lorenz Gauge Condition. I know about Non - Relativistic Quantum Mechanics, but I don't know m... |
I'm writing finite element code in 3D, and I wish to connect vertical (Euler-Bernoulli) beams to a horizontal plate. The deformations of a beam are well described, but for the plate it is more difficult: for in-plane deformations of the plate I use quadrilateral elements, and for out-of-plane deformations I use Kirchho... |
Let's assume the equation
$$
\nabla^2u_n(\vec{r})+a_n(\vec{r})u_n(\vec{r})=\sum_{m=1}^{N}b_{nm}u_m(\vec{r}),\quad n=1,2,\dots,N,\quad \vec{r}\in\varOmega\tag{1}\label{eq1},
$$
is to be solved for $u_n$ in a domain $\varOmega$ with
$$
\hat{e}\cdot\nabla u_n(\vec{r})=0,\quad n=1,2,\dots,N,\quad \vec{r}\in\partial\varOmeg... |
I am trying to solve the following problem nuemrically:
$$u_t = \Delta u + \sin t$$
To that effect I scanned the documentation of FreeFEM, the closest example I can find to my problem is the Thermal diffusion problem.
I am trying to modify the existing tutorial code to solve my problem instead of the one in the example... |
Let us considered the following ODEs
\begin{align*}
\dfrac{dX}{dt} = F(X), \tag{1.1}
\end{align*}
where the unknown $X\in \mathcal{D} \subset \mathbb{R}^l$ and it can be stiff. These ODEs can be solved numerically by classical Newton's method if $F$ is differentiable almost everywhere on the considered domain
\begi... |
Are there any good IDEs for working with Octave code?
I'm used to type hints and documentation preview from software like IntelliJ or VS Code. While there are syntax highlighting plugins for VSC, all that isn't quite there yet, so is there a better solution?
|
I am asking for some help on how to calculate the reynolds number for an AWES. I know the formula of Re=rhovl/viscosity. I have selected the air foil as Clark y with chord length 3.72m (which will be the characteristic length). I specifically need the values of rho, v, viscosity with changing altitude. And also if it i... |
Suppose $a_i,q_i,b_0$ are positive real numbers. I need to solve the following equation for $k$
$$\sum_i^d a_i \exp(-q_i k)=b_0$$
Is this a well-known problem? One my special cases has $a_i=q_i$
In my application $d> 20000$, $q_i\approx 0$. Wondering if equation structure makes it possible to solve faster than Newton's... |
I'm interested in extending the concept of a staggered grid (commonly used to solve the incompressible Navier-Stokes equations) to a linear stability analysis context. For example, we can consider flow within a two-dimensional rectangular duct, as in Theofilis, Duck, and Owen in the Journal of Fluid Mechanics, 2004. Th... |
I am looking for an element for FEM that is piecewise $C^1$ continuous across triangles (i.e. $C^1$ continuous on the edge separating 2 triangles of the mesh).
I have heard about the Bell element:
https://arxiv.org/pdf/1706.09017.pdf
https://defelement.com/elements/bell.html
But I am struggling finding a simple definit... |
I am trying to solve the following differential equation in the domain of $\theta \in [0, 2 \pi]$ using finite differences scheme:
For $0< \theta \leq \pi$
\begin{align}
\rho_i^{n+1}=\rho_i^{n}+D\frac{\Delta t}{\Delta\theta^2}[\rho^n_{i+1}-2\rho^n_i+\rho^n_{i-1}]-\beta \frac{\Delta t}{\Delta\theta}[\rho^n_i-\rho^n_{i-1... |
I have a file that contains the coordinates of two points that make up a line. When I plot these lines, I notice that there are areas where the lines intersect more often. These points are identified as the areas where the yellow patterns are the thinnest on the plot. To make it easier to locate these points accurately... |
I have a matrix of the form:
$M:=\begin{pmatrix}
S_1 & & & \\\ Q_1 & S_2 & & \\\ & ... & ... & \\\ & & Q_n & S_n\end{pmatrix}$
where the blocks are square. The $S_i$ are asymmetric, the $Q_i$ are symmetric and positive definite. Would you have a reference/hints for efficient solution algorithms for systems of the... |
Suppose I'm solving $Ax=b$ for dense $m\times d$ matrix $A$. For which $A$ is this hard to do?
More concretely, is there any work on estimating the error after $k$ steps of iterative solver, $k\le d$, for some specific solvers, based on properties of $A$? For random isotropic vector $x$ and large $d$, a useful property... |
I am trying to use Matlab's pdepe.m to solve the first order parabolic PDE
$$\frac{\partial u}{\partial x}+\frac{\partial u}{\partial x}=x$$
I have not had trouble coding the argument of pdepe @pdefun:
function [c,f,s] = pdefun(x,t,u,DuDx)
c = 1;
f = -u;
s = x;
end
Since this is first order in space and time, we have ... |
I'm running a test problem to set up larger problems. Solving the simple unsteady heat equation via finite differences:
$$ \frac{\partial T}{\partial t} = \alpha \frac{\partial^2T}{\partial x^2}$$
$\alpha = 0.001$
$T(x=0,t) = 60°C$
$T(x=L,t) = 25°C$
$T(x,t=0) = 25°C$
import matplotlib.pyplot as plt
import numpy as np
i... |
I have an equation that I need to calculate numerically, but I am having doubts about my approach. I am cross-posting this question from Stack Exchange, because I am not getting any responses.
This is the equation I need to program:
where $\chi$ is a volume mixing ratio in the stratosphere, $\chi_0$ is a volume mixing... |
I am trying to find a P1 Lagrange finite element solution to the following ODE:
$\begin{cases}-u''+u'+u=f~~~~~~~~\text{in}~~(0,1)\\ u(0)=1, u'(1)=0\end{cases}$
Where $f(x)=-2e^{x}+2\left(1-x\right)e^{x}+\left(1-x\right)^{2}e^{x}$.
My procedure:
First I obtained the variational formula $\sum_{i=1}^{n+1}U_ia(\phi_i,\phi... |
I am currently trying to familiarise myself with (Pseudo-)Spectral Methods for solving differential equations. Now, I am struggling to understand some obviously crucial concept of this approach. The notes that I have read so far proceed their explanation of spectral methods roughly as follows:
The solution $f(x)$ to a ... |
I've made a previous question here and also in SO wondering why only the fsolve solver converges for the simple one dimensional unsteady conduction problem
$$ \frac{\partial T}{\partial t} = \alpha \frac{\partial^2T}{\partial x^2}$$
$\alpha = 0.001$
$T(x=0,t) = 60°C$
$T(x=L,t) = 25°C$
$T(x,t=0) = 25°C$
One of the answe... |
I am using backtracking linesearch to globalize a (semismooth) newton solver to minimize a (strongly semismooth) strongly convex function , and I am observing something strange (which may be a bug). For some problems, I observe that the accepted step size alternates between 0 and 1 in successive iterations. On other pr... |
I am dealing with a non-trivial Riemannian metric $H$ defined on a particular subset of Euclidean space ($E \subset \mathbb{R}^n$). I was able to show the Riemannian manifold $(E,H)$ is geodesically complete. I am interested in finding a geodesic that connects arbitrary points. I think this is accomplished via the shoo... |
Consider the following nonlinear diffusion problem,
$$
\frac{\partial u}{\partial t} = x^{-2}\frac{\partial}{\partial x}\left(x^2 u^4 \frac{\partial u}{\partial x}\right), \quad 0 < x < 1
$$
We can notice that if $v = u^5/5$, we can simplify the diffusion term to
$$
\frac{\partial u}{\partial t} = x^{-2}\frac{\partial}... |
Suppose $u$,$v$ are vectors and $A$ is a convergent $d\times d$ diagonal + rank-1 matrix.
How do I estimate $u^T A^k v$ in $O(d)$ time?
Powers of convergent diagonal $D$ can be computed in $O(d)$ time by utilizing Laplace transform.
For a general DPR1 matrix, there's $O(d^2)$ algorithm but I need something that works m... |
I'm quite new to the smoothed particle hydrodynamics method, so I'm trying to find Matlab or Python code to help me understand it. Specifically, I want to know how to solve the one-dimensional diffusion equation like in this paper,
$$\frac{\partial u}{\partial t} = \lambda \frac{\partial^2 u}{\partial x^2}$$
SPH is rev... |
I'm attempting to solve a strange differential equation problem. My goal is to know if there are kinds of ODE solver packages to solve this kind of problem.
I'm solving a 1D Partial Differential Equation for the vertical temperature structure of a planet's atmosphere:
$$\frac{\partial T}{\partial t} = - \frac{g}{c_p} \... |
I have lots of difficulties trying to make a phase plot for the motion of the particle trapped in Lennard-Jones potential:
$$V(q)=\epsilon\left[\left(\frac{q_\mathrm{min}}{q}\right)^{12}-2\left(\frac{q_\mathrm{min}}{q}\right)^{6}\right]$$
where $q$ is particle's position and $q_\mathrm{min}$ is the point where $V$ has ... |
[UPDATING]
The old one is a simplified version of the current one. Here is a solution based on the answer proposed by professor Bangerth down below. To describe what I am trying to do, first rewrite the question into
$$\max_X\|(I-\alpha X)^{-1}X\circ AE\|_F^2$$
where $X,A$ still are $n$ by $n$ square matrices, $E$ is a... |
I am a physicist who is fairly new to numerical analysis, currently, I am trying to simulate a non-linear paraxial equation, and part of my calculation involves solving a 2D Poisson equation with Dirichlet boundary conditions and a source function.
In order to solve the 2D Poisson equation, I tried using the iterative ... |
I have the following problem:
$$argmin_{\vec{x},\phi}||A\vec{x}-\vec{y}e^{j\phi}||_2^2$$
Here, $x$ and $y$ are vectors and $\phi$ is a constant phase factor that applies to the all entries of $y$. I could not make any progress in this problem. If anyone can point me to a possible closed form solution that would be grea... |
I was reading Scientific Computin, An Introductory Survey, by Michael Heath. In the Example 1.11, he madr a Finite Difference Aproximation, with the usual approxination : $f’(x)\neq \frac{f(x+h)-f(x)}{h}$. He postules the following:
We want h to be small so that the approximation will be accurate, but if h is too sma... |
I am trying to calculate classical trajectories for a single positive ion and a single electron inside an RF trap. Therefore, I am dealing with a two-body system that possesses:
Coulomb potential with a singularity
time-dependent potential that is periodic in time and quadratic in space (smooth, relatively weak - comp... |
I am looking for a numerical integration library like this one. The examples look very appealing but I see that all test functions use very barebones C arrays.
Do you have any recommendations of libraries for numerical integration over functions of multi-variate arguments that bind easily to Eigen?
I suppose in a pinch... |
In any FEM problem involving mechanics, we try to solve the differential equation for the displacement field, $u$ given the force vector in the nodes, $F$. In industry, we often see our automobiles getting deformed in ways we had not expected it to. Now, the reason is we simplify the real-world problem with approximate... |
I have a simulation that can generate quite a bit of data when it runs, for example $650\cdot 400 \cdot 400$ floating point numbers. Without compression, that's a few gigabytes worth if I want to save the whole simulation and not just some data extracted from it. However, with some methods, like Crank-Nicolson, we know... |
A recent question in Astronomy SE Numerical Programming using odeint takes more than 17 minutes got me interested in looking closer at SciPy's odeint.
The problem is a modified orbital mechanical problem in the solar system. I'd used odeint with great success in orbital mechanics without really understanding the detail... |
I am trying to solve the following PDE:
$$
\begin{align*}
u_{xx} + u_{yy}
=
\begin{cases}
- \cos(x) \quad -\pi/2 \leq x \leq \pi/2, \\
0 \quad \text{otherwise}
\end{cases}
\end{align*}
$$
The domain is the rectangle with vertices $(-π, 0), (-π,2), (π,0)$ and $(π,2)$. The boundary conditi... |
Consider a system of the following form:
$$(A+K)x=b$$
where $A$ is symmetric, positive definite and block diagonal (in fact, a block diagonal matrix made of stiffness matrices arising from FEM discretizations at multiple timesteps, grouped together). Multiplying our linear system by $P^t=K^tA^{-1}+I$, we get $$(K+K^t +... |
I am trying to numerically solve the Poisson's equation
$$
u_{xx} + u_{yy} = - \cos(x) \quad \text{if} - \pi/2 \leq x \leq \pi/2 \quad \text{0 otherwise}
$$
The domain is the rectangle with vertices $(-π, 0), (-π,2), (π,0)$ and $(π,2)$. The boundary conditions are mixed:
Dirichlet: $u(x,0) = 0$
Neumann: $u_y(x,2) = 0... |
It all starts with this Cauchy problem:
$$
\begin{cases}
\sin(2x(t)) -\cos(3x'(t)) = x(t) + x'(t) \\
x(0) = 1 \\
\end{cases}
\quad \quad \text{with} \; t \in [0,10]\,.
$$
Not knowing which way to turn, I started Mathematica:
Clear[t, x];
xsol = NDSolveValue[{Sin[2 x[t]] - Cos[3 x'[t]] == x[t] + x'[t], x[0] == 1}, x,
... |
I need to approximate the following in $O(d)$ time for $d\times d$ diagonal $A$ and rank-1 $B$
$$u^T \exp(-A+B) v$$
Here $u,v$ are vectors in $\mathbb{R^+}^d$, $A,B$ are positive semi-definite and $B$ is relatively small
The following approximations take $O(d)$ to compute and get me within factor of 2 of true value on ... |
I set my t_start and t_stop as 0.52 (lj unit), and I ran the nvt first. after it reached equilibration I ran the nve but found the temperature of the last 1000steps went up to 0.56 while my coworker still had the normal result around 0.52. we even used the same code but our results are quite different. why does the ave... |
I am trying to solve the $\textbf{1-D}$ Poisson equation for a semiconductor structure at equilibrium (There is no external bias applied).
$\textbf{Background}$
\begin{equation}
\frac{d^2V}{dx^2} = -\frac{\rho(V)}{\epsilon}\\
\rho(V) = q(N_D-N_A+p(V)-n(V))
\end{equation}
When there are two different semiconductors plac... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.