instruction
stringlengths
43
28.1k
I want to triangulate a point-set like the one below. I would like the triangulation of the point-set to have the following properties The triangles must have as vertices the black and orange points The triangles should be nicely shaped (like in Delaunay triangulations) ie not to skinny. I would like to enforce the c...
I am using BVP4C to solve a system of ODEs which is as follows. \begin{equation} \left\{ \begin{aligned} \frac{\partial f(x,y)}{\partial x} &- \frac{d}{ds}\big(\dot{x} f(x,y)\big) = \lambda \ddot{x}(s)\\ \frac{\partial f(x,y)}{\partial y} &- \frac{d}{ds}\big(\dot{y} f(x,y)\big) = \lambda \ddot{y}(s)\\ \end{aligned} \ri...
I am seeking recommendations on how to compute the Binder ratio numerically accurate when doing Monte Carlo simulation on spin models. Binder ratio is defined as: $$ B = \frac{\langle M^4\rangle}{\langle M^2\rangle^2}. $$ Given a safe method to compute $M$ per metropolis sweep, one can get directly $M^2$ and $M^4$. If ...
Parallel computing allow us to compute tasks in parallel. And if there was a system like torrent that unlike sharing files, it share computing power? For example I have a gpu and I use only 25% of its power, so the remaing 75% is used for compute tasks of others computers. Sorry for my poor english
If I have already accurately known the eigenvalue spectrum (i.e. all eigenvalues) of a matrix, is there any efficient numerical algorithm to compute all the eigenvectors corresponding to these eigenvalues? I guess with the information about eigenvalues, there should be some quicker way to compute eigenvectors of the m...
I am reading Algorithm Design Manual by Skiena, which says in Chapter 8, Section 8.1.4 when talking about the calculation of binomial coefficients: Intermediate calculations can easily cause arithmetic overflow, even when the final coefficient fits comfortably within an integer. I can’t think of a reason why. Should...
I am trying to implement Nesterov's first method to solve convex piece-wise linear optimization problem, from this website: https://blogs.princeton.edu/imabandit/2013/04/01/acceleratedgradientdescent/ But then, such $\beta$ does not exist convex piece-wise linear function. So I am wondering what shall I put into $\beta...
Say I have a simple elliptic PDE: $$ -\nabla\cdot(K\nabla p) = f \;\;\;\text{in}\;\Omega $$ with the appropriate boundary conditions. I solve for $p$ using a FEM (a discontinuous Galerkin method to be exact). Let's denote this as $p^{DG}$. Now I compute the velocity $\mathbf{u}^{DG} = -K\nabla p^{DG}$. This velocity w...
I am trying to solve an optimization problem $$\begin{align} &\min f(x)\\ &\text{subject to } Ax\leq b\\ &x \in R^{\sim 10000},\ b \in R^{\sim 10000} \end{align}$$ $A$ is somewhat sparse (usually less than 5% populated) and I can efficiently evaluate $f(x)$ and $\nabla f(x)$. The Hessian of $f(x)$ comes at prohibitive ...
Is there any library/toolbox which has implementation of incremental SVD in MATLAB. I have implemented this paper, it is fast but does not work well. I tried this but in this also error propagates fast (within updating 5-10 points error is high).
I noticed something odd today. I have a matrix X that is very skinny (20800 x 200), double precision real numbers, not sparse, and I want the SVD of it quickly. Matlab does it rather fast: > tic; [U,S,V] = svd(X,'econ'); toc Elapsed time is 0.280848 seconds. But if I ask for the SVD of its transpose, which is an extre...
At the moment I consider the following problem. I have a huge dense banded matrix $A$ which I want to factorize and use to solve linear systems $Ax=b$. $b$ has around more than 100 columns. At the moment I use DGBTRF from LAPACK to factorize $A$. This routine is a level-3 BLAS accelerated one which works fast and effic...
I have some non-hermitian matrix $A$, that I have the left and right eigenvectors. (Calculated using SLEPc, by finding the eigenvectors of $A$ and $A^H$). I'm not sure how to orthogonalize them however. I know that they must obey the relation: $$L^HR = 1$$ But I'm not sure how to enforce this. The normalization of ...
I am setting up to solve a 2D Poisson equation $\nabla^2u = T$ by the finite difference method. I am using the multigrid method. On the coarsest mesh, where the grid size is 2x2, I want to set up boundary conditions so that the right hand side, $T$, is constant. I do not want a Dirichlet boundary condition, where $u$ i...
This paper says centroid decomposition (CD) is an approximation to singular value decomposition (SVD). First I do not understand CD yet, since code is available I just want to try it out how it works but I cannot figure out how to use it, it looks preety much different than SVD. Given a CD how do I get left/right singu...
I am working in my graduating project about the hypersonic flow, particularly the properties of the air behind a strong shock wave, I try to do a simulation for that process in Fluent but I don't know exactly if that it's possible in Fluent. Anyone who have an idea how to do that?
If one has to simulate oscillating plate/solid wall ( sinusoidal function of time) in a domain (a simple piston movement in 'y' direction), the obvious way would be scenario 1. For brevity, assume there is no topological changes involved. Scenario 1: To use dynamic mesh and move the mesh points via the prescribed equat...
A bit of a simple question here. Recently, I was evaluating some line integrals using a Gaussian quadrature rule on $[-1,1]$ where the abscissae $x_{i}$ are just the roots of the Legendre polynomial $P_{n}(x)$ and the weights are $$ w_{i} = \frac{-2}{(1-x_{i}^{2})[P_{n}^{'}(x_{i})]^{2}} $$ Embarrassingly, I just spent ...
In the method of weighted residual applied to boundary value problems, is it necessary for the basis function to satisfy all of the boundary conditions? Will it work even if it does not satisfy all of the boundary conditions?
i am studying the solver for PageRank problems which drived from the web link graph. I have tried using METIS to divided the matrix into subdomains, but METIS can only produce subdomains with nearly equal size. For the web link graph, it usually has blocks with different sizes because the domain or host of pages has di...
Out of curiosity, I was recently trying to search what skills are required to be successful as developer in scientific computing field (e.g. CFD or similar). And to do so, I was going to through various job postings to understand what industries look for in candidates. Most basic requirements are strong programming sk...
If I were to solve a relatively small problem, that is, a problem that can be handled by a direct method like LU, then does the condition number of the linear operator affect the accuracy of the solution? One of the research problems I am working on focuses on the development of optimization techniques to solve linear ...
04/06/15 After more research I found a candidate algorithm but it seems to be incomplete. I have also reworked the spider chart to number all of the boxes using an x,y ((origin = 1,1) lower left) coordinate method. The following sample spider chart shows attribute values of A=80 (19,19) B=30 (14,8) C=40 (7,7) and D=70 ...
The description: I have a number of similar piecewise functions, where $d$ is the translation distance lets assume this is the function (where a and b are known constants): $$f(x-d) = \left\{ \begin{array}{l} a-b(x-d) & \text{if } 0 \le x-d < \frac{a}{b}\\ a+b(x-d) & \text{if } -\frac{a}{b} < x-d < 0 \end{array} \right...
After wasting 3 days with scalapack, I gave up and moved to Armadillo, considering it uses lapack underneath its beatiful and easy interface. I would like to calculate the eigen values and eigen vectors of a non-sparse Hermitian matrix. This is very easily done with Armadillo with like 4 lines of code with the function...
I have a scatter plot where I need to shade the Ramachandran allowed regions for aminoacids. I know there is a function that plots them for you, but it is not helpful for my case since I need the regions in my plot and this function opens a new figure.
Consider points $(x,y)$ in a domain $\mathcal{D}$ that is bounded above by a curve $C$ that is multivalued (i.e. I have points defining it that are of the form $(x_n,y_n)$, $n=1,2,..,N$), and looks like, for instance the figure shown below. The remaining parts of the boundary $\partial \mathcal{D}$ occur at $x=0, x=L...
A sixth order backward differentiation formula (BDF) need six (five plus initial value) previous solutions to get started. How I can get these previous solutions? I need a method accurate to sixth order capable of handling stiff problems.
I'm trying to find the "looped" route with the lowest value of D/n, where D=Distance, and n=Number_of_points, for a cloud of 3D points. However there are a few conditions. Conditions: Each point must have one or more points in the route that are greater than $X$ distance away. Not every point needs to be passed through...
I need to solve an optimization problem with two nonlinear equality constraints. My function evaluation is very fast (less than a second) and I also provide fmincon with the gradients of my objective and constraint functions. However, when fmincon is slow when there are about 2000 variables, and it is very slow when th...
What is the most computationally efficient way to find the layer on which a ball (i) belongs when arranged in a tetrahedron or 3 dimensional triangle with a triangular base. The ball on the top layer is numbered one. The balls on the second layer are numbered 2 - 4. The third layer 5-10 and so on.
I am using 8 ODEs in Matlab to simulate the effect of asymptomatic infections in the epidemiology of a vector borne disease. Searching the parameter space under certain settings produces negative numbers for the human population and the following warning in the command consol: "Warning: Failure at t=3.562559e+03. Unabl...
I managed to solved a lid-driven cavity flow using LB code. It gave me the velocity field data points. Now I have to obtain streamlines too, of course from the obtained velocity field. Besides, I know the theory of Potential Flow as well as all of the associated relations. How can I directly draw the streamlines of thi...
I am interested in solving the following PDE (heat equation): $$\frac{\partial u}{\partial t} = \kappa \frac{\partial ^2 u}{\partial x^2}$$ In order to solve it, I discretize space uniformly into $N$ segments and convert the PDE into $N+1$ ODEs: $$ \frac{du_k}{dt} = \kappa\frac{u_{k+1} + u_{k-1} - 2u_k}{(\Delta x)^2} \...
I need to describe the optical aberrations of my set-up with Zernike polynomials. To do this, I want to fit the first 15 polynomials in the following way on my data: $$\chi^2 = \sum_k\left(\beta_k^x - \sum_{n=2}^M C_n\frac{\partial P_n}{\partial x}\right)^2 + \sum_k\left(\beta_k^y - \sum_{n=2}^M C_n\frac{\partial P_n}{...
Update 4 I have almost given up on getting this right. This is the solution to the time-independent Schrodinger's equation, so the analytical solution is: $\psi(x,t) = \psi(x,0)e^{\frac{-iE t}{\hbar}}$. That means $|\psi(x,t)|^2 = |\psi(x,0)|^2$ for all t. However, I cannot make that work numerically, and I do not know...
I am looking for explanations of algorithms to adaptively sample a function of two variables $f(x,y)$, in a given domain $x_0\le x \le x_1$, $y_0\le y \le y_1$. Intuitively, I want to sample more densely regions were $f(x,y)$ has more variation. I know almost nothing a priori about the function, except that inside the ...
I have a Cartesian grid (100x100) in which some of the points are known (30 out of 10,000) and the rest are unknown. I want to use the known points and estimate the other cells. Is there any philosophies behind the way that I must use the known points to estimate the unknown cells? In other words, does it matter that w...
I need to integrate the following integral: \begin{align} I = \int^z\frac{1-\zeta^2}{(1+\zeta^2)(\zeta-\zeta_l)(1-\zeta_l\zeta)}\prod_{k=2}^{n-1}\left ( \frac{\zeta-z_k}{1-\zeta z_k} \right )^{-\beta_k} d\zeta \end{align} along any complex path within the upper half of the unit circle in the argand plane, where $z_k$, ...
I'm using VEGAS integration, specifically the GSL implementation, for some QCD calculations, and I've been investigating the behavior of the algorithm for various numbers of iterations in an attempt to get more accurate results. The value produced by the integration routine changes rather drastically with the number of...
I need to permute the degrees of freedom of a system and apply this permutation to a few sparse matrices in CCS (or CRS) format. I could construct a permutation matrix and perform sparse matrix-matrix multiplies, but that seems like overkill. Are there standard algorithms for permuting sparse matrices? How do users of ...
There are examples for fast numerical inversion of the Laplace transforms. For example here: http://www.mathworks.com/matlabcentral/fileexchange/32824-numerical-inversion-of-laplace-transforms-in-matlab My question is: are there implementations of Fast Laplace transform? For example if one takes and array of values $[a...
I am investigating stability and convergence of series of approximations for coupled thermoelasticity problem yielded by one-step recurrent time-integration scheme. I've managed to show that the one-step time integration scheme ( OSTIS ) is stable and convergent when the gradient of thermal field is positive (energy of...
I have a FE model of a simple plate with hole (tension load) with HEX20 mesh. I need to obtain the Shape Function of one of the elements (the one with highest stress) and plot it (with MATLAB). After that I will find the Stress Gradient. My question is: how can I get the values of the stress between the 3 nodes on one ...
I have three 32 bit integers a,b,c. I want to make 10th bit of a=(23 rd bit of b) xor (4th bit of c) without disturbing other bits of a. How can I do this in C programming language? a can be zero also. In that case I consider a= 00...0, 32 zeros.
In FEM literature, semi-variational methods are typically used in the solution of time-dependent PDEs. I have not seen a fully-variational approach i.e. where space and time are discretised by FEM, perhaps allowing the use of unstructured space-time meshes. Although timestepping methods may be easier to implement, is t...
The Fast Marching Method, Fast Iterative Method, and Fast Sweeping Method are three ways of solving the Eikonal Equation on a discrete grid, essentially just a wavefront spreading out from initial points, e.g.: The idea is that we want to compute the time $T(x, y)$ at which a wavefront, moving across a field with a ve...
I would like to know more on choosing hardware to get the maximum price/performance when using the PETSc library (and various third-party preconditionners) I am currently working on a 2 cpu (2*E5-2640) workstation with a total of 24 logical cores. But my system is bounded by RAM banwidth such that I don't get any speed...
This is an incredibly mundane integration, but for some reason I can't spot the error. I am just performing a simple 3d integration in spherical coordinates which should return the value of 1.0: Nr = N; Nt = round(pi*N); Np = round(2*pi*N); rs = linspace(R0, Rf, Nr); ts = linspace(0, pi, Nt); ps = linspace(0, 2*pi, Np...
For a given discontinuous galerkin (DG) implementation for Navier-Stokes, targeting 10,000 to 1,000,000 4th order cells in 3D, I'm using PETSc's suite of linear/non-linear solvers on the back-end. It seems to me that there are two broad methods of implicitly solving the discretization. One can explicitly form the Jacob...
Consider a thin film with a perpendicular applied magnetic field $H_a$ in $z$-axis. The nonlocal relation between $H_a$, the self-field $H_\text{self}$ (generated by the eddy current $J$) and the local magnetic flux density $B_z$ is given by : $$B_z = \mu(H_\text{self} + H_a)\quad (1)\\ H_\text{self} = \frac{1}{4\pi} \...
Consider a function $X(\xi,\nu)$, $2\pi$ periodic in $\xi$ satisfying $$\nabla^2 X = 0$$ in a domain $D$ with $\nabla = (\partial_{\xi},\partial_{\nu})$. If I know the values of $X$ on the boundary $\partial D$, what is the simplest (in a numerical sense) way of finding $X$ in the interior? Here, $\partial D$ is a co...
$$ \frac{\partial|\nabla\phi|^2}{\partial\phi}=-2\nabla\cdot\nabla\phi$$ I would very appreciate that you help me . Please do it in detail, I am quite not good at such problems. There is something wrong with this equation, and it is the primary condition below : $$F = \int\limits_\Omega (f_\text{gr} + f_\text{loc} + f_...
I have a nicely working multigrid solver, which I use for solving the Poisson equation from an electrostatic problem. I solve this equation first without any charges, and then many times with a slowly changing charge distribution. Right now, I do a FMG from scratch each time I solve this equation, ignoring the fact tha...
Is there an iterative sparse parallel linear equation solver with out-of-core capabilities? I need to solve a very large system of equations. I have implemented direct sparse parallel solvers in-core and out-of-core and now I have to try an iterative one. I mainly use FORTRAN for the implementation.
Let's say we have an unorganized point cloud P1 with N points, each with coordinates {x,y,z}. We apply non-rigid transformation to P1 (translation + rotation + warping), to obtain point cloud P2. Given a pair of corresponding points in P1 and P2, how can we efficiently estimate the change in local point density around ...
I'm aware of a Matlab function which take a set of point as an input and select the points which compose the convex hull. Exemples from Mathworks website : xx = -1:.05:1; yy = abs(sqrt(xx)); [x,y] = pol2cart(xx,yy); k = convhull(x,y); plot(x(k),y(k),'r-',x,y,'b*') Now, my question is : does there exists a Matlab funct...
This is a follow-up question to an answer I read here. $M$ is some hermitian matrix and $V$ an vector. Since the matrix is hermitian, you could use it as a hamiltonian to propagate it in imaginary time. That is, solve the following system of differential equations: $$ i\frac{d \vec{V}}{dt}=M\vec{V}$$ The general solut...
I would like to know the algorithm to calculate contour line length. Suppose we have numerical data set of an function $f(x,y)$. How could I calculate the length of the line from $(x_1,y_1)$ to $(x_2,y_2)$ on the contour $f = f_0$? I am working on this with Fortran, but the example with any other language will be OK.
There are so many Runge-Kutta methods, including Dormand-Prince 45, Cash-Karp 54, Fehlberge 78. Is there any comparison between them? E.g. What is each approach sacrificing? What is the general trade-off in different RK methods? Which approach is suitable for what model? How does Cash-Karp Method perform when we ha...
I want to solve a 1-D heat conduction PDE using Matlab which looks like $$ \rho c_p \dfrac{\partial T}{\partial t} = \dfrac{\partial}{\partial z}\left( \lambda \dfrac{\partial T}{\partial z} \right), $$ where the initial condition is T1 (in Kelvin) and the final condition is T2 (also in Kelvin), the difference being T...
I have developed a pseudospectral solver of the Navier-Stokes equations using FFTW. I tested my formulation of right hand sides (RHS) of the NS equations against standard trigonometric functions (sines, cosines and their combinations). For example, I set density = sin 5x x_velocity = 5cos 5y + 6sin7z y_velocity = 4sin...
With the advent of "big data" applications, different algorithms have to be used to efficiently solve optimization problems, even in the convex case (e.g. the recent success of stochastic gradient descent). Now I was wondering what happens in cases where you have hard MILP instances with millions ($10^6$-$10^9$) of va...
Which method should I choose to solve a large (~20 000 variables) dense symmetric positive-definite, possibly ill-conditioned, system of linear equations? The system will be solved for two vectors. I'm interested both in performance and numerical accuracy, so I'm looking for possible solutions to choose the best compro...
Suppose we have a triangular mesh of a two dimensional shape $\Omega$, and on this mesh we define a P1 finite element structure. I know that given $u,v$ by their values at the vertices of the triangles, we can compute $\int_\Omega \nabla u \cdot \nabla v$ using the stiffness matrix $A = (\int_\Omega \nabla \varphi_i\cd...
I have data which can be described by $y=f(x,z)$ where $z$ varies from 170 ~ 154. Now values given by $ks$ are known sample values that equals value given in the table header, $uks$ are unknown samples. $$ \begin{array} & z & x_{ks_{1}=0} & x_{ks_{2}=50} & x_{ks_{3} = 60} & \cdots & x_{uks_{1}}& \cdots & x_{uks_{n}}\ne...
Suppose a cuboid $\mathbb{A}$ has $L$,$M$ and $N$ as its length, width and height respectively, where $L\ge{M}\ge{N}>0$; Now we want to cut $\mathbb{A}$ into smaller cuboids with length $x$, width $y$ and height $z$ respectively, where $x\ge{y}\ge{z}>0$, $L\ge x$, $M\ge{y}$ and $N\ge{z}$. How to design an algorithm to ...
I am trying to solve simple scalar biharmonic equation using bubnov-galerkin finite element method. I am using $H^2$ conforming basis functions. I was wondering that if anyone can give me some pointers on how can I further debug my algorithm. I proceeded by converting the strong form of equation to weak form: \begin{al...
What methods are available to integrate a sharply peaked function (position of peak known) on a finite interval (the interval includes the peak)? Currently I am getting underflows using some of GSL's adaptive algorithms. I suspect that GSL fails to find the position of the peak, and hence is thinks that the function is...
I have an isoparametric mapping $F_{E}: \hat{E} \to E$ where $\hat{E}$ is a reference quadrilateral (square) and $E$ is some quadrilateral in the domain $\Omega$. If $E$ is a parallelogram, then the mapping is affine and computing $F_{E}^{-1}$ is straightforward. But for the general case, we have: $$ F_{E}(\hat{x},\hat...
Is there an efficient way to perform an incomplete Cholesky factorization on a symmetric positive definite sparse matrix (CSR format), in order to use it as a preconditioner for a CG solver? Is there a FORTRAN subroutine that performs such an factorization in parallel?
here is a Matlab beginner banging his head on the wall... I am trying to solve a system of partial differential equations in Matlab, with both derivatives in time and space domains. I am using the pdepe function for that. The system is, to be simple, a sort of solar thermal panel, made of three layers: an absorber plat...
Is the following a standards-conformant MPI-3 C program? #include <mpi.h> int main(int argc, char** argv) { int dlocalouter=1, dglobalouter=0, dlocalinner=1, dglobalinner=0; MPI_Request router, rinner; MPI_Init(&argc,&argv); MPI_Iallreduce(&dlocalouter,&dglobalouter,1,MPI_INT,MPI_SUM,MPI_COMM_WORLD,&router); ...
Is anybody here using kriging for surface interpolation from huge datasets (> 1 million points)? How large datasets are your datasets and what do you model? Also what software are you using?
Background For a study that is beyond the scope of this question, I applied all of GSL’s adaptive Runge–Kutta methods to a certain problem. This includes a Runge–Kutta method of 2nd and 3rd order, denoted as gsl_odeiv2_step_rk2. It is arguably a rather bad method, but this makes the method particularly intersting for m...
I try to solve the problem $Ax=B$ where $A$ is a large sparse $n\times n$ matrix, and $B$ is a dense $n\times m$ matrix (here $n=754850$ and $m=182$). The backslash operator yields correct solution (x = A\B), but most of the computational time is done on one thread (the initial step of the process is nicely executed in...
I have to minimize a nonlinear objective function $f(x_0, x_1, x_2, x_3, x_4, x_5)$ with 6 variables. The constraints governing these these variables are a mix of nonlinear inequality constraints, and some combinatorial constraints. For the nonlinear inequality constraints and the objective function, I can evaluate th...
I'm working with Computational Neuroscience. I have a large Synaptic Matrix (x axis: presynaptic NeuronID, y axis: postsynaptic NeuronID) in a Modular network. This matrix is close to a random one and Girko's circular law applies partly, in the sense that the bulk of the eigenvalues lies in a circle when you plot their...
I am trying to solve a 2D wave equation implicitly using FD with central approximations with the following boundary conditions $$\begin{align} &u=2\sin\left(\frac{2\pi}{5}t\right)\quad \text{at }x=0\\ &\frac{\partial u}{\partial y}=0 \quad \text{at }y=0\\ &\frac{\partial u}{\partial y}=0 \quad \text{at }y=2\\ &\frac{\...
So I'm constructing a Gibbs sampler for a moderately sized graphical model, and I started encountering underflow errors (the computed relative frequencies were all very small). To get around this, I've started using the LOG-SUM-EXP-LOG trick found here: https://math.stackexchange.com/questions/648514/preventing-underf...
I'm a chemical engineering undergraduate and I'm currently starting to work in a theoretical transport phenomena/colloid science group. While my group has a nice code base for larger scale simulations (by this I mean Monte Carlo/Molecular Dynamics/Brownian Dynamics type methods) it seems that when it comes to smaller ...
I have the following problem. I have two sequences of elements $A = [a_1,a_2,\cdots,a_n]$ and $B = [b_1,b_2,\cdots,b_m]$. I can build a matrix $D[n \times m]$ where $d_{ij} = d(a_i,b_j)$ My greedy merging algorithm works as follows: For each iteration it takes the shortest distance pair and merges them. Then all the d...
I have a model of a tall, slender structure that I am investigating using both shell and $3D$ frame elements. The shell elements are type MITC4, $4$-node membrane elements. The frame elements are the basic line ($1D$) elements found in any introductory structural analysis / stiffness method book - they include axial...
What are theoretical hurdles in applying Galerikin method on, say, first order time dependent ODE? Is there no way we can form an inner product??
I want to compute the value of an integral of a function. This function, however, is not given by a formula, say $f(x) \: \forall x \in [0,1]$, but is only known through its values on some given points, say $f \left(\frac{k}{n} \right) \: \forall k \in \{0,\cdots,n\}$. (is the name for that scattered data ?) How should...
I do understand the meanning of "conservative discretization" within the FVM/FDM framework, indeed it is well explained in this post. Now, according to the table in this slide (pp.8), it concludes: FEM suffers from "Stability for conservation laws", while Discontinuous Galerkin (DG) is just fine I interpret this stat...
I'm trying to implement nonzero Displacement Boundary Conditions in VegaFEM on a non-linear model, using the method outlined in §3.6.2 of University of Colorado's intro to FEM (modify $f = Ku$: set desired displacements in $u$ and eliminate rows and columns in $K$ by calculating forces and applying to $f$). However it'...
Is it better matplotlib interactive mode or matplotlib animation in terms of performance? I have a continous flow of data coming from the serial port. I get 2 measures let's say var1 and var2. I need to plot them in a 3d plot adding the 3th dimension, the time. I've tried different approches based on ion, but i couldn...
This is something I've been trying to figure out for a long time, and all I have is vague numerical results. I'm trying to answer the following question analytically: Suppose I have a time dependent system: $u_t = L(x, u, u_x, u_{xx}) , u(t=0,x) = u_0 $ I approximate differences with some finite difference scheme, for ...
I am currently working on 2D interpolation and I am using cubic splines. In 1D given N points one would use N+2 splines and would have to apply additional constraints in order to achieve a square system. For example requiring that the interpolant, S, second derivative is equal to zero ,Sxx = 0, at the end points (Natu...
I want to solve $$\min_x f(x)\qquad \textrm{s.t.}\qquad g_i(x) \geq 0\ \ \textrm{or}\ \ h_i(x) \geq 0$$ for $i=1,\ldots,m$. Clearly if the inequality constraints split the feasible set into $2^m$ disconnected components, there is no hope for an efficient numerical solution. But in my case I know there is only one feasi...
Cross posted in Mathematica.SE, I'll try to rephrase it in a more general way here. A friend of mine showed me this initial value problem (IVP) for a linear ordinary differential equation (ODE) with variable coefficient: $$y''(x)=\left(x^2-1\right) y(x)$$$$y(0)=1$$$$y'(0)=0$$ Seems to be a simple one, right? Actually i...
When I run the following (in Matlab) on a sparse matrix $A$, I get larger band width. The symrcm (symmetric reverse Cuthill-McKee permutation) is not guarenteed to find the smallest band width, but it makes no sense for it to increase. What is wrong here? reorderingForSmallBand = symrcm(A); A = A(reorderingForSmallBand...
This question is based more on the theory of neural networks than my particular implementation. Therefore I will leave out my code unless requested. I'm working on a project in C# which can create and train feed forward neural networks. It works well and can train networks to perform some simple functions such as squar...
I am trying to write a 2D Navier Stokes solver using an RK3 for time advancement in python. For debugging, I have converted the RK3 to an Euler step for simplicity. Checking my divergence for my predictor velocity I find that the divergence is acceptably close to zero. I then go to my pressure solver and the solution i...
I'm working with the Boundary Element Method and want to integrate an expression over a triangular region. I would like to use Gauss Integration to do this, but I'm having trouble since the triangular element is zero order(1 degree lower than a constant stress triangle). Unlike the higher order elements, the zero order...
Consider two functions $$X=\sum_{n=-N}^N i\ sign(n) y_n e^{-in\xi}; \quad \quad Y = \sum_{n=-N}^N y_n e^{-in\xi}.$$ where $y_n$ are the dependent variables of the system, and are functions of time. sign(n) is $1,0,-1$ for n positive, 0 and negative respectively. Based on the physics of my system, I find that the Lag...
I am facing a problem solving a mechanical system which is shown in the scheme below. We assume that coupling of the two shafts is done with a clutch Equations: $$J1*\frac{d\omega1}{dt} + Td(\omega12) + Ts(\phi12) = T_1$$ $$ J2*\frac{d\omega2}{dt} - Td(\omega12) - Ts(\phi12) = T_2$$ where $$w1 = \frac{d\phi_1}{dt}...
I want a numerical method to evaluate: $$\log \int_a ^b f(x) \mathrm{d}x$$ when what I have is a numerical routine to evaluate $\log f(x)$. The problem is that if $f(x)$ takes very large or very small values, direct evaluation of $f(x)$ will lead to overflows/underflows. I am wondering if anyone has approached this num...
The equations of motion for an elastic solid are given by $$\begin{align} &\nabla \cdot \boldsymbol{\sigma} + \mathbf{f} = \rho \ddot{\mathbf{u}}\\ &\boldsymbol{\sigma} = \mathbb{C}\boldsymbol{\varepsilon}\\ &\boldsymbol{\varepsilon} = \frac{1}{2}\left(\nabla \mathbf{u} + [\nabla\mathbf{u}]^T\right) \end{align}$$ or in...