instruction
stringlengths
43
28.1k
In a constrained optimization problem, I found in a paper a way to define new variables such that the constraints disappear. They only give the new variable definitions, and I would like to understand how they did. The context is thermodynamics. A mixture of $c$ components can phase separates into $p$ phases. $z_i$ is ...
I'm a novice in object-oriented programming, but this design technique seems very interesting for me. I have a Fortran 90 CFD package , not very complex, but it is already very hard to maintain and to add new physics or other features. As I learnt for now it can reduce complexity of program, but most important from my ...
I am trying to interpolate irregular data $f(\theta, \phi)$ on a sphere and I have so far tried a scipy approach using Kd-Trees and inverse distance weighting, which works ok - however I was wondering if there is an open-source library for spherical interpolation. I have come across the SHTns library, which is suggeste...
For my application, I need factors $\tilde C$ so that $$ \tilde C{}^T \tilde C = C^TMC $$ where $C$ is a long matrix, i.e. $C$ has much more columns than rows, and $M$ is a small symmetric positive definite (mass) matrix. Since my code assembles $MC$, I will also have to use some inverses of $M$. I have found that with...
I'm working on a code that we eventually plan to scale up to 10's or 100's of thousands of processors (using MPI). I have a single HDF5 file (mesh nodes and connectivity, etc) that needs to be read and distributed to every process with identical data. This is only done once during the setup part of the code. The curren...
I am trying to replicate Fortran90 array syntax using a C++ library. The libraries themselves are discussed at length in this question. They can all do something like this: D = alpha*A + beta*B + gamma*C for vectors A, B, C and scalars alpha, beta, gamma. This could be translated as: for (i = 0; i < D.length; i++) ...
I deal with PDE module in COMSOL and I would like to simulate Poisson's equation. Actually I need to simulate the distribution of the electric filed created by the spherical probe in the material, hence I need to consider at least two different domains: air and material. Air and material have different properties, so...
What are the subtleties involved in solving vector PDEs on manifolds? Can someone suggest a reference summarizing the problems involved? Specifically I want to solve a vector Helmholtz equation with a source field on a curved manifold (e.g. a sphere, or a sphere with distortions). How do I go about solving this? Say us...
I've currently begun studying Finite Element Method (FEM) and I'm finding it a little difficult to find resources that break it down into something comprehensible. All the resources I've found are simply too advanced for me to understand as I do not have a mathematics background (hence the confusion). I'd like to kindl...
function [R, RI , S ] = Matrix_block (A,N) [U,D]= schur (A); E=ordeig(D) ; [R, S]= ordschur (U,D, abs (E) <1000* eps ) ; RI=R'; m= max(max(R* RI-eye (2*N) ) ) ; if m >100* eps; sprintf( 'R not unitary , N: %d , Maximum : %d \n ' ,N,m); end C = R*S*RI-A; m= max(max( abs (C) ) ) ; if m >10* eps ; sprintf ('Rtransf...
For ease of explanation, suppose that you began with a two-dimensional surface in (x1, x2, x3, x4)-space, and the surface begins as a flat planar region in the (x1, x2)-plane. The boundaries of this flat region is not that important to resolve, but it would have a closed boundary. Pretend it is a square. So this surfac...
I am interested in methods for solving the optimization problem $$ \begin{array}{rl} \arg\min_x & x^T A x \\ \mathrm{s.t.} & x^T x = 1 \\ & Bx = 0 \end{array} $$ where $A$ is symmetric and full rank with well-separated eigenvalues, and $B$ has a nontrivial null space. In other words, I want to restrict $A$ to the null...
I've spent some time writing a spectral element solver aimed at solving fluid flow problems concerning the motion of self-propelled bodies. I've gotten to the point where the code has grown long enough that I'm having trouble organizing things in a way that is simple and understandable. Presently, I have written it in ...
I want to numerically solve the diffusion equation $\partial_t u = D \partial_x^2 u$ in Fourier space, and can think of multiple ways to do it. Setup Option 1 Differentiating $u$ twice in Fourier space brings down two factors of $ik$ from the exponential $e^{i k x}$. $$\partial_t \tilde{u}_k = D (ik)^2 \tilde{u}_k$$ wh...
Electromagnetic metamaterials are resonant, periodic structures (repetition of a unit cell) involving both dielectric and conducting elements, and are used and simulated in frequency ranges from microwave (a few hundred MHz) up to optical and more (up to PHz) frequencies. These structures are simulated in frequency dom...
I have scatter plot and I want to trace the border of that. for example: Plot: and I wanted it traced: Or at least wanted to know the border points? Also, is it possible to detect if any point exist on inside or not?
I have a partiuclar kind of graph problem and (not having a background in graph algorithms) I would like to know how this kind of problem is called in the literature and what algorithms exist for solving it. I have an undirected graph consisting of vertices $V$ and edges $E$. Each edge has a potential $p_e \in [0..1]$ ...
I have an expression (let's say determinant of matrix A) expressed in symbolic form in terms of 2 decision variables x1, x2 and 2 parameters q1 and q2. I'm minimizing this using fmincon for different start point and parameter value combinations. For certain combinations of x1, x2, q1, q2 the matrix A is not invertible ...
I do not need a complete answer but just some advice. I have a sparse matrix of points in a volume. I know a surface passing by these points exists and this surface is mostly flat and relatively smooth with some small harmonic contents. See the two images below (this surface of the first one is a bit too complicated an...
I am minimising a diagonal quadratic matrix using CPLEX. All off diagonal elements are zero. It has 500 variables and 20 linear constraints plus each variable is constrained to be within 0 and 1 All of the elements on the diagonal are greater than zero. CPLEX complains that it is either not-optimal or unbounded depend...
I run Python/C simulations for biological problems, so the range of computational tasks can be broad. Here are some examples: 1) continuum model simulations: FEM type 2) agent-based simulations: each agent may be a 2D polygon, on whose vertices ODEs are defined, modelling the time evolution of interesting variables, an...
So, I'm trying to simulate polygon rigid body physics, both linear and angular. To calculate the MTV is easy in SAT (Minimum Translation Vector), and to use it to adjust position is also easy: PolygonA.center -= MTV * .5 PolygonB.center += MTV * .5 But if you want to adjust velocity and angular velocity with it how wo...
Consider solving numerically for roots: $( x_0, y_0): f(x_0, y_0) = 0, g(x_0, y_0) = 0$ where you only know that f, g continuously differentiable but the theoretical differentiation is not a possible. So for this rather take it as continuous only. $ f_x(x,y) \leq 0$ $ g_y(x,y) \leq 0$. $f_y $ and $g_x $are per se n...
I'm solving an ODE, where currently the dependent variables are the (time dependent) spatial Fourier coefficients. It turns out that the phenomena I'm interested in describing is spatially localized, and it takes an impractical number of Fourier coefficients to fully describe it. Therefore, I'm interested in looking at...
I want to construct a MIP formulation for Ising model. For simplicity, I will only include terms involving nearest-neighbor pairs and triangular terms. I propose one formulation and ask whether there would be some stronger formulation form that would be potentially faster in computation. Thank you :D the original objec...
In Lapack (zhseqr) and matlab, the eigenvalues of a complex matrix are computed successfully. I notice that QR iteration or algorithm is involved with that process. QR iteration repeats to call QR decomposition of R*Q from the previous step. Here is my question: QR decomposition in Lapack (zgeqrf) produces real diagon...
I am writing a finite element solver in C++. The main bottle neck is assembling the global stiffness matrix in sparse compressed row storage (so far I am only solving steady problems). Because I don't know how many nonzero entries exist in each row, I am currently assuming a constant upper bound on the number of non-ze...
Suppose I have a quadrature method with a theoretical error estimate that scales with the number of points as $e(N)$: $$\int_a^b f(x)\mathrm{d}x = \sum_{i=1}^N w_i f(x_i) + \mathcal{O}\bigl(e(N)\bigr)$$ For example, $e(N) = N^{-4}$ for Simpson's rule, or $e(N) = N^{-2}$ for the trapezoidal rule. In this question I only...
Given a problem like this: $$ \text{min } ||Ex-f|| \text{ s.t.}$$ $$ Gx \ge 0$$ $$ Cx = d $$ And assuming that the matrices are medium sized (dimensions in the low thousands) and dense, what's the state-of-the-art for solving this system (imagine for use in a real time system)? Preferably using something like an activ...
I have a single sparse matrix $A$ for which I can easily compute $Ax$ and $A^*x$ and I would like to solve $\min(||Ax||) \text{ s.t. } ||x||=1$. I know the answer is the right singular vector associated with the smallest singular value, and thus I can use something like Lanczos (or one of the modern bells-and-whistles ...
The diffusion equation is: $ \frac{\partial T}{\partial t} = \alpha \left( \frac{\partial^2 T}{\partial x^2} \right) $ An explicit finite difference approach can be used to solve this, forward in time and central differences in space. Approximating the diffusion equation at a node i, yields, $\frac{T_i^{n+1}-T_i^n}{...
I have done Molecular Dynamics Simulation and now want to venture into Lattice Boltzmann Method. What would be the best reference book/lecture notes/videos for a beginner?
Given symmetric, positive-definite matrix $A$ and its preconditioner $M^{-1}$. What's kind of preconditioner $M^{-1}$ which preserve the symmetry of $M^{-1}A$?
I've coded up a Stokes Flow problem using finite elements and am in the process of verifying that it works. I'm just not sure what convergence rate I should be expecting as I globally refine the mesh. I know for scalar problems using linear basis functions I'd expect order $h^2$ convergence ($h$ is element size), and u...
I have some technical question concerning the ellipsoid method Referring to the paper : http://paswkshop.comm.utoronto.ca/~weiyu/01658226.pdf It is mentioned in p.1317 at the last line in the left column that "When the subgradient of the dual objective function has a bounded norm [26], the ellipsoid update is guarantee...
How many years it would take our laptops to be as fast as the fastest super computer in 2000 according to Moore's law?
Due to the derivation of an algorithm I tried to use Maple (9.5) to calculate some block matrix expression. Unfortunately Maple seems to ignore the assumption I set on the variable. Lets consider the following minimal example: restart; with(LinearAlgebra); assume(A,'SquareMatrix'); assume(B,'SquareMatrix'); E:=Matri...
What is the fastest multithreaded radix sort code out there? I am using radix sort to sort the Morton/Hilbert keys when constructing a tree structure. The number of identical keys is in the range of 10-100. I also need the sorting code to return a permutation index array so that I can sort other elements according to i...
I would like to numerically solve a hyperbolic PDE of the form $\frac{\partial\theta_t}{\partial t}(x,y)+\frac{\partial\left[\theta_t \gamma_t^x\right]}{\partial x}(x,y)+\frac{\partial\left[\theta_t \gamma_t^y\right]}{\partial y}(x,y)=0,$ which is very similar to the 2D advection equation, except that the partial deriv...
I would like to determine a temporal derivative and a Laplacian by the finite differences method to solve the heat equation in a 1-dimensional case. My aim is to get the sources term that is why I need to get all left terms of the equation. When I plot the sources term as a function of time, the result is surprising......
I am struggling with an equation that represents the Weak form of Galerkin method: $ \phi^{T}F(\textbf{u})\sim \int_{\Omega}^{ } \phi.f_{0}(\mathit{u},\nabla \mathit{u}) + \nabla\phi:f_{1}(\mathit{u},\nabla \mathit{}u) = 0 $ Where the pointwise functions $f_{0}$ and $f_{1}$ capture the problem physics. After discretizi...
These days, one can have 64 cores in a single node. I wonder how well the dense matrix-matrix product (SGEMM and DGEMM) scales with multiple CPUs/cores? I tried to find some relevant benchmarks, but couldn't.
So in my school we have a day where everybody participates in different activities. Each projects can have like 10 members. The whole day is divided in 2 or 3 different blocks, in which the pupils assigned to the activity change.(So in block 1 pupil x takes part in activity a and in the second block in activity d). Bef...
I am fairly new to using SRM, and I am wondering if I should be using srm CLI tools (srmping, srmls, srmcp, etc..) provided by dcache, or bestman2 counter parts (srm-ping, srm-ls). I used to think that either tools should work fine against either dcache, and bestman2 servers, but recently I am seeing this is not the ca...
After reading three books about finite element method, with two of them covering also finite volume and grid generation, I found myself lost when I have to discuss these topics with library developers scientists that use an advanced mathematical language (for example, they usually encompass the discussion with Sobolev ...
I have a MIP which I know the solution almost for certain. I want to use gurobi to prove that the true solution (even if it is not the one i provide) shall not lie more than 0.5% deviated from the solution I gave. I believe that simply keep cutting without branching would possibly save much more time. Do you know a way...
Is there any fast way to compute the barycentric Lagrange interpolation using matlab? something more faster than using repmat instead of for loops
I'm using interior point algorithm for solving a nonlinear optimization problem and want to provide Hessian of the Lagrangian as part of fmincon to speed up the process (running couple of thousand variations for different sets of parameters) The workflow that I'm designing has the (nonlinear) objective function, form o...
I'm trying to generate start points for my optimization problem in Matlab. At this point Im not worried about feasibility but only a fast way to generate the points from which I could test the performance of different algorithms available within fmincon. Though am not worried about feasibility I don't want to use rando...
If I am to solve a symmetric eigenvalue system $A=QDQ^T$, where $A\in\mathcal{R}^{n\times n}$ and $n$ is small (in the range 4 - 64); I want all the eigenvectors and eigenvalues; There are two major consideration in my design; I wish my implementation to be as fast as possible; I need $Q$ to be as orthogonal possible,...
I am numerically simulating the Mathieu equation using ODE45 and I have to keep changing the parameters delta and epsilon for each simulation to get the required peiodic solution. Following is the MATLAB code I am running: function xdot=trial2(t,x) delta=0.1045;epsilon=0.0048685; xdot=[x(2);(-delta-epsilon*cos(t))*x(1...
Given a desired state $y_0$ and a regularization parameter $\beta \in \mathbb R$, consider the problem of finding a state $y$ and a control $u$ to minimize a functional \begin{equation} \frac{1}{2} \| y - y_0 \|^2 + \frac{\beta}{2} \| u \|^2 \end{equation} subject to the constraint \begin{equation} Ay = u. \end{equ...
Are there any open-source auto-differentiation libraries for MATLAB? I am aware of commercial packages such as Tomlab/MAD and plenty of C++ libraries, but I can't find many more for MATLAB other than Automatic Differentiation for Matlab package on Matlab File Exchange which isn't a major package. Added As a bare minimu...
So I'm working on a fitting algorithm using the levenberg-marquardt algorithm and I'm a bit stumped as to how to handle fixed parameters. Looking around at other code, like the minpack version of the l-m algorithm, it looks like they are just setting the columns of the jacobian for fixed parameters to be 0.0, which mak...
ATLAS is an extremely popular linear algebra library. When you install ATLAS from source, it tries to automatically tune a number of parameters to give you the fastest code. Does it make sense to do this tuning when installing ATLAS on a cloud server like AWS or GCE? I know that these services often provide shared VMs,...
Is it possible to run Clp on multiple threads using Julia and JuMP?
I need to find the root of a nonlinear system (which comes out of collocation, so I will change the order to test). I will likely have about 50-300 variables, and the Jacobian is going to be somewhere between 1/9 and 1/2 dense, and calculated using auto-differentiation. What do people suggest for the linear system of ...
I am writing a global climate simulation software system. My idea is the following : At the top of everything, I interface to the OS using D, a very powerful language for compile time code generation. The D code gets environmental variables, finds necessary input data, and then according to the config files, initiates ...
I am trying to use the diary function in Matlab: delete task1.txt diary task1.txt echo on format long b = 1:c; x = 10.^(-b); y = sin(x)./x; echo off diary off end When I run the script I get the following error: "Cannot open file: permission denied" How can I enable the permission in the script?
I have a problem of the following structure: For some scalar $g$, functions $F(z)$ and $h(z)$ defined on $[0,\bar{z}]$ , and a non-linear operator $\phi(F,z)$ (in reality, $F$ and $h$ are vector valued) The $F(z)$ and $g$ must fulfill the ODE st. boundary values: $$ 0 = -F'(z;g) + \phi(F,z;g)\\ F(0) = 0\\ F(\bar{z}) =...
Is there a mathematical optimization branch that explicitly tries to optimize this (type) problem? $$\eqalign{ & \min \cr & \sum\limits_{i = 1}^N {(J*s[i] + {J_1}*s[i]*s[i + 1] + {J_2}s[i]*s[i + 1]*s[i + 2] + ... + {J_m}s[i]*s[i + 1]*...s[i + m])} \cr & s[i] \in \{ 0,1\} \quad \forall i \in \{ 1,2...,N + m\...
What is the current state of the art for solving higher dimensional (3-10) parabolic PDEs in the complex domain with simple poles (of the form $ \frac{1}{|\vec{r}_1 - \vec{r}_2|}$) and absorbing boundary conditions? Specifically, I'm interested in solving the multi-electron Schrödinger equation: $ \left( \sum_i \sum_{...
I am finding the eigenvalues of dense NxN Hermitian matrix which is calculated from a density operator in quantum physics. All the eigenvalues are needed as I need to calculate the sum of the absolute value of them. I would like to know whether there are good solvers for this problem that can run in parallel? The probl...
Hibbs et. al use SVD to balance the strength of different underlying signals in gene expression data using the following decomposition: $X_{m*n} = U_{m*n} \Sigma_{n*n} V^T_{n*n}$ In this case $U$ has the same dimensions as $X$, so the way that they see $U$ as a balanced projection of $X$ makes sense. I'd like to use th...
I want to find the minimum-norm solution to a rank-deficient least-squares problem, subject to positivity constraints, e.g. $$\min_x\ \|x\|^2 \quad s.t.\quad Ax = b,\ x \geq 0$$ where $A$ is large, sparse, rectangular, and rank deficient. What is the most efficient way of robustly solving this problem? Is there recomme...
I am trying to create the same outputs in Mathematica and Matlab, however I am running into trouble aligning the eigenvectors with the eigenvalues, I think the Matlab is doing something slightly more complex (Ordering/Sorting) than I anticipated. using the example in on the Mathwork website, for [V,D] = eig(A). http://...
I have a set of points defined by their coordinates $(x_1,y_1)$ after changing some parameters of the problem I obtain a second set of points defined by their coordinates $(x_2, y_2)$. There exists a one-to-one mapping between these two sets of points. Is there a standard way to obtain the most likely mapping between t...
Not sure if this question is more appropriate for StackOverload, but I'm guessing a bunch of people here have experience with MPI2, so thought I would try here first. I have some large dense complex symmetric matrices that I would like to factor and wanted to try out Elemental for its MPI support. I compiled Open MPI 1...
Below is a Python code that calculates the periodicity of the middle-square method for a given 4 digit-numbers: n = int(input("Please enter a four digit number: ")) already_seen = list() while n not in already_seen: already_seen.append(n) n = int(str(n * n).zfill(8)[2:6]) print(n) print('periodicity = ', le...
I'm new to the PDE toolbox in Matlab. From the PDE specification window of the toolbox, it looks like one can only solve PDE with constant coefficients. How can I use Matlab's PDE toolbox to solve PDE like $$ \partial_t P(x,y,t)=x\partial_xP(x,y,t)+(y-1)\partial_yP(x,y,t)+2P(x,y,t)? $$
I am attempting to translate a dgemm / MPI matrix multiplier onto the GPU through OpenCL C. My issue is that the code below gives the correct output for a 9x6 matrix being multiplied by a 6x450 matrix until the 6x450 matrix changes slightly and the kernel output is shifted by 315 indeces. Included is the dgemm that I ...
I'm trying to implement the Helmholtz-Hodge Decomposition in 2D, which states that a vector field is composed by a rotational free component, a divergence free component and a harmonic component. This leads me to a Poisson Equation: $\begin{equation} \left\{ \begin{array}{lcl} \nabla \cdot \mathbf{F} & =...
I want to numerically solve the following system of differential equations at the steady state: \begin{equation} \begin{aligned} \frac{\partial \rho_{11\mathbf{k}}}{\partial t} =& +\frac{i}{\hbar} V_{0}^{2121}\sum_\mathbf{k'}(\rho_{21\mathbf{k'}}\rho_{21\mathbf{k}}^* - \rho_{21\mathbf{k'}}^*\rho_{21\mathbf{k}}) + \\ ...
I'm transforming cartesian images into polar images. (x,y) => (angle, radius) I fill the polar image by iterating on each of its pixels and filling them by doing the reverse polar transform. For a given (angle, radius) pair, I'm interpolating in the source cartesian image at the following location: xcartesianpoint = co...
I have several matlab functions and one script that call those functions. Suppose that they are 'a.m' 'f1.m' 'f2.m' and 'f3.m'. The script 'a.m' must open the functions files when it is manually opened and the run command is used. How can I do that with scripting techniques?
I'm trying to understand how the adjoint-based optimization method works for a PDE constrained optimization. Particularly, I'm trying to understand why the adjoint method is more efficient for problems where the number of design variables is large, but the "number of equations is small". What I understand: Consider th...
Is there some flag to let the Fortran compiler pre calculate a math expression before compiling it?. I have to write expressions that contain many small 4x4 matrix multiplications. The thing is, most of the elements of these small 4x4 matrices are zero, so in terms of performance it's better to actually do the multipli...
At our research facility we routinely perform what are called PALM (Photo-activated localisation microscopy) or STORM (stochastic optical reconstruction microscopy) experiments. You can read all about it in the links above but in short it boils down to this: Normal optical microscopy is diffraction limited. We can onl...
I would like to solve the following equation, wrt $n(e)$ $$f(n(e))=g(n(e)) + \int_{\alpha}^{e} w(n(x))dx $$ The integral there it confuses me. Any suggestion on how I can implement this on a the computer (I am mostly Matlab user) thanks UPDATE or simplicity assume the integral is between some values $e_1$ and $e_2$ a...
I'm trying to write a Python program to use Tanh-sinh quadrature to compute the value of \begin{equation} \int_{-1}^1 \frac{dx}{\sqrt{1-x^2}} \end{equation} but although the program converges to a sensible value with no errors in every case, it's not converging to the correct value (which is $\pi$ for this particular...
Is checking the equivalence of two convex polytopes $p^{s}$ and $p^{t}$ NP-hard? $p^{s}= CH\{ \cup <p^{s,a_1},...., p^{s,a_m}> \} $ // CH is convex hull computed on union of a polynomial number of polytopes $p^{s,a_i}$ $p^{t}= CH\{ \cup <p^{t,b_1},...., p^{t,b_n}> \}$ // CH is computed on union of a polynomial nu...
I'm using Matlab's fmincon to solve a constrained nonlinear optimization for varying sets of parameters in the objective function. I have 2 parameters and have 400 unique combination of these 2 parameters. Within a particular combination of parameters I use a range of start points (100 start points). Trying to do rough...
I am applying an iterative method (projected newton) to an optimization problem. Theoretically, the method should converge linearly. I would greatly appreciate it if you could share how should I test the convergence and which stopping criteria should I use? I used the gradient norm (gradient of the objective function) ...
Let a system of $n$ polynomial equations of degree $d$ with $m$ variables. I'm interested in a sparse system with $d = 3$, $n \sim 2000000$, $m \sim 50000$ and integer coefficients. What techniques can I use from numerical analysis to show the existence of a solution? What numerical methods exist for finding a soluti...
I what to calculate displacements, stress and strain in a soil slope with a FEM script. The slope moves like a laminar flow. Can you suggest me some bibliography on this problem? I've already look on Zienkiewicz - The finite element method vol 1, 2 and 3-
I have the following SDP problem: max: $Tr(CX)$ subject to: $X \geq 0, I - X \geq 0$. I want to convert it into the standard form specified by CSDP (I'm using the callable C interface), which is: max: $Tr(CX)$ subject to: $\forall_i, Tr(A_iX) = a_i, X \geq 0$. The SDP is part of an algorithm which iteratively increase...
Can anyone explain how the MATLAB functions: stream2(x,y,z,u,v,startx,starty) and stream3(x,y,z,u,v,startx,starty) compute stream lines from vector data u and v? In the stream2.m file, it calls the stream3c function. I assume it is a .c file but unable to see it. Thanks in advance.
I have two animal running trajectories. A regular one with repeated back and forth running between point A and B, like the one on top in the figure. The other one is very irregular, animal paused and turned around a lot in the middle. Is there any algorithm to measure the regularity of a trajectory, like repeated acti...
This is somehow unexpected, but my recent experience with solving a system of nonlinear equations is that treating them as the right hand side of a system of ordinary equations and then evolve the system with an ODE solver can be considerably faster than with the usual Newton-Raphson iteration. Of course this only appl...
I am dealing with a highly nonlinear system of two PDEs. I already have a code to solve the system in case of Dirichlet boundary conditions. The explicit system is: $$ \begin{eqnarray*} \partial_{t}u & = & D_{11}\partial_{x}^{2}u+\partial_{x}D_{11}\cdot\partial_{x}u+D_{12}\partial_{x}^{2}v+\partial_{x}D_{12}\cdot\parti...
I have an upper trapezoidal matrix stored in column major format. That is, my matrix looks like this: I'd like to RQ decompose it, and store Q in the rectangular part of my upper trapezoidal matrix. For QR decomposition, I can store Q in the lower portion of the matrix, as a sequence of column vectors ($v$) which fo...
This is a somewhat basic question, I guess. Take the ODE boundary value problem $$ \frac1\lambda y''-y'=0, \qquad y(0) = 0, \quad y(1) = 1, $$ with the solution $$ y(x) = \frac{e^{x\lambda}-1}{e^\lambda -1}. $$ Discretize it on a uniform grid $x_k = kh$, $h=1/n$, $k=0,\ldots,n$, as follows: $$ \frac1\lambda \frac{y_{k-...
I'm reading up on the Parameter ESTimation algorithm, (Link to PEST homepage 1), and having trouble understanding the broad strokes, as I keep getting lost in null spaces, different regularized ion techniques, etc. Can someone who is familiar with this algorithm, often used in the calibration of environment models, pro...
I am writing the pre processing program for a porosity based cfd project we just started. Basically I have a 3 dimensional mesh made of cubes and I need to import a STL file over it, and calculate how much space of each cell is being used by the object. The STL file is a CAD format that uses triangles to represent a su...
I noticed this post, where spalloc and sparse are recommended for efficient assembly in Matlab. I personally use sparse assembling for simple cases. However, when it comes to the case of coupled PDE, say, 3-PDE coupled, then the scalar unknown becomes a $3\times 3$ tensor. In this case, I can't figure out a way to expl...
Let $F_1$, $F_2$ be the foci points of an ellipse $\mathcal{E}\colon \mathbf{x}^TA\mathbf{x}=1$, $\mathbf{x}\in\mathbb{R}^2$, $A\in\mathbb{S}_{++}^{2}$. Let also $a$, $b$ be the semi-axes of $\mathcal{E}$. We would like to find the (symmetric positive-definite) matrix $A$. I tried the following: I first constructed th...
If I have N particles how do I assign their x values so that the end result is Gaussian distribution. i.e. particles near the ends are more spread out than particles near the center.
I am trying to derive Galerkin type weak formulation for the Stokes equations. I'm having a bit of a problem reconciling the notation in the integration by parts. I know that the answer I'm looking for is: $ \int_\Omega \Delta\mathbf{u}\cdot\mathbf{v}d\Omega = \int_\Gamma (\mathbf{n}\cdot\nabla\mathbf{u})\cdot\mathbf{v...
After studying the process of Gradual Underflow, I'm left a little curious as to why machines don't implement Gradual Overflow; where numbers exceeding the overflow level would be stored as un-normalized floats. Just as the precision of the mantissa is decreased for representation of a larger (in magnitude) exponent (a...
How can I automatically set the limits of my axis to be e.g. 5% bigger than all data contained in the plot? Of course I could calculate the total max/min values for all the stuff I plot but I would have to do this for each plot separately. Since Matlab somehow must know all min/max values (it computes a decent limit it...