instruction
stringlengths
43
28.1k
Suppose I have a 3d triangular mesh with the topology of a finite cylinder. Let $C$ be a vertex on that mesh. How can I find the shortest path from $C$ to itself that goes around the cylinder? By shortest, I mean the sum of Euclidean distances between consecutive vertices on the path. By "around the cylinder" I mean th...
I am new to Fenics and just started reading the tutorial Solving PDEs in Python. For simplicity, we can refer to simplest example, page 17 (the linear poisson equation), despite not necessary. My problem is: given a fixed PDE, solve it multiple times with different parameters. (For instance, changing the constant f the...
Circuit simulation software based on SPICE (such as ngspice) uses Newton-Raphson method to solve non-linear system of equations which model circuits containing non-linear elements such as diodes or MOSFET transistors. In each iteration of Newton-method, most of the time is spent on the following two parts: device mode...
I am not sure whether this question belongs here, but I would like to give it a try and benefit from the experience of the people at scicomp.SE. From my experience, the software quality in computational science often leaves a bit to be desired. Clearly, established software projects such as PETSc or OpenFOAM are except...
I'm reading an article regarding approximating sums using KD-trees (similar to FMM). As part of the effort I'm trying to make sense of this article , which is cited. I'm having trouble understanding this part: Computing the maximum variation of weights over all points below node ND is easy. We know the location of x...
I have searched and what I understood was that they use the naive one with several memory and cache optimizations. However, I wanted to know whether they are using the Strassen or the Coppersmith-Winograd algorithms. If they don't use them, then why? Additionally, does NumPy use BLAS or ATLAS? What I did is that I ...
Documentation in scipy.interpolate (found at https://docs.scipy.org/doc/scipy/reference/tutorial/interpolate.html) states: "The parameter variable is given with the keyword argument, u, which defaults to an equally-spaced monotonic sequence between 0 and 1." From experimenting with the function in 2D, it appears that ...
I am trying to visualize the time dependence of a free particle given an initial wave-function using Python and I just wanted to know if I could use the in built FFT implementation from NumPy to find the coefficients of the integral $$ \Psi(x,\,t)=\frac{1}{2\pi}\int_{-\infty}^\infty\phi(k)\exp\left[i\left(kx-\frac{\hb...
I am trying to solve numerically the following second order linear ODE: $a \frac{\partial^2 u}{\partial x^2} + \frac{\partial u}{\partial x} \frac{\partial a}{\partial x} + b u =0$, on the domain $[-L,L]$ with boundary conditions $u(-L)=u(L)=0$ where $a=\lambda c(x) + d(x)$, and $b = \lambda e(x) + f(x)$. $c(x)$, $d(x...
So I just picked up a project that is written in fortran90. I am used to coding in python and C. What is really troubling for me is the use of subroutines in fortran90. In fortran people use subroutines to set variables of the parentscope in a sub function. This is really intransparent for me since tracking changes of ...
Is there any online implementation for the coppersmith matrix multiplication I have searched alot but can not find any? and if there is not any why is that Isn't this algotithm much faster than strassen in very large square matrices in the range of 100000 to millions, from what I understand the only downside of it is...
The equation is $\rho \frac{d \bar{u}}{dy} = -\frac{d\bar{p}}{dx} + \mu\frac{d^2\bar{u}}{dy^2} $ with boundary condition $u(-1)=0$ and $u(1)=1$ I am to solve it using fifth order runge-kutta felhberg approach with Matlab. To do that, I have to change the equation to initial value problem using shooting method. So, m...
I am using a Runge-Kutta fourth order method to solve numerically the usual equation of motion of a background scalar field in curved spacetime with a quartic potential: $\phi^{''}=-3\left(1+\frac{H^{'}}{3H}\right)\phi^{'}-\lambda\phi^3/H^2$, $'$ denoting the derivative w.r.t. the e-folds number $\textrm{d}N=H\textrm{d...
Possible an open-ended question, but I am wondering if most statistical packages and libraries, for instance, Stata, R, Python's NumPy and MATLAB rely on LAPACK algorithms to perform matrix operations, including inverting a matrix.
I am trying to calculate the spectrum of Bremmstrahlung, which involves calculating the Fourier transformed acceleration. I am solving a non-linear ODE to numerically calculate the acceleration in the time domain. After taking the Fourier transformation using Numpy's fft, the resultant spectrum looks highly non-smooth ...
I´m now a chemistry grad student and I feel the need to get involved with computational chemistry and coding in the chemical field (in general). I have a very simple question: What is the best way to get started by myself? Should I cover the theoretical topics first with a good book? Can I/Should I start coding right a...
when we solve a large sparse linear system Ax=b, using preconditioned Krylov subspace methods,e.g., gmres, should we need to reduce the condition number of the coefficient matrix? In my opinion, we just need to consider how to cluster the eigenvalues distribution of the preconditioned matrix M^{-1}A, as long as the spe...
Is there any deep learning library based on Trillinos or Petsc linear algebra?
I am a computer science grad and I am working to write an electronic structure calculation program and I am stuck at forming basis functions using 6-31G Basis set for atoms having higher atomic numbers (p,d,f shells). For example, consider a gaussian g as g(alpha) = (2*alpha/pi)^(3/4) * exp(-alpha*r^2). Looking at the...
The ODE $${d^2x\over dt^2}=-kx; k>0$$can be converted in the system of linear equations as $$\begin{align} {dx\over dt} & =v\\ {dv\over dt} &= -kx\\ \end{align}$$ Using Euler’s method, given $x_n$ and $y_n$ and for the time step $\Delta t$, the next values can be determined as $$\left[ \begin{matrix} x_{n+1}\\ v_{n+1}...
I'm trying to model diffusion through a cylindrical domain $D = \{ (x,y,z) : x^2 + y^2 \leq 1, \;\; 0 \leq z \leq 1\}$. The is an initial concentration of the diffusant at the upper flat surface, say $C(x,y,z=1) = C_{init}$, and initially zero concentration within the domain. The diffusant can move through both the $z...
Let $A=[A_1|\ldots|A_m] \in \mathbb R^{n \times m}$ with $n \gg m \gg 1$ and $D=\text{diag}(d_1,\ldots,d_m)$ where $d_1,\ldots,d_m > 0$, and consider the $n\times n$ positive-definite matrix $X=\sum_{i=1}^m d_i A_iA_i^T=ADA^T$. Question What is an efficient way to compute the leading eigenvector of $X$ without forming ...
I have a 2D flow and would like to obtain the value of certain scalar field in a set of points forming a regular mesh. These points should not coincide with the nodes of the actual mesh used in the CFD simulation. May be you know how to automatize this process in ParaView. Basicly, I need to first define the set of poi...
Let $u$ and $v$ be nonzero column vectors of size $n$ and consider the $n \times n$ positive-definite matrix $A:=uu^T + vv^T$. In this post https://math.stackexchange.com/a/112201/168758, the eigenvalues of $A$ were computed analytically. Question I wonder whether there is an analytic formula for the eigenvectors of $A...
Does somebody know an open-source GUI for the management of a small material database? I have a spreadsheet with some materials in it. Each materials has some temperature-dependent properties like this: . The problem is that some parameters are a function of temperature, and entering equations in cells is a little er...
I am trying to solve a problem with 2D Convection-Diffusion equation with U = Concentration ($mg/m^{2}$) using Implicit Upwind Finite Difference Method like this $$ \frac{\partial U}{\partial t} + v_{y}\frac{\partial U}{\partial y} = D(\frac{\partial^{2} U}{\partial x^{2}}+ \frac{\partial^{2} U}{\partial y^{2}}) $$ Se...
I am trying to assign fixed constraint at specific indices of VTK mesh, however, I only can view STL file in a blender as follows: Upon assigning the favored indices in my scene at the SOFA physics simulator, of course, I did not get favored results since I am using VTK mesh. To view VTK mesh, I am using GMSH, the mes...
e.g. water in a height map Choosing a range with a margin of error for typical model behaviour seems practical. Could we instead (1). predict maximum values; or (2). have a natural maximum? 1. predict maximum The total energy in a system probably limits the maximum possible values (i.e. if it was all concentrated into...
Let $u$ and $v$ be column vectors of size $n \gg 1$ (not both zero), and consider the matrix $A:=uu^T+vv^T$ Question What is an analytic formula for $\arg\max_{\|z\|_\infty \le 1}z^TAz=\arg\max_{\|z\|_\infty \le 1}(z^Tu)^2 + (z^Tv)^2$ ? Observations In the constraint, if we replace $\|\cdot\|_\infty$ with $\|\cdot\|_2...
I have some C++ code that generates meshes from step files and then analyses these meshes for visibility of the faces from different viewing directions. I currently use CGAL but I would like to switch over to using gmsh for my meshing. The problem I'm encountering is that gmsh doesn't mesh flat cylindrical faces well, ...
I have the following pde (Burger's equation) for $\epsilon>0: u_t+u.u_x=\epsilon.u_{xx}$ and $x\in \mathbb{R},t>0$ and the initial condition: $u(x,0)=\phi(x)=1_{(-\infty,0)}(x)$. I want first to solve it (using matlab) for the case $\epsilon=0$, which is a first pde, and then for $\epsilon=0.1$ and $ \epsilon=0.001$.
For example, how to solve the well-known isoperimetric problem (i.e., to enclose the largest area with a fixed-length curve)? We can simplify things a bit and fix the two ends of the curve at $[a,0]$, $[b,0]$, then the problems is $$\text{maximize} \quad \int_a^b y(x) dx \quad \text{subject to} \quad \int_a^b \sqrt{1+y...
I have a question about direct and iterative method. Many people including me often say that for very large sparse linear system, Ax=b, an iterative method is necessary because of cpu memory. I also believe that ideas. But, recent days, I find that MATLAB direct methods command A\b for large sparse system is also fa...
In FEM/FV codebases, I stumbled upon the fact that the discretized functionspaces are represented within the code as a tree structure. I find this very puzzling. Example: lets say somebody wants to simulate the navier stokes equations. The codebase expects the discretized function spaces to be put into a data structure...
I've spent the whole day trying to figure out what is the correct way to impose (and implement) periodic boundary conditions $u(0,t)=u(1,t)$ for all $t>0$ for the simple advection equation $u_t + v u_x=0$, given an initial data $u_0(x)$, but I'm not sure if I'm correct. I need to understand what am I missing in order t...
Being $\bar{\mathbf{x}} \in \mathbb{R}^3$ a point and $S =\{\mathbf{x}\}_{i=1}^N \in \mathbb{R}^3$ a sample of N points. I am looking for a simple algorithm to determine the nearest point in $S$ in respect to $\bar{x}$ along a specific direction $\mathbf{\hat{u}}$ Thanks
I am trying to solve a system of SDEs in R using the Diffeqr package. Let's reduce the system to a simple ODE: # Packages library(tidyverse) library(diffeqr) library(JuliaCall) diffeq_setup() # Drift function f <- function(u,p,t){ du1 = p[1] return(c(du1)) } # Diffusion function g <- function(u,p,t){ du1 = 0 ...
Recently, I have been studied iterative methods for large sparse linear system Ax=b, where A is nonsingular, so there is a unique solution x. And the stopping criterion is usually chosen with norm(b-Ax_k)/norm(b)< tol (may 1e-6). But some situations may happen that matrix A is singular, for example, when solving Poisso...
I've generated a 2D O-mesh around an airfoil. Unfortunately, the mesh O shape is not a perfect circle as you can see in the figure below (in the figure I plotted only the mesh nodes in blue). The red circle is obtained using the smallest enclosing circle algorithm. My goal is to stretch the mesh nodes so the outer nod...
I am trying to follow the dynamic linear elasticity in Matlab, link here. My goal is to extract the FE Matrices using the function assembleFEMatrices in matlab and solve the resulting system of second-order ODE's by Backward Euler, for example. I am not having any success reconciling the result from solvepde with the r...
I am trying to take the numerical derivative of a dataset. My first attempt was to use the gradient function from numpy but in that case the graph of the derivative looked not "smooth enough". So I tried to calculate it with the savgol filter from the scipy.signal library but now I get a wrong scale: import matplotlib....
I am solving an 1-dimensional diffusion equation with Neumann boundary condition at outlet and constant concentration, C, at the inlet. In the end, I want to observe how the concentration diffuses over time along the x direction. $$\frac{\partial C}{\partial t} = D\frac{\partial ^2 C}{\partial x^2}$$ The following is ...
I have some 2D data and would like to find a line $y = mx + b$ such that a maximum number of points from the data is captured within the area between $y = mx + b + margin$ and $y = mx + b - margin$. Please see the image for an example (the yellow lines are boundaries, where margin = 20). If it helps, the values on th...
for a convection-diffusion equation with Dirichlet boundary conditions as follows: $$-u''+qu'=f$$ Using centered difference for $u''$ and $u'$, we get a linear system $$Ax=b$$where matrix $A$ is nonsymetric. Let $H = (A+A')/2,S = (A-A')/2$, we know that matrix $H$ is symmetric positive definite. Given a constant $\alp...
For CG method for SPD matrices, (Ax = b arising from Poisson equation with homogeneous boundary condition) we know that the convergence theorem: After m steps of iteration, the error $e^{(m)}=x-x_m$ satisfies the bound that $$\|e^{(m)}\|_A\leq 2(\frac{\sqrt{k}-1}{\sqrt{k}+1})^m \|e^{(0)}\|_A,$$$\quad k = cond_2(A)=\la...
I implemented a rather simple SPH simulation using a cubic-spline-kernel and a simple non-iterative pressure solver as described in this PDF in equation 9. I followed algorithm 1 of that paper (including gravity). The resulting particle behaviour is certainly fluid-like (with quite some compressibility as is expected f...
Assume I know that I can express an approximation of a function by $$ \sum_{l=0}^{k}\left( \sqrt{A_l} z_{l,0}^1 L_{l,0}(\theta)+\sqrt{2A_l}\sum_{m=1}^l L_{l,m}(\theta)(z_{l,m}^1 \cos(m\phi)+z_{l,m}^2\sin(m\phi))\right) $$ where $\theta$ is the inclination and $\phi$ azimuth, and $z_{l,m}^{1,2}$ are a sequence of indep...
I'm trying to optimize a binary portfolio vector to be greater than a benchmark using CVXPY. import cvxpy as cp import numpy as np # Generate a random non-trivial quadratic program. n = 10 # number of options np.random.seed(1) mu = np.random.randn(n) # expected means var_covar = np.random.randn(n,n) # variance-covar...
I'm interested in applying Robin boundary condition to a convection-diffusion problem in 1D. In the following system, $$\frac{\partial C}{\partial t} = D\frac{\partial ^2 C}{\partial x^2} - v\frac{\partial C}{\partial x}$$ $$\frac{\partial C}{\partial t} = \frac{\partial}{\partial x}( D\frac{\partial C}{\partial x} - ...
I am in a situation where as part of a sort of inverse power method scheme, I want to very often perform the following step: Apply a symmetric rank one update $uu^\top$ to my inverse matrix $A^{-1}$ Compute the QR decomposition of my updated inverse Right now, I'm using Sherman-Morrison-Woodbury formula to update my ...
My goal is to get audio from the input of another device (either connected to computer throught aux or audio interface threw rca or coaxil(from an external device playing audio live) adapters to line or something) and let a certain property (gain or volume, probably just volume) drive the animation of a 3d model (The m...
I want to ask a question about fast solver to the Poisson equation with Homogenous boundary conditions as follows: $$-\Delta u = f.$$ After centered difference using $n+2$ equidistance points in all directions, we get a SPD system: $$ Ax=b. $$ Let $T = \begin{bmatrix} 2 & -1 & & \\ -1 & 2 ...
Hybrid ELL-COO sparse matrix representation can be done as in the picture, I was looking intensively, however I couldn't find out what is the threshold of decomposing the original matrix into ELL part and COO part, how to divide the original matrix A ?
We know that for lagre sparse matrices, we can use compressed sparse row (CSR) or compressed sparse column (CSC) format to store the sparse matrices so that we can save CPU memory. And the coordinate format (COO) does not save memory. My question is that in MATLAB, a sparse matrix $A$ can be indexed for example, A(1,2...
I have a probability measure $\mu$ (say, in $\mathbb{R}^{d}$, with density) and I want to approximate it numerically. Today I noticed that my measure is ergotic for a certain Stochastic Differential Equation. If we call $x$ our starting point (asymptotically not relevant), to sample from $\mu$ I see two alternatives: ...
I have a system of chemical reactions where the rate equations represent a batch reactor model. The model is a system of ODEs which is solved with the SciPy solve_ivp function. My example (see below) currently contains 5 reactions but I need to add many more reactions from the overall scheme. With my current approach i...
I need to obtain the Eigenvectors of a general complex matrix, but with quadruple precision. Is anyone aware of a means to do this? I currently use Tux Eigen, and I see that in their unsupported modules, they offer arbitrary precision using MPFR C++, however this appears to be for real numbers only. Perhaps this could ...
I have been playing around with convolutions in scipy's signal package: N = 2**16 t = np.linspace(-4, 4, N) h = rect(t, -1, 1) scipy_conv = signal.fftconvolve(h, h, mode = 'same') scipy_conv = scipy_conv/max(scipy_conv) ax1.plot(t, h, label = r'$h(t)$') ax1.plot(t, scipy_conv, label = r'$(h*g)(t)$ (SciPy)', linestyle...
Question: Is there some pre-conditioner for Conjugate-Gradient (CG) cheap enough, that it is worth using even if my operator is very local (i.e. already has a low number of non-zero elements), as it is when fitting B-spline functions? or any other way how to improve the speed of CG convergence? Background: I fit funct...
I have been working on creating a few home-made numerical methods, and I am using them to visualize text-book problems from my Strogatz dynamics textbook. It feels like a good way to learn numerical methods and dynamics at the same time. A recent problem from the book deals with "Critical Slowdown" and is exemplified ...
I've been learning about butcher tables and am having some difficulty understanding how to translate them when it comes to implicit methods. Specifically, I'm looking at backwards Euler: \begin{array} {c|c} 1&1 \\ \hline & 1 \end{array} Now generally, I am aware of how implicit methods work. A to-be-determined value ...
I've been reading about the Discontinuous Galerkin discretization scheme and it's application to CFD for fluid flow. It seems to be a promising method for simulating turbulent flows, by using higher-order cells to mitigate the need to have extremely high mesh densities. I am just wondering if there are any commercial (...
I saved a sample of $N$ Cartesian locations $\{x_i, y_j, z_k\}$ inside a one-dimensional array $\mathbf{a} = \{a_l\}_{l = 1}^N$. How can I access back (efficiently) the $l$-location of the array $\mathbf{a}$ knowing just the three $i,j,k$ Cartesian indices? (Fortran/C++ examples would be helpful)
I've been trying to track this down, but google is giving paywall papers that don't appear to be directly related to computational science, or simply don't explain the source algorithm. There's an account on shadertoy that has been showing off this method, but does not know where it came from and got it from someone e...
scipy.linalg.solve, in its newer versions, has a parameter assume_a that can be used to specify that the matrix $A$ is symmetric or positive definite; in these cases, LDL or Cholesky are used rather than LU (Lapack's sysv and posv rather than gesv). Is there a similar interface for sparse solvers? As far as I understan...
I have been recently trying to attempt to write an algorithm in C# that would calculate the determinant of a matrix via recursion using the expansion of minors method. I understand that there are other methods such as upper and lower triangular forms which give the same solution, but for the moment I am trying to figur...
In matlab, there are 2 commands named "eig" for full matrices and "eigs" for sparse matrices to compute eigenvalues of a matrix. And eig(A) computes all the eigenvalues of a full matrix and eigs(A) computes the 6 largest magnitude eigenvalues of matrix A. If we want to compute all the eigenvalues of a sparse matrix, so...
Consider a line element in FEM. Let each node have 3 DOF. They are x and y translation DOF and temperature. Can we use interpolation functions of different orders for the translation DOFs and Temperature, like say, first-order interpolation function for translation DOF and second-order interpolation for temperature?
Assuming I have a computer representation of a graph presented in the figure below: How can I find out whether there are some close-loops inside the graph, like the one marked in red (or more complicated ones)? In other words I need to create an algorithm that will check if there are some "recurencies" in the graph. By...
When a CPU has $K$ steps the speed up of using pipelining compared to non-pipelining is $K$. But what I want to know is, say I am a CPU designer and want to decide whether I should build $K$ or $N$ steps, how do I know the speedup between having $K$ or $N$ steps? I figured that the theoretical speed would be the same ...
I am interested in solving a system of linear PDEs with the finite difference method and I'm having trouble to solve the no-flux boundary condition correctly. \begin{align} \frac{\partial n}{\partial t} &= D_n\nabla^2n - \nabla\cdot\left(\chi n\nabla c\right) - \nabla\cdot (\rho n\nabla f) \\ \frac{\partial f}{\partial...
(I originally asked this in a different exchange.) I'm writing a program that uses the prime-counting function. Right now, I'm using x/log(x), but I want to switch to something more accurate. A better approximation is the logarithmic integral function (actually, its Eulerian variant), which can be computed from the e...
Recently, I have been studied my lessons about gmres iteration, probably the most popular iteration method for general large sparse linear system of equations Ax=b. And the convergence is obtained under the condition of which the matrix A is diagonalizable, but in real applications, this is seldom the case where such a...
I'm doing CFD simulations in unstructured grids. Well, it's a bit different from conventional unstructured grids that are used mainly in FEM or FVM as tetrahedral meshes. Mine is a voxelized mesh of an unstructured surface, which is shown here as an example: The left image is my unstructured mesh and the right one is...
I am interested in problems of the form $$ u_t = F(u) + S(u) $$ where $F(u) = - div(f(u))$ and $S(u)$ is a stiff source term. I am looking for any existing works which develop Lax-Wendroff type schemes for such stiff problems using an IMEX approach to deal with stiff source. So far my search has yielded nothing more th...
Recently, I have been studying Krylov subspace iterative methods. I find the matlab robust command pcg and the new concept of the function handle to return a matrix-vector product. Then I use help pcg in matlab command window and find an example as follows: % compare the difference between two ways of definitions of ...
I'm interested in solving the following advection-diffusion system in a 1D network of pipes. $$\frac{\partial C}{\partial t} = D\frac{\partial ^2 C}{\partial x^2} - v\frac{\partial C}{\partial x}$$ To solve for the concentration of a solute in a 1D pipe of uniform dimension, without branches, I could use MATLAB's pdep...
As we know, for a symmetric positive definite (SPD) matrix $\mathbf{A}$, there is a theorem about the Cholesky factorization $\mathbf{A}= \mathbf{L}\mathbf{L}^T$, where $\mathbf{L}$ is a lower triangular matrix. I am a little curious whether the factorization $\mathbf{A} = \mathbf{L}^T\mathbf{L}$ exists for a SPD matr...
I'm trying to calculate the maximum step size that provides stability for the following nonlinear IVP using the Euler forward method: $u'(t) = -200tu(t)^2,\qquad u_0 = 1, \qquad t\in [0,3]$, with the analytical solution being $u = (1+100t^2)^{-1}$ (see figure below). From linear stability analysis, that is by solving $...
Watermark extension for Jupyter shows system and package information for reproducibility: CPython 3.7.1 IPython 7.8.0 numpy 1.17.2 scipy 1.3.1 sklearn 0.21.3 compiler : Clang 4.0.1 (tags/RELEASE_401/final) system : Darwin release : 18.7.0 machine : x86_64 processor : i386 CPU cores : 12 interpreter: 64b...
Is it possible to solve a linear matrix system $A x = b$ using the Newton-Raphson method? If yes, how can this be done? More special, how is the derivative build?
For a SPD matrix A, there exists Cholesky factorization $A=LL^T$ or $A=R^TR$, where L, R are a lower and upper triangular matrix, respectively. Also in matlab, there has a command R = chol(A) which produces $A=R^TR$. and another command L = chol(A,'lower') which produces $A=LL^T$. But when I implement these two comman...
I am searching a solution method for the following equation system of equation systems: Let $A, B \in \mathbb{R}^{n \times n}$ be s.p.d. Matrices and $O$ be the zero matrix of the same size. Further let $f\in\mathbb{R}^n$ be given vector and $0$ the zero vector. I am searching for a numerical method to find the soluti...
As far as I know, multigrid uses stationary iterative methods as smoothers (i.e GS), but can we use a direct method also? For example, in case we have a tridiagonal system (for example 1D heat equation), can we use Thomas algorithm with spatial coarsening (in a V-cycle for example). I know that using Thomas in this sp...
I have a somewhat peculiar Jx=R system that I need to solve. The matrix J is 2N -by- 2N. The first N rows have all entries filled. The next N rows are banded in two places, i.e. for the (N+k)th row, the (k-1,k,k+1)th and the N+(k-1,k,k+1)th entries are filled, and the rest are zero. There is absolutely no symmetry in t...
I would like to solve the following problem $$ \vec{v}(x,y)= k\, \nabla \theta(x,y) $$ with respect to the unknown function $\theta$. Parameter $k$ is just a real constant quantity. I have two matrices where I have stored the values of $v_x(x,y)$ and $v_y(x,y)$, which are the components of the 2D vector field $\vec{...
Suppose I rasterize a rectangle of width 2.5 gridpoints and get the values as shown: =============== | 0 | 1 | 1 | 0.5 | 0 | Now I resample that raster to a grid which is offset by 0.5 grid resolutions. The formula for resampling with offset by 0.5 pixels: a new pixel's value is the average of the old p...
I want to ask something about Chebyshev differentiation via FFT, which can be used to obtain with spectral accuracy the derivative of a smooth function. See for instance this code in python, which performs the derivative of a given function "u" in the domain [-1,1] and computes the L2 norm of the error. from numpy.fft ...
I entered an instruction to calculate the coordinates of a vector after a change of basis in order to repeat it many times with various vectors. X0=[1;1/2] is a set of coordinates in the initial basis and P=[-4,2;1,1] is the new basis expressed in the initial one. When I compute P^(-1)*X0 I get : ans = [-2.776D-17 ; 0...
I am new in Domain Decomposition method. I am started to solve $-\Delta u = f$ in $\Omega$ and $u = 0$ on $\partial\Omega$. From that I get in $\Omega _1$ $$\begin{bmatrix}4&-1\\-1&4\end{bmatrix} \begin{bmatrix}u_1 ^{k +\frac{1}{2}}\\u_2 ^{k +\frac{1}{2}}\end{bmatrix} = \begin{bmatrix}f_1-u_3 ^k\\f_2-u_4 ^k\end{bmatrix...
Consider a time dependent pde(i.e u(x,t)).I know when only space-coarsening is used the standard multigrid performance can be applied but what if instead we use only time-coarsening?Can we apply the standard multigrid for solving the spatial problem in order to take one time step(i.e going from t1 to t2)?
Short question: how to ensure that extra points are not included as 'boundary' points after calling the refine function. More details. I am working with a hexahedral mesh in $3$d. Let $X$ be the set of mesh points. The mesh describes a connected object with an irregular geometry, but is flat in the sense that if $\pmb{...
My question is if I can calculate the transformation matrix between two sensors. Each sensor provides a $4\times 4$ matrix for every timestep recorded. The sensors are moving and have some noise in the data. I would like to calculate the best fitting transformation matrix between the two sensors with the given data bec...
First of all, I hope you accept my apologizes if my question seems off topic here. But, I asked this question in ParaView forum and after a week still I did not receive any response yet, so I'm wondering if I could find an answer hopefully here. Background: I'm using lattice Boltzmann method to do simulation of blood f...
It is an idea that dates back to Demmel, 1987 that the condition number of a problem is often related to the distance to the closest ill-posed problems. In Section 3 of the above paper, the author cites as examples linear systems/matrix inversion (1/condition number = relative distance to the closest singular matrix), ...
In lattice Boltzmann method, we have a concept, which is called pseudo-compressibility and it is defined based on the fact that LBM simulates incompressible flows by having small Mach number to ensure density fluctuations in time (or pressure fluctuations in time) are not that big. Note, that introduced Mach number her...
In a question, we have been given the speed of a car at time t= 0,2,4,6,.......,20 minutes.But it asks us to approximate the distance travelled by the car in 30 minutes using Composite Simpson's rule. I do not understand how that can be done as so far I have come across problems where I have been asked to approximate ...
For elliptic PDEs (Poisson-type), the multigrid method is very sufficient, but how about time-dependent problems (i.e parabolic or hyperbolic PDEs)? Is it efficient to solve such problems using a multigrid method? Somewhere I read that for very small time steps a classical iterative method (i.e GS) may be a better opti...
I have the following system of differential equations: $$ x' = ax- cy + e1 $$ $$y' = by- dx + e2 $$ for variables $x,y$ and parameters $a,b,c,d,e1,e2$. I'd like to solve this in python, which is easy enough with odeint. def f(y, t, params): weaponsC1, weaponsC2 = y a, b, c, d, e1, e2 = params t_0 = 10 ...
During my PhD work, I had to use tabulated values of thermodynamic properties of gases in some Computational Fluid Dynamics (CFD in short) simulations. My tables are discretized in temperature and pressure (which are the independent variables) as reported in the scheme below: So I had to reconstruct an approximation ...