instruction
stringlengths
43
28.1k
I have a system where $A$ is a large $n\times n$ marix with fast MVMs. It may have many nonzero entries (albeit in a structured way so as to allow fast MVMs), and is not necessarily diagonally dominant. However, $A$ is weakly positive definite. $Y$ is a $n\times m$ dense matrix. I understand iterative Krylov-subspace-b...
I have a question regarding quadric fit to a set of points and corresponding normals (or equivalently, tangents). Fitting quadric surfaces to point data is well explored. Some works are as follows: Type-Constrained Direct Fitting of Quadric Surfaces, James Andrews, Carlo H. Sequin Computer-Aided Design & Applications...
What is the difference between edge finite elements and nodal finite elements? This for use in modeling the eddy current problem in classical electromagnetism. I am attempting to convert MATLAB code written for Electrical Impedance Tomography (EIT) into a code for Magnetic Induction Tomography (MIT). EIT involves elect...
Since learning about point charges in my physics II class this semester, I want to be able to investigate not only the static force and field distributions but the actual trajectories of movement of electrically charged particles. The first stage in doing this is to build a naive engine for simulating the dynamics of $...
Suppose I have a multi-objective optimization problem, and I wish to find solutions using two different methods/algorithms. The result of each algorithms is a Pareto front. Comparing two different methods for a single-objective optimization problem is simple: just see which one produces the better result for the single...
I am looking for methods that allow estimating the information entropy of a distribution when the only practical ways of sampling from that distribution are Monte Carlo methods. My problem is not unlike the standard Ising model that is typically used as the introductory example for Metropolis–Hastings sampling. I have...
What would be the numerical method of choice to find minima in a non-smooth, non-convex, locally Lipschitz function $f: \mathbb{R}^n\rightarrow \mathbb{R}$. The function $f$ is mostly smooth but contains three-dimensional cusps of the following form: $$ g: \mathbb{R}^3\rightarrow \mathbb{R}\\ g(\boldsymbol{x})= -\exp(...
My question may be so general and simple but I'm really confused about the meaning of the "stability". I look that up in the Internet but there was no general answer to this question. Can anyone help me to understand its meaning or definition and its types or references about the subject? And how is it determined? For ...
I had a similar question to Finite element method applied to 1D structural problem - what is wrong with body force? I did some work on it as per answers, but it seems that is not working. Quadratic 1D element runs from 1 to 5. Nodes are $x_1=1, x_2=3,x_3=5$. $x_{global} = [1,3,5]^T$ Element length $h=4$, Jacobian for g...
In a collocated grid, which velocity is used in the convective term in the momentum equation? Is the Rhie and Chow constructed face velocity or an average of the adjacent cell center values(in a structured grid) used?
I was wondering if there are any shallow water equation solvers out there that can include rigid body motion for the surface the water flows on?
I am currently following J.Anderson Jr.'s CFD with basic application and I came into some troubles while coding for my very first CFD problem. As the title suggests I am solving an incompressible Couette flow using an explicit finite difference approach. How can I increase the steps without it blowing up? I tried to ch...
Background I am solving a variant of the Ornstein-Zernike equation from liquid theory. Abstractly, the problem can be represented as solving the fixed point problem $A c(r)=c(r)$, where $A$ is an integro-algebraic operator and $c(r)$ is the solution function (the OZ direct correlation function). I am solving by Picard ...
I have to minimize a function $f(\mathbf{x})$, where the vector $\mathbf{x}\in\mathbb{R}^n$ satisfies $|\mathbf{x}|=1$. So I tweaked the code of $f$ so that it renormalizes $\mathbf{x}$ as the first step, and this allows me to avoid adding the constraint to the minimization algorithm. At the end of the optimization I c...
In the DEAP algorithms (see documentation here), I notice that we need to specify the the number of generations (NGEN). I was advised that convergence has been achieved if the Pareto curve is smooth. How can I monitor for convergence in DEAP? Update: It is possible to monitor for convergence by specifying a "smoothnes...
Consider a random variable which is given by an orthogonal polynomial expansion in one parameter (or polynomial chaos expansion PCE), i.e. , $$ f(\alpha) = \sum\limits_{n=0}^{\infty} \hat{f} (n) \psi _n (\alpha) \, , $$ where $\alpha$ is uniformly distributed in $[-1,1]$, $\psi _n (\alpha)$ are the orthogonal Legendr...
I am writing a GAMS program where I am interested in using the value of a variable as a condition inside an another equation. Let's say I have two equations with two variables, $g_1(t)$ and $g_2(t)$, and they are defined over a set of time $t$. The sample equations are written below: \begin{align} g_1(t) &= g_1(t-1)+1 ...
Given two different BLAS implementations, can we expect that they make the exact same floating point computations and return the same results? Or can it happen, for instance, that one computes a scalar product as $$ ((x_1y_1 + x_2y_2) + x_3y_3) + x_4y_4 $$ and one as $$ (x_1y_1 + x_2y_2) + (x_3y_3 + x_4y_4), $$ so poss...
I have the function $c(t) = A \cdot \cos \left(\dfrac{2\pi}{\tau} \cdot t + \phi \right) $ which is used to define $ T(t) = \begin{cases} M + c(t), & c(t) > 0 \\ M, &c(t) \leq 0. \end{cases} $ $T(t)$ is used to fit in the least square sense to measurements $y(t)$. Now, the question is how to get the partial deri...
For a large parallel sparse matrix (mpiaij type matrix) in my code, I was experimenting with various preconditioners to see which one would do best with GMRES/BiCGSTAB. I tried the PCMG preconditioner without specifying any grid/interpolation/restriction information, and this actually seemed to do pretty well for my p...
I need to solve the Kadomtsev Petviashvili (KP) equations $$\partial_x(\partial_t u+u \partial_x u+\epsilon^2\partial_{xxx}u)+\lambda\partial_{yy}u=0 $$ where $$\lambda=\pm 1 \;.$$ My questions are: 1) Which is the best numerical method to solve them? Or maybe a good method that is simple? 2) What does wikipidia mean...
I'm trying to solve the Travelling Salesman Problem in a non-complete graph $(G,E)$ using genetic algorithms. My problem is that I can't find a good first approximation by the usual greedy algorithms, as long as I can't assure an arbitrary edge $(u,v)$ to be in $E$. I tried to add to $E$ new edges (with almost infinity...
At each iteration $i$ of the GMRES method, is calculated a single new orthonormal vector of the existing Krylov subspace. If the norm of that vector is 0 (or close to 0), then the subspace is "complete", and we should be able to calculate the converged solution. In theory, this occurs when we have $N$ orthonormal vecto...
The Wikipedia page for SGD describes optimizing a function $f = \sum f_i(\theta;x_i)$ by successively approximating gradients from random subsets of the data, while most literature poses the problem as optimizing $f = \text{E}[F(\theta,\zeta)]$ for some random variable $\zeta$. I can see how these are asymptotically eq...
I'm a double major in computer science and mathematics. I love both subjects. I'm thinking in taking a graduate career, perhaps in scientific computing. What's the real difference between scientific computing and numerical analysis? Are they studied as careers?
If $A, B, C$ are $n \times n$ matrices, where both $B$ and $C$ are nonsingular, and $b$ is a vector of length $n$, how would you compute the following without computing any inverses? $$x = B^{-1}(2A+I)(C^{-1}+A)b$$
I am trying to integrate the following function in Python, $\int_{0}^{\infty}\int_{0}^{\infty} \dfrac{e^{-x-y}}{B(x,y)}dx dy$, where $B(x,y)$ is the beta function - $B(x,y) = \int_0^{1}a^{x-1}(1-a)^{y-1}da$. As the above function was not directly integrable in scipy.integrate, I did a change of variable, $x\rightarrow ...
I'm reading an article lately, and there is one point which confuses me. So, we have the following constrained binary quadratic problem. min $x^{T}Qx$ with the constraints that $Ax≤b$ and $x\in {0,1}^{n}$ This can be relaxed into the following: min $\sum_{1\leq i <j \leq n}2q_{ij}y_{ij} + \sum_{i=1}^{n}q_{ii}x_i$ with ...
I'm going through an article lately and there is one point which is very confusing. So, we have the following original constrained binary quadratic problem as the following. The pre-assumption of certain parameters are $Q\in Z^{n*n}$, $A\in Z^{n*n}$, and $b\in Z^{n*1}$. $\text{min}$ $x^{T}Qx$, $s.t.,$ $Ax\leq b$ $\tex...
I am currently trying to plot a function which describes linear perturbation growth in cosmology for different world models. I would like to be able to have all the curves on the same set of axes, but am struggling with setting it up. This is the function $D(z) = \frac{5 \Omega_M H_0^2}{2} \int_z^{\infty} \frac{1+z}{H...
While reading this paper on MPM (page 48), the definition of the objective function $E(\boldsymbol v_{\boldsymbol i})$ didn't make sense to me, although I completely understand the definition of (what I suppose to be) it's derivative $\boldsymbol h(\boldsymbol v^{n+1})$. Excerpt from the paper: We will show that solvi...
Note: This was cross-posted from comp-sci, as I didn't know this community existed! I have a problem which I'm looking to see if there is literature on: Consider three types of actors, a Director, Aggregator, and Follower. The Director talks to multiple Aggregators, the Aggregator talks to multiple Followers. The direc...
I'm going through an article with title "Solving constrained quadratic binary problems via quantum adiabatic evolution" (reference 1). And there are several points confusing me a lot. This article is aimed to solve the CBQP (constrained binary quadratic programming) with the following format. \begin{align} &\min &x^{T}...
I'm a New Yorker and take the subways every day. I have a growing interest in understanding the distribution of paths people take on the subways to work every day. I.e. if there are $n$ subway stations, I want a temporal distribution over the paths $\omega = (n_i, n_j, t)$ where $n_i$ and $n_j$ are nodes representing...
Given that there are eigensolvers in Scalapack that use a divide and conquer method, is there any way we can use Scalapack functions to only compute the first $k$ dominant eigenvalues and corresponding eigenvectors? This is for a spectral clustering code.
Summary We are trying to solve some models of emission of substances to the air. In these models, emission stops at a certain point. We are using the DotNumerics implementation of radau5 We had issue finding correct solutions. If emission stops, the air concentration should drop, but this was not always the case. We we...
I have written a function that sets up a sparse matrix A and RHS b for the 3D Poisson equation in a relatively efficient way. The set-up is nothing fancy: I have extended the 2D 5-point stencil to an equivalent 7-point stencil for 3D. Conductors are (at this moment) simply blocks of Dirichlet BCs and I am not (yet) tak...
I'm going through the article in the following link lately and one point confuses me a lot. https://arxiv.org/pdf/1509.05001.pdf So, the goal of this paper is to solve the following constrained binary quadratic programming. Here the parameters $A$, $Q$ and $b$ are all of integer values. max $x^{T}Qx$ $s.t.,$ $Ax\leq b$...
Suppose that I'm solving the poisson equation by the finite element method by lagrange elements. I know that the error can be measured in a variety of ways, depending on which norm you choose. For a given lagrange element order p and a symmetric bilinear form (e.g. galerkin's finite element method), the errors in the...
I have a 7000x7000 sparse matrix (scipy), which I want to exponentiate. I've tried using scipy.sparse.linalg.expm, which works quite well for smaller matrices (takes a few seconds for a 1000x1000 matrix) but it takes too long time to compute for the matrix in question. Is there a way to optimise this or work around the...
Given the one dimensional equation: $\epsilon\frac{\partial^2u}{\partial x^2} +\frac{\partial u}{\partial x} = 0 $ with $0\le\epsilon \ll1$ with boundary conditions $u(0) = 0$ and $u(1) = 2$, we can't neglect the diffusive term because of the boundary conditions. In which situations (with very small $\epsilon$ could w...
I'm trying to come up with the right algorithm for a system in which the user enters a few symptoms and the system has to predict or determine the likelihood that a few selected symptoms are associated with those existing in the system. Then after associating them, the result or output should be a specific disease for ...
I have written a code which solves the incompressible formulation of the Navier-Stokes equations. It uses high-order methods both for time and spatial derivatives. I have been conducting convergence rate analysis to validate the high-order aspect of my solver. For space convergence, the problem was relatively simple. F...
I've recently written a code that solves the incompressible/low-Mach number formulation of the Navier-Stokes equation with high-order methods for both time and space. My advisor insisted that I use third order Runge-Kutta method. However, I do not find it to be adapted to our current problem. In incompressible solvers...
I think it's already been asked, but I still can't figure out a way to do it computationally. I had to check for positive definiteness of an $n \times n$ matrix $A$. I know that for any nonzero column vector $x$, we have $x^{t}A x > 0$. I want to implement it in C++ to use it with the Cholesky method, in which I need:...
I have spend the last few days working my way through an interesting paper and I'm building a numerical model so I can apply the method. However, I am getting stuck at an "it can be shown" step. I am trying to convert the following system into the form $A\cdot{x}=b$. Have I missed something obvious, I really don't know...
I've recently got interested in CFD and started a small project by solving the radial Reynoldsequation. Why the Reynoldsequation? I recently encountered it through my studies and somehow got stuck :) I would greatly appreciate it, if someone were so kind to have a read through my steps and point out my thought mistakes...
When simulating a partial differential equation describing a physical phenomenon like vibrations on a string, fluid flow in a chamber or quantum wave functions, the most straight-forward way is to divide your space into small regions / cells, set up the relevant values at each cell according to the initial condition, a...
In a initial value problem does the initial condition has to satisfy the boundary condition and the governing equation? For example: If a non-homogeneous Neumann boundary condition for the pressure in a fluid dynamics problem is applied on a boundary, can one initialize a zero pressure field?
How do we correctly define the flux in a finite volume method applied to Poisson's equation where we have a piecewise constant material? Specifically, say we have the equation \begin{align*} -\nabla\cdot(k\nabla u) =& f\textrm{ on }\Omega\\ u =& 0\textrm{ on }\partial\Omega \end{align*} where $\Omega$ is some kind of ...
In a book that our course is following this semester, the theorem given is only in one direction: if the scheme is both consistent and stable, then the scheme is convergent. However, since this isn't a double implication theorem, then are there convergent schemes that are either consistent but not stable, or stable ...
I have a function $\mu(x)$ that I need to convolve with several functions $\nu_n(x)$. I'm currently taking the DFT of $\mu$ and multiplying it individually with the N DFTs of the functions $\nu_n$ and then taking the inverse DFT to obtain the convolution. Can I instead define $m(x, y) = \mu(x), n(x, y) = \nu_y(x)$ for...
I'm writing a library that involves some approximations of variational calculus problems. Whenever I implement routines to evaluate the derivative or Hessian of an action functional $A$, I write a test to check that these are working correctly. To do this, I evaluate the error in using the first and second derivatives ...
The question is exactly as the title: Which 2D (triangular) mesh generator software can be used which has a set of geometric primitives, controlled mesh size and standard output (.vtk or something similar)? For testing my code I need a triangular mesh for a circle and I am looking for the easiest way to do that. E.g.,...
I have two vectors which specify the bounds $x_{min}$ and $x_{max}$ of the sample space. Also, it has to satisfy the linear constraint $Ax \leq b$. How to generate an evenly spaced set of points, with some control over grid spacing, which satisfy these constraints and this includes both the boundaries and the interior?...
I have a optimization problem in which the optimal objective value occurs at multiple point in the feasible space. If I run my problem in LINGO software then it gives me the optimal objective value at a point in the feasible space but how to get the all points in which optimal solution occurs.
There are several functions of two or three variables that I am working with. For this question I have made a small set showing the resistivity, $\rho$, in n$\Omega$m, of copper as a function of its purity ($RRR$ value) and its temperature, $T$, in Kelvin. RRR\Temp [K] 20 90 160 230 300 60 0...
I am attempting to solve a nonlinear advection diffusion equation $$\frac{\partial u}{\partial t} = \frac{\partial}{\partial x}(\frac{\partial u}{\partial x} + u^2)$$ with Robin boundary conditions via the finite volume method. I am using the WENO method to reconstruct the function $u$ and its derivative $u_x$ as well ...
I have worked on mathematical modeling based on differential equations, and now I want to simulate a cellular automaton based on a system of mixed ode-pde coupled first order differential equations \begin{eqnarray} \dfrac{dR}{dt}(t)&=&v_r(R,t),\\ \dfrac{\partial v_r}{\partial r}(r,t)&=&\dfrac{R\sinh(r)}{r\sinh(R)}[1-\...
Can somebody point me to software/code to extract a solenoidal (a.k.a. divergence-free) field from a 2D vector field numerically? There are a plethora of papers and documents describing how to do this, but for some reason none of the authors (or anybody else for that matter) puts a simple piece of source code online im...
Right now I stuck with a problem. It seems to be really trivial one, but still it is hard for me to find an appropriate solution. The problem is: One has two intervals and are to find the intersection of them. For instance: Intersection of [0, 3]&[2, 4] is [2, 3] Intersection of [-1, 34]&[0, 4] is [0, 4] Intersection ...
I have a MATLAB code (see below) that employs 'fsolve' from the optimization toolbox for a root finding problem. The bottleneck is that, within the objective function calculation, there is a computationally expensive function (denoted as 'expensive_function' in the below code, and is located in the matlabpath). The var...
Suppose I have a energy functional E depending on X, where X is a N-dimensional real value vector and N could be very large (~=2000). I assume that there exists (at least) a (local) minimizer for E. There are several problems I am dealing with now: Firstly, the functional E is extremely 'complicated', it is nearly imp...
I want to numerically solve the damped oscillator equation $$\frac{d^2x}{dt^2}+\eta\frac{dx}{dt}+x=0 .$$ Usually it's very easy to solve this kind of ODE analytically and numerically. But now the damping coefficient is extremely small, $\eta=10^{-10}$. To get the obvious damping pattern, the value of oscillating time $...
As the title says, I'm trying to make my code include a uniform pressure/force to the surface of a plate for analysis. Structural/Element Modeling I am modeling a 2D 9 node Mindlin plate that has a clamped boundary condition on one side. It is 0.2 [m] by 0.2 [m]. Currently, I am using 6x6 elements. The plate has 6 laye...
I've asked this question on mathoverflow too. Let $T>0$ $I:=(0,T]$ $d\in\mathbb N$ $\Lambda\subseteq\mathbb R^d$ be nonempty and open, $$\mathcal V:=\left\{\phi\in C_c^\infty(\Lambda,\mathbb R^d):\nabla\cdot\phi=0\right\}$$ and $$V:=\overline{\mathcal V}^{\left\|\;\cdot\;\right\|_{H^1(\Lambda,\:\mathbb R^d)}}\;,\;\;...
I am working on some medium to large scale finite element codes. By using established and available tools I am able to have an algorithm that scales well up to about 10,000 cores. Investigating scaling beyond this requires investigating larger meshes, which leads to my problem. Once meshes start getting large (in range...
I've asked this question on Math.SE too. Let $d\in\left\{1,\ldots,4\right\}$ $\Lambda\subseteq\mathbb R^d$ be bounded, nonempty and open and $\partial\Lambda$ be Lipschitz $V:=\left\{u\in H_0^1(\Lambda,\mathbb R^d):\nabla\cdot u=0\right\}$ $W:=\left\{p\in L^2(\Lambda):\int_\Lambda p=0\right\}$ $\mathfrak a(u,v):=\su...
As a toy problem, I was looking at a classical second order system of the following form: \begin{align} \ddot{x}(t) + c \dot{x}(t) + k x(t) = 0 \end{align} Instead of the basic system above, I want to replace $x(t)$ with a Low-Pass filtered version of $x(t)$. This can change the equation to the following form: \begin{...
I am working on a generalized eigenvalue problem of the form $$ \boldsymbol{A}\cdot\boldsymbol{x}=\lambda\boldsymbol{B}\cdot\boldsymbol{x} $$ where $\boldsymbol{B}$ is not symmetric positive. Therefore I recast the problem to $$ \boldsymbol{B}^{-1}\cdot(\boldsymbol{A}\cdot\boldsymbol{x})=\lambda\boldsymbol{x}\ . $$ I a...
I was wondering if there is a simple or known way to minimize the number of unique elements in a decision variable (vector). Note that I'm not asking for minimization of nonzero elements (rank constraint). In particular I'm searching for a penalization (soft constraint) or hard constraint in the form $$f(x) <= n_{ma...
I am trying to calculate real speed and time in free fall of a body. I wrote a code in Fortran and I am trying to improve it by using RK4 method x=time y=total free fall Purple line using: DO WHILE ((K1-K2) > y) y = y + t*((G*m*t/(2*((r-y)**2))) + sqrt(2*(G*m*y)/(r*(r-y)))) time = time + t ...
Consider solving a differential equation system for 1D, 2D, or 3D. It involves various input and output "field" variables, which, more often than not, correspond to various physical quantities relevant to the problem. The typical discretization step is to agree on a mesh, and then solve the system. We might refine the ...
As the title mentioned, some suggestions and references are needed to help me to construct a function in $H^3(\Omega)$, but not in $H^4(\Omega)$?The domain $\Omega=[0,1]\times[0,1]$ and has zero trace. I'm very glad to receive some suggestions. More precisely, I want to construct a function satisfying \begin{align} &-\...
my problem is a ecuation i don't understand, I have no idea how to solve that, is a classic minimisation programme of quadratic form with linear constraints, here is the ecuation: $$\sum_{i,j}^n[P(i/j)P(j) - \sum_{k=1}^rt(ijk)\prod_k]^2 + \sum_{i,j}^n[P(i/ \bar j)P(\bar j) - \sum_{k=1}^rs(ijk)\prod_k]^2$$ subject to th...
I have read some papers about time-fractional PDEs solved by finite element method. The time-fractional derivative is the Caputo derivative defined by $$ \frac{\partial^{\alpha}u}{\partial t^{\alpha}}=\frac{1}{\Gamma(1-\alpha)}\int_{0}^t\frac{\partial u}{\partial s}\frac{ds}{(t-s)^{\alpha}},~~~~0<\alpha<1. $$ Now, we...
I have $m$ inequalities involving $n$ variables as follows $$a_{1,j} x_1 +a_{2,j} x_2 +\dots +a_{n,j} x_n>0 \quad \text{for} \quad 1 \leq j \leq m$$ How can I check if a solution exists (with the possible help of computer)?
I have a computationally expensive objective function, whose analytical form is not available. The only input argument to the objective function is an integer variable. The goal is to compute the integer variable that minimizes the objective function. $$x_{sol} = argmin_{x \epsilon [x_{min},x_{max}]} f(x)$$ where $x$...
Trotter expansions say: $$ e^{A+B} = \lim_{P\to\infty} \big(e^{A/2P} e^{B/P} e^{A/2P} \big)^P. $$ With $P = 2$, it becomes (with high accuracy) $$ e^{A/4} e^{B/2} e^{A/2} e^{B/2} e^{A/4}. $$ Let's say I want to solve $\frac{dy}{dt} = Cy$, where $C = A + B$. $C$ can be time dependent. How can I solve this equation by sp...
In this question, I suggested that the Couran-Friedrichs-Lewy (CFL) condition for the wave equation in polar coordinates reads $$C = 2c\frac{\Delta t}{\Delta r \Delta \phi} \leq C_\max \enspace ,$$ where $c$ is the phase speed. I suggested this from an intuitive point of view, and it worked in that example. Nevertheles...
I'm trying to find an approach for integral image resizing. I found out that I can do it with a bilinear interpolation method, but with this approach I can only resizing by the factor which is a power of two. I found a paper (Speeding Up Object Detection Fast Resizing in the Integral Image Domain) which describes a for...
When looking at the output file of my solver, I have been told that the time-step taken by the solver depends on parameters like the total number of elements and their relative size in my geometry, or the material properties. A material with a high Young modulus could decrease the time step taken by the solver, as well...
Just for my interest I'm thinking how to make some cheap-and-dirty simulation of processes such as: penetration of metal plate by projectile explosion of shaped charge (for example https://www.youtube.com/watch?v=qqMoFx0uwpo) implosion of atomic bomb core I can imagine how to do it in Lagraginan frame ( something li...
EDIT based on comments below: I add the mathematical formulation of my problem below. I am trying to solve an equation of the form $$ \partial_t f(x,y,t)= (\partial^2_x +\partial^2_y) f(x,y,t) \equiv G(x,y,t), $$ discretizing this equation we have $$ f^{k+1}_{i,j}= f^k_{i,j} + \Delta t G^k_{i,j} $$ where $i,j$ refer to...
I am solving a flow physics problem, in which I encounter a symmetric boundary. So I set the boundary conditions to be $$\frac{\partial u}{\partial r} = \frac{\partial v}{\partial r}=\frac{\partial w}{\partial r}=\frac{\partial T}{\partial r} =\frac{\partial \rho}{\partial r}$$ where $u,v,w$ are the 3 components of ve...
Consider two-body central force problem in polar co-ordinates $r,θ$. Corresponding 2nd order differential equation is obtained by using conservation of angular momentum. This equation is : $ d^2r/dt^2=l^2/(m^2r^3)−GM/r^2 $ $r(t)$ is the radial position of particle (of mass $m$) as a function of time $t$. $l$ is angular...
I need to use variable precision arithmetic in MATLAB for an expensive set of computation. The vpa function provided by the symbolic math toolbox is very slow. I found a non-free alternative toolbox known as "Advanpix" (http://www.advanpix.com/) ,which sped up things by an order of magnitude, using a trial version. How...
I have a real signal in time given by: And I am simply trying to compute its power spectrum, which is the Fourier transform of the autocorrelation of the signal, and is also a purely real and positive quantity in this case. To do this, I simply write: import numpy as np from scipy.fftpack import fft, arange, rfftfreq,...
I am leveraging the SLEPc library for solving the first $k$ (where $k = 3$ or $4$) eigenvalues and their corresponding vectors for a matrix of size 200,000. The matrix is sparse and symmetric. I intend to compute the eigenvalues without using MPI, as a result of which the entire computation takes more than 2 minutes. I...
I am applying a 6th order Finite-Difference differentiation scheme as seen in http://www.scholarpedia.org/article/Method_of_lines/example_implementation/dss006 There seems to be severe numerical/floating-point issues with this scheme. The result is very sensitive to the values in the vector with which the FD matrix is...
In some cases I have seen that if the local error is: $Err = O (\Delta t^{p+1})$ where the global error is p. So if local error is 3, global will be 2. Does somebody know where it comes? For instance in the case of multistep solver you can say that regarding wikipedia, but are there other cases. Is there a simple way ...
For a CFD panel-based potential method, I'm trying to reduce the time to solve the linear system. The matrix has the larger values on the diagonal, since the influence of a panel on itself is maximum, and that the panel's influence on other panels decreases at least as the inverse of their distance. The matrix has no r...
I have a function: delt=1 #trial def f(z): return ((1-2*z)*np.exp(-delt/z))/(((1-z)**(2+delt))*(z**(2-delt))) I also have a variable: import scipy.integrate as integrate var=integrate.quad(f,0,0.5)[0] # equals 0.040353419593637516 Now I am trying to find the value p such that integrate.quad(f,0.5,p)= var and m...
I have successfully solved the multi-species diffusion-reaction equation \begin{equation} \frac{\partial c_i}{\partial t} = \nabla \cdot (d_i(x)\nabla c_i) + s_i(x,t), \quad \quad (1) \end{equation} with dicontinuous source term \begin{equation} s(x,t) = \left\{ \begin{array}{rcl} s_1(x,t) & \text{for} & 0<x\le x' , ...
I'm trying to better understand finite volume methods and have started coding up a basic script to solve the diffusion equation $$u_t = u_{xx}$$ which has the finite volume form: $$\frac{\bar{u}^{n+1}_i\ - \bar{u}^n_i }{\Delta t} = \hat{F}_{i+\frac{1}{2}}^n - \hat{F}_{i-\frac{1}{2}}^n$$ where $\bar{u_i}$ is the average...
I actually find the formulae for peak theoretical performance: Node performance in GFlops = (CPU speed in GHz) x (number of CPU cores) x (CPU instruction per cycle) x (number of CPUs per node) CPU Speed and CPU cores are easy. but how can i know the cpu operations per cycle? For example, my qualcomm processor specs are...
I am currently working on a project where a two-phase flow is considered. The phases are described using a level set approach and a signed distance function from the interface between the phases where positive values are liquid and negative values are gas. I consider a Stoke's flow which gives me a velocity field $v$ ...
I am referring this paper, and trying to implement chaotic sender and receiver, to decode message, as given in section $V^{th}$ Chaotic signal masking. The process that I want to implement is figure 6 of the same paper, where we have Lorenz system given by equations: : \begin{align} \frac{\mathrm{d}x}{\mathrm{d}t} &=...
There seem to be many books and papers that explain various CFD methods in great detail, but unfortunately I have not been able to find many good resources of such methods implemented in codes such as MATLAB or Python (besides the most basic of problems such as the linear advection equation). As such, I was wondering i...
I recently coded a 1 stage and 3 stage optimal TVD-RK explicit scheme using eqn 3.3 here http://www.ams.org/journals/mcom/1998-67-221/S0025-5718-98-00913-2/ on the equation Ux+Uy=0, where x and y are the independent variables with which U velocity is differentiated. It is a 1D problem. The space is discretized using t...