instruction
stringlengths
43
28.1k
For an optimization routine I needed to compute the derivative of the right-hand side $\: f_u(x_k, u_k)$ of a discrete-time system $x_{k+1} = f(x_k, u_k)$. Since $\: f_u(x_k, u_k)$ includes terms that are divided by $u_k$, it is not possible to evaluate $f(x_k, u_k=0)$. From the physics, it's pretty clear that a limit ...
Assume $X$ and $N$ are two sets of observations from two different normal distribution, where $X$ represents clean data and $N$ represents noise; and $A$ a projection matrix of a filter and the relation between $X$ and $Y$ defines as: $Y=A \times X + N$ considering that $X_i$ are not sequential samples and are just dif...
I'm coding the simplex method and observing that it easily falls into cycling, even if Bland's rule is used. It seems to me I have found the reason and I would like to check my understanding is correct. It seems the problem is in tiny detail of the choice of the pivot row. We choose the pivot row "r" by the codition B...
Reposted from: https://stackoverflow.com/q/34909093/472610 I work in scientific research. Technical tools aren't always ideal or even really thought through sometimes, but with recent developments one recurrent need (in my field and many other I know of) is that of storing reasonably large datasets (10GB - 1TB) with la...
Assume I start with an 8x8 coarse mesh (see Fig 1) where the vertices (except boundary vertices) represent the unknown variable. After iterative approximation - I find 2 vertices (unknowns) where the error exceeds a certain bound (see Figure 2 red dots). Now I further refine the red dots (high error points) (see Figu...
I have some data defined in an array (an image) and I need to find the curl of a certain function. Wikipedia has an integral definition of curl that I like, maybe it can be discrete. $$ \nabla \times F = \frac{1}{|A|} \oint F \cdot d \mathbf{r}$$ Can we write this as some kind of finite difference. Let $F = (F_1, F_2, ...
I need to ask a question about partial derivatives. I want to solve this equation (steady state, one dimensional continuity equation): $$\frac{\partial (\rho u)}{\partial z}=0$$ which is equivalent to: $$\rho\frac{\partial u}{\partial z}+u\frac{\partial \rho}{\partial z}=0$$ and discretized by means of finite differenc...
A scalar field f approximated on a triangular mesh using the FEM method can be given as $f(x,y) \approx \bar{f}(x,y) = \sum_{n=1}^3 \left(\phi_n(x,y) \cdot f_n \right)$ I am of the understanding, then, that the gradient of f can be found inside each triangle with $\nabla \bar{f}_t = \sum_{n=1}^3 \left(\frac{\partial\p...
I'm having trouble solving a second order differential equation with Gaussian white noise. The equation I'm solving follows the form: $$Ax'' + Bx' + \sin(x) = i + i_{n}$$ where $i_{n}$ is the Gaussian white noise, and $i$ is a constant source. I'm ultimately interested in $x'$, not $x$. Without the Gaussian source, I'...
I have the following problem, I have a class of N people and I want them to do stuff by pair, but I want them to do this with everybody but as fast as possible. For N = 4 I got this: A-B C-D A-C B-D A-D B-C so in three turns it's finished. I need to find an algorithm (simple to explain if possible) to solve this probl...
I am aware that I could use deconvolution algorithms such as LUCY, Weiner and Blind but I am confused as to how to estimate the PSF (point spread function), which is needed for the LUCY and Weiner algorithms. I am currently using the Widefield Florescence Microscopy setup. I have read in a lot of places around the int...
I need some advices to start to solve some problems about fluid motion in a conduit. The problem domain is shown below: a conduit with some obstacle of different geometric properties. The fluid is a "real" and viscous, the viscosity is very high in relation to speed (low speed, very high viscosity). The fluid is in p...
I have problem to solve stiff equations. Any idea on how to solve this? I have tried "StiffSwitching" but it didnt work. Im solving this using Mathematica 10. Here is my code. Im sorry if I wrote the code badly but I have fllowed the instructions on how to copy and paste code from Mathematica and this is what I end up ...
I am seeking of any already written R package which could help in an optimization technique which is called Difference of convex functions. This technique is sketched here and could be very useful for reinforcement learning processes. Does anyone know something, that could be helpful? I have found package called ccc...
I have $n$ boolean variables $x_1,\ldots,x_n$ with associated real-valued costs $c_1,\ldots,c_n$, respectively, and a boolean function $(x_1,\ldots,x_n)\mapsto\Phi(x_1,\ldots,x_n)$ in conjunctive normal form (CNF). I'm looking for a dedicated (ideally free) software package to find an assignment for $x_1,\ldots,x_n$ th...
So in ${\bf R}^{n\times p}$ we have the Frobenius inner product given by $$\langle A, B\rangle=\text{tr}(A^TB)$$ which can be interpreted as the Euclidean inner product on ${\bf R}^{np}$. My understanding is that all inner products on ${\bf R}^{np}$ can be written as $$a^TPb$$ for $P$ positive-definite. The best I cou...
during the development of my N-body simulation with visualisation in WebGL, I devised an optimisation, and I'm wondering if it has a name. I find it unlikely that it has never been done before. It works like this: During the first timestep, make an all-pairs iteration. During that iteration, for each particle: Store a...
I have a set of 3d points to which I want to fit two planes. I know the assignment of points to the planes so I don't need any RANSAC or similar. Currently, I'm using a PCA-based approach to fit two planes and they are rather orthogonal (+/- 2 deg) but I'd like to integrate this knowledge directly into the plane fitti...
I have an expression like the following (anyway to input latex?), $$ z^{m}\left( \ln\left(\frac{z}{z-1}\right)-\sum_{k=1}^m \frac{z^{-k}}{k} \right)$$ for m integer, z complex It seems if I code it the following way, it gives noticeable round-off error in case $|z| \approx 1$. Z_1=1/Z ZV1=LOG(Z/(Z-1)) ZK=...
I have a system of ordinary differential equations (ODEs). It is a large system that has dozens of equations and hundreds of parameters. I wish to reduce its size so it becomes computationally more efficient to simulate, and I'm willing to tolerate some error in the reduced model. So the end result should be a system o...
There are some technique to generate mesh in a domain. My qustion is that: Is there any difference between the results using different techniques for mesh generation? If yes which one is better. For example If I solve an equation by regular triangle mesh and by criss-cross mesh wich one must be better (especially in ad...
I would like to construct a surface on a 2D mesh, given a set of Fourier coefficients for the original function $V(x,y)$. Given some $\mathbb{K}\subset \mathbb{Z}^2$ I have a partial double sum of a Fourier series for $V(x,y)$, which could be some potential, for example $V(x,y)=\frac{1}{\sqrt{x^2+y^2}}$ then $f(x,y)=\...
I have the function $cos(x+t)$; the following PDEs have $cos(x+t)$ as the analytical solution of them: $$u_t = u_{xx} -\sin(x+t) + \cos(x+t) \\ u_x(0,t)=-\sin(t) \\ u_x(1,t)=-u(1,t)^4-\sin(1+t)+\cos^4(1+t)\\ u(x,0) = \cos(x)$$ $$ v_t = v_{xx} -\sin(x+t)+\cos(x+t) \\ v_x(0,t)=-\sin(t)\\ v_x(1,t)=-\sin(1+t) \\ v(x,0) = \...
I have a PDE defined over $\mathbb{R}$, for which I don't have the exact solution, and I am to approximate it with finite differences so I need to input some BC. Can anyone suggest any good references for dealing with infinite intervals as BCs? Possible attempts: Input $[-M,M]$ as domain for large M and try to guess ...
I've seen a few other posts on this topic but none have full answers. I'm trying to implement some eigen-decomposition algorithms. I've managed to get the Explicit QR algorithm and the Implicit (Francis) algorithm to compute the eigenvalues. My question however relates to computing the eigenvectors. My core question i...
Update: Someone changed the title to this post to a possible answer ("Fourier decomposition of parametric shapes") but I changed it to a different title as that makes it clear what I was asking. As I think putting the answer in the title makes it confusing to a new reader. I am learning about programming so this quest...
I've been trying to understand the Fast Multipole Method but not really getting anywhere. It seems like the fastest mainstream N-body simulation algorithm, and I would like to implement it in an efficient javascript version, mostly for amusement in browsers. My math is pretty weak, but my programming is strong, relativ...
Briefly, what are the different types of basis used in FEM and why is the nodal basis so popular and advantageous in the finite element context?
I am a physics undergrad and I have MOKE data for a magnetic material (thin permalloy film on a silicon substrate). Here is one of the hysteresis loops I obtained, plotted using Python: The form of the $y$-axis is irrelevant since I am just going to normalise the signal. I am also going to shift the loop horizontally ...
I'm working on a Magnetization simulation and writing an algorithm using the metropolis method. I am using a change in energy and a Boltzmann distribution, but, my question is about the trial step. Should the trial position of the magnetization be completely random or should it be a random differential added onto the ...
I have the system of equations \begin{align} &A \frac{\partial u_1}{\partial t} = 1 - u_1 B \frac{\partial u_2}{\partial y}\\ &\frac{\partial u_2}{\partial t} = \frac{\partial}{\partial y}\left[ e^{u_1} \frac{\partial u_2}{\partial y}\right] \enspace . \end{align} The initial condition is $u_1(y, 0) = 0$, and $u_2(y<1...
The cfl condition for linear advection equation $$ u_t + a u_x = 0 $$ using a DG method of degree $k$ polynomials, upwind flux and an RK scheme of $k+1$ stage/accuracy is stated to be $\frac{1}{2k+1}$ for $L^2$ stability. However I have not been able to find a paper which proves this though it is mentioned in some pap...
I am trying to identify a non-linear plant using the identification toolbox of Matlab. In particular I would like to identify a non-linear arx model, where the nonlinearities are expressed by means of tree partitions. According to Mathworks (http://it.mathworks.com/help/ident/ref/treepartition.html): TREEPARTITION is ...
Lets say I have a system of differential equations which has the form $$\dot{C}_{\alpha,\beta,m} = f_{\alpha,\beta,m}(C_{\alpha,\beta,1},\ldots,C_{\alpha,\beta,N};t).$$ The $f$s are some functions of time and of the $C$s. The exact form is not important. In principle, this can be solved with a simple RK4 algorithm. How...
I work on an inverse problem for my Ph.D. research, which for simplicity's sake we'll say is determining $\beta$ in $L(\beta)u \equiv -\nabla\cdot(k_0e^\beta\nabla u) = f$ from some observations $u^o$; $k_0$ is a constant and $f$ is known. This is typically formulated as an optimization problem for extremizing $J[u, \l...
I am looking to numerically solve many different integrals where the integrand is simply the indicator function for a region (i.e. 1 on the region, 0 outside. This is for measuring areas). The dimensions range from 1 to 5. What is an efficient quadrature method solving this? It seems like the standard methods which ut...
Assuming that the crosses in the figure below are unknowns in a vertex-centered finite difference scheme in an Adaptive Mesh, how can I calculate the double derivate (Laplacian) at the Red x ? The Red x has only Eastern, Western and Northern neighbours but not a Southern neighbour. Can I take the average of just 3 poin...
It is necessary for me to solve a Poisson equation by adaptive finite element method with transition elements technique to get conforming mesh. For the first local refinement everything is OK, because there is not any transition elements, but after that there are some of them. After the first step, the error must...
So after posting this question and reading all your comments I would like to make this new question (update). If you consider the three equations presented here: $$\frac{\partial \rho}{\partial t} +\frac{\partial (\rho u)}{\partial z}=0$$ $$\frac{\partial C_i}{\partial t} +\frac{\partial (u C_i)}{\partial z}=Reactionra...
I'm used to displacement forumlation of elastic wave equation: $$ \nabla \cdot \sigma (u) + F = \rho \ddot{ u } $$ where $u$ is the primary variable. Recenty I started experimenting with DG and in almost every paper the stress-velocity formulation is used as a "conservative or divergence form". What's special about thi...
We have an elliptic projection $$P: V \rightarrow V_{h}$$ which satisfies $$\Vert u - Pu \Vert_{L^{2}(\Omega_{e})} \leq Ch^{k+1} \enspace .$$ Can we say anything about $\Vert u - Pu \Vert_{L^{2}( \partial \Omega_{e})}$? I know if we have use the Trace theorem we can bound it by $h^{k}$, but I would not like to lose th...
I want to use ADMM to solve a LP defined over a graph. According to Distributed optimization and statistical learning via the alternating direction method of multipliers S. Boyd, N. Parikh, E. Chu, B. Peleato, and J. Eckstein, 2011 the first primal update ($x^{k+1}$) is given by the solution of $$ \begin{bmatrix} ...
When solving fluid flow problems using finite elements you typically end up requiring that $p\in L^2$. For Darcy flow problems, a popular choice of elements is the Raviart-Thomas element and discontinuous pressure elements. For Stokes/Navier-Stokes flow a popular choice of elements is the Taylor-Hood element which ha...
I'm working on a finite volume advection scheme for unstructured meshes which uses a multidimensional polynomial weighted least squares fit for interpolating from cell centres onto faces. In 2D, the advection scheme typically uses a 4x3 stencil of cell values in the domain interior to fit a polynomial that is cubic in ...
Markov Chains can be used to generate, or auto-complete, text. https://en.wikipedia.org/wiki/Markov_chain#Markov_text_generators Training text is read, and some information about the text is remembered, for example: The word "I" is usually followed by the word "have". The word "to" is usually followed by the word "go",...
Recently I work on mechanical shocks (e.g. impact) in FE (fenics). I've already put together simple timesteppers (Euler, Crank-Nicolson). I use higher order basis, so I think of higher order time integration schemes like RK4. Is it worth the effort in mechanics? I can't find any appropriate example of this method in el...
$A$ is a symmetric matrix and is known to be invertible. $X$ is rectangular of size $(N+p) \times N$ with $p > 0$ but full column rank. Can we provide an upper bound on the condition number of $X^{T}AX$ based on this information along with the condition number of $A$ and norm of $X$? Can we use the pseudoinverse of $X...
How does the pseudo inverse of a full column rank matrix change if I rescale a single row? In more detail the problem is the following: We have a fixed matrix $V$ with linear independent columns and lots of matrices $D_i$ of the form $$D_i = \begin{pmatrix} d_i & 0 \\ 0 & E_n \end{pmatrix} $$ where $E_n$ is the iden...
I am using finite elements, Newton Raphson technique and MUMPS direct solver, to solve for $P$ in this equation: $$\frac{\delta K}{\delta x} \frac{\delta P}{\delta x}= \frac{\delta K B}{\delta x} + A$$ $A$ and $B$ are constant parameters. $K$ is a parameter varying over space. $P$ is the solution variable. $K$ is distr...
I have an ordered list of (2d-)points that are forming a (not axis aligned) rectangle and I'd like to recover that rectangle. Approximations like a minimal enclosing rectangle can't be used so that I'm looking for an algorithm that minimizes the least-squares norm or the hausdorff distance. The rectangle can be a squ...
I am facing a problem with MPI (Fortran). I have a really big matrix at each node and they differ at different nodes. At some point of my calculations, each node needs the matrix from all other nodes, so that the MPI communication is between every node. Each node is a sender at the same time it is also a receiver. The ...
A few days ago, I asked how constraints like $A^T A = I$ can be implemented if one wishes to integrate differential equations of the form $\dot{A}=f(A,t)$. Kirill was so kind to point out that a projection step on the Stiefel manifold after one integration step (for example after one Runge Kutta step) is sufficient to ...
For the past several weeks I was attempting to adapt Lax-Wendroff or some similar scheme for polar coordinates. The process was complicated due to me being unable to find step-by-step derivations of used schemes, so i had to guess the process for cartesian coordinates and to repeat the same for polar ones. I managed to...
I have a 2D triangle which deforms with each vertex moving by some small ($\sin(x) \approx \tan(x) \approx x$) displacement vector. The displacement of any point in the triangle is linearly interpolated from the displacements at the vertices. How can I find the rotation angle of any point in the triangle? I want the ro...
I am having trouble indexing correctly the below statement in C inside a function and then returning it as a pointer. The returning part should not be confusing - hopefully - however the indexing is a nuisance. P can be just about any real number greater or equal to 0 and $O_{j-n}^{k-m}$ is supposed to be a pointer to ...
I consider ordinary wave equation $$ u_{tt} - u_{xx} = 0 $$ with initial conditions $$u(x, 0) = \exp (-2 x^2) \\ u_t(x, 0) = 0 $$ To solve this problem I approximate $u_{xx}$ with 4-th order difference scheme and find time evolution with symplectic 4-th order method. I use following parameters: $$x_{min} = -500 \\ x_{...
While reading Boyd's paper on ADMM I encountered an issue. Consider the following problem: Problem. Minimize $f(u) + g(v)$ subject to $Au + Bv = c$, where $f$ and $g$ are closed, proper, convex and differentiable. Denote by $\lambda$ the dual variable. On page 18 of the paper, it is stated that the necessary and suffic...
I have been looking to do a 3D mesh for a shallow tunnel FE analysis. The output of mesh node orientation along the element should be counter clock wise direction. How and which material helps me best as I am a programming beginner?
Assuming I have a length-$n$ real vector $x$ and have already computed its Fourier transform $\hat x$ (in time $O(n\log n)$), I would like to compute the Fourier transform of $y = x + \delta x$, where $\delta x$ is a small perturbation. Does there exist a method for computing the Fourier transform of $y$ in less than $...
I am simulating unsteady flow around a circular cylinder (using FLUENT). I am facing the following problem. Kindly please help me. OBJECTIVE: To find out the Reynolds number at which vortex shedding actually starts during a flow around a circular cylinder. Note: This study is already available in literature. Literatur...
I have a CFD code that I want to run on an HPC cluster. Of course, before it can be run, it first needs to be compiled. What is the best option between compiling on the head node and compiling on one of the compute nodes ? The hardware specifications of head and compute nodes are not necessarily identical, and sometime...
I have a question that relates to the classical "longest common subsequence" problem. I'll give the background to the problem, but you could skip to the formulation below if you like Let's think of genes on a bacterial chromosome as beads on a string - atomic, unique objects, with an ordering. I'm deliberately ignoring...
I know that incompressible and compressible flow solvers are specifically designed to solve different types of problems with different fluid properties/flow conditions. Clearly, among the advantages of using incompressible flow solvers for modeling problems with incompressible fluids is that the energy equation can be...
I am solving one relatively simple problem with two different algorithm: one which uses brute force while the other is optimized. For a variety of reasons I actually cannot show the codes here but I do not think this is of importance. Here is how I am currently comparing the two algorithms (I use Fortran): CALL CPU_TI...
Problem statement: I'm trying to solve a problem statement using C# as programming language. In the problem system for an input (double/decimal) say $H_i$, the output generated is a form of dataset containing number of parameters ($F_i$, $P_i$ and $T_i$). I somehow have to filter out only those entries in the data set ...
In the the Finite Element Method (FEM), we attempt to obtain the Weak Form of the described equation. I understand that this is an attempt to reduce the order regularity of the equation, but what are the actual benefits and disadvantages of using the Weak Form? What does regularity mean in this sense? I've checked out ...
I trying to do a simulation where there are two quantities, $\Delta\theta(x,t) = \theta(x,t) - \theta_{o}$ and $\Delta\nu(x,t) = \nu(x,t) - \nu_{o}$. These quantities are chemical concentrations resultant from reactions. There is no significant convective flow only diffusive flow. The quantities $\Delta\theta $ $\Delt...
In presenting geochemical data, I would like to try a statistical method that presents the data in an ISOCON diagram. This method requires scaling all the data to be the same distance from the origin (i.e., normalizing so that the sums of squares = 1). Result: all data points lie along an arc of a circle centered on th...
What does it mean: to force a line through the origin? I interpret this to be making (forcing) the intercept as (0,0) in the regression procedure of an x-y scatterplot, but am not sure.
I have a model of a system which consists of diffusing reactants and intermediates. For each variable, $u_i$, the final representative equation looks like the standard reaction-diffusion form: $$\frac{\partial}{\partial t}u_i(x,t)=f_i(\bar{u}(x,t))-D\frac{\partial^2}{\partial x^2}u_i(x,t)$$ where $f_i$ is a non-linear ...
I wrote a small simulated annealing library in C++. Right now is just a few classes, a toy project I want to use to test some ideas. But before I move on I want to be sure that it works. Meaning, that if I give it a difficult problem it will work. I won't be fast, or efficient, or whatever. I just want to be sure it wo...
I am solving differential equations that require to invert dense square matrices. This matrix inversion consumes the most of my computation time, so I was wondering if I am using the fastest algorithm available. My current choice is numpy.linalg.inv. From my numerics I see that it scales as $O(n^3)$ where n is the numb...
Let $u_h$ be the finite element solution of a fourth order equation (like biharmonic equation), using polynomial degree two. If the convergence rate of $u_h$ is $2$, what is the convergence rate of the second order derivatives of $u_h$? Is it possible they do not converge?
Background I am a graduate student and a researcher. I do not like to rely on commercial products due to cost and also because I feel more comfortable in using and extending existing tools based on languages such as Java, Python, C#, and R. Right now I want to establish a base line of classic neural networks before I ...
I haven't much experience with conservation laws, shocks, etc. After reformulating my wave equation to 1st order system (velocity-stress): $$ \frac{\partial v}{\partial t} + A \frac{\partial v}{\partial x} + B \frac{\partial v}{\partial y} = 0 $$ where: $v=(v_{x},v_{y},\sigma_{x},\sigma_{y},\sigma_{xy}) \\ A = A(\rho, ...
After running several calculations with numpy, I end with the mean vector and covariance matrix for a state vector. Is there a way with numpy or scipy to sample a random vector around this mean and covariance?
I was wondering if anyone knows about the differences between the large HPC resources available to US researchers. I am currently using a startup allocation (through the NSF GRFP) on XSEDE but was thinking about helping my PI apply for a research allocation. However, I was wondering what the other options are. I have h...
For a system $\mathbf{x=Da}$, there exist a lot of algorithms to estimate sparse vector $\mathbf{a}$. I wish to know the big-O mathematical complexity of 1) orthogonal matching pursuit (OMP) both with fixed sparsity and error tolerance criteria. 2) L1-magic (which is based on interior point methods) algorithms.
I need to implement a structural analysis code, and I turn to you for advice. My needs are simple: Library must be integrable in a C++ code I want to express a weak form, without manual intervention The second point leaves libraries like deal.II out of my scope. I've tried FEniCS, but it is a nightmare to make it wor...
I have a conic section in the real projective plane. This is represented by its real symmetric 3×3 matrix. I verify that the conic section is real and non-degenerate by computing the eigenvalues of the matrix, finding that it's of full rank and indefinite, and follow a different code path if it isn't. The conic coul...
I have two line segments given by their endpoints $(a_1,a_2)$, $(b_1,b_2)$ in $R^3$ and want to know if they have the same length (up to some error), so that the naive test looks like $$|\, \Vert a_1-a_2\Vert- \Vert b_1-b_2\Vert\, | < d_\text{threshold}$$ However, I need to test a large set of segments so I would like ...
I am looking to implement GMSh into a simualtor that I am going to create. I am looking to integrate the geo, mesh, and post processor modules. However, looking online, it appears the documentation for the GMSH function calls are non existent. I was wondering if anyone on the forum has ran into some sort of documentati...
For those familiar with more of these tools than I am, what are the pros and cons of the various tools available? Right now I exclusively use Tecplot for CFD visualization, but it leaves a lot to be desired. The vector graphics are okay, but not great, and it's not clear to me how to have the fonts be correctly generat...
I'm looking to solve a matrix equation and not sure where to start looking for resources. The equation is $$AX + XB = C\,,$$ where $A\in\mathbb{R}^{n\times n}$, $B\in\mathbb{R}^{m\times m}$, $C\in\mathbb{R}^{n\times m}$ and $X\in\mathbb{R}^{n\times m}$. (Alternatively $AX + XA = C$ with $n=m$ would be useful.) I can se...
Given that $R$ is a rectangular matrix, $D$ is a diagonal, square matrix and $S$ being a square matrix along with the fact that both $D$ and $S$ are invertible. $S$ in this specific case can be assumed to be symmetric, positive-definite. $R$ is actually the first few columns of the discrete Fourier Transform matrix. Th...
I am confused. I read an introduction to finite element method where it was derived for the poisson equation: $$-\Delta u + cu = f,\qquad, u = g_0 \text{ on Dirichlet boundaries},\qquad\partial_n u g_1 \text{ on Neumann boundaries}.$$ It introduced the concept of the weak form: Find u such that $u=g_0$ on Dirichlet b...
I am trying to evaluate this integral directly using numerical integration functions in Mathematica and Python. $$ \int_0^\infty {y^{-(n+1)}\prod_{i=1}^n \gamma(a_i+1,b_i y) }dy $$ where $\gamma(a,x)=\int_0^x dt\ t^{a-1}e^{-t}$ is the lower incomplete Gamma function. In my actual problem $n$ can take values from 10 to ...
Our task is to implement a factorization routine that given A in a suitably efficient data structure returns the factors $L$ and $U$ where $L$ is unit lower triangular and $U$ is upper triangular. In order to guarantee that pivoting is not required you may restrict $A$ to be a diagonally dominant matrix. You must also ...
I am a beginner user of R. I am trying to maximize log likelihood function with the bounded parameters. The function is a kind of gamma mixture model which try to capture unobserved heterogeneity across individual. I chose the optim's L-BFGS-B given that the function contains two parameters (i.e., alpha and r) which sh...
Consider a discrete constrained optimization problem: $$ \mathbf{q}_*^h= \arg \min {\cal J}^h(\mathbf{x}^h[\mathbf{q}^h],\mathbf{q}^h) $$ subject to the (weak-form) constraint $$ F^h[\mathbf{x}^h(\mathbf{q}^h),\mathbf{q}^h](\mathbf{w}^h) = 0 \; \forall \, \mathbf{w}^h $$ with $\mathbf{x}^h \in \Omega^h$ (the discrete d...
I'm trying to assemble global matrices for the following system. $$ \begin{bmatrix} K& Q\\ Q^T&S \end{bmatrix} \begin{bmatrix} u_h\\ p_h \end{bmatrix} = \begin{bmatrix} f_u\\ f_p \end{bmatrix}$$ In which, $$ K, Q, Q^T, S $$ are matrix generated from element integral, which I know how to compute. Likewise, $$f_...
I am trying to implement a solver for the Euler/Navier Stokes equations. I have a problem implementing boundary conditions for the wall. I am using an unstructured solver. A lot of literature says that at the wall you simply reflect the normal velocity, and then pose it as a Riemann problem. So let me take the momentu...
My question falls under purview of turbulent flows. I want to add an initial perturbation, for which I have a given energy spectrum (say$ E(k)=ak^4e^{-bk^2} $). The steps involved in getting these perturbation is as follows: Choose random values for $u\in (-1,1)$ Fourier transform: $u(x,y,z)\rightarrow\hat{u}(k)$ Mak...
I want to simulate the electric fields in simple circuits using Python and only free software. My first goal is to reproduce the images given in (1) which are made by the commercial ANSYS Maxwell software. Where to start for such a project? Which libraries are suitable to attack this problem by solving Maxwell's equati...
Specifically, how does one go about writing code that works with, say, both MPICH and OpenMPI? I am currently in the process of cleaning up the build scripts and code for a distributed-memory stochastic mixed-integer linear programming package we aim to release this Spring. One of idiosyncrasies of the code (or rather,...
Suppose I want to numerically solve for $f(x,k)$ the one-dimensional Boltzmann equation for electrons in steady-state condition, given as: \begin{equation} \left( \dfrac{\hbar k}{m} \right) \dfrac{\partial f}{\partial x} + E \dfrac{\partial f}{\partial k} = \dfrac{f-f_0}{\tau} \end{equation} where all other symbols rep...
I am trying to figure out at exactly what dimension it is better to use Strassen algorithm rather than the standard multiplication. I know that there is 18 addition and subtraction in Strassen algorithm but I don't know how I must calculate it. This is a homework so I don't want direct answer without any explanation. A...
To solve the heat equation from implicit scheme subject to Neumann boundary condition we can write: $$ T_i^{j+1}-T_i^{j}=\alpha (T_{i+1}^{j+1}-2T_{i}^{j+1}+T_{i-1}^{j+1}) $$ $$ \textbf{A} T^{n+1} = T^n $$ $$ -\alpha T_{i-1}^{n+1}+(1+2 \alpha)T_i^{n+1}-\alpha T_{i+1}^{n+1} =T_i^n $$ Initial and boundary conditions are ...
I can not undrestand when we have jump on interior boundaries, if the solution be continuous. In the interior boundaries, derivatives have only different unit outward normal vector and this means we can discard all interior derivatives terms. But in some text i see that they are different and the notation of $[\frac {...
I am looking for an algorithm to search a substring in a string. I know there are a number of wellknown Algorithms like Knuth-Morris-Pratt, for instance, and I suppose most preimplemented functions use one of those. However, I remember a lecture, long ago, where the lecturer said that the usefullness of such an algor...