instruction
stringlengths
43
28.1k
I am looking for a relatively simple book/paper that explains the basic Streamline Upwind Petrov Galerkin (SUPG) method for solving the incompressible unsteady Navier-Stokes equations. Most of the references I have managed to find online have been papers that more-or-less assume you already know the method well. I plan...
I hope the following question will not be perceived as to vague. I am trying to ask the question directly, without going into too much information regarding my code. I am currently developing a molecular dynamics code for a custom application, as part of my PhD thesis. I have checked over and over again the validity of...
\begin{equation} \frac{\partial C_i}{\partial t} = D_i \nabla^2 C_i - \frac{I \cdot \nabla t_i}{z_i F} - \sum_{i'} \frac{z_{i'}}{z_i} D_{i'}\nabla \cdot (t_i\nabla C_{i'}) \end{equation} \begin{equation} \nabla \eta = \frac{I}{\kappa} + \frac{F}{\kappa} \sum_i z_i D_i \nabla C_i \end{equation} The dependent variables a...
As per the suggestion by Christian in the comments here, as part of my continuing quest to understand the Raviart-Thomas (RT) elements I'd like to know how exactly the RT elements are defined globally, and in particular how they have compact support. For RT0 on the reference square, one of the basis functions is $\mat...
I run many PBS scripts that take advantage of the job array structure for similar jobs (e.g. 12345[0] through 12345[9]). With the way that the code is written, job [0] needs to run first, and then any other job can start. Preferably, the jobs would run in numerically increasing order. When I submit an array of jobs, th...
I'm using scipy.odeint to solve Fisher-Kolmogorov equation: \begin{equation} u_t = u_{xx}+u(1-u) \end{equation} The code can be found here. From Ablowitz and Zeppetella we know that the analytical solution reads: \begin{equation} u(x,t)=\frac{1}{1+e^{{(-\frac{5}{6} t+ \frac{\sqrt{6}x}{6}})^2}} \end{equation} Now, if we...
Note: I'm trying to implement a Discontinuous Galerkin method, as kind of a way to learn about these things. As of now, I've taken the acoustic wave equation $c^2 \nabla \cdot \nabla u(x,t) - \frac{\partial^2 u(x,t)}{\partial t^2} = f(x,t)$, rewritten it in weak form with the test function $v(x,t)$, and used Green's fi...
I am translating a piece of Fortran code into Python and am testing my code with a certain test case. All the results differ with 0.04% compared to the Fortran results. This is a very small difference and I am not sure if I can almost see this as machine zero or if there are mistakes in my Python implementation. What i...
Let's say I have a LDL factorization of a matrix A. Is there an efficient $O(n^2)$ way to get the eigen decomposition of A given it's LDL factorization? Is there a more efficient way, in case L and A are sparse and we have a fill-reducing permutation of A? Thanks!
This is a fairly simple question but my Matlab knowledge is still very limited. I want to take a given binary number (or rather, a bistring) of length $mn$ and generate an $m \times n$ matrix whose entries correspond to the bit values. For example, if the given bitstring is $b = 1001110101$ (which is the binary value o...
I was wondering if there is a Fortran library that contains a solver for the Sparse LSE(linear equality-constrained least squares) problem $$ min_{x}\|Cx-d\|^2 \text{ subject to } Ax=b $$ where $A$ and $C$ are large and sparse. For dense linear systems, LAPACK has the subroutine DGGLSE, but I am looking for a solver...
I am looking for books or articles, or blog-posts, or any published material in general, that address specifically the uses of C++ modern features (move semantics, the STL, iterators, lazy evaluation, etc.) in scientific computing. Can you suggest any? I think that these new features will make it easier to write effici...
The original equation is $$\frac{1}{c^2} \frac{\partial^2 u}{\partial t^2} = \frac{\partial^2 u}{\partial r^2} + \frac{1}{r}\frac{\partial u}{\partial r} + \frac{1}{r^2}\frac{\partial^2 u}{\partial \phi^2}$$ and the finite difference version used is $$U^t_{i,j} = {c^2 \Delta t^2}\left[\frac{1}{2r_i\Delta r }(U^{t-1}_{i...
I am dealing with following problem: $$ \min_{u,\gamma}\Bigg\{ \frac{1}{1000} \iint_{S_2} {\gamma (x,y)^2 dxdy} + \iint_{S_2} {[u(x,y) - u_0 (x,y)]^2 dxdy} + \iint_{S_2} {[\Delta u(x,y) - \gamma (x,y) u(x,y)]^2 dxdy}\Bigg\} $$ where the unknown functions $u(x, y)$ and $\gamma(x, y)$ are defined on the unit square $S...
I am facing a simple (at first glance) problem. I need to implement a numerical scheme for the solution of the first order wave propagation equation with chromatic dispersion included. My original problem is (for a forward propagating wave): \begin{equation} \frac{1}{c} \frac{\partial u(x,t)}{\partial t} = -\frac{ \par...
$X_{1} = (A, b)$, where $X_{1}$ is a $n\times p$ matrix, $A$ is a $n\times (p-1)$ and $b$ is $n\times1$. update $b$ with $c$,Is there any update method to compute more efficiently?
I want so visualize the spatial density for my simulation. The result of my simulation is a (time-dependent) system of large number (~100k) of moving particles in a confined space. Each particle has its own Cartesian coordinates as well as a weight ($w$) in the form of $(x_i,y_i,z_i;w_i)$. I am looking for a software...
I'm a computer science student. Please I need a help in solving a constrained normalized quadratic function. I'm familiar with solving quadratic constrained optimization function with matlab by providing a symmetric matrix and a vector as inputs for quadprog matlab function. Now, I encountered an other form of quadrati...
I have a matrix A which is of size (n2, n1) and I am multiplying it by a matrix, B, of size (n1, n0). I have identified this single matrix multiplication as the bottleneck in my Fortran code. Out of ~2000 lines of code, this single line takes about 77% of the runtime. A is a double precision matrix with floating point ...
I am working on some model analysis, getting two diff equations and after I convert them into matrix form, I have equations looks like $$ [A][X]=C\times\big(\exp([B][X])-1\big), $$ where $C$ is a constant and Both $[A]$ and $[B]$ are found out from two diff equations and boundary conditions. Now my question is how am I...
So I inherited from some people a code that solves the advection-diffusion-reaction equation for a particular system. The original code was first implemented in 1D which worked fine in cartesian coordinates. However, now that I'm trying to implement it in 2d I'm having a few problems. The equation is: $$\frac{\partial ...
Character tables are an important tool for symmetry analysis in many computational chemistry software packages. Are there any standardized file formats for point group character tables? This may seem to be an odd question as I could (and I do) just retrieve this information from other sources. But for code interoperabi...
I'm familiar with finding the order of accuracy using von Neumann analysis for finite difference schemes formulated using Taylor series expansions. But is there a similar technique for finding the order of accuracy for schemes that use a least squares fit for approximating gradients? Currently, I am solving a 1D advect...
Is there a relation between say the heat equation $u_t -\Delta u = f.$ and advection-diffusion equation $-\Delta u + c \cdot \nabla u = f$? I have heard several people use this argument in many talks and articles but this is particularly not clear to me.
I've written a basic 2D Langevin dynamics simulator in C++, for a particle in a potential, solving the equation: $$M\ddot{X} = - \nabla U(X) - \gamma M \dot{X} + \sqrt{2 \gamma k_B T M} R(t)$$ This relies on a source of random numbers for $R(t)$, and I've been using std::random (in particular, a Mersenne Twister RNG). ...
When solving semi-discrete equations (originating from finite element models, for example), which are second-order in time of the form \begin{equation} M\ddot d + C\dot d + Kd = F, \end{equation} where $d$ is the solution vector, $M$, $C$ and $K$ are matrices, and $F$ is a vector, one can make use of methods that damp ...
How to solve the optimization problem written below? $$\begin{align} &\operatorname{argmax}\limits_{a}\; a^T b - \frac{1}{2} a^T X a\\ &\text{subject to } \sum_i |a_i|=4,\; \sum_i a_i = 0 \end{align}$$ where $a$, $b$ are $n$-vectors and $X$ is a $n\times n$ matrix. Also, $b$ and $X$ are constants. My main issue is ab...
I am trying to implement the finite difference beam propagation method to study the propagation of a TE light signal through a waveguide. However, my solutions are exponentially growing, and display no propagation. For more information, see "Introduction to Optical Waveguide Analysis" by Kawano and Kitoh, section 4.3. ...
In the wave equation: $$c^2 \nabla \cdot \nabla u(x,t) - \frac{\partial^2 u(x,t)}{\partial t^2} = f(x,t)$$ Why do we first multiply by a test function $v(x,t)$ before integrating?
I am curious, if there is a function to convert MPIAIJ (distributed matrices in AIJ format) to a SEQAIJ matrix that lie on a single processor. It is possible to do such an operation for PETSc vectors with VecScatterCreateToAll or VecScatterCreateToZero, but I couldn't find a similar function for matrices. It is not a s...
I'm afraid the title is terrible, but I don't know how to summarize this problem in a few words. Using an instrument, we are monitoring the trajectory of several objects during a period of time. We take a lot of measurements of the position of the objects in the field of view of the instrument, so we have a list of tri...
So I'm trying to implement a 9-point stencil discretization to the 2D difussion equation. The stencil is here. However, most of the literature deals with a Laplacian that has a constant diffusion coefficient. i.e. $$ f_t=d\Delta f(x,y). $$ However the problem I'm dealing with has a variable diffusion coefficient, i.e. ...
Given the following system of partial integro-differential equations $$ \frac{dX(t)}{dt}=\Lambda-\mu X(t)-\beta X(t)Z(t),\\ \frac{\partial Y(t,\omega)}{\partial t}+\frac{\partial Y(t,\omega)}{\partial \omega}=-\delta(\omega) Y(t,\omega),\\ \frac{dZ(t)}{dt}=-\gamma Z(t)+(N-Z(t))\int^{\infty}_{0}\kappa (\omega)Y(t,\omega...
FEA when applied to solid mechanics / structural engineering result in the solution to the equation $$ F = K\cdot x $$ $F$ being the forces, $K$ the stiffness of the system and $x$ represents the resulting displacement. Now if I were to analyse a live experiment where, lets say, I am applying a point load to a beam, ...
I am working on solving complex system of 2D PDEs governing the behaviour of plasma in a gas lamp during discharge. Recent tests have shown that because of steep gradients in temperature field and overall explosive nature of a process I won't go anywhere further without adding gas dynamics to the model. As far as I kno...
Is there a Matlab interface for minpack2? minpack2 http://ftp.mcs.anl.gov/pub/MINPACK-2 consists of Fortran programs , but i would like to call the test problems from matlab. What can i do ?
I'm part of a team trying to generalize a 1D Advection-Diffussion-Reaction code we inherited by extending it to 2D by using dimensional splitting, i.e. solving advection and diffusion for x and y separately with 1D schemes. Diffusion was (relatively) painless but there are issues with advection. Originally the code had...
I am trying to find how much an engine would turn until it stops accelerating with an acceleration of $a = A \sin^2(x)$. Acceleration Integrating the acceleration I get velocity $v = A(x/2 - \sin(2x)/4) $ Integrating the velocity, I get the distance $d = A(x^2/4 - \cos^2(x)/4) $ Velocity and distance Now, I need to ...
Hi I have made a 3D alternating direction explicit scheme for solving the diffusion equation, which will eventually replace a FTCS scheme in model of bubble dynamics in tissue. I have been testing it and have realized that despite the unconditional stability I get oscillations in the system if the Courant number is gr...
Let x, y be two floating-point numbers. What's the right way to compute their mean? The naive way (x+y)/2 can result in overflows when x and y are too large. I think 0.5 * x + 0.5 * y maybe better, but it involves two multiplications (which maybe is inefficient), and I am not sure if it is good enough. Is there a bette...
I am dealing with following 2-dimensional problem in the unit square domain $S_2$ $$- \Delta u (x,y) = f \ \text{in} \ S_2, \hspace{1.5cm} u(x,y) = 0 \ \text{on} \ \partial S_2$$ where $f$ is such the analytical solution to problem is $$u(x,y) = \cos [ 2 \pi x (y - x) ]^2.$$ Problem should be discretized by 5-po...
I want to numerically (with Matlab) solve Poisson's equation : $ \frac{\partial^2u}{\partial x^2} + \frac{\partial^2u}{\partial y^2} = f(x,y)$ On a rectangular domain using experimental data. From experimental data let's say that I have a $ [1:m \times 1:n] $ matrix that represents the right hand side of the equation. ...
Given an $n_1 \times \cdots \times n_k \times g \times g$ tensor $A$ (i.e. a collection of $g \times g$ matrices) and an $n_1 \times \cdots \times n_k \times g$ tensor $b$ (i.e. a collection of vectors of length $g$) I want to use Numpy to compute the $n_1 \times \cdots \times n_k \times g$ tensor $c$ where each elemen...
The Sherman-Morrison formula $$ (A+uv^T)^{-1} = A^{-1} - \frac{A^{-1}uv^TA^{-1}}{1+v^TA^{-1}u} $$ results in small errors in relation to the standard matrix inverse operation after each application, as shown here. From what I understand, the Sherman-Morrison identity is exact, so the error must come from numerical pro...
In Nocedal & Wright's book on Numerical Optimization, there is a statement in section 2.2 (page 27), "Generally speaking, it is easier to preserve scale invariance for line search algorithms than for trust-region algorithms". In that same section, they talk about having new variables that are scaled versions of the ori...
I need to know what library is the fastest one that can factorize a polynomial of large degree whose coefficients are big integers. I have tried NTL library to factorize a monic polynomial but it is not efficient.
I have a density function $f(x,y)$ on a rectangular domain $[0,1] \times [0,1]$ My domain is divided into cells of length $[0,h] \times [0,h]$, and I want to compute mass of each cell. I am going through each cell by using two for-loops, but then the computation becomes really slow even when $h$ is still pretty large...
I have implemented a basis transformation in C of the following form kron[A,A]*B*Transpose[kron[A,A]] where A and B are matrices and kron is the Kronecker product. However, my naive code is not scalable, and I am looking for a library to achieve this. My starting point was to look in BLAS and LAPACK for Kronecker pro...
I would like to have a divergence-free formulation of the Navier-Stokes equations for creeping flow (a.k.a. Stokes equation, N.-S. without the inertial terms) in 3D, for purposes of tracking particle deformation in finite elements. I would also like to be able to specify the usual kinds of boundary conditions (no-slip ...
I'm working with pressure-velocity coupled systems. It means that instead of solving 4 different linear systems in segregated approach (1 for pressure and 3 for Ux, Uy, Uz), we can solve only one coupled system. Assuming simple 3D rectangular mesh resulting matrix appears to be 7-diagonal with each element is a block 4...
What is the the simplest way to get started using GPU computing? My interests are primarily in neural networks and I would love to start using GPUs, but my time for learning GPU computing is very limited. Are there simple libraries for R or something that make it easy to multiply matrices on GPUs?
Let $$T=1, K=100, S_0=100, \sigma=0.05, r=0.15. $$ Define $\nu:=\frac{2r}{\sigma^2}-1$ and $$H(y,z)=\frac{z e^{\pi^2 /4y}}{\pi \sqrt{\pi y}}\int_0^{\infty} e^{-z \cosh(u) -u^2/(4y)} \sinh(u) \sin(\frac{\pi u}{2y})du$$ then next define $$ f(y,z)=\left( \frac{z}{S_0}\right)^{\nu/2}\frac{1}{4KT}\exp\left(-\frac{2(S0+z...
I tried to solve Hamiltonian system ($Q$ is a vector of all generalized coordinates, $P$ - of generalized momentum) $$ \frac{\mathrm{d} Q}{\mathrm{d} t}=\frac{\partial H}{\partial P} \\ \frac{\mathrm{d} P}{\mathrm{d} t}=-\frac{\partial H}{\partial Q} $$ where $$ H=\frac{1}{2} \sum_{i=1}^{n}\overrightarrow{p}_{i}^{2} + ...
What's the best method to maximize the value of slow multivariate function? Here is what I know about the function: Number of parameters is ~ 10. It takes considerable amount of time to compute the value of the function for single variable set. Let's say 30 minutes. Function seems to be concave against every individua...
I need to find an equation for the upper bound of $\max \mathbf{w}^T\mathbf{x}_i, \; i=1, \dots N$. where $\mathbf{w}$ and $\mathbf{x}_i$ are two vectors. I need to find a function $f$ which holds the following inequality. $\max \mathbf{w}^T\mathbf{x}_i \leq \mathbf{w}^T \mathbf{z}$ where $\mathbf{z} = f(\mathbf{x}_i),...
I am currently trying to use iterative least squares to solve a system, $y = Hx + v$ where $y$ is a vector of observations, $H$ is the design matrix, and $v$ is the observation error. From my understanding, iterative least squares tries to minimize a cost $J$ where $J = \min (Hx-y)^2$. My pseudocode for this is while |...
If one chooses to discetize the advection-diffusion (AD) equation using the standard Galerkin finite element method, stability issues may arise in cases of high Peclet number (i.e., high advection to diffusion ratio). Other than using methods like SUPG, can one achieve stable AD solutions (with Galerkin FEM) through th...
I was wondering if someone has implemented the "Tunneling algorithm" for the global minimization of a single variable function in Matlab. I am hoping to implement it on $[B, A - \lambda I]$. Where $A$ is and $N\times N$ matrix, B is an $N\times M$ matrix, $I$ is the identity and $\lambda$ is the unknown variable in the...
Suppose I have two sparse matrices, $A$ and $B$, of size $N \times N$. They each have the same sparcity pattern ("footprint"). They each also have values which in theory should be identical, but aren't due to machine precision error. A simple example of this in MATLAB syntax: % Dimensions of square, sparse matrices N ...
I am trying to solve the very simple one dimensional burgers equation which is: $$\frac{\delta U}{\delta t} + \frac{\delta F}{\delta x} = 0$$ where the flux F of some variable U is defined as$$ F= \frac{U^2}{2}$$ If I consider a small control volume around the node i, then I should write the original equation as: $$\fr...
Suppose I have this matrix in Matlab R2013a M = kron(A,B); where A and B are $N \times N$ matrices, with $N$ a "big" number. Now, I just want to extract a submatrix of M, composed by taking just few rows from it Msub = M(rows,:); where rows is a vector of length $m \ll N$. Q: Is there an efficient way, in Matlab R20...
I'm new to factor analysis and I need to compute factor scores using Python. I have R code to compute scores and I want to adjust my Python code (decomposition.FactorAnalysis() settings) to get similar output. R code: data <-read.csv("test.csv", header=F) col_names <- names(data) drops <- c() for (name in col_names){ ...
Time-explicit high order finite element/DG methods for the advection equation tend to have a timestep restriction which looks like $$dt < C h/p^2$$ where $h$ is mesh spacing and $p$ is polynomial degree. I'm having trouble finding a similar order-dependent restriction for high order finite difference stencils. Is ther...
I obtain numerical discrete data of the form $$ S_{raw}(\omega) = \sum_{j}w_{j} \delta(\omega-\omega_{j}) $$ to compare the result with experimental data the delta peaks need to be broadened according to $$ S_{broad}(\omega) = \int d\omega^{\prime} K(\omega,\omega^{\prime}) S_{raw}(\omega^{\prime}) $$ where $$ K(\omega...
I am looking for a way to simulate behavioral economic models to illustrate the effects of changing parameters. I am familiar with statistical analysis (especially R), but I only have few programming skills beyond R. I think that if there is a way to achieve my goal (I'm not really sure if it is possible at all!) that ...
I'm doing a 2D combustion hydrodynamic simulation and there's a hydrodynamic instability that should be triggered because of the particular physical properties of my system. The key to the instability are temperature gradients perpendicular to the flow direction of my problem. What is a good and "consistent" way to art...
I need to calculate the Jacobian matrix of a subroutine F(U). Both F and U are of size N(=O($10^5$)). Using Tapenade, I differentiated the routine in tangent mode. I cannot calculate the full Jacobian directly because of the large memory requirement. Is there a package that I can use to parse the differentiated FORTRA...
Is there any universal method to fill this matrix for any $n$ value: $\textbf{A} = \left[ \matrix{n & \sum x_i & \sum x_i^2 & \cdots & \sum x_i^n \cr \sum x_i & \sum x_i^2 & \sum x_i^3 & \cdots & \sum x_i^{n+1} \cr \vdots & \vdots & \vdots & \ddots & \vdots \cr \sum x_i^n & \su...
Consider a set of polytopes $P_i : i=1,2,...,k$ each of which has a structure as $P_i:= \{(x_{i1},x_{i2},..., x_{in})\; |\; x_{ij} \in [a_{ij}, b_{ij}] \subseteq [0,1]\}\;\; \text{for all}\;\; j=1,...,n$ and $\sum_j x_{ij}=1$. We define $P= CH (\cup_i P_i)$ where $CH$ stands for the convex hull. On the other side...
I am starting to get into scientific computing with a library called Deal.II and I was wondering what the community recommends as good source material that I can learn about scientific material. About the Finite Element Method and how to setup problems within the code. How to think about the problems, etc.
I have the following LP: $$ \begin{array}{ll} \text{Minimize} & \sum_{j=1}^n x_j \\ \text{Subject to} & \sum_{j=1}^n a_{ij} x_j \geq b_i,~~~i\in\{1,\ldots,M\} \\ & 0 \leq x_j \leq 1,~~~j\in\{1,\ldots,n\} \end{array} $$ where all $a_{ij} \geq 0, \forall i,j$ and $b_i \geq 0,\forall i$, and these are kn...
I've tried looking for efficient parallel algorithms to solve banded systems. SPIKE is a good example but it however requires that the band size is large. Is there any efficient library implementing a parallel algorithm for n-diagonal systems (where n is less than 10) I haven't found any implementations of Thomas' algo...
I'm currently reading this paper, and I'm a bit confused about how they compute the accuracy of their algorithm. In the aforementioned paper, they investigate the regularized long-wave equation: $$ u_t + u_x + u u_x - u_{xxt} = 0 \tag{1} $$ They discretize the grid by spacing $h$ and time step $\tau$, giving the grid p...
I am currently writing my dissertation on different methods for pricing barrier options. As part of this, I have implemented a finite differences method for solving one partial differential equation, and another finite differences method for solving another partial differential equation. I would like to create some plo...
I have the optimization problem as below: $$\begin{align} &\text{maximize } \sum_{k=1}^{M} \alpha_k {R}_k\\ &\text{subject to: } \exp \left[ - (2^{{R}_k } -1) \left(\frac{\tilde{Z} g_{k} p_{\max} + \sigma^2}{g_{pu} p_{pu}} \right) \right] \leq q \end{align}$$ $\alpha_k$ is the weight factor associated to the $R_k$....
We have a group of observations $$y = f(x_1, x_2, x_3) \enspace .$$ We have also a forward model $y = f(x_1, x_2)$. The forward model does not include $x_3$ because $x_3$ might include dozens of parameters which we do not understand clearly. First, we inverted parameter $x_1$ with the forward model $y = f(x_1, 0)$ embe...
I need to get just a random vertex of a polytope. Any will do. The only way I can do this now is to pick a random function (say 0s) to maximize with scipy.optimize.linprog. However, this is wasteful, because I really don't care which vertex I get. I saw something in the docs about getting the internal state of the solv...
I have attempted to code up the simple math required to plot the total field set up by an incident plane wave on a semi-infinite flat plate which can be found here. To summarise: $$\phi_s(r,\theta ) = e^{ikr}/2 \left( w\left[ e^{i\pi/4}\sqrt{2kr}\sin(\frac{\theta + \Theta}{2}) \right]+ w\left[ e^{i\pi/4}\sqrt{2kr}\sin(...
I am parallelizing code to numerically solve a 5 Dimensional population balance model. Currently I have a very good MPICH2 parallelized code in FORTRAN but as we increase parameter values the arrays become too large to run in distributed memory mode. I have access to a cluster with 15 nodes, where each node has two 8 ...
I am solving a boundary value problem in 2D via an implicit finite difference scheme. Unfortunately, although the problem is well-posed and should have a unique solution, the condition number of the matrix to solve is through the roof (~10^15 for a highly simplified version that is just the 2D Poisson eqn.; otherwise m...
I'm looking for a computationally efficient algorithm for solving the following type of assignment problem: I have two sets of points. Set A has N points and set B has M points. I'd like to establish one-to-many assignments from A to B, where each element in A can have at most two and at least zero matches in B. Obviou...
I'm trying to solve a generalized eigenvalue problem $$Ax = \lambda Bx, \quad A = A^\top > 0,\; B = B^\top > 0$$ with $\lambda \approx \sigma$ using Rayleigh Quotient Iteration (RQI) (RQI is applied to $B^{-1/2}AB^{-1/2}$, but the $B^{-1/2}$ cancels from the final formulas): $$ (A - \mu_k B) \tilde x_{k+1} = B x_k\\ x_...
Suppose I'm optimizing for an unknown $x\in\mathbb{R}^k.$ I have a linear operator $A(\cdot)$ that maps $x$ to an $n\times n$ symmetric matrix, i.e., $A:\mathbb{R}^k\rightarrow\mathbb{R}^{n\times n}.$ I'd like to solve a problem of the form $$ \begin{array}{rl} \min_{x\in\mathbb{R}^k} & f(x)\\ \textrm{s.t.} & x\in\ma...
I'm running a potential flow solver, and I have values of the velocity potential $\phi$ on the boundaries. I'd like to compute the spatial evolution kinetic energy in the system. In particular, I'd like to find $$T(x) = \int \int_{-\infty}^{\eta(x,t)} \frac{1}{2}(\phi_x^2+\phi_z^2) \ dz \ dt.$$ Can I calculate this int...
Matrix reorderings are important for many direct solvers. Sometimes the objective is to reduce the bandwith or the generated fill in by LU Decomposition. I am interested in a reordering which reduces the fill in of $A + A^{−1}$. Is there some work, or is it hopeless?
Consider the following equation on the circle: $$\dfrac{\partial p(x,t)}{\partial t} = a(x)\dfrac{\partial p(x,t)}{\partial x} \equiv L(p) \enspace ,$$ where $L$ is the operator acting on $p(x,t)$. Now, I would like to create a matrix of this operator $L$ using FFT/IFFT in Matlab. Note that since our domain is the circ...
In all descriptions of the Lanczos vector, it's said that the starting vector is random. But let's say I'm only interested in the eigenvector associated with the lowest eigenvalue (as is the case when using Lanczos to find the ground-state of a quantum mechanical system). Wouldn't then any start vector that has some no...
TLDR: Are these polynomials really harmonic polynomials, and how can I generate them? Long version: I want to describe an electrostatic potential $\Phi(x,y,z)$ over a source-free volume, by using a polynomial of the form $$\begin{align} \Phi(x,y,z) &= a_{000} + a_{100} x + a_{010} y + \dots + a_{123}xy^2z^3 + \dots \\...
Let $D_{\nu}(.)$ is the parabolic cylinder function (http://mathworld.wolfram.com/ParabolicCylinderFunction.html) And $\Gamma(.)$ is the Gamma function. Define $s_y(\mu,\nu,t,z)=2^{\nu}\displaystyle\sum_{k=0}^{\infty}\frac{\Gamma(\nu+k)e^{-(\nu t+z+2kt)^2/(4y)}}{\sqrt{2\pi}y^{1+\mu/2}\Gamma(\nu) k!} D_{\nu+1}(\frac{\n...
I am trying to follow an algorithm that is described in Elementary Quantum Mechanics in 1D. I want to compute eigen-energies and functions in bound states in the basic case in rectangular potential well shown on page 99 as a simple example. I am doing my code in MATLAB. And I can't get the same solution as shown in pag...
I am using variational data assimilation (4D-VAR) to estimate emissions of anthropogenic greenhouse gases using a rather complex atmospheric transport model. Hence, the optimal solution to my problem is obtained by minimizing a (non-linear) cost functional $J$. The model is weakly nonlinear so I can expect the inverse ...
I'm trying to solve the advection equation $$m_t+(\alpha m)_x=0$$ with $m(0,\cdot)=m_0$ numerically using the first order Godunov scheme. Hence I write $$m_j^{i+1}=m_j^i-\frac{dt}{dx}(m_{j+1/2}^i\alpha_{j+1/2}^i-m_{j-1/2}^i\alpha_{j-1/2}^i)$$ where $m_{j+1/2}^i=m_{j+1}^i$ if $\alpha_{j+1/2}^i<0$ and $m_j^i$ otherwise. ...
I face to the following problem: $$(1+u_x^2)u_{yy} - 2u_xu_yu_{xy} + (1+u_y^2)u_{xx}=0.$$ Problem needs to be discretized and assembled. Does anybody know how to proceed in Matlab?
I'm investigating algorithms to make a mesh watertight for 3d printing. I'd be very excited to implement such algorithms. The initial input is a mesh which is not watertight and I want to understand and implement algorithms to transform it to make it suitable for 3d printing. Here is a good explanation about watertight...
This is not a typical question with a deterministic answer. If this is not the right place, feel free to close it. For the past one year I have been working on various kinds of inverse problem. Most of them are related to parameter estimation, ranging from small linear differential equation to equations of fluid dynami...
I am trying to improve the resolution of a Stokes problem (P2/P1 on unstructured mesh) defined by the matrix $M$: $M= \begin{pmatrix} A_u & 0 & B_u \\ 0 & A_v & B_v\\ B_u^T & B_v^T & 0 \end{pmatrix}$ Current Implementation I am currently solving it using a Uzawa method, with a Krylov method accelerated by a preconditi...
Let us say I want to compute the following expression by a numerical integration scheme: $$ I = \int^{-x}_{-\infty} f(x + y) \, \mathrm dy - \int_{\mathbb R}\bigg(f(x+y) -f(x)\bigg)\, \mathrm dy $$ for a range of $x$-values $x \in \mathcal O$ for some $\mathcal O \subset \mathbb R$, and where $f(x)$ is some function s...
I am trying to solve one dimensional inviscid Burger's equation using adaptive mesh refinement. This is the PDE: $$\frac{\delta U}{\delta t} + \frac{\delta F}{\delta x} = 0$$ where the flux F of the variable U is defined as$$ F= \frac{U^2}{2}$$ To solve this equation, I am defining a control volume around point i, then...
I am wondering how Dirichlet boundary conditions in global sparse finite element matrices are actually implemented efficiently. For example lets say that our global finite element matrix was: $$K = \begin{bmatrix} 5 & 2 & 0 & -1 & 0 \\ 2 & 4 & 1 & 0 & 0 \\ 0 & 1 & 6 & 3 & 2 \\ -1 & 0 & 3 & 7 & 0 \\...
I am trying to implement my own multigrid method in fenics. Is there any "smart/ fenics" way how to assemble subdomains and obtain restriction/ prolongation operators ? Thanks!