instruction
stringlengths
43
28.1k
I have my own little subroutine for numerical integration (quadrature), which is a C++ adaptation of an ALGOL program published by Bulirsch & Stoer in 1967 (Numerische Mathematik, 9, 271-278). I would like to upgrade to a more modern (adaptive) algorithm and wonder whether there are any (free) C++ libraries that provid...
I am solving a 1D advection problem of the the form $$dQ/dt=[A]Q$$ where {Q} is the vector of unknowns and [A] is the matrix of coefficients of spatial discretisation. I have worked out the eigenvalues of [A] to get an idea about the stability of the semi-discretised system and I am getting eigenvalues with zero real p...
I'm a little bit about the SVM. I'm actually understanding for which purpose Support Vector Machines are used. The aim is to find the biggest (best) hyperplane between two different data clusters. The question is here do we apply SVM after we have classified data points or is Classification also a task of SVM? The exam...
I'm looking for a program to obtain meshes to finite element codes 2D and 3D as complete as possible, preferably in fortran 90 or C/C++. For example, softwares "Triangle" or "TetGen" generate meshes but I would like a software that creates meshes with more information (for example, normal vectors). May you suggest to ...
I acknowledge the following post where a similar question is posed and a very nice answer has been provided: Is there a mesh generator that will generate zero thickness elements for interfaces? However, the interface created there consists of 2 noded line elements. My question is as follows: Is there a convenient m...
I want to solve this simple advection equation using the finite element method. $$\frac{dc}{dt}+v\cdot\nabla c = f$$ What's the best FEM discretization for this? I have tried using the standard/primitive least-squares finite element method for this but it seems I still get oscillations.
I have a large matrix $A \in \mathcal{R}^{N\times N}$ which is supposedly positive-definite, but numerically low rank. Instead of $A$, I have its incomplete Cholesky factor $G$, such that $A \simeq GG^\top$. $A$ is very large, so I can't keep it in memory, but $G$ is small enough. I need to numerically solve: $$ (A^{-1...
I was having some lectures and I didn't quite understand the following: let's say you have a grid like $$G=\{ x \in \mathbb{R} : x = x_j = hj, \ j = 0,1,...,n,\ h=1/n\}.$$ And you write in difference form the following 1D diffusion equation (comma before index indicates derivative along the index): $$-(au_{,1})_{,1}...
I have a piece of code in Fortran90 in which I have to solve both a non-linear (with the Newton-Raphson method, for which I have to invert the Jacobian matrix) and a linear system of equations. When I say very small I mean n unknowns for both operations, with $n\leq4$. Unfortunately, $n$ is not known a priori. What do ...
I have an ODE of the form $$C_1 d_y u + C_2 (d_y u)^n = C_3 y + C_4$$ with boundary conditions $u(0) = 0, d_y u(L) = 0$, where $C_1 \to C_4$ are known constants, and where $0 < n \leq 1$ is a real number. Special cases: If $C_2 = 0$, this is a simple linear ODE and is straightforward to solve. If $C_1 = 0$, I can take...
I have a program that has a nested loop, together with its parent running at $O(n^2)$ complexity performing floating point arithmetic. I see that the performance of the code when compiled with icc is comparable to that of g++ -ffast-math. Does this mean that icc is switching on an equivalent of the -ffast-math implicit...
First of all, I hope I am posting this in the correct place. If not, I'm sorry and could you please direct me to where I should post this? Problem: You are given a set of vectors, $\{\mathbf{a}^i\}_{i=1}^{24}$, and matrices $D_1$ and $D_2$ (both of dimension $[10\times6]$. Let the following be true: $\sum_{i=1}^{24} ...
I am wondering what chaotic systems are from the perspective of numerical analysis. I am talking about 'deterministic chaos' such as for instance the 'logistic map' exhibits it. That is, the solution after many steps in the iterative solution is highly dependent on the initial conditions. It is clear that it will also ...
I'm trying to make a neural network using MATLAB. But I'm finding that many problems do not get solved. These are the formulas on which I based: $$ Layers\ in\ Neural\ Network = [0, ..., i, ..., out] $$ $$ W_{i,j} = weights\ of\ the\ layer_i\ to\ layer_j\ \in M_{m\ x \ n}\\ B_{i,j} = weights\ of\ the\ layer_i\ to\ laye...
I do have a stirred tank reactor with two inlets and one outlet. Several components enter the reactor at inlet 0 and particles at inlet 1. All component from inlet 0 adsorb on the particles from inlet 1. I can write a mass balance like: \begin{equation} C \cdot V_{liquid} + Q \cdot V_{particles} = 0 \end{equation} C i...
This question has also been asked at Stack Overflow. This is a very general question regarding the maximum size of a set of linear equations to be solved by today's fastest hardware, in the form: $$X = AX + B$$ Where we solve for $X$, and $A$: $N\times N$ a sparse matrix of floats; $B$: $N$-vector of floats. This be...
This might be better somewhere else, but I'll give it a try here first. I'm implementing a finite volume scheme for an axisymmetric problem in C, and am looking for a more efficient way to handle all of the necessary parameters each function needs. Is a pointer to a struct better, more efficient, or easier in implemen...
I am trying to write a code to calculate the potential and forces, for the same using ewald summation.For this purpose, the formula for potential and force I have used is : $$ U = U^{(r)} + U^{(k)} + U^{(bc)} + U^{self} $$ where the k-space contribution of potential is given by $$ U^{(k)} = \frac{1}{2\pi L^{3}}\sum_{...
I am trying to think of what this kind of problem is called. I illustrate it with a telegrapher's equation with (hopefully) standard notation. Find $u:\Omega\times \mathbb{R} \to \mathbb{R}$ such that $$ \begin{align*} u_{tt}+u_t-\nabla^2 u &= 0& \mathrm{for}\, (x,t)\in \Omega\times \mathbb{R}\\ u&= u_{bc} \sin(\omeg...
does anyone know any matlab algorithm that can help me generate a random matrix with REAL EIGEN values? Thanks.
Suppose that there are $N$ pieces of data, each of which contains $M$ parameter values such that $N >> M$. If we put this information into matrix form ($N$ rows, $M$ columns) and then compute the covariance matrix of this data, $C$, then we can consider that $C_{i,j}$ is the covariance between parameter $i$, $p_i$, and...
I've been working on calculating large factorials ($N>10^9$) and I was wondering if it wasn't faster to use the GPU to run the calculations on something like openCL. What I realized however was that, not only I didn't know if it was worth it in that case, I couldn't tell when it is or isn't appropriate to use a GPU for...
I want to solve a set of hyperbolic equations (not the Euler equations) using an upwind type method. I am interested in using a first order upwind scheme and one that is not based on the method of characteristic and does not require the eigenvalues and eigenvector. So far, I have understood that I first need to solve t...
I need to solve to solve a "large" symmetric sparse linear systems, with matrix size 8000? I heard about HSL, ITPACK, but I don't know how to use them, and I am working in C language.
Do all BLAS routines compute the respective operation with minimum error ? i.e. Is the reduction in sdot computed with least error ? I need to call these routines through gsl/gsl_cblas.h.
I have a matrix which is "almost" like an upper triangular just that the last row has non zero elements. And I want to perform the QR decomposition on that matrix. Does anyone know the "name" of such a matrix? And also since I don't want to use the built in matlab QR function for such a matrix, can anyone suggest a bet...
I'm putting together a very simple integration program in FORTRAN using MPI. I have done this with C and all was well. However, in my "MAP_REDUCE" call, the comm argument seems problematic. I have tried several different values and have gotten several error messages when the program runs. Note: the program does comp...
I have to solve the following least squares problem: \begin{equation} \| \left[ \begin{smallmatrix} \mathbf{L} \\ \mathbf{I} \end{smallmatrix} \right]\mathbf{x} - \mathbf{b} \|_2^2 \end{equation} where $\mathbf{L} \in \mathbb{R}^{n\times n}$ is $O(n)$ sparse lower triangular matrix, $\mathbf{I} \in \mathbb{R}^{n \times...
Question I am performing least squares fitting using an objective function of the form $f(\mathbf{x})$ where $\mathbf{x}$ is a vector of parameters containing around 20 elements. The model function is somewhat expensive to evaluate so I am exploring options for reducing the number of parameters in the model. Are there...
What kind of optimisations does the option -ffast-math do ? I saw that the time taken for a simple $O(n^2)$ algorithm being reduced to that of an $O(n)$ algorithm using the option.
Suppose $A\in\mathbb{R}_+^{n\times n}$ is symmetric. I would like to factorize $A\approx UU^\top$ by solving $$ \begin{array}{rl} \min_U & \sum_{ij} \left(A_{ij}\ln\frac{A_{ij}}{[UU^\top]_{ij}}+[UU^\top]_{ij} \right)\\ \textrm{s.t.} & U\geq0, \end{array} $$ for a local minimizer. The objective of this problem is KL di...
I want to create a finite element code in fortran. There are many libraries out there on internet. Can someone suggest me a good finite element library in fortran? I am looking for Ease of use (using fortran language specifically) Well documented free
I was reading some work by Butcher and I came across Pade approximations and the correlation between them and stability functions for some Implicit Runge-Kutta methods. For example, in this Pade table for the exponential function, we see that the $(2,1)$ Pade approximation $$\frac{1+\frac{1}{3}z}{1-\frac{2}{3}z+\frac{1...
I have experimental data containing horizontal and vertical components of speed and I need to evaluate this: $$ \frac{\partial^2}{\partial x_i \partial x_j}\left(v_iv_j\right) $$ Denoting $U$ as horizontal component and $V$ as vertical, we should obtain: $$ \frac{\partial^2}{\partial x_i \partial x_j}\left(v_iv_j\right...
I would like -if possible at all- to represent and handle missing data (in the statistical sense) within the standard IEEE-754 format. Seeing that for both SNaNs and QNaNs various bit representations are possible, I wonder if they all can arise from standard computations or some can be made inaccessible to paths other ...
I am facing the following problem. I need to solve numerically a set of coupled equations $$i\frac{d}{dt}f_{n}^{(i)}(t) = \left[U\cdot n(n-1) + \mu\cdot n\right]f_{n}^{(i)}(t) - \sqrt{n+1}\Phi_i^{*}\ f_{n+1}^{(i)}-\sqrt{n}\Phi_{i}\ f_{n-1}^{(i)}$$ where $U,\mu$ are just constants and $$\Phi_{i} = \sum\limits_{n=1}^{N...
Let's say I'm optimizing something. To pick an arbitrary example, let's say I'm choosing the shape of some part to maximize strength-to-weight ratio. So I get some FEM software, parametrize the shape, and run gradient ascent or whatever to find the optimum shape. When I do this procedure, I would generally expect that ...
When using many iterative methods, whether for solving linear systems, looking for steady-state convergence in CFD, etc., the semilog plot of the residual often shows "humps" as the residual decays. These humps generally appear in a regular pattern (same number of iterations between them for example). I've seen cases w...
I am writing a code to perform hybrid monte carlo molecular dynamics. To do this, I need to have a code to initialize the velocities of all particles according to a maxwell distribution. The code is as follows subroutine thermalize implicit none double precision :: MassInv double precision ::...
When assembling all the stiffness matrices for each element together, is the final matrix size equal to the number of joints or elements?
I am trying to use ARPACK to diagonalize a sparse Hermitian matrix. My program is executing without error but returning incorrect eigenvalues. I have tried to trace the problem back. The work is done by two functions: znaupd and a function I have defined av to perform matrix vector multiplication. znaupd takes a vecto...
I work on geological problems and I use the Finite Element Method. But this question can be applied on other classical mechanical problems. I work on implicit 3D surfaces (which represent the limits between two geological layers aka two media). I have to impose displacement on these surfaces (Dirichlet Condition). The ...
I'm working with functions which, in general, are much smoother and better behaved in log-log space --- so that's where I perform interpolation/extrapolation, etc, and that works very well. Is there a way to integrate these numerical functions in log-log space? i.e. I'm hoping to use some sort of simple trapezoidal ru...
This is related to a question I had asked earlier, with the distinction that earlier I did not have a non-linear objective functional to minimize. The problem is reproduced below with added information. I used MATLAB to solve the problem posed in that question. Why I need to minimize the objective functional given belo...
Let $n,m\in \mathbb{N}$ be such that $m\ge n$. Let $M_1\in \mathbb{R}^{n\times n}$, $\{M_{2},M_{3} \} \subset \mathbb{R}^{m\times m}$ be symmetric positive definite and computationally cheap to invert. You can think of them as a diagonal matrix. Let $S\in \mathbb{R}^{n\times m}$ be full rank. Let $B\in \mathbb{R}^m$...
I know that spectral-methods which are weighted-residual methods can be applied to solve for the incompressible N-S equations. In particular, they are applied to Direct Numerical Simulations (DNS) for studying turbulence. However, I'm still unclear how the continuity condition is enforced in such cases, and what trial ...
Problem statement I implemented geometric multigrid for $-\nabla^{2}=f$ where $f=\frac{3\pi^{2}}{4}sin \frac{\pi x}{2} sin \frac{\pi y}{2} sin \frac{\pi z}{2}$ on $\Omega \in [0,1]$ on a unit cube. Dirichlet boundaries on the left face, bottom face and front face is 0. Neumann boundaries on the top, right and back face...
The program should first read from the keyboard the values of a and b then estimate the area under f(x) in the interval [a, b] using Simpson’s 1/3rd rule and display the estimated area and the error in the estimation. Which that f(x)=sqrt(x+1)+0.25, I have an syntax error in data array and this function: float f(float ...
Suppose I have this set of equations: $$a = x + z\qquad (1)$$ $$b = y + \frac{z}{2}\qquad (2)$$ $$ z = k_0x\sqrt{y}\qquad (3)$$ Where $a$, $b$ $\in \mathbb{R}$ and $k_0 > 0$. The values of $a$ and $b$ assume that neither x nor y can be less than zero, how do I robustly solve this system? I have attempted the Newton-Rap...
I have been learining the NURBS theory by the classical textbook "The NURBS Book" this year. In the chapter 9, the author introduced the method of non-rational B-spline curve interpolation with a open curve. I have implemented this global B-spline curve interpolation algorithm with the Wolfram Mathematica. About the de...
In a trust region based Newton method, a number of constants are given as inputs to the algorithm that determine the updating rules for the trust region bound. Are these constants chosen arbitrarily or are there some rules that govern these constants. For instance refer to this paper http://www.csie.ntu.edu.tw/~cjlin/p...
For a large matrix $A$, I need to evaluate the $\log(\det(A))$. I already have it's LDLT decomposition. Is it possible to evaluate the $\log\det$ with the elements of the diagonal $D$ of the LDLT decomposition? Thanks!
I need to evaluate Kummer's confluent hypergeometric function for imaginary arguments: $$_1F_1(a,b;ix)$$ where $i$ is the imaginary unit, $a,b,x$ are real, and $a,b>0$. Is there a routine available in C/C++? I already saw GSL, but it only computes $_1F_1$ for real arguments.
I have a $80\times200$ matrix, and I want to plot its contents with the contourf command in MATLAB, as follows: \begin{align} &\text{[C,h] = contourf(mat,100);}\\ &\text{set(h,'LineColor','none');} \end{align} The resulting image, as you can see, has some step-like discontinuities where the white part meets the coloure...
Quadratic Pseudo-Boolean Optimization (QPBO) problem: Problem 1. Minimize $\sum_i a_ix_i + \sum_{i<j} a_{ij}x_i x_j$ subject to $x_i\in\{0,1\}\forall i$. Consider the following problem, where the integral constraints are relaxed: Problem 2. Minimize $\sum_i a_ix_i + \sum_{i<j} a_{ij}x_i x_j$ subject to $0\le x_i\le 1\f...
How to find $C$ such that $CC^T = AA^T + BB^T$, $A$ and $B$ are known. $A = \left(\begin{matrix}X\\Y\end{matrix}\right)$, $B = \left(\begin{matrix}0\\cY\end{matrix}\right)$, $c$ is a constant. To clarify. Cholesky decomposition can give the solution. I was wondering is there any closed form solution?
I am modeling the temperature of the groundwater using heat equation. I have Dirichlet BC at the top but at the bottom I have constant temperature equal 12 degrees C (see attached pic). It is look like at the bottom we have zero flux. When I specify the Dirichlet BC I have a "knee" right before "neutral zone" which i...
I would like to know the career options for a computational scientist other than getting into software industry. I wish to use the my skills of Numerical Linear Algebra,Parallel Programming, Scientific Visualization,Topological Data Analysis in some Research Lab of any manufacturing company or Scientific company.
We have the recurrence relation: $5x_{n+1}-x_n=\frac{1}{3}$ $x_0=\frac{1}{12}$ solution: $y_h=(\frac{1}{5})^nC$ $y_p: 5A-A=\frac{1}{3} $ $ A=\frac{1}{12}$ $y=(\frac{1}{5})^nC+\frac{1}{12}$ $y(0)=C=0$ Will the answer go to $ \frac{1}{12}$ or somewhere very close to $\frac{1}{12}$? The answer sheet says very clos...
Somebody on my team wants to paralelize IPOPT. (at least some of functions of it). I have not been able to find a GPU implementation of it or a similar package. Nor I've found anything on their docs. So the question is, is there an alternative already implemented on GPU? or at least somebody working on porting it to GP...
Warning: Failure at t=6.137539e-04. Unable to meet integration tolerances without reducing the step size below the smallest value allowed (1.734723e-18) at time t. In ode15s (line 730) In khademi (line 59)
When we simulate a bulk molecular system using molecular dynamics in (say) NVE ensemble (microcanonical), we apply some periodic boundary conditions (PBC) to avoid surface effects. What effect does this have on quantities like Pair Distribution function, since it so happens that part of a molecule is near one edge of t...
I am simulating the sound wave propagation in non-rectangular and asymetric spaces using finite-difference method. I presume linear acoustics equations to be enough (i.e. $\Box p = 0$, $\Box \vec{v} = 0$) and I need to have open and closed boundaries of the system (e.g. node or antinode of acoustic pressure on the wall...
I have several probability distribution histograms of images that I am comparing to test for dissimilarity. Each histogram has 256 bins, the bins are common for all histograms. The images are taken in very low light conditions, using narrow bandpass filters and illuminated by the same light source (with any other ligh...
Suppose I have a linear system $$ \left\lbrack \begin{array}{cc} M_1& S\\ S^{\mathrm{T}}& M_2 \end{array} \right\rbrack \left\lbrack \begin{array}{c} X\\ Y\end{array} \right\rbrack= \left\lbrack \begin{array}{c} F\\G\end{array}\right\rbrack, $$ where $M_1\in \mathrm{R}^{n\times n}$ is symmetric positive definit...
I want to solve 7 pde's that are functions of time, radius(j) and length(i). I used the method of lines and converted them to a system of odes in time and it becomes something like this: $$dy/dt=((y(i,j)-y(i,j-1))\Delta{r} )+(y(i,j)-y(i-1,j))\Delta{x}$$ I define all of the equations in one function in MATLAB. This is m...
Is there a Fortran subroutine which performs linear interpolation in one-dimenional data? I need something similar to MATLAB function interp1.
I am creating a random configuration of particles for a molecular dynamics simulation, where I would like to guarantee a certain density. The strategy is as follows: choose randomly the positions of the particles in $x$- and $y$-axis in square of the side length equal to $a$. compute the distance between every pair of...
I am working with symmetric matrices of order $n \times n$ where $n \leq 50$. The diagonal elements of my matrices are a fixed number $d$ and the off diagonal elements are limited to two small numbers $\{a,b\}$.I know $a,b,d$ in advance. For any such matrix I need to be able to determine whether its determinant is nega...
I'm not sure how I can represent and solve the following problem. I have a list of sales (timestamp and quantity) and a list of corresponding inventory draws (timestamp and quantity). What I ultimately want to achieve is to identify inventory draws not accounted for by a sales transaction (ie. missing inventory taken)...
I would like to have both the normal (xx) component and shear (xy) component of a 2D (stress) tensor defined on a boundary (y=const, for instance) for an equation which is of the type $$ \nabla \cdot \sigma = 0 $$ The normal value of $\sigma_{xx}=P$ at $x=0,1$ can be accounted for via a Neumann boundary condition, in ...
From Wikipedia: Explicit methods calculate the state of a system at a later time from the state of the system at the current time, while implicit methods find a solution by solving an equation involving both the current state of the system and the later one. Then why the Crank-Nicolson is considered implicit in...
Suppose I have a mesh of the sphere (points on the sphere and a triangulation). What is a good and efficient way to find the triangle which contains a point on the sphere (the point does not need to be a triangulation node)? It would be nice if the operation could be vectorized, to improve Matlab speed. The purpose ...
I am trying to program the pieceewise quadratic lagrange, but I have to deal with these intervals at which the point I am trying to evaluate belongs to. So, essentially you need to have an if statement before we apply the formula, here is a picture of it. I am not sure how to write the if statement, if anyone can help...
Given a sparse rectangular matrix $A$ (let's say, with dimension $n,m$ and number of non-zero elements $O(n)\sim O(m)$) with entries in $\mathbb Z/2\mathbb Z$ I'm looking for a basis of the kernel as a $\mathbb Z/2\mathbb Z$ vectorial space. I know that applying Gauss I can easily find them, but it doesn't use the hyp...
I am trying to implement adaptive mesh refinement for a finite element code. The code uses (at least for now) linear triangles and so when I do the mesh refinement I want the triangular mesh to remain conformal, i.e. no hanging nodes: I am planning to use the longest-edge bisection method by Rivara [33,34]. Unfortunat...
I am looking at approximating my function $f(x)$ using a Chebyshev and Legendre series and I ran into this question. Is interpolation using $n+1$ Chebyshev nodes the same as representing the function using the first $n+1$ Chebyshev coefficients in its Chebyshev series, i.e., is $$f(x) = \sum_{k=0}^n f(x_k) l_k(x)$$whe...
I have an existing FEM code that solves the linear elasticity problem. I would like to use the same code for large strain rates, still using a simple material law (Saint Venant–Kirchhoff model). [The problem I want to solve is a contact problem in which strain is larger than 1 very locally, close to the contact point] ...
I can't imagine I'm the first to think about the following problem, so I'll be satisfied with a reference (but a complete, detailed answer is always appreciated): Say you have a symmetric positive definite $\Sigma \in \mathbb{R}^{n \times n}$. $n$ is thought of as very large, so holding $\Sigma$ in memory is impossible...
Suppose I want to simulate the well-known diffusion partial differential equation in 2D, for example with finite elements or finite differences. Can I directly take physical diffusion coefficients from the 3D real world or do I have to adjust them for 2D?
I need to compute the pseudo-inverse of a very large rectangular dense matrix without any special structure or properties. I run out of memory/computing power and have no access to a large parallel computing resource. However, the good news is that I need only one column of the result at a time (for the subsequent ca...
I'm looking for some methods that could be directly applied to the PDE $$ \frac{\partial u}{\partial t} + \frac{(u_x)^2}{2} = 0\tag{*} $$ without converting it by $v = u_x$ to the Hopf equation $$ \frac{\partial v}{\partial t} + \frac{\partial (v^2/2)}{\partial x} = 0. $$ Ideally, a WENO scheme is perfect, but I'm wo...
Let $A\in \mathbb{R}^{n\times n}$ be symmetric positive semidefinite, and $B\in \mathbb{R}^{n\times n}$ be symmetric positive definite. Suppose $B$ is block diagonal so it is easy to invert. (We have access to the entries of $B^{-1}$ in the computer). Let $\omega \in \mathbb{R}$. Suppose I want to solve the followi...
Are there any limitations of particle in cell (PIC) method for high density plasma? To be more specific, is modeling of a narrow channel of high density plasma possible or are there any limitations connected with PIC approximation?
In the Non-Negative Matrix factorization (NMF), you basically compute an approximation of a given matrix $V \in \mathbb{R}_{+}^{n \times m}$ into matrices $W$ and $H$ such that $W \in \mathbb{R}_{+}^{n \times r}$ and $H \in \mathbb{R}_{+}^{r \times m}$. Or in other words, $V \approx WH$. For the Sparse NMF with sparsit...
I have to maximize $$f(x,y)=-\log(xy)$$ However I need it over the polytope $T=\mathrm{conv}\{(1/2,1/2),(1,2),(2,1)\}$ and this gives me problems: Then I get $$f_x(x,y)=1/x=0$$ $$f_y(x,y)=1/y=0 $$ and I get $x=1$ and $y=1$. However, I know the answer is $(1/2,1/2)$? But I simply don't see why. The point $(1,1)$ is in ...
Can anybody help me? I heard that Gauss-Newton method compute an aproximation of the Hessian instead of the true Hessian, but, quasi-Newton method too, don't it? what is the differences between them? any help would be appreciated :)
User hardmath, provided an excellent overview of how to handle overflow when calculating the product of two functions, where one is likely to overflow: https://scicomp.stackexchange.com/a/20913/9466 The answer also discusses special cases involving $\textrm{erf}$ functions, which was discussed as an example in the ques...
In this excellent answer, it is recommended that one make use of the $\textrm{erfcx}$ function to avoid roundoff error in calculating dealing with $x < 25$ (approximately). So, one scales their answer by $e^{x^2}$, and then scales back, I suppose (?) to recover the number they are really looking for? What if we have t...
I am looking to solve a class of SDPs with complex entries, with the semi-definite cone $S^n$, $n$ around 5000 to 15000. Also, $m$, the number of equality/inequality constraints is close to $n$. I tried SeDuMi and SDPT3 with CVX, but I quickly run out of memory for $n=1000, m=1000$ (I have about 50 GB available). Could...
So I'm trying to construct a 2 fold oversampled cosine basis in MATLAB. I know how to construct the basis as a square matrix using the following command: dct(eye(n,n)) where dct is the discrete cosine transform function and $n\times n$ is the size of my basis but how would I do this if I wanted my basis to be oversamp...
Is there a fast algorithm for computing the matrix square root of a real symmetric matrix using random matrices or randomized algorithms?
Let $A\in \mathbb{R}^{n\times n}$ symmetric and positive semidefinite, and $\omega\in \mathbb{R}\setminus\{0\}$. I am interested in solving the following linear system for a range of values of $\omega$: $$((A-\omega^2 I)(A-\omega^2 I)+\omega^2 I)x = b.$$ It may be useful to note that the matrix factors as $$ (A-(\ome...
I just started leaning Julia, and my command of it is still very preliminary. I am trying to reorder a Schur decomposition. In Matlab, I could use the ordqz command and just had to specify the ordering by passing a string argument. In Julia, my understanding is that this is achieved by the matrix select in the command ...
Convert the following model into an LP model. Note that you're not being asked to convert this to standard form. $$\min z = \max (x_1, x_2, x_3, 2000)$$ s.t. $$-2x_1 + x_2 + x_3 \geq -4$$ $$3x_1 - 4x_2 + x_3 \leq 12$$ $x_i \geq 0$ for all $i$ I am having difficulty thinking through how to set up an objective function ...
I am learning SPH method. At the moment I am trying to implement simulation described in this very good article. However I don't get how the ghost particles properties are computed: Position of the ghost particle: $$\textbf{x}_{i,G}=2\textbf{x}_w-\textbf{x}_i,$$ where $\textbf{x}_i$ denotes the $i^{th}$ particle posi...
What are some of the methods used to test for the exactitude of a numerical solution, given that the analytical solution isn't available, and the numerical solution converges ?
I want to solve 3 coupled PDEs equations. They depend on time, radius and length. I used the method of lines (MOL) and converted them to a system of ODEs in time. Now I want to solve them using MATLAB. Here are the equations: \begin{align} &\frac{\partial C_{i,p}}{\partial t} + \frac{u_{cp}C_{i,p}}{r} + C_{i,p}\f...
In the context of a research project of mine, I am faced with the difficult task of modeling the mixing of two fluids in a container. I would like to achieve the following: Given a container (cylindrical or spherical) containing a static mixture of gases (carbon dioxide + nitrogen), an inflow channel of oxygen into the...
I am trying to understand how boundary conditions are implemented when one uses the nonlinear LU-SGS algorithm for Euler equations. Most papers describe the Gauss-Seidel sweep over mesh cells, but do not explain how are boundary conditions applied. I could either consider the same BC implementation as in explicit case ...