instruction stringlengths 43 28.1k |
|---|
I'm given a matrix. How do I find the nearest (or a near) positive definite from it?
The matrix can have complex eigenvalues, not be symmetric, etc. However, all its entries are real valued. The resulting matrix from the algorithm must be positive definite, with all its entries real valued only. Symmetry is a plus, but... |
The original post was on stackoverflow : I transfert it here.
I have to solve numerically the advection equation with periodic boundaries conditions : u(t,0) = u(t,L) with L the length of system to solve.
I start also with u(0,x) = uexacte(0,x) = sin(2*pi*x/L)
Here the main part of the code with loop time (we use here ... |
I am poking at reproducing some fundamental research in group theory. In particular, I want to reproduce the OEIS sequence #1. The crux of the problem is not generating potential groups, this can be accomplished by a sat-solver and about 20 lines of code, but determining which of those groups so generated are isomorp... |
There are a lot of algorithms which seem to have been supplied an official number, such as Algorithm 76, Hierarchical clustering using the minimum spanning tree. Another example is Algorithm 123, Single Transferable Vote by Meek's Method. These numbers seem to refer to some official registry, but I haven't been able to... |
The question is pretty much the title. Note that I have lots of experience using open-source meshing tool, e.g. Gmsh and OpenFoam blockMesh & snappyHexMesh. Nevertheless, I have no idea on how to generate the 2D mesh shown below when doing some simple test in SU2 (CFD code).
I believe some commercial meshing kits can d... |
I have an array of length L with N zeros, and L-N non-zero values. I have another array of length N. I would like to put the values of the shorter array into the positions of the longer array which are zero, keeping them in order. For example, if I had,
$$
L = \, [1,2,3,0,0,4,5,6,0]
$$
$$
N = \, [10,0,20]
$$
I would wa... |
Compared to the transient PDE for linear elasticity, the steady equations appear to less well-conditioned. Are they inherently ill-conditioned without the transient term?
The condition number for the operator matrix seems to be fairly large (at least $O(10^4)$) for all the problems that I have solved. Is this fairly n... |
In an attempt to create three-dimensional volumes with inclusions in Gmsh I stumble upon a problem which was non-existent in the two-dimensional case.
I'm using the OpenCASCADE geometry kernel because this facilitates convenient boolean operations to remove parts of the inclusions outside my considered domain box.
In ... |
I am trying to understand the meshless methods as described in https://arxiv.org/pdf/1409.7395.pdf. I'm having trouble understanding the following step: (Page 7, just after equation 17)
Now, rather than take the flux functions F directly at the particle location and time of i or j, in which case the scheme would
req... |
Nonlinear ODE Statement
I would like to use scipy to solve the following:
u'' + (u')^2 = sin(x)
u(0)=0,
u(1)=1
where u = u(x).
Approach
I am looking at the following link
https://docs.scipy.org/doc/scipy-0.18.1/reference/generated/scipy.integrate.solve_bvp.html
Problem - Not sure about variable wrt x or How to in... |
I'm having two sets of grids. One is uniform and another one is not uniform. I will calculate the derivative in uniform grid points and I like to transfer(map) the derivative to the non-uniform grid points. I have the relationship between uniform and non-uniform grid points.
A similar question was already asked. I'd l... |
I am working on an FEA mesh of hexahedron elements. The elemental level calculations involve finding the surface normals and area for each surface of a hex element. I preferred the vector cross product approach. But that doesn't seem to work when the faces are non-planar. Will the isoparametric transformation of each ... |
I am trying to identify the weak form of PDE in structural mechanics. I read a lot of papers where they are using the elliptic boundary value problem
\begin{equation}
\int\limits_{\Omega} \delta \epsilon : \sigma \,d\Omega - \Big[\int\limits_{\Omega} \delta u \cdot b \, d\Omega + \int\limits_{\Gamma_N} \delta u \cdot ... |
I have a set of $K$ keywords. Each of this keywords can have set of bids from $1\$,\dots,N\$$. For each bid for a keyword, it will get a specific amount of clicks and a specific cost. Clicks and Cost are monotonic in bids. Now, the problem is this
Select a bid for each of the keyword such that overall clicks across t... |
One can use GMRES as it is, but there is also a version of GMRES called k-step restarted GMRES, which is used for large matrices, where $k$ is some fixed number of steps after which we take a new $x_0$ and restart the algorithm to save memory storage.
I want to count the number of flops and memory storage required in e... |
I am currently working on a numerical algorithm involving a lot of floating point arithmetic, involving some badly conditioned problem sets.
I am using the relation $|x - y| / (\max(|x|, |y|, 1)) \leq \epsilon$. Unfortunately, the corresponding relation $=\sim$ is not invariant with respect to additions, i.e. $x =\sim ... |
I want to obtain the algebraic values of, for example, Hermite polynomials using SciPy but in a recursive manner.
Using Maple, for example, these can be defined as
H(0,x):=1;
H(1,x):=2*x;
for n from 1 to 6 do
H(n_1,x):= 2*x*H(n,x) - 2*n*H(n-1,x);
print( simplify(%) );
end do:
I can find no way in SciyPy to do... |
I have an explicit FD (Finite Difference) code for diffusion/heat on a PDE in a cuboid domain, and it works fine. I would like to update the discretized equations and change the code so as to solve the problem on a sphere. From some preliminary searches, I can't seem to find any examples of FD on spheres using rectangu... |
I have 5 at most 4th order polynomials in 5 variables,
$$p_i(x_1,x_2,x_3,x_4,x_5) \qquad i = 1, \ldots, 5$$
where all coefficients are either rational or floating point. I'd would like to get the roots of the simultaneous equations $p_1 = 0, p_2 = 0, p_3 = 0, p_4 = 0, p_5 = 0$ and I'm partially able to do this quite ea... |
I am trying to solve a simple optimal control problem using the Hamilton-Jacobi-Bellman equation, numerically in Python. This is proving to be rather difficult as I end up having to solve the following:
$$
J_t - (J_x)^2 + x\cdot J_x = 0
$$
I believe this to be a non-linear first order PDE. Being the HJB, we are given b... |
Consider the nonlinear least-squares minimization of a vector of $n$ residuals $\mathbf{f}$ in $p$ parameters $\mathbf{x}$:
$$
\min_{\mathbf{x}} || \mathbf{f}(\mathbf{x}) ||^2
$$
This can be done with a standard Gauss-Newton or Levenberg-Marquardt approach, using the $n \times p$ Jacobian matrix
$$
J_{ij} = \frac{\part... |
Is there a faster way to check whether $A\in\mathbb{R}^{n\times n}$ is positive definite on $b^{\bot}:=\{x\in \mathbb{R}^{n}: x\cdot b=0\}$ than
function foo(A,b)
N = null(b);
e = eig(N'*A*N);
return all(e>0);
end
|
In my calculation (of a simple heat equation, for testing) using the Newton method, I tried to replace the full Jacobian matrix with an approximation vector, i.e. replacing $J$ in
$$J(u)\delta u=-F(u)$$
with
$$J\vec{v}\approx\frac{F(\vec{u}+\varepsilon \vec{v}) - F(\vec{u})}{\varepsilon}$$
which should be possible, a... |
I'd like to know how to deal with a divergence when trying to solve the Poisson equation for electrostatics with a simple spectral method. I'm not sure how to best state my problem, so I'll explain how I got to the problem. I'm sorry that this makes the post long.
Suppose that I have two conducting ground planes at $z=... |
I'm trying to calculate higher order (e.g., m=0, n=46) Zernike moments for some image. However, I'm running into a problem regarding the radial polynomial (see wikipedia). This is a polynomial defined on the interval [0 1]. See the MATLAB code below
function R = radial_polynomial(m,n,RHO)
R = 0;
for k = 0:((n-m... |
Homework disclaimer...
The task:
We are using the following algorithm to solve the quadratic equation $x^2+2px+q=0$:
$x_1=|p|+\sqrt{p^2-q}\mathtt{;}$
$\mathtt{if}\,p>0\,\mathtt{then}\,x_1=-x_1\mathtt{;}$
$x_2=q/x_1\mathtt{;}$
Point out two places where running this algorithm can meet significant problems. How to mitig... |
Supposing that one molecule is static and one is dynamic,
can the dynamic one be solved with LINCS for its shape (angle, bond length) constraints and also keep collisions with static molecule off, using single-pass (with order-4) LINCS?
if single pass LINCS is not enough to keep both molecules non-interfered state an... |
I have the following integral:
$\int_{1}^{Xd} \dfrac{(X^{z_i}-1)}{[X^2 \sum_{l=1}^{N}c_l(X^{z_l}-1)]^{1/2}}dX = \int_{1}^{Xd} h(X) dX$
where:
Xd is a real that can be either negative, positive or even 1.
$z_i$ is a integer (positive or negative)
$z_l$ also a integer ($z_i$ will be in the vector that contain all the $... |
The Sokhotski-Plemelj theorem states,
$$\lim_{\epsilon\rightarrow 0^+}\int_a^b\frac{f(x)dx}{x+i\epsilon} = \mathcal P \int_a^b \frac{f(x)dx}{x} - i\pi f(0). $$
Is there a numerically stable way to take this limit, without explicitly using the above theorem? I find that if I use $f(x)=1$, $a=-b$, I almost converge to $-... |
I have a question regarding the condition number of two different perturbation matrices. To start with let $A$ be a spd matrix with elements defined by $a_{i,j} = \int\limits_{\Omega\subset \mathbb{R}^d} \nabla \varphi_i\cdot \nabla\varphi_j \,d\Omega$ arising in Finite Element Methods with $\varphi_i$ basis functions ... |
I have a matrix which I want to assembly quickly, which is in block form:
$$
A = \pmatrix{ A_{11} & A_{12} & A_{13} \\ A_{21} & A_{22} & A_{23} \\ A_{31} & A_{32} & A_{33}}
$$
with:
$$
A_{ij} = \sum_{k=1}^N \alpha_{ijk} v_k v_k^T
$$
and my current implementation is quite slow, so I am looking for advice on how to speed... |
I'm asked to find the conditions on the coefficients $a_1,a_2,b_1,b_2$ in the RK method
$$y_{n+1} = y_n + ha_1f(t_n,y_n) + ha_2f(t_n + b_1h, y_n + b_2hf(t_n,y_n))$$
such that is consistent of (a) first order and (b) second order.
The first assumption I make is that $b_1 = b_2 := b$ otherwise I have no idea how to solv... |
Can someone point me in a direction to solve this kind of integral constrained system of ODEs.
\begin{align}
&\int_0^{1/2}\dot{y}^2(t)=p\\
&2\lambda_1\ddot{y}(t)+\pi cos(\pi y(t))=0\\
&y(0)=0,y(1/2)=1/2
\end{align}
I have reduced it to 1st order:
\begin{align}
&\int_0^{1/2}x^2(t)=p\\
&\dot{y}=x \\
&2\lambda_1\dot{x}(t)... |
In my textbook it is stated that we make a "simplifying assumption"
$$c_i = \sum_{j=1}^sa_{i,j}, $$
where $c_i, a_{i,j}$ are the constants in the butcher tableau.
What's the relevancy of this assumption? Is it only for explicit RK-methods?
|
Consider a nonlinear system of the form $\boldsymbol{f}(\boldsymbol{x}) = \boldsymbol{0}_{\mathbb{R}^n}$ for $\boldsymbol{x} \in \mathbb{R}^n$, where the function $\boldsymbol{f}$ is given by
\begin{equation}
\boldsymbol{f}(\boldsymbol{x}) := \boldsymbol{g}(\boldsymbol{x}) + \boldsymbol{\underline{A}} \boldsymbol{x} + ... |
I am looking for the analytical solution of 1-dimensional advection-diffusion equation with Neumann boundary condition at both the inlet and outlet of a cylinder through which the fluid flow occurs.
$$\frac{\partial C}{\partial t} = D\frac{\partial ^2 C}{\partial x^2}-v\frac{\partial C}{\partial x}$$
with initial cond... |
I am doing a project related to robotics where I am using fmincon function from matlab to minimize the distance between the points x_0 and x_f. Basically task is to make manipulator move from x_0 to x_f such that it never goes out of torus region. So I think it is a constrained optimization problem.
I am having diffic... |
I need to use a Discrete-time Algebraic Riccati Equation (DARE) solver for an embedded controller (with limited processing power) in a research project and sadly, I can't find any implementation of it in C++ that I can understand. I use C++ since it is faster than higher-level languages.
I found various libraries onlin... |
I am in need to optimize the performance of the 3D solver that integrates a system of equations for seismic wave propagation.
Unsurprisingly, the function that implements the finite-difference stencil computations, is the bottleneck of the computations.
I read this article, where in Section 3.2 the authors say that the... |
Start with 1d case. Say I have lots of 1d intervals $[s_i, e_i]$ and I want to find an interval $[s^*, e^*]$ to maximise the count of interval $i$ such that $[s_i, e_i]\supseteq [s^*, e^*]$.
1d case is easy. All I need to do is to sort the $s_i$ and $e_i$ together, eg $[s_1, s_2, e_1, s_3, e_3, e_2]$. Then go from lef... |
I found an old lecture on YouTube given by Walter Rudin (1990, in Wisconsin), and towards the beginning he mentions that if $f(x)$ were not integrable, on some interval, it would be obvious that it doesn't have a Fourier Series on that interval, since if you looked at the Fourier coefficient given by
$$ \frac{1}{\pi}\... |
I need to fix a code to utilise the $2$ stage multistep method :
$$y_{n+2} - y_n = h\left[(1/3)f_{n+2} + (4/3)f_{n+1} + (1/3)f_n\right]$$
Since this is an implicit method, I used a Newton-Raphson approach for the final determination of $y_{n+2}$.
Below, is my attempt at a code implementing the already given rk4 method ... |
I have an ultrasonic image represented by a point cloud as shown below:
I need to extract features from this image. These features can be easily recognised by a human brain since they form continuous lines/curves. I am currently using a modified density based clustering algorithm to extract the features. A result is s... |
Does there exist a library (in any programming language) for solving (numerically) systems of multidimensional first-order linear PDEs in the form
$$\mathbf{u}_{t}+\hat{A}(\mathbf{x})\mathbf{u}_{\mathbf{x}}=\mathbf{f}(\mathbf{u}),$$
$$\mathbf{u}(\mathbf{x},0)=\mathbf{g}(\mathbf{x}),$$
where $\mathbf{u}=(u_1(\mathbf{x})... |
I am familiarizing myself with CVXPY, and encountered a strange problem. I have the following simple toy optimization problem:
import numpy as np
import cvxpy as cp
A=np.array([[1,0,0],[0,1,0], [0,0,1]])
y=np.array([1,1,1])
# Upper bound for the constraint term
upper=1
# Solve the optimization problem using CVXPY
x =... |
I'm trying to model the temperature distribution over a curved surface. Apart from the heat equation, I need to take into account the energy emission/absorption through electromagnetic radiation. The surface is divided into small triangles that will exchange energy.
If we focus on the radiation part, one way to start i... |
I have a system of fairly large set of linear equations (approximately 30K equations). I am using scipy.sparse.spsolve to solve these equations. Initially, I tried with 10K equations, but my program got killed due to memory issue. In general, I would like to know the memory and time requirements of the spsolve algorit... |
I'm trying to implement the aforementioned procedure using this website as a reference. At the end of the page the algorithm is described as follows:
I think I've mapped the given algorithm to code correctly. However when I use the U and V obtained in the procedure to compute $U^{T}AV$ I don't get a bidiagonal matrix.... |
I'm studying the transport of species A in the blood vessels,
$$\frac{\partial C}{\partial t} = D\frac{\partial ^2 C}{\partial x^2}-v\frac{\partial C}{\partial x}$$
At x=0, I want to use the Neumann boundary condition
$\frac{\partial C}{\partial x} =$ constant
From the literature, I have the average concentration of ... |
I have come across schemes where TVD (with flux limiters) is used for spatial discretisation along with Runge-kutta for Temporal discretisation.
Can TVD be used for Temporal discretisation? If so could you please point me to some references? I have been trying to look for it but couldn't find anything.
|
If I have a RK method $y$ of order $p$ and a RK method $z$ of order $p-1$ I have read I can estimate the local error as $r_{n+1} = y_{n+1} - z_{n+1}$. First of all I don't see how this estimates the local error defined as the error we make in a single step using correct previous values. What does a lower order method h... |
I am trying to do some work on some math conjecture. I am testing the conjecture numbers using very large math numbers (100+ digits ). I am currently using python to test these numbers.
In the conjecture's calculation, I quickly need to multiply and divide different large numbers several times. Python can do this quick... |
x0=[10 5]';
tol=1e-6;
syms x y
f= (1/2)*(x^2)+(9/2)*(y^2);
g=gradient(f, [x, y]);
g0=subs(g, x, x0(1,1));
g0=subs(g0, y, x0(2,1));
while norm(g0)>tol
s0=-g0;
%perform a linesearch to find an acceptable step size
alpha=1/2;
L0=1;
f0=subs(f,x, x0(1,1));
f0=subs(f0,y,x0(2,1));
v=f0;
xnew=... |
x0=[0.8, 0.8, 0.2, 0.2]';
m0=[0.5,0.5]';
tol=1e-6;
syms x y z p m1 m2
h1=y-(x^3)-(z^2);
h2=(x^2)-y-p^2;
h=[h1;h2];
f=-x;
L=f+ m1*h1+m2*h2;
h0 = subs(h, {x,y,z,p}, [x0(1,1), x0(2,1), x0(3,1), x0(4,1)]);
h0=double(h0);
%the system h evaluated at the intial vector
g1=gradient(h1, [x, y, z, p]);
g2=gradient(h2, [x, y, ... |
I am trying to solve the following, "test problem" involving a vectorial Poisson equation:
$$-\nabla^2 \vec{A}=\vec{J} \quad \forall x\in\Omega=[-1,1]^3$$
$$ \vec{A}=\vec{0} \quad \forall x\in\partial\Omega$$
The inhomogenity $\vec{J}$ is given as:
$$\vec{J}(x)=\vec{e_{x}} \quad \mathrm{if} \quad \mathrm{max}(\mathrm{a... |
I want to simulate Brownian motion in 3-D for the following conditions:
$$p(x=0,y=0,z=0,t=0)=1$$
$$p(x,y,z=c,t)=0$$ where $p$ is the probability of finding molecules in the 3-D environment. I want to find the number of particles getting absorbed on a certain region on the absorbing wall in 5 secs. As can be inferred th... |
I'm looking at the analytical solution of the convection-diffusion equation
$$\frac{\partial C}{\partial t} = D\frac{\partial ^2 C}{\partial x^2}-v\frac{\partial C}{\partial x}$$
with initial condition
$$c(x,0) = 4000$$
and with Dirichlet boundary condition
$$C(x=0,t>0) = 4100$$
Neumann boundary condition
$$\frac{\par... |
I'm trying to use the gradient ascent method on a convex function like the multivariate-Normal density function with respect to its parameters (the original is a bit more complicated), something similar to maximum likelihood estimation.
$$a_{n+1}=a_n+\gamma_n\nabla F(a_n)$$
I'm wondering if for the gradient ascent meth... |
The codes Quantum Espresso (QE) and Vienna Ab initio Simulation Package (VASP) both use plane wave basis sets and psuedopotentials. Most of the codes in both implementation of DFT uses Fortran code. Do they use similar self-consistent-field procedure to find the solutions of Kohn-Sham equations?
|
Examine a dynamic 2D heat equation $\dot{u} = \Delta u$ with zero boundary temperature. A standard finite difference approach is used on a rectangle using a $n\times n$ grid. For the resulting linear systems a banded Cholesky solver is used. Compare the three methods explicit, implicit and Crank-Nicolson for the time s... |
I want to understand Binary Search for 2 element list made of 1,2. I draw a tree as below. Is it correct?
If I want to search for an element 2, it will make 2 comparisons. If I want to search for an element 22, it will also make 2 comparisons. But according to formula Θ(lg n), with n=2, it should make only one compa... |
I would like to do simulations using cellular automata to describe the behavior of influenza. What software do you recommend?
|
Hello all,
I've recently been introduced to Python and Numpy, and am still a beginner in applying it for numerical methods. I've been performing simple 1D diffusion computations. I suppose my question is more about applying python to differential methods. I'm asking it here because maybe it takes some diff eq backgrou... |
I have been reading upon numerical techniques that are used to solve stiff ordinary differential equations.
From the description given here, I could follow the steps till equation (5).
I am finding it difficult to understand how equation 6 is obtained and the calculations involved in computing the coefficients of BDF.
... |
I have a following problem : I want to transform a function $g(\omega) \exp(i C \omega^2)$. $g(\omega)$ is real and limited. It changes slowly compered to $\exp(i C \omega^2)$. I have a black box that I can ask for the values of that function at any specific point in frequency domain. I want to get $g(\omega) \exp(i C ... |
I have these three differential equations in which I need to solve numerically:
$$
\frac{dn_0}{dt}= -n_0(t)W_{01}(t) + n_1(t)K_{10}
$$
$$
\frac{dn_1}{dt}= -n_1(t)W_{12}(t) - n_1(t)K_{10} + n_2(t)K_{21} + n_0(t)W_{01}(t)
$$
$$
\frac{dn_2}{dt}= n_1(t)W_{12}(t) - n_2(t)K_{21}
$$
such that
$$ n_0(0)=1 $$
$$ n_0(N)=0 $$
$$ ... |
I am trying to understand how stiff differential equations are solved.
For instance the equation,
$$\frac{\partial y}{\partial t} = \alpha\frac{\partial ^2 y}{\partial z^2}$$
can be solved using an ode solver by discretizing z-direction at i th node
$$\frac{dy_i}{dt} = \alpha\frac{y_{i+1}-2y_i + y_{i-1}}{\Delta z^2}$... |
I have many STL files and I want to reduce their size, so I use Gmsh in this way:
gmsh -2 -bin -format vtk -o file.vtk file.stl -0
It reduces the size from 7 MB to 1.2 MB, but if I use the option "Recombine 2D" the size is reduced to 800 KB. I cannot find a way to use recombine in the command line, so I try with the ne... |
I want to minimize the following with respect to parameters $B$.
$$\sum_{k = 1}^{K} f(A_{k}, B)$$
where $A_k$ are $K$ different data-sets and $B$ is a matrix of parameters.
Can I do this by a gradient descent where:
randomly pick one matrix $A_{i}$ among $K$ matrices.
perform a gradient step that minimizes $f(A_{i}, B... |
Consider
$$
I = \int_{-L}^L f(x)dx,
$$
where $f(x)$ is real-valued and analytic on $[-L,L]$, but it has a pole in the complex plane whose real part lies in $[-L,L]$. Call it $z_0$, and assume it is a simple pole. If the imaginary part of $z_0$ is small compared to the real part, then $f(x)$ is sharply peaked in the vic... |
I am trying to find the roots of a monotonic function with as few function evaluations as possible.
I have approximated a manifold with a piece-wise defined polynomial. The manifold is periodic and so I am only considering its unit cell (one period). I split the unit cell, in general, a parallelogram but in this case a... |
I want to compute the matrix
$$
A = \sum_{i=1}^N v_i v_i^T
$$
where each $v_i$ is a given vector of length $2500$, so that $A$ is $2500 \times 2500$, and my $N$ is about 2 million. Rather than call DSYR 2 million times, I found I can speed up the calculation significantly, by storing the $v_i$ in block matrices, and th... |
Is it possible to construct a sequence that converges in theory but when computed numerically with a computer program is diverging.
I feel that today our computer programs doesn't allow such pathological cases so I think I might found such pathological sequence working in simple precision.
Of course I want to avoid the... |
I need to compute elliptic integrals of the third kind with complex arguments, preferably in C++. Is there code out there to do this? I have discovered the Arb library, but that does much more than I would like to do, and would be much slower for my particular application.
|
I have to compute $CA^{-1}B$ and $CA^{-1}x$, where $A,B,C$ are conformable matrices and $x$ is a vector.
I've read that the a very computationally stable way to compute these inverses is by computing the Cholesky Decomposition.
However, I don't see how one can use that decomposition to compute Both terms I'm intereste... |
I am currently looking into post-processing of simulation data using Paraview. I would like to compute certain integrals of field quantities. As an example, consider the following surface integral of an electric field in a simple situation:
$$\iint_{S}^{} \vec{E}\cdot\vec{\omega}=\Phi $$
The surface $S$ is shown in the... |
TL;DR: How do I simulate a hole, at the bottom of a (full) water tank?
I am attempting to simulate water, flowing out of a hole/slit, at the bottom of a tank (Water Domain) (under the influence of gravity); entering into a domain (vertically downward), that contains air (Air Domain), and impinging on a curved surface.... |
Which C standard should be used for computational science code ?
Should we keep compatibility with C89/90/ANSI or jump to C99 or C11 ?
Context:
Code will use third-party : BLAS, LAPACK, MKL, OpenBlas, Direct Sparse Solvers, ...
Parallel computation | HPC | OpenMP | MPI
|
How can I generate the higher $n$ quantum harmonic oscillator wavefunction (in position space) numerically? Here, higher means around $n=500$, or say $n=2000$, where $n$ is the $n$th oscillator wavefunction.
The position-space wavefunction of the $n$th state involves Hermite polynomials of order n (see Griffith's boo... |
I wanted to verify my FEM-program by applying the method of manufactured solutions, while solving the Poisson equation in two dimensions using the continuous Galerkin method
$$-\nabla^2u=f$$
with
$$u=\sin(\pi x)\sin(\pi y)$$
resulting in
$$f=2\pi^2\sin(\pi x)\sin(\pi y)$$
My system is defined on a square with $\Omega=... |
This is my first post on here, so please excuse mistakes if any.
I am trying to plot out the difference between two ODE solvers based on Taylor series:
1st order acccurate: $x(t_0 + h) = x(t_0) + h x'(t_0)$ and
2nd order accurate: $x(t_0 + h) = x(t_0) + h x'(t_0) + \frac{h^2}{2} x''(t_0)$
ODE: x'= -x + e^-t x0 ... |
I have a matrix that is extremely singular, but I am still interested in computing the exact condition number, which is the ratio between the largest and smallest singular values.
Is it possible to do it in Python? I am curious because if we stick with machine precision 10^-16, then any condition number beyond 10^16 co... |
Let $r,\epsilon > 0$ and $a, b \in \mathbb R^n$ with $\|a\|_2 \le r$. Define $C(a) := \{x \in \mathbb R^p | \|x+a\|_2 \le r,\;\|x\|_\infty \le \epsilon\}$, and assume it is non-empty.
Question
(A) How to formulate and solve the problem problem $\sup_{x \in C(a)} b^Tx$ in the cvxpy language ?
(B) Same question with $\|... |
I've been looking into radial solvers for quantum wave equations (Schroedinger and Dirac). In both cases, the suggestion seems to be to go with the "shooting method", with integration schemes of various precision such as the Numerov one.
Now, for a shooting method, one needs to impose starting values coming from bound... |
I am trying to solve the following coupled PDEs:
$$C_e\frac{\partial u(x,t)}{\partial t} = k_{ed}\frac{\partial^2u(x,t)}{\partial^2x} - G_{el}(u(x,t) - v(x,t)) + S(x,t)$$
$$C_l\frac{\partial v(x,t)}{\partial t} = k_{ed}\frac{\partial^2v(x,t)}{\partial^2x} + G_{el}(u(x,t) - v(x,t)) $$
where $k_{ed}$, $G_{el}$ are con... |
I'm having some difficulties understanding the Langevin thermostat (MD).
In my notes, there is written that the Langevin equation is
$$ m\dot{v} = F - m\gamma v + f_R, \tag{1} \label{1}$$
where $f_R$ is the random force. Then, to prove that by using this thermostat we are actually sampling from the canonical ensemble, ... |
I am working on a 1D drift-driffusion problem in a finite-difference (FD) approach.
I hade 3 equations per node ($3N$ in total): electron continuity $E_i$, Poisson $P_i$, hole continuity $H_i$. With corresponding variables: electron concentration $n_j$, potential $V_j$, hole concentration $p_j$.
By rearranging the prob... |
I need to calculate a basis of the nullspace of large (up to a thousand columns and rows) matrices. For my application, it is very important that no round-off errors occur during the computation, so I need software that computes the nullspace symbolically.
The entries of my matrix are fractions but can of course be con... |
I have a quite large algebraic equation system to solve, the system is so large, I can't post the example here, so I am posting it to pastebin.
The sympy.solve is taking ages: I started it this morning and it is still running on a single core. I have tried to use the optional arguments from the sympy documentation, li... |
I'm trying to use the finite-difference WENO scheme to solve the 2D density conservation law with axial symmetry (coordinates $r,z$):
$\frac{\partial \rho}{\partial t}+\nabla \cdot (\rho \vec{v}) = \frac{\partial \rho}{\partial t}+ \frac{1}{r}\partial_r (r \rho v_r)+\partial_z (\rho v_z) = 0$.
$\rho$ is defined at grid... |
I have a symmetric matrix $M$ which I want to numerically project onto the positive semi definite cone.
To do so, I decompose it into $M = QDQ^T$ and transform all negative eigenvalues to zero. (according to this post for example How to find the nearest/a near positive definite from a given matrix?)
When I numerica... |
I am trying to fit some data points $d_i$ to a non-linear model function $m_i$, which depends on a number of fit parameters $f_k$ (I want to determine these) and also on some known, constant values $c_j$. For this I am using the Levenberg–Marquardt (LM) algorithm, which iteratively minimizes
\begin{equation}
\chi^2=\su... |
I am developing a 2D CFD solver for fluid-particle interaction. To solve Navier-Stokes equations on a grid of size $10000\times 10000$ cells (or >1 million cells), a large linear system $Ax=b$ with $A$ being the $10000\times10000$ sparse coefficient matrix needs to be solved efficiently in each time-step.
What I am loo... |
I'm trying to solve the following PDE by Matlab,
$$
u_t-\Delta u = 0, \quad \text{in}\quad \Omega\times (0,T)
\tag{1}
$$
$$
u_t-\Delta_\Gamma u + \partial_\nu u=0,\quad \text{on}\quad \Gamma\times(0,T)
\tag{2}
$$
where $\Omega$ is a bounded domain of $\mathbb{R}^n$, $\Gamma =\partial \Omega$ is the boundary of $\Omega$... |
The problem I am trying to solve involves minimising a function with respect to a large number (probably 10,000+) of parameters. I can cheaply compute both its Jacobian and its Hessian. The Hessian is very helpful; I am not entirely sure the function is convex, but using the Newton-CG algorithm in scipy.optimize:
resul... |
I have a sequence of points which was obtained from an iterative algorithm, and I computed the order of convergence $p$ of the method using the formula
$$
p \approx \frac{\log({\rm err}(k+2))-\log({\rm err}(k+1))}{\log({\rm err}(k+1)) - \log({\rm err}(k))}.
$$
The first computed ratio is much larger compared to the o... |
What is difference beetwen this two method? Are these methods far from each other or are these methods complement each other? Could you take an example?
|
It is well-known that Newton's method can converge quadratically, if initial guess is close enough and if the arising linear systems are solved accurately.
I am applying Newton's method to highly ill-conditioned systems (with condition number around $10^{14}$). I am sure that my Hessian is computed correctly, however I... |
I am looking for examples of poorly conditioned sums which can rapidly be evaluated, for the purposes of unit testing.
I'm currently using the series representation for $\ln(2)$:
$$
\sum_{n=1}^{\infty} \frac{(-1)^{n+1}}{n}
$$
which has an infinite summation condition number, but in double precision, I can only get the ... |
I have a little background in writing toy finite volume CFD codes. In 2D Cartesian scenarios, I typically take $x_{\min}$, $x_{\max}$, $y_{\min}$, $y_{\max}$, and the number of points in $x$ and $y$ to calculate $\Delta x$ and $\Delta y$.
Then, I compute cell centers and assemble a 1D array of cells.
To perform field... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.