instruction
stringlengths
43
28.1k
Lets say I've decomposed a continuous function $y(x)$ over some domain $L_x$ using known finite element method with local basis $Q_i(x)$. Suppose $L$ is divided into $M$ "elements". If I want to know the function $y(x)$ at a point $x=p$ (where $p$ is not at a nodal value) then I will need to first know which element $p...
I encounter an optimization problem. The simplified version is like following: Denote function $F(x):\mathbf{R}^n\rightarrow\mathbf{R}$, where $F(x)$ is a smooth lower bounded convex function (i.e. $F(x)>0$). The hessian matrix of $F(x)$ is positive definite. However $F(x)$ is not a strongly convex function, namely we ...
I am currently working on an iterative closest point algorithm (in C++, see here). I understand the basic premise of an ICP algorithm. You have two point clouds (a target and a reference) and you want to register the reference into the target. You do this by: Associate Pairs of Points (k-d tree or something similar) F...
I am interested in fixed-step simulation of an ODE. The methods I know of are either variable-step with prescribed error tolerance or fixed-step without error control. Are there methods known which work on a fixed time grid (for inputs and outputs) AND allow the specification of an error tolerance? The solution for th...
I am given a $n \times n$ matrix $A$ with real entries and define the inner product $$\langle x,y\rangle = x^T A y.$$ I am also given an integer $k$ and need to find all binary vectors $x$ such that $\langle x,x \rangle = k.$ By binary vector I mean a vector whose entries are in $\{0,1\}.$ For $n$ small it is not hard...
I'm trying to solve a 1D Poisson equation with pure Neumann boundary conditions. I've found many discussions of this problem, e.g. 1) Poisson equation with Neumann boundary conditions 2) Writing the Poisson equation finite-difference matrix with Neumann boundary conditions 3) Discrete Poisson Equation with Pure Neumann...
I was taught in my freshman college computer programming course that using global variables is almost always a bad idea. However, I have found that when designing Fortran programs for very complex simulations, such a practice seems to make things easier; for instance, I never have to worry about passing variables to va...
I know that for a dependent-mesh norm Nitsche' method for boundary conditions is coercive. But how to prove this for the usual norms for $H^1$?
I am looking for a reliable library where I can find polylogarithm function and newton/secant method for solving non-linear equations. Basically I have something like this: f(x) = x - A*PolyLog(3/2, B*Exp(-t*x)) f(x) = 0 and f(x,y,z) = 0 g(x,y,z) = 0 h(x,y,z) = 0 involving polylogarithm function. Implementation of P...
I work with scientific simulation, but what I like the most in programming is creating graphical user interfaces and 2D or 3D outputs to visualize the evolution of the simulations. I know most input data in scientific simulation are in text files, not in GUIs, and that more usually statistical graphs are scientifically...
I'm currently working on cubic splines interpolation. My question has to do with the end conditions. Instead of using natural or clamped cubic splines, I am asked to use the following condition : $S_{1} = S_{2} $ and $S_{n} = S_{n-1} $ but I am not pretty sure how this is applied. Could anyone help me clear this out? ...
Say I have a random number generator that generates a number within [0, RAND_MAX], and RAND_MAX < UINT_MAX. How do I generate a random number within [0, i] such that i>RAND_MAX and i<UINT_MAX, while maintaining an even distribution, and without exceeding UINT_MAX in any calculations? The first attempt is to split the r...
I'm working in a finite element code where I need to calculate $$\int_F b_F$$ where $F$ is a face of some tetrahedron $K$ in the mesh, and $b_F$ is the usual bubble function defined by $$b_F=9\lambda_1\lambda_2\lambda_3$$ where $\lambda_i$ are the usual barycentric coordinates. Note that $\textrm{supp}(b_F)=K_+\cup K_-...
I'm using power iteration to find the dominant right eigenvector of some large-ish matrices ($1000\times 1000$ to $10000\times 10000$ or so, maybe I'll need to go bigger later) with non-negative elements. I need to know both the left and right eigenvectors corresponding to the largest eigenvalue. Obviously I can find t...
I am running molecular dynamics simulations of water for testing purposes. The box is quite small, if you ask a guy running classical MD, and relatively large, if you ask a DFT guy: I have 58 water molecules in periodic boundary conditions. To save CPU time, I am optimizing my cell with a classical force field before r...
When simulation atoms, molecules, colloids, autc., are there programs that define each interacting unity as an object in the OOP sense? In my own case, I've been simulating magnetic nanoparticles in colloidal dispersion in Fortran, but I have many arrays that are unrelated in the code for each attribute of the nanopart...
As you may know, Fortran is widely and longly (?) used in science. I've heard a lot of people saying that we natural scientists should all migrate to C++ or Java. I've seen people increasingly suggesting also Python, that I thought it was basically a script language like Bash, but which supports floating-point number o...
I know that it is possible to determine the theoretical order of accuracy (B) of numerical solutions in FVM (for instance for a steady problem in which only the central differencing scheme (CDS) is used to interpolate, B = 2 since CDS is 2nd order accurate). I know that with FVM the order of accuracy is obtained from ...
I need to devise a algorithm (in Python) that calculates adjacency matrices for the platonic solids. Inputted into the algorythm needs to be the number of polygons meeting at each vertex and the regular polygon on which they are based. Any ideas are welcome as I've tried a few avenues and haven't come up with anything ...
Are there any frameworks that could be classified as "general computational fluid dynamics framework"? What I'm thinking of is a framework that's modular and extensible in order to allow the development of new algorithms pretty much unlimitedly. And scaleability over different computer configurations (laptop - HPC). Do...
Note: this is a continuation of Generate Random Number outside Bounds. I have a function (thanks to the previous question) with the following prototype which returns an integer in the range $[0,b]$, $b \le UINT\_MAX$: unsigned int randrange(unsigned int b) Now I want to create a function which returns an integer in th...
The Weierstrass approximation theorem says any continuous function $f(x): [0,1] \to \mathbb{R}$ can be approximated uniformly by polynomials. Given any $\epsilon$, we can find $p(x) = x^n + \dots $ such that: $$ |f(x) - p(x)| < \epsilon $$ is always true. In practice how to do we find $p$? Let's say $f(x)$ was the s...
Are there any known issues (such as precision issues) with $\mathsf{MATLAB}$ eig and charpoly functions for large enough $\{-1,0,+1\}$ matrices? Even if I change $1$ or $2$ entries between matrices would it be able to find the accurate eigenvalues and characteristic polynomials? I am using size less $40\times40$. My ma...
I'm reading a technical report on Simulated Annealing: On the Convergence Time of Simulated Annealing, by Sanguthevar Rajasekaran. You may find it following this link. Given $G=(V, E)$ is the graph whose vertices are possible solutions to the given problem, and $E$ is the set of edges between the neighbours, the goal i...
I'm trying to solve this problem: $\begin{cases} \partial_t E=-k\left([f(\rho)-i.\left[\delta+\frac{1}{2}a\left[\dfrac{\nabla^2_{\bot}}{4}+1-\rho^2\right]\right]]E - 2CP\right)\\ \partial_t P=-\gamma_{\bot}[(1+i\delta)P + ED]\\ \partial_t D=-\gamma_{\parallel}(D-\chi(\rho)-\frac{1}{2}(E^*P+EP^*)) \end{cases}$ Here $f(\...
I want to solve 3 coupled equations. I converted them to a system of odes in time and discrete it in Length and radius. Now I have a problem in one of the equations in first point. Because in this point I have A second order derivative and when I discretize it I dont have $y$ in second point. This is my equation: $\fra...
As stated in the title I have a raster image (black or white) with no complex or fuzzied components (only horizontal or vertical text, italic or bold are allowed). I need to express that raster image in as cheap a way as possibile using vertor representation (I only have one primitive that can draw a rectangle). My fir...
Given: Several circular series of map GPS coordinates for several bus routes. The GPS coordinates are not all equal when they run along the same road. The number of GPS coordinates for a single bus route runs from 140-600. Problem: When the points are downloaded drawn, the raw routes don't follow each other perfectly a...
I'm developing a solver for solving linear hyperbolic equations of first order with respect to time and spatial derivatives. The formal order of accuracy of the solver must be 5 because I use 5th-order accurate Runge--Kutta method and 5th-order finite-difference WENO for Hamilton--Jacobi equations. To verify my solver,...
I want to solve 7 coupled equations.I use method of line(MOL) and discrete the equation in Length and radius and convert them to a system of ODEs in time.and use ode15s to solve them in MATLAB. But an error occur: Warning: Failure at t=5.422028e-006. Unable to meet integration tolerances without reducing the s...
I am solving the monodimensional diffusion/reaction equation by discretization using the well-known method of lines ${\partial c\over\partial t}=D{\partial^2 c\over\partial x^2}+ r\text{ for t>0 and -L<x<L} \quad[1]$ $c(x,0)=1 \quad[2], \quad \text{ initial condition}$ ${dc\over dx} \mid_{(0,t)} =0\ \text{ for ...
I have a system of seven nonlinear equations that I want to find their symbolic solutions. The solution will depend on the parameter K, and I should have different solutions by varying the parameter. I want the program to give the ranges of K and the solution associated with each value. I tried to solve the system usin...
In the recent question Solving system of 7 nonlinear algebraic equations symbolically, Brian Borchers experimentally confirmed that Maple can solve a polynomial system that Matlab/Mupad cannot handle. I have heard in the past from people working in the field that Maple has a high-quality implementation of Gröbner bases...
I am working on adaptive techniques for solving some elliptic equations. The technique is based on residual on elements. My problem is that when I use a predefined tolerance for refining elements, the number of elements that refined are too much, even for a tolerance around $10^{-2}$. I also, tried refining those eleme...
How can I understand the flow is incompressible or not with this information at 4 edges?
I have code that attempts to implement a solution to the Schrödinger equation where there is a central potential (more or less im thinking of hydrogen), in 1-D using the numerov method to construct the wave function. It does not take care of the states (N=1,..) as my goal is to understand the link between the theory a...
So I am attempting to solve a 3D poisson problem with Discontinuous Galerkin (interior penalty method). The weak form (written in FEniCS) is as following: a = dot(grad(v), grad(u))*dx \ - dot(avg(grad(v)), jump(u, n))*dS \ - dot(jump(v, n), avg(grad(u)))*dS \ + alpha/h_avg*dot(jump(v, n), jump(u, n))*dS \ - d...
Ridge regression can be posed as minimizing the following objective function (over $x$): $$\frac{1}{2} \lVert Ax - b \lVert_2^2 ~+ \frac{\lambda}{2} \lVert x \lVert_2^2 $$ Which has a closed form solution: $$x = (A^TA + \lambda I)^{-1} A^T b $$ Let's say we want to solve this problem for several different values of $b$...
I would like to efficiently and (to the extent possible) reliably find the Perron-Frobenius eigenvector of non-negative matrices. These are not stochastic matrices, they are typically dense, and their entries differ by many orders of magnitude. They are probably usually irreducible, though if you think of the very smal...
I'm trying to compute the Madelung constant of the ZnS lattice. The method is as follows: The lattice is a face-centered-cubic with basis $S^-: (0,0,0)$ and $Zn^+: (1/4,1/4,1/4)$. The Madelung constant is $$\alpha=\sum_j \frac{q_j}{r_j}$$ where $q_j$ is the charge (in this case divided by the number of neighboring bloc...
I want to show convergence of a finite element method for a higher order equation.I have a coupled equations that solved together and gives two variables as answer $[u, v]$. $$w+\Delta u=0$$ $$\Delta w=f$$ for finding the answer $$[u,w]=K^{-1}F,$$ Unfortunately, I am really confused about that and have a lot of quest...
Suppose $A\in\mathbb{R}^{n\times n}$ is a symmetric, positive definite matrix. $A$ is big enough that it's expensive to solve $Ax=b$ directly. Is there an iterative algorithm for finding the smallest eigenvalue of $A$ that doesn't involve inverting $A$ in each iteration? That is, I'd have to use an iterative algorithm...
I am solving the 1D advection problem given by: $$\frac{\partial u}{\partial t}=-c\frac{\partial u}{\partial x}$$ where c is the wave speed, and u is the unknown field variable, and x and t are time and space. I am using central differencing to discretise in space. My initial $u$ profile which is being convected is a s...
Not 100% sure where this question belongs, since I'm not sure if the problem is code related or not. I've written a program to model the solar system. I am now testing its accuracy. I've checked conservation of angular momentum, and it is perfectly conserved, as is energy - I'm using the velocity verlet algorithm. I'v...
I'm trying to solve these equations of hypersonic adiabatic flow over a flat plate. I did all the simplifications and got these equations for the stagnation point flow. $$\left(Cf''\right)' + f f'' = \left(f'\right)^2-g$$ $$\left(\frac{C}{p_r} g'\right) + fg'=0$$ For a calorically perfect gas, $g=h/he$, and $he = \rm s...
The geodesic differential equations are given as \begin{align} \frac{d^2 x^j}{ds^2} + \Gamma^{\phantom{h}j}_{h\phantom{j}k}\frac{dx^h}{ds}\frac{dx^k}{ds} = 0, \end{align} where the $\Gamma^{\phantom{h}j}_{h\phantom{j}k}$ is the Christoffel symbol of second kind. According to T. A. Moore - A general relativity workbook...
The strong form of a PDE requires that the unknown solution belongs in $H^2$. But the weak form requires only that the unknown solution belongs in $H^1$. How do you reconcile this?
I have a discrete 2D temperature field, i. e. a dataset of N points (x, y, T). I would like to compute line integrals at fixed radii, $\int_0^{2\pi}T(r,\theta)d\theta$. My first thought was to transform all coordinates into radial coordinates, and then interpolate to a regular grid in $r,\theta$, so the integral would...
I have two parts, which need to be meshed. One part is located inside another. To simplify the problem, imagine two cubes: one inside another. Geometries are stored in STL files. From CAD point of view, one file contains an internal cube, another contains cube with a hole for an internal cube. All dimensions fits (the...
I am curious as to what the current status is for symbolic computation, and future outlooks as well. Here are some questions I would like to pose : What is the current outlook for symbolic computation ? Will it replace numerical computation in the near future (is that even a possibility) ? Can symbolic computation ou...
I've got several sets of xyz-data where x,y are coordinates and z is a 'value'. I want to be able to do simple arithmetic operations on these data. The x,y locations are not necessarily the same in the different data sets. There must be a library (preferably python) out there so that I don't have to do all the work by...
I have the ODE below $$\frac{d}{dt}\pmatrix{x\\ y} = \pmatrix{0 &1\\-a &0}\pmatrix{x\\ y} \enspace .$$ The $m=1$ leapfrog method is defined as: $$y_{n+1} = y_{n-1} + 2f_nh \enspace .$$ For the $a<0$ state, how do I simply find the condition the solution must satisfy for the method to be successful? Further, how do I en...
What is the difference between the $l^2$ norm and the $L^2$ norm. I can not find a definitive reference. Wikipedia uses them interchangeably.
I need some help in numerically solving the nonlinear Poisson's equation for electrons in frequency domain. The steady-state equation is: \begin{equation} \nabla.(\epsilon\nabla\varphi) = q\left(n_i\exp\left(\dfrac{\varphi-\Phi_n}{V_\text{T}}\right) -N_D\right) \,. \end{equation} In small-signal analysis, we have $\var...
I was wondering if anyone could help with understanding the geometric conservation law for moving domains. I came across Link1, and have tried to understood the paper by Farhat et al Link2. So far my understanding is that the two things to consider are 1) the time step to which the cell areas using for integration of ...
So I'm given a solver that can solve for $x$ in the matrix equation $\underset{=}{A} \underline{x} = \underline{b}$ where $b$ can be anything we specify. (NB: A is an NxN matrix). I now want to find the inverse of matrix A, $\underset{=}{A}^{-1}$, using the solver. How would i go about doing this? My first two ideas we...
On page 18 on this text: http://www.dima.uniroma1.it/users/lsa_adn/MATERIALE/FDheat.pdf , the graph in figure 8 on this page, how would I write a suitable code in matlab or maple that will produce this graph? It's a graph of the different truncation errors of the different finite difference methods (on the last page o...
I have the following function that has been vectorized so that for every element in input array t, an array is output: @np.vectorize def Ham(t): d=np.array([[np.cos(t),np.sqrt(t)],[0,1]],dtype=np.complex128) return d I am getting an error: TypeError: only length-1 arrays can be converted to Python scalars. I b...
I am using the Newton's method to solve $3\times3$ systems. For some particular cases, it turns out that at a given iteration, the Jacobian matrix cannot be inverted and that its determinant is very close to zero (looking at the matrix, there are terms that are around 1e+0 and others that are 1e-15). After investigat...
In my research, one of the steps is to choose a numerical method to estimate $\int_a^b f(t)dt$, where $f$ is Lipschitz continuous but not differentiable. For simplicity, I used midpoint rule but the overall result is not that good. I was thinking whether the problem came from the fact that I didn't select a correct num...
I am dealing with an optimization problem that has a large number of variables to optimize over - for example let's call these variables $x$, $y$, and $z$ and I wish to minimize the function $f(x,y,z)$. The optimization method that I am using is not able to handle optimizing over all the variables at once. I am instead...
I am trying to solve the CDR-Equation in 2D: $$\frac{\partial c(x,y)}{\partial t} + \nabla \cdot ( -d\nabla c(x,y) + \vec{v}(x,y) c(x,y))+ a c(x,y)=0\,,$$ with Boundary Conditions (length of square is $L$): $$c(0,y)=0$$ $$-d\nabla c(L,y) + v(L,y) (c(L,y))=0\,.$$. $$ c(x,y=0)=0$$ $$ c(x,y=L)=0$$ 1.) Why exactly is thi...
I am working on a program that tracks a flying object through space and predicts the future position of said object. I was given some equations to use, but some of them do not look right, mainly the equation I was given for finding slope: slope = (N * sum(t*GCx) - sum(t) * sum(GCx)) / (N * sum(t^2) - sum(t) * sum(t)) ...
Are there any one dimensional hyperbolic test cases for a 1D uniform flow? (I need the test case for the purpose of showing the satisfaction of geometric conservation law on a moving mesh).
My first question, please excuse me if its too basic. I have a matrix of evenly spaced geographical points; say 10 x 10, which I will call seed points. Each seed point has a lat/long and the spacing can vary. Then I place $n$ random points on the same matrix. I call these demand points. What algorithm can I use to calc...
Im doing a computational biology project in which I simulate evolution under different inheritance rulesets and I am generating phylogenetic trees (beautifully visualised in python with ete3, which I recommend and can be found here: http://etetoolkit.org/download/ My question is: Can someone point me in the right direc...
Between these four different meshes for the same shape, compare them whilst considering the different results for displacement and stress. Moreover, the difference in computational cost and accuracy of the meshes.
I am accepted to computational science master program. The master program just started to accept students in our university and today each group of 3 students was assigned to an advisor teacher (we are only 13 students). Our advisor asked us to research for valuable topics in Computational Science, so I thought why don...
I have a rudimentary question about the differences between finite difference (FDM) and finite volume methods (FVM). In FDM we concentrate on the nodes (points) in space while in FVM we concentrate in the volumes enclosed by faces. Correct me if I am wrong here. When the Gauss Divergence theorem is applied on the integ...
I hope this is not a vague question. I would like to know if any researchers and students in this community have used or considered using 3D graphics software (such as Blender) or a game engine to visualise scientific data as opposed to specialist software. I understand there are many limitations to using popular 3D g...
We know that in classical two-phase Stefan problems, let's say in the temperature distribution of ice-water problem here, the governing PDEs are: \begin{equation} \left. \begin{aligned} C_1\frac{\partial T_1}{\partial t}=\nabla\cdot(k_1\nabla T_1),\ in\ \Omega_1\\ C_2\frac{\partial T_2}{\partial t}=\nabla\cdot(k_2\nabl...
I am developing a BEM code based on a deal.ii tutorial. Consider the Poisson equation $$ \Delta u=-f\,, $$ and its Green's function $G\left(\mathbf{x},\mathbf{x}'\right)$ with the property $$ \Delta G=-\delta\left(\mathbf{x}-\mathbf{x}'\right)\,. $$ Applying Green's 2nd identity leads to the well known boundary integra...
Suppose I have the following integral: $$\int_{-1}^1 \int_{-1}^1 C_if(x,y)dxdy$$ where \begin{equation} C_i= \begin{cases} C_1 \quad \text{in }\Omega_1\\ C_2 \quad \text{in } \Omega_2\\ \end{cases} \end{equation} So how can I compute it using Gauss quadrature without having to splitting the unit cell into two seperate ...
While trying to solve a stochastic Gross-Piaevskii equation I have found a problem that can be tracked down to something buggy occuring in the simplest Schrodinger equation possible: $\partial_t \psi = i \partial^2_x \psi$ This has the very simple solution of a plane wave: $\psi(t) = A e^{i k x - i\omega t}$, with $\om...
I am trying to understand the divide and conquer division algorithm that is used in the GMP bignum arithmetic library. The code is very optimised and that makes it somewhat hard to understand. the doc does not really offer an explanation of how it is done, (and the references do not point to an actual algorithm, not on...
I am looking for a simple subroutine in Fortran 90 (GNU Compiler) to solve linear equation of the type $AX=B$, where $A$ is an $n\times n$ symmetric matrix stored in the form of symmetric skyline matrix. I want a solution of this type: X = skysolve(A,p,X,B,n) A = {11,22,13,0,33,24,34,44,55,16,0,0,46,56,66} where p is ...
In the FEM we usually use a trick to find the coefficients for shape functions: Finding $M^{-1}$ in the system $MC=I$, where for example in the linear case: $$ \begin{aligned} M&=[1 ,x_1,y_1;1 ,x_2,y_2;1 ,x_3,y_3],\\ C&=[a_1, b_1,c_1;a_2, b_2,c_2;a_3, b_3,c_3],\\ I&=[1,0,0;0,1,0;0,0,1]. \end{aligned} $$ and $\phi_1=a1+...
I am interested in computing the ranks of fairly large, the largest being of magnitude $10^6$ x $10^6$, sparse matrices whose entires are all 0, 1, or -1. I have been trying to use Matlab to accomplish this. In particular, my approach has been to use QR-factorization -- that is factoring my matrix $T$ as $TP=QR$ were $...
I am currently writing software in c++ which solves the eigenvalue problem of sparse hermitian matrices. The size of the matrix depends on the user input, but as an estimation it will roughly be 1000x1000. I will have to solve about 300 (again relies on the user input) of them for different initial conditions. What is...
I am interested in generating a 1D non-uniform grid on the interval [0, L] with N points, where a region of width $\sigma$ and centred at $\mu$ is at a higher density and where the transition from low and high densities of grid points occurs over a length $\ell$. This is for a finite-difference code, where particular a...
I'm planning on building a program that will carry out HPC. I'm aware that C/C++ is significantly better than Python in terms of the speed of computation. However, I'm not yet proficient in C/C++, so do you think it'll be wise to build a fully functioning prototype of sorts in Python and then get it rewritten in C/C++ ...
my name is Lorenzo and I am a postdoc researcher in Italy. My job is related to tomography imaging using synchrotron radiation. This is a new field for me and I start to face with Matlab to write some code. I am completely new with tomography imaging and Matlab shows new challenges for me. My actual problem is to creat...
Solve a matrix equation of the type $AX=B$, where $A$ is an $n \times n$ symmetric matrix stored in the form of symmetric skyline matrix. With the solution given by Bill and some more research on factorization, I used the prototype code provided by S.H Lee along with the same test code: parameter (neqs = 5) rea...
all, I've tried to find an answer to this question and have come across some related threads but nothing I was able to apply to my problem given my relative lack of experience in this arena. I basically have a constrained minimization problem using both inequality and equality constraints. I will have more variables (~...
I am looking for the Butcher tableau of a fourth order accurate Runge-Kutta method with IMEX splitting. I have been reading the ''classical'' paper on the subject by Ascher, Ruuth and Spiteri as well as a number of works that cite this paper (through Google Scholar). However, in all papers I looked at, only methods of ...
It is written in a book I'm reading that $$\nabla f(x) = \left( \frac{\partial f(x)}{\partial x_1}, \frac{\partial f(x)}{\partial x_2},...,\frac{\partial f(x)}{\partial x_n}\right)$$ and $$\nabla^2 f(x)_{ij} = \frac{\partial^2 f(x)}{\partial x_i ~\partial x_j}, \qquad \forall i,j=1,...,n.$$ According to 2nd-order con...
I want to plot a numerical integral function of some function $f$ using scipy and matplotlib. How can I do this? I tried the following but it didn't work (run with ipython %pylab): import numpy as np from scipy import integrate def f(x): return x*np.sin(1/x) X = np.arange(-0.5,0.5,0.001) #plot(X,f(X)) def F(x):...
I need to write the fast fourier transform in C++ and I am referring to this formula from wikipedia: But for some reason I am not getting the correct output when I simply enter (1,1) (1,1) (1,1) (1,1) for by vector $v$. Here is my code: #include <iostream> #include <complex> #include <cmath> #include <time.h> using n...
I need to solve a very large linear system (coming from finite element method). I'm currently using the Intel MKL library, but the system has been delayed more than 20 hours. The matrix of the system is sparse and it is written in Morse (CRS) I'm programming in Fortran 90, but I guess the language of the library is not...
I asked this question over at StackOverflow and someone told me that I'd get a better answer here. So here's my problem: I'm working on a machine learning project which involves doing a Principal Component Analysis on some labeled data and using those labels to extract more valuable information from the data. To do tha...
My question may be elementary, but it is quite essential as I am getting confused. Here I am supposed to solve the following equation: $Ax=B$ From my understanding I have options of using either direct solvers or iterative solvers. I have tried using iterative solver GMRES(It is quite simple in terms of implementation ...
I need consultancy for a possible p=np workaround. First of all sorry for my English because it is going to be long question:) To better understand the architecture which I design maybe you will need to have experience with matrix operations and a bit object oriented programming. I wanted to tag this question also to c...
For a start I need to implement a 2-D, vertex centered, finite difference scheme, Adaptive mesh refinement serial code. I have the following doubts before starting: Is the input to AMR (say 2-D) always a box bounding the entire domain ? Is a cell-centerd scheme easier to implement than vertex centred scheme ? Do I nee...
cannot delete my own question, so I try to overwrite it instead...
I'm solving the 3D Diffusion equation $$u_t=k(u_{xx}+u_{yy}+u_{zz})$$ in MATLAB using Fourier techniques. I assume a 3D Fourier expansion $(e^{-ipx},e^{-imy},e^{-imz})$of the solution. Physical space: $u(x,y,z,t)$. Fourier Space: $c(m,n,p,t)$. Substitution and differentiation result in: $$c(m,n,p)^{N+1}-c(m,n,p)^{N...
I am trying to solve the following problem, where $a_{ij} \ge 0 \ \forall i,j$: \begin{align} \mbox{minimize}\quad & \sum_{i=1}^m\sum_{j=1}^n (a_{ij}x_{ij}^2 + b_{ij}x_{ij})\\ \mbox{subject to}\quad &\sum_{i=1}^m x_{ij} \le 1 \quad \forall j,\\ &\sum_{j=1}^n x_{ij} \le 1\quad \forall i,\\ &x_{ij} \ge 0 \qua...
Assume $X$ and $N$ are two sets of vectors (observations) from two different normal distributions, where $X$ represents clean data and $N$ represents noise; and $A$ a projection matrix of a filter. the scenario is that our clean data was corrupted by a multiplicative noise via matrix $A$ and an additive noise of $N$. ...
Suppose we have an optimization problem $$ \mathbf{x} = (x_1, x_2, \ldots, x_m) = \arg\!\min_{\mathbf{x}\in \mathbb{R}^m}f(\mathbf{x})$$ and a second related problem: $$ \mathbf{y} = (y_1, y_2, \ldots, y_n) = \arg\!\min_{\mathbf{y}\in \mathbb{R}^n}g(\mathbf{y})$$ because we have the relations $$ \mathbf{x} = \mathbf{t...
Could somebody explain to me why periodic boundary conditions are automatically satisfied if you solve your problem assuming a Fourier series? So, if we assume a Fourier series for our solution, we don't need to impose any type of boundary conditions because the necessary periodic boundary conditions are naturally sat...
It is necessary for me to find the element indicator for poisson equation by linear basis in FEM. Therefore I have to find the following: $$\eta_k=h_k||f+\Delta u_h||_{L^2(k)}+\frac{1}{2}h_k^{1/2}||n.\nabla u_h||,$$ So, I should approximate $\Delta u_h$ numerically, and I need to second order derivative of the shape fu...