instruction
stringlengths
43
28.1k
In Yurii Nesterov's Introductory Lectures on Convex Optimization, there is a description of the rate of convergence and corresponding upper bound for the analytical complexity of a minimization problem: $$\min f(x),\quad x \in \mathbb R^n$$ The error at iteration $k$ is denoted by $r_k=||x_k-x^*||$ where $x_k$ is the ...
I am trying to implement the Thomas algorithm using OpenCL. __kernel void thomas(__global float *a_d, __global float *b_d, __global float *c_d, __global float *d_d, __global float *x_d, __local float *shared, int system_size, int num_systems, int iterations) { int thid = get_lo...
I need to put $N$ spheres with given radius $R$ randomly in a Volume $[-0.5,0.5]^3$, without any overlap of spheres. If I choose values so that all the spheres will occupy ~57% of the total volume, I find it difficult to get results. The basic scheme to place the $i$-th particle after $i-1$ particles have been placed: ...
Analytical Inside the box, the wavefunction is: \begin{equation} \frac{\hbar^2}{2m} \frac{d^2 \psi(x)}{dx^2} = E \psi(x) \iff \frac{d^2 \psi(x)}{dx^2} = k^2 \psi(x) \end{equation} where $k = \frac{\sqrt{2mE}}{\hbar}$. Outside the box: \begin{equation} -\frac{\hbar^2}{m} \frac{\partial^2 \psi(x)}{\partial x^2} = (E ...
When a timestep $h$ is rejected using a Runge-Kutta pair, such as Dormand–Prince, the algorithm resumes from the same initial point $t$ with a smaller timestep. A different idea is to resume at an intermediate point $t + kh$ where $1/7 < k < 4/5$, using the 4th order interpolation. The estimated error would be tested a...
Existing algorithms for solving ODEs handle functions $\frac{dy}{dt} = f(y, t)$, where $y \in \mathbb R^n$. But in many physical systems, the differential equation is autonomous, so $\frac{dy}{dt} = f(y)$, $y \in \mathbb R^n$, with the $t$ left out. With this simplifying assumption, what improvements can be seen in exi...
I want to implement a Bilinear Finite Volume discretisation of the anisotropic diffusion problem: $$\frac{du}{dt} = \nabla \cdot (\textbf{D} \nabla u)$$ Both my degrees of freedom as well as the Diffusion Tensors are given on the vertices of my quadrilateral grid. I can, therefore, use bilinear test/trialfunctions on e...
I have a linear system of complex numbers. I am using LAPACK' zgesv (actually I am using intel MKL LAPACKE, but I am assuming the algorithm is the same). No assumption can be made about the system. I tried to follow its subroutine calls, but I got lost. What algorithm does it use, how many operations will be needed acc...
I'm trying to solve this advection-diffusion equation (ADE): $$\frac{\partial \phi}{\partial t} + \nabla \cdot (-D \nabla \phi + \mathbf{u} \phi) = 0$$ In fact, this ADE framework is coupled to a Navier-Stokes (NS) solver and I get velocity field ($\mathbf{u}$) from NS solver. My question is about ADE boundary conditio...
I'm trying to implement a model I found in a paper, but there is something I do not understand. The authors say they use TDMA to solve their equations; however, they use a 3rd order upwind biased approximation to discretize the convective terms. This leads to an almost tridiagonal matrix (with coeff. for the terms $i-1...
I have a question for the format of Schrodinger equation $$\psi(x,t) = \int_0^\infty c_n e^{-iE_nt/\hbar} \psi_n(x)$$ Why do we have $i$ instead of $-i$?
For teaching purposes I'd need a continuous function of a single variable that is "difficult" to approximate with polynomials, i.e. one would need very high powers in a power series to "fit" this function well. I intend to show my students the "limits" of what can be achieved with power series. I thought about concocti...
I understand that the function applyrule uses patmatch to identify patterns and apply transformations accordingly. Suppose, I want to write a rule for transforming spatial derivatives along $z-$direction of field components $E_i(x,y,z)$ to momentum space, so that: $\partial_{z}(E_i(x,y,z)) \to -ikE_i(x,y,z)$. I trie...
I have come across an optimization problem with the following objective function: $$f(x_0,y_0,z_0,x_1,y_1,z_1,...,x_N,y_N,z_N) = \sum_{i=0}^N f_i(x_i,y_i,z_i, \alpha(x_{i+1}-x_i) + \beta(y_{i+1}-y_i))$$ i.e. the objective function is the sum of the functions $f_i$ that only depend on three variables $x_i,y_i,z_i$ and o...
The discussion in How does density functional theory scale with system size? already tells, how DFT scales with the number of electrons. I want to simulate some clusters, so the simulation cell contains much vacuum and its size can be changed without affecting the number of electrons. I know that with a larger cell le...
I'm interested in running Hartree-Fock calculations on single atoms for a project, and I was trying to find more information about how to actually run them instead of just derivations of equations. Most of what I've found involves simulating molecules, but since I just want to do single atoms, can I use the hydrogen wa...
I want the eigenvalues of the following generalized eigenvalue problem: $$ Av = \lambda M v $$ where $A\in\mathbb{R}^{n\times n}$ is sparse, symmetric, and positive semi-definite $M\in\mathbb{R}^{n\times n}$ is sparse, symmetric, and indefinite (i.e. neither positive nor negative definite) I want the eigenvalues $\l...
Imagine a simple triangular base mesh in finite element method with an unknown number of elements (varying by the user). How can connectivity matrix be coded to be generated automatically?
Can someone recommend the best way to solve a least squares fitting problem with B-splines, with additional equality constraints? I want to solve: $$ \min_x || b - A x ||^2, \textrm{subject to: } C x = d $$ where $A$ is $m \times n$ and $C$ is $p \times n$. Specifically I want to fit B-splines and force the first deriv...
I am trying to simulate a robot manipulator dynamics in SciLab. Basically, I generated a step function that has constant acceleration for half of the time and then the same acceleration but negative for the other half, so I get a smooth transition between the manipulator positions. This code generates the velocity and ...
I simply want to solve the elliptic equation: $$ -\kappa \nabla^2 u + u = f $$ where $f\in [0,1]$. When using continuous Galerkin with Lagrange elements, I have noticed that $\kappa$ has to be greater than a certain value related to the mesh resolution to avoid values of $u$ under 0 or over 1. I would like to avoid the...
You can set the Absolute or Relative ODE solver tolerances in Matlab with the options structure from an odeset command. But how do I find the default values for the different ODE solvers?
I have a nonlinear function fun with n inputs and n outputs. I also have a function jac which calculates the Jacobian, which is sparse. Which SciPy method, if any, can I use to find the root of fun? I am surprised that I can't find a method in scipy.optimize that takes a Jacobian in sparse matrix format. But I believe...
I'm interested in solving a differential equation in which I don't know the analytical form of the right hand side, I only know its numerical value for a finite set of values of the independent variable: $$\frac{dy}{dx}=f(x_i).$$ I haven't found a library that allows me to solve this problem and I want to make sure if ...
I was doing my research/project using WENO as the limiter in finite volume methods to solve hyperbolic conservation law. I have no idea why the result in the characteristic wise method has a big error compared to component-wise. This is my current solution that I get from my solver, it shows that there is a numerical i...
I am trying to attain the Moore-Penrose pseudoinverse of a very large, very sparse, rank-degenerate, singular, and square matrix. ($75000 \times 75000$, near rank). The matrix is a graph Laplacian and I need to find the resistance distance between a large number of nodes (LU determinates are too slow). I realize the in...
I am trying to solve a particular form of the Euler / Navier-Stokes equations in 1D, with very strong and non-linear diffusion coefficients. My system of equations is \begin{cases} \frac{\partial n}{\partial t} + \frac{\partial}{\partial x}\left(nv \right ) = S_n\\ \frac{\partial \left( ...
I have a cube which is divided into 8 small cubes by bisecting each edge, I am trying to find out the surface area of each of the faces and the corresponding outward normals for them. This operation is done on a finite element mesh, so I have transformed the cube into the isoparametric form using shape(basis) functions...
I'm trying to get the normal modes of a system of springs and dasphots using the basic dynamic equations for a linear, damped elastic structure: $ M \ddot{u}(t) + C \dot{u}(t) + K u(t) = f(t) $ to get the normal modes, the following QEP (quadratic eigenvalue problem) must be solved $ (\lambda^2M+\lambda C+K)\bar{\psi...
I have just started with PETSc hence it might seem like a very stupid question but I couldn't find any answer in manual. After Calling KSPSolve, where can I access the soluition for my linear system? Example for a matrix: $$ \left(\begin{array}{ccc} 2 &-1 & 0\\ -1 &2&-1\\ 0&-1&2 \end{array}\right) \left(\begin{array}...
If $u_1$ and $u_2$ are solutions of (weak-form) Laplace equation on a connected domain $\Omega$, with Dirichlet boundary values $u_{\partial\Omega, 1}$ and $u_{\partial\Omega, 2}$, respectively. If $$u_{\partial\Omega,1} \neq u_{\partial\Omega, 2},$$ we know $$\|u_1-u_2\|_{L^2(\Omega)} \neq 0.$$ My question is, for any...
What is the difference between the Dishonest Newton method and the Very Dishonest Newton method? Is there a difference or do they mean the same thing? I have tried searching for this on the internet but I can't find anything. I understand that in the ordinary ("honest") Newton method, the Jacobian is computed in each i...
Suppose I know the expected sparsity of a matrix (i.e. the number of non-zeros / total possible number of non-zeros). Is there a rule of thumb (perhaps approximate) for deciding whether to use sparse matrix storage (specifically, compressed row storage) vs. storing it as a dense matrix? Speed is more important in my a...
The goal is to display the relation between K and E in the following equation: $$\cos(K) = 5 \text{sinc}( 5.12\sqrt{E} ) - \cos(5.12\sqrt{E} )$$ The intended result is: However, using the following code: k = linspace(0, 3*pi, 99); % 0 < k < 3pi , crystal momentum. E = linspace(0.1, 3.5, 99);% Energy. [X, Y] = meshgr...
As a simple exercise for a class in computational methods for physics, we've learned how to implement the RK4 (Runge-Kutta 4th-order) algorithm for a very simple exponential decay. E.g. the function y(t) is governed by Based on the RK4 definition from most sources, and specifically in this case Wikipedia, determinin...
If I just need a chain of cartesian coordinates (as parameters/dimensions) that photon travels one after another until it reaches to a stop (hitting a wall or something), can GA minimize its path to get true ray tracing, if objective function returns total time of travel and whole 3D space is uniformly divided into nod...
I am trying to solve the viscous Burger equation $$ \frac{\partial u}{\partial t} + u\frac{\partial u}{\partial x} = \mu \frac{\partial^2 u}{\partial x^2} $$ with Neumann boundary conditions. I am using the Maccormack predictor-corrector scheme: $$ u_j^\overline{{n+1}} = u_j^n - \frac{\Delta t}{\Delta x}(F_{j+1} - F_j^...
I have asked this question already on maths and mathoverflow. Just a question about a literature reference. I am writing a paper for engineers. Usually for the Lagrange multiplier problem $$ \nabla f(x)+\lambda \nabla g(x)=0 $$ the sensitivity result that the multiplier $\lambda$ gives the sensitivity for changes in t...
In a traditional PDE solver on unstructured meshes, we know exactly the sparse pattern of the Jacobian matrix, and we know that the amount of data to communicate is far smaller than the amount of local data. Then is it more efficient to use ghosted PETSC Vec (created with VecCreateGhost or VecCreateGhostWithArray) tha...
I am applying optim() function in R to obtain maximum likelihood estimates of the fixed effects and random effects in a model with bivariate random effects. The code works well but it is very slow in executing the line of code involving the optim() function. I would like to know if there is/ are any specialized optimiz...
Problem In the case of a finite element code, I have many small (order of 30x30) matrix inverses (or LU factorizations), one per finite element. These matrix inverses never change and must be applied to vectors repeatedly in the context of a matrix-free solver. Storing all these inverses is the memory bottleneck of the...
I'm thinking to couple my fluid flow solver based on lattice Boltzmann method with a mechanical deformation solver based on finite element method to take account for solid deformation in my models. In fact, I'm looking for a fluid-structure interaction framework, which its fluid solver was written based on lattice Bolt...
I am switching from OSX to Linux, which I am familiar with but have no greater experience. There are several different alternatives: archlinux, gnome, ubuntu etc. Which would you recommend for a PhD student in numerical analysis? I mainly use Julia, Fortran, C++, Python and occasionally Matlab. Thus it should be easy t...
I'm new to numerical analysis, and have been learning root finding algorithms. I am a bit confused about the difference between Muller's method, and Newton's method using an n-degree interpolating polynomial. How is the Muller's method, which approximates f(x) using a quadratic polynomial, different from the Newton's m...
I've been trying to learn about root finding using Newton's method, which uses a quadratic interpolating polynomial. I found this text, Numerical methods for roots of polynomials, PART 2: McNamee & Pan, which has relevant theory, but there seems to be some error in the text. While calculating $x_{i+1}$, shouldn't th...
I was doing error analysis of numerical scheme and I get $L_1$ error for each grid size with $N$ element. I was searching reference to compute accuracy order/rate from that error data but doesn't find any good reference. Anyone know? Error: $e=|u-u_{exact}|$ $L_1$ error: $L_1=1/N \sum_{i=1}^{N} e_i$
The Langevin function $\mathcal{L}(x) = \mathrm{coth}(x) - \frac{1}{x}$ occurs in computations related to elastomers and paramagnetic materials. It is easily computed accurately and with high performance as long as the issue of subtractive cancellation near the origin is addressed, e.g. by using a minimax polynomial ap...
I struggle with this problem: I understand how to apply Newton's method to a already given function but I can't seem to find that function in this case from the given input n, t, d and s. I'm completely new to numerical method's so sorry if I don't see the obvious. It would be nice if someone could lead me in the righ...
I am trying to compute the following integration $$ \int_0^\infty e^{-y}y^{a/2}L_c^b(y)L_e^d(y)dy $$ using the generalized Gauss-Laguerre quadrature routine in the GNU Scientific Library. Here the $L$'s are the generalized Laguerre functions, and $a>-1, b>0, d>0$. I am not sure how to choose the number of quadrature p...
I am currently enjoying writing computational codes as a hobby. Right now I've worked out an Euler method and results are pretty good with up to $x=1$. Over $x=1$, instability starts to kick in. May I know why is this so? The equations are as below: $$ df=-\frac{x^2}{y},\quad y(0)=1 $$ #Euler Method import numpy as np ...
I am trying to solve a non-linear time-dependent heat equation $$\partial_tT=\nabla \left(k_T(T)\nabla T\right) + f$$ (similar to question Solving a non-linear heat equation with the galerkin method gives negative values) with a FEM-approach, using the continuous Galerkin method for the FEM part, the Newton method for ...
I need to solve the following equation: $$ \begin{pmatrix} \frac{\omega^2}{c^2}\varepsilon_x-\mu_z^{-1}k_y^2-\mu_y^{-1}k_z^2 & \mu_z^{-1}k_xk_y & \mu_y^{-1}k_xk_z\\ \mu_z^{-1}k_xk_y &\frac{\omega^2}{c^2}\varepsilon_y-\mu_z^{-1}k_x^2-\mu_x^{-1}k_z^2 &\mu_x^{-1}k_yk_z\\ \mu_y^{-1}k_xk_z & \mu_x^{-1}k_yk_z&\frac{\omega^2...
How well do explicit Runge-Kutta "tableau" methods compare to the state of the art ODE solvers and when do they fail? I've been reading Butcher's ODE book and he does a good job at introducing tableaus to represent different Runge-Kutta methods. This includes methods with built-in error estimates for adaptive steps siz...
I have a PDE (coming from a Bellman equation with $z$ under brownian motion). Let $z \in [0,\infty)$ and $t \in [0,T]$. To sketch the equation: $$ (r - g(t)) v(t,z) = \pi(t,z) + (\gamma - g(t))v_z(t,z) + \frac{\sigma^2}{2}v_{zz}(t,z) + v_t(t,z) $$ with a terminal condition $v(T,z)$ and ugly nonlinear boundary condit...
Are there any high performance integer BLAS libraries that implement matrix multiplication i.e. i32gemm and i64gemm ? I need to use them for a cryptographic application and can tolerate overflows, i.e. I don't require the kernel to do any wraparound checks. The difference between a Igemm and an Fgemm is that the latter...
I'm prototyping a system that finds the 3D pose of a object in a video sequence. For this I minimize a error function involving the rotation and translation of the object as parameters and two sets of points (polluted with gaussian noise but no outliers) as data. I have tried to parameterize the rotation matrix both us...
Suppose I have a multi-dimensional vector space $X$, and a collection of $n$ vectors $\{x_i\}_{i=1}^n \subset X$, which are not evenly "spaced-out" in $X$. I am searching for $m<<n$ of these $x_i$ that are good representatives of $X$, or in other words, they are roughly equi-distant to each other. How can I find these ...
Considering that COMSOL forum is dead and CFD-online is not responsive, I'm gonna try asking my question here: I have done a 2D simulation in COMSOL multiphysics. I have two independent variables x and t and two dependent variable u1 and u2. Comsol gives me 2D projections of the 3D graphs u1(x,t) and u2(x,t) as below:...
I have $n$ points that form a grid with empty space and I need to find an algorithm that would calculate the total distance of those points with time complexity lower than $O(n^2)$. a grid with $n=5$ could be represented as a matrix: $$ \begin{matrix} 0 & 0 & 1 \\ 1 & 0 & 1 \\ 0 & 1 & 1 ...
Problem I would like to solve a nonlinear integro-differential equations on a 2D square domain $\Omega$ subject to Neumann boundary conditions using finite differences: $$\frac{\partial u}{\partial t} = f(u) + \int_\Omega G(x'-x)\left[u(x')-u(x)\right] dx'.$$ The variable $u(x,t)$ depends on space and time, $f$ is a no...
I need to diagonalize such kind of matrix during research: it's n-by-n, with it's upper-left (n-1)-by-(n-1) corner be diagonal while the nth row & column are dense. It's observed that the self adjoint eigensolver is not quite efficient as a solution when n is greater than roughly 2000 and there is no existing eigensolv...
These are the discretized drift diffusion equations as taken from the book "Analysis and Simulation of Semiconductor Devices". The electron continuity equation is: $$((\Delta_{j-1}^y+\Delta_j^y)/2\Delta_i^x).D_{i+1/2,j}^n.B((\varphi_{i+1,j}-\varphi_{i,j})/V_T).n_{i+1,j} + ((\Delta_{j-1}^y+\Delta_j^y)/2\Delta_{i-1}^x)....
I'm trying to implement Dinur-Nissim algorithm and am stuck at how to solve the set of linear inequalities with multiple unknowns and a large number of equations along with constraints. Example: \begin{align} 0.2 \leq c_4 \leq 0.66\\ 0.66 \leq c_3 \leq 1.56\\ 0.96 \leq c_3 + c4 \leq 2.26\\ \end{align} Constraints: $$0...
I have this dataset, and I am using y = (a * x^n) / (b + x^n) Hill function as the model, where a is the limit of the Hill curve, b is the point at which a/2 is reached (for n = 1) and n is the cooperativity or steepness of the curve. Currently, I am storing all X,y values, computing the parameters from scipy.optimize....
I want to simulate a simple 3D diffusion (e.g., an ink released from one side of a vessel) using SciPy. There are some tutorials for one-dimensional diffusion. Although the ink goes in one direction, it will not be straight. I appreciate if you can help me to consider the spread of the ink along with other dimensions t...
Suppose I am given a vector $v^0\in\mathbb{R}^n$ and integers $k,\ell\in\mathbb{Z}$. Assuming $k$ is close to zero (e.g. $0\leq k\leq5$), is there an algorithm for solving the following integer optimization problem? $$ \boxed{ \begin{array}{rl} \min_v & \|v-v^0\|_2\\ \mathrm{s.t.} & v_i\in\{-k,\ldots,0,\ldots,k\}\ \fo...
I'm interested in modeling the electromagnetic fields radiated from an accelerated charge, but do not want to reinvent stuff if possible. I suspect there are software packages already out there which allows a person to provide the incoming accelerating field or trajectory of the charge, and is returned an array of valu...
I want to compute the difference $\Delta f(x_1,x_2) = f(x_1)-f(x_2)$ of a smooth function $f(x)$ at two points $x_1$ and $x_2$ which are close to each other. The magnitude of the expected result, $|\Delta f(x_1,x_2)|$, is often small compared to $|f(x_1)|$ and $|f(x_2)|$ and several significant digits are lost if I eva...
I am trying to calculate the singular value decomposition of this matrix using numpy.linalg.svd . However, reconstructing the matrix from the SVD gives a poor reconstruction - in particular, the first row and second column are far smaller in the reconstruction than in the original matrix. u, w, vt = np.linalg.svd(M) np...
I would like to volumetrically render 3D scalar data in Paraview, and I'm not sure if my inability to do so is incorrect usage of VTK or Paraview. I have built a *.vtu VTK unstructured grid file containing 2 cells consisting of 10 PolyVertex objects with scalar data associated with each point. These are meant to repres...
Thank you all 1.) I am trying to solve the lid-driven cavity problem for an incompressible Stokes and Navier Stokes equations using the general "Mixed" finite element method. Dirichlet boundary conditions are specified everywhere on the boundary. When I try to solve these systems of equations, my matrix showing is that...
I am looking for different approaches to extract 3D polylines out of Point Clouds. We are able to create these point clouds out of different data sources of real world surveys (LIDAR, RADAR, etc...) and to classify points (as metallic in common soil for example). What I am looking for is academic work/papers on algori...
I'm trying to implement finite-difference WENO method to progressively complex equations and systems. At the moment I'm successful with singular scalar equations (constant advection and Burgers), and trying to advance to 1D system of Euler equations. I've read that there are two approaches to apply WENO to systems of c...
What data structure (or C++ library implementing it) is most suitable for efficient high dimensional histogramming? I have an application where I need to compute something similar to a histogram in a high dimensional space ($d=10..20$). Even with a large linear bin size, there would be too many bins in total. However, ...
Let's say that I have a FEM code which yields the following problem: $$ \mathbf{A}\mathbf{x} = \mathbf{b}. $$ In order to solve this more efficiently with an iterative method, I would like to precondition it, $$ \mathbf{BAx} = \mathbf{Bb}, $$ using domain decomposition. This is a common application for domain decomposi...
I tried to used f2py, Cython and Numba to make a simple loop structure be faster in python. Python implementation: def Python(A): B = 0.0 for i in range(100): for j in range(100): for k in range(100): for l in range(100): B = B + A[i,j,k,l] return B Numa ...
I'm trying to apply finite-difference characteristic-wise WENO method to 1D Euler equations: $$ U_t + F(U)_x = 0, \; \;\text{where} \;\; U = (\rho, \rho u, e) \;\; \text{and} \;\;F(U) = (\rho u, \rho u^2+p, (e+p)u) $$ Physical values are set at grid points $x_j$, so we need to approximate fluxes at mid-points $x_{j\pm ...
I was using scipy.integrate.odeint function , the ode is $$\frac{y\ dx - x\ dy}{(x+y)^2} + dy = dx$$ with solution $$y^2 - x^2 - y = c (x + y)\ .$$ Solving it via odeint from scipy.integrate import odeint import numpy as np import matplotlib.pyplot as plt def dy_dx(y, x): return ((x+y)**2 - y)/((x+y)**2 - x) xs = np...
I would like to solve a system of second-order differential equations to describe the dynamics of a system of particles. Two Newton-like forces are responsible for the motion of each particle $i$: A force acting on each particle due to other particles $f_{i,j}$ and a stochastic term of noise $f_{\mathrm{noise}}$. The f...
I am looking for libraries for solving large scale linear system (10e5) of equations using parallelization and shared memory. 1. Sparse, complex symmetric, SPD. 2. Suitable for higher order FEM ,DGFEM using Domain decomposition. 3. Suitable for iterative solvers with built in preconditioners. 4. Suitable for C++ an...
Given a set of ODE's $ \dot{z} = f(z) $ (or discrete time $ z_{t+1} = f(z_t) $), is there a way to numerically find constants of motion? For $ f(z_t) \approx M z_t $, diagonalizing the matrix $ M $ and finding eigenvalues equal to 1 works, but this only finds linear combinations of $ z $ that are constant. I would like...
When applying the classical formula for the angle between two vectors: $$\alpha = \arccos \frac{\mathbf{v_1} \cdot \mathbf{v_2}}{\|\mathbf{v_1}\| \|\mathbf{v_2}\|}$$ one finds that, for very small/acute angles, there is a loss of precision and the result is not accurate. As explained in this Stack Overflow answer, one ...
How to determine if a PDE is structure-preserving (energy,mass conserved)? Are there some standards in judging the preserving-structure? Or rather, how to derive the formulation of energy-preserved form of a PDE? I am new to this field, I am long for receiving some references (some books, representative papers or s...
I tried to simulate soliton propagation by solving the nonlinear Schrödinger equation using the split-step Fourier method. The following is an example of the Matlab code copied from a textbook. alpha = 0; beta_2 = 1; gamma = 1; A = N*sech(T); % initial pulse shape L = max(size(A)); delta_omega = 1/L/delta_T*2*pi; om...
Is it possible to solve an equation with only a single derivative such as: $$\frac{\partial U(x,t)}{\partial t} = A - BU(x,t)$$ with finite difference methods? I ask as I am trying to solve the below equation using a finite difference method. $$\frac{\partial \vec{m}(x,t)}{\partial t} = -\frac{\partial \vec{j}_{m}}{\p...
I want to trace electrostatic field lines emerging from 2D surfaces in 3D space. Eventually I want to find their intersection with an (uncharged) mesh. The charge distribution $\sigma(x), x \in \Gamma \subset \mathbb{R}^3$ is defined by requiring a constant potential $\phi(x) = \phi_\Gamma\ \forall x\in\Gamma$. For the...
I have a 2d distribution of moving points with known trajectories represented in a 640x480 image. Here is the initial state: I have to find the minimum number of rectangles with fixed dimensions (35x42 pixels) that are able to cover all my input data, minimizing also the overlapping areas for each step. So far I tried...
It has been discussed that Intel MKL can exhibit irreproducible behavior under certain conditions. In fact, this is a known thing and described by Intel as Conditional Numerical Reproducibility. A colleague has recently encountered this issue while trying to find the eigenvalues of a matrix and he realized that the fun...
For a Bounday Element Method problem I require the solution of a system of linear equations with multiple right-hand sides. Though this is a dense system, I still want to do it via Petsc in parallel. Would the best way to do this be through something such as -ksp_type preonly -pc_type lu -pc_factor_mat_solver_package m...
I am trying to solve Lid driven square cavity flow problem of Stokes equation using finite element method. I have boundary conditions for velocity as zeros on every boundary but u=1 on top boundary. can you please help me with the boundary conditions of stream function and how to obtain ? especially on top boundary. I ...
After successful implementation of characteristic-wise finite-difference WENO method to 1D Euler equations, I'm moving to 2D equations on cartesian grid: $$ \frac{\partial U}{\partial t} + \frac{\partial F(U)}{\partial x} + \frac{\partial G(U)}{\partial y} = 0 $$ where $$ U = \left( \begin{array}{c} \rho \\ \rho u \\ \...
I can't seem to find a good algorithm for the one-to-exactly-two assignment problem. Good algorithms are known for the classical assignment problem, where N tasks need to be assigned to to M agents in a one-to-one correspondence. In my case of the one-to-exactly-two assignment problem, I have N tasks and M agents. Howe...
I have data for a random variable and I wish to test whether it conforms to the Tracy-Widom distribution. However, the T-W distribution is hard to compute. Is there a readly available table of its values I can just download?
I am a newbie in finite difference methods, so I apologize in advance if the question is trivial. I am trying to solve the advenction equation, i.e. $\frac{\partial \phi(x,t)}{\partial t} + v \frac{\partial \phi(x,t)}{\partial x}=0$, where $v$ is a velocity, with the finite difference method. The system is of course al...
I want to solve the following optimization problem: $$\min_{A,B,X} \|Y-AX\|_F^2 + \lambda_1 \|Z-BX\|_F^2+ \lambda_2 \|B\|_F^2$$ $$s.t ~~x_{ij}~ \geq 0$$ in which, $Y$ and $Z$ are data matrices and are $d \times n$ and $l \times n$ (the corresponding columns of $Y$ and $Z$ are data samples), and $A,B,X$ are the paramet...
I have two arrays $f(z)$ and $z$ both indexed by k and I want to solve $\frac{df}{dz}=\mu(1-f)$ to find $\mu(z)$ What would be the best numerical method to solve this equation?
I want to use FEM to solve a 2D eigenvalue problem for the biharmonic equation \begin{align} &K \psi= \lambda M \psi\\ &\psi=\nabla \psi\cdot \hat{n}=0\quad \text{on boundaries} \end{align} where $K$ is the stiffness matrix corresponding to $$K_{ij} = \int_{A} \nabla^2 \psi_i \nabla^2 \psi_j \mathrm{d}A$$ and $M$ is t...
Is there an algorithm that can determine the interaction laws between particles (or point-like objects) based on their motion? A simple case: an algorithm that determines the gravitational interaction from nothing but the motion of the planets in the solar system. Without a lookup table of particle interactions.
I have small scale dense least squares problem with box constraints $$\mbox{argmin}||Ax - b||^2 \quad $$ $$\mbox{subject to} \quad l_i \leq x_i \leq u_i,$$ Number of variables is about 10-50, several hundreds in worst case. Number of constraints is equal to number of variables. So i can factorize $A$ and/or $A^TA$. Als...
It is conventional wisdom that programmers should use std::hypot whenever one implements an expression of the form $r = \sqrt{x^2 + y^2}$ In my example, my expression is $r = \sqrt{1 + c^2}$, where $0 \le c \le 1, c \in \Re$. My first instinct is to reach for hypot() to implement - I am interested in both double and f...