instruction
stringlengths
43
28.1k
A typical 2D Poisson PDE is given as $$\nabla^2\varphi(x, y)=f(x, y)$$ where the Laplacian term, $\nabla^2\varphi$, can to some degree be interpreted as the kinetic energy (given proper scaling) (Laplacian term in the Schroedinger-like equations, such as Ginzburg-Landau or Gross-Pitaevskii). However, in the mentioned e...
Polyharmonic equations, to my understanding, are defined as: $$\Delta ^k u = 0$$ i.e. one repeatedly applies the laplace operator to the function a certain number of times and the result must be 0. The system can be discretized quite easily using finite differences or in the case I care about, triangle meshes, using th...
I'm currently studying aerospace engineering, and I'm attempting to create a ground track plot in Python using data from a TLE file. I'm doing this without relying on explicit packages like AstroPy or skyfield. Instead, I'm using Gpredict and the Beyond package to compare my plot with the actual one generated by these ...
Lets consider a range of "K" binary digit numbers. In that range, we want to take a subset of those values which have (<="n" consecutive 0s) AND (<="n" consecutive 1s). Then, we want to find the order of values in the resulting subset incrementally. Also, we want to do the "un-ordering" of the values. i.e. find the val...
I'm trying to model fluid-structure interaction of cylindrical energy harvesters in various arrangements. I have chosen OpenFOAM for the fluid part but I have no clue which framework to use for the solid modelling. The cylinders are supposed to be able to undergo large nonlinear deformations. I want to know which frame...
I am reading through the documentation of matlab function eigs specifically the function handle input version. Here it is: https://www.mathworks.com/help/matlab/ref/eigs.html#bu2_q3e-Afun I don't understand what this function is supposed to do. Does anybody know? I have a piece of matlab code not written by me which us...
I am attempting to calculate the Madelung constant for NaCl using an Ewald sum derived by Nijboer. There are other methods and published codes to do this, but I am specifically interested in working within Nijboer's framework for a more complicated problem unrelated to a Madelung constant. Ref: Nijboer, B. R. A., De We...
I am looking for a library (don't care about the programming language) that performs the following two tasks as quickly as possible: Compute the coefficients of the product of a set of degree 1 polynomials Evaluate a polynomial at a given set of points (multi-point evaluation) Everything happens modulo some integer. ...
This is something I've never thought too much about because it seemed like an unnecessary micro-optimization, but I've come across a situation where this computation is actually the primary bottleneck in my code, so I figure it is worth it to think about whether this can be improved. I'm simulating a model on a 3D cubi...
I'm reading a program about computational plasticity, this program use frontal solver to solve the program, but I'm not familiar with frontal solver even after reading some papaers, so could you please recommend some papers about frontal solver that has: (1)detailed algorithm about the storage of non-symmetric stiffnes...
I have a Python program (available on github) that uses naive gradient descent to find approximate solutions to the Thomson Problem. It works surprisingly well, but I've been wondering if there's a way to speed up my gradient descent implementation. The relevant code snippet is the one below: given a set of points in n...
The PETSc documentation example of a non-linear solver call has the user provide separate functions for the Jacobian and function evaluations: PetscCall(SNESSetFunction(snes, r, FormFunction2, NULL)); PetscCall(SNESSetJacobian(snes, J, J, FormJacobian2, NULL)); In my case, it would be most convenient to comput...
I am new to computational fluid dynamics, and am having a tough time implementing the Book and Boris flux limiter SHAS2D model. I am attempting to re-create the SHAS2D fluid code to solve the Euler equations. The algorithm for the code is found in the appendix of this paper (Equations A6 to A17): D.L. Book; J.P. Boris;...
I am studying the time-integration of the following paper, Young, L. C. (1981). A finite-element method for reservoir simulation. Society of Petroleum Engineers Journal, 21(01), 115-128. A copy (PDF) can be found on the author's ResearchGate: https://www.researchgate.net/publication/236367847_A_finite_element_method_...
Some time integrators, notably the Runge-Kutta-Chebyshev method, implemented in the RKC code from Sommeijer & Verwer, gives the user an option to provide a callback with an estimate of the spectral radius of the Jacobian matrix, $J = dF/dy$. (I'm not aware if the Julia version of RKC in DifferentialEquations.jl also pr...
I am trying to model a physical system by (lets say the system is a long deformable object, on which I can apply forces). It can be described by Cosserat Rod theory and discretized, by modelling it trough several spheres. If I now apply forces on one of the spheres, to me it seems, like the force reaches the other sphe...
I aim to solve the (non-linear) Schrodinger equation using the Crank-Nicolson method in Python. Here are my two functions. def diags(N, dt, dx): Adiag = sp.empty(N) Asup = sp.empty(N) Asub = sp.empty(N) bdiag = sp.empty(N) bsup = sp.empty(N) bsub = sp.empty(N) Adiag.fill(1 + dt/dx**2) A...
I am using comsol to model a linear elastic materials and perform a frequency domain study. I try to understand the equations it provided but all symbols are not explained. For example, How should or where can I find the documents to explain these symbols?
I am solving the linear elasticity equation within a FEM library with a complex 3D geometry. The resulting linear system is solved with CG, preconditioned by AMG (Algebraic Multigrid). The computed numerical solution is correct. However, when running the program with different numbers of processors, say going from 5 to...
I'm trying to build a pure python distributed numerical algebra computation kernel based on GPU. but after I've learnt most of the software engineering, I realise that I'm seriously lacking in computational theory. Does anyone have any recommendations for books or materials? So far I have implemented a distributed matr...
For a nonsymmetric matrix, we can solve { A^T @ A x = A^T b } by lsqr or cgls or something else. Usually it will be slow, so we need a preconditioner either ilu, multigrid or something else. Is there any good source for comparison of different preconditioners with python implementation? And what combination of solver/p...
Let's say we have a weighted least squares problem under the same matrix $A$ such that, $$\hat{x} := \arg \min_x ||A x - b||_{W_1}$$ where $|| \cdot ||_{W_1}$ is the Euclidean norm weighted by diagonal elements in $W_1$. We can solve this easily by performing a $QR$ decomposition of $W^{1/2}_1 A$ together with $W^{1/2}...
I often use diverging colormaps (like the Paraview default "cool-to-warm") with a color range that is symmetric around zero, e.g. to visualize areas of tensile (red) and compressive (blue) stress with stress-free areas in a neutral color. For this, I have to adjust the "Custom Data Range" by hand every time I load a ne...
I have a set of halfplanes $H$, and a target vector $T$. My goal is to find the vector $v$ closest (2-norm) to vector $T$, such that $v$ is in the intersection of all of the halfplanes. This can be reduced to a simple linear program, as each constraint on a halfplane can be represented as $ax+by\le c$, and the optimiza...
In this paper, the authors describe how to use locally rigid transformations (sampled on nodes in space) to deform mesh vertices. In the paper, rotations are relative to the pivot point, which corresponds to the node's position in world space. I wonder why the authors chose this formulation and what would change if we ...
I'm reading paper 1 and on page 4 they define the integral operator $\mathcal{K}$ as $$ (\mathcal{K}(a;\phi)v_t)(x) := \int_D \kappa(x,y,a(x),a(y);\phi)v_t(y)dy $$ Now in an another paper from the same group, they define the integral operator $\mathcal{K}$ on page 8 as $$ (\mathcal{K}v_l)(x) := \int_D \kappa(x,y)v_l(y...
Schwartz type domain decomposition techniques require a transmission condition which can be hard to come by. Mortar type techniques enforce continuity with a Lagrange multiplier across domains. Are there limitations to this approach?
In chapter 7 of Numerical Computation of Internal and External Flows (Second Edition) (https://www.sciencedirect.com/science/article/abs/pii/B9780750665940500497) the author describes the diffusion error as the ratio of the magnitude of the numerical amplification factor, which I will call $( G_{numeric})$, to the magn...
I'm new in the multigrid approach and I'm trying to implement an algorithm from this paper: https://www.researchgate.net/publication/242913687_A_Multigrid_Algorithm_for_the_p-Laplacian I'm stuck with the construction of the restriction operator $R$. I see people recommending taking $R = I^T$, where $I$ is my interpolat...
I am new to the topic " Algebraic Grid Generation". I want to find a simple example where we solve the host equation, let us say the heat equation, numerically in the computational domain then transform it back to the physical domain. All the references I found discuss the general steps without providing a single pract...
I was wondering how computationally expensive it is to compute an image convolution. That is, to convolve an NxN image with a 3x3 or 5x5 convolution filter? It seems like this would be a costly operation, because there is a lot of multiplication and then additions. However, I imagine that some of these operations have ...
I am trying to simulate LLG equation without damping. The equation is $$\frac{d\vec{m}}{dt} = \vec{m}\times\vec{H}$$ I am solving in spherical coordinates as LLG equation is known to have problems in rectangular coordinates. My output should look like sine wave for all three components of the $\vec{m}$. Instead I am ge...
When solving for a given PDE, how is the entropy taken into account? Does the fluxes has another form? Or is the entropy PDE for a given entropy-flux included in the solver?
I was looking at various research papers and most of the researchers use CasADi, YALMIP, MPCTools to implement MPC. My question is "Why researchers use MATLAB based YALMIP or CasADi for MPC rather than using only built-in options like MATLAB, Simulink or the MPC Designer app?"
For two-dimensional or three-dimensional elliptic equations, when will the stiffness matrix be asymmetric and positive definite? This affected the solution efficiency so much that I had to choose an appropriate preconditioner based on the stiffness matrix.
The LU parallel computation theories I've seen are based on $M\times N$ mesh computations, is there a theory for one dimensional device mesh LU parallel decomposition? For example, $A$ is a matrix. we have p device, we decompose $A = [A_1, ..., A_p]$. That means, if we have only 2-3 devices involved in the computation...
I am interested in using Gaussian processes as emulators for other computational models, and I would like to characterize the expected numerical precision of the emulator. Specifically, how small can $|\hat{y}_{\mathrm{emulator}} - y_{\mathrm{model}}|$ be made given the limitations of floating point computation. Second...
I am going to solve an equation containing an exponential matrix $e^{tA} x =b$, which can be obtained naturally through $x=e^{-tA} b$. A is a 1million $\times$ 1 million matrix with stores 7.15 million elements. However, accurately computing a matrix exponential $e^{-tA}$ requires very high computer memory. Although th...
I'm currently using ode15s to solve a set of stiff differential equations. I am trying to use the MATLAB profiler to understand the section of the ode solver code which calls BLAS routines. Since the instances in which BLAS routines are called by ode15s are not explicit, I want to use CVODE in Sundials solvers. However...
For this electrical circuit: The voltage $ V_D $ can be found by solving a nonlinear equation: $$ \frac{V_{DD}}{R} - \frac{V_D}{R} - I_se^{V_D/V_T} = 0 $$ In this example, let $R=1000$, $V_T = 0.025$, and $I_s = 10^{-13}$. I want to solve this equation using Octave in the range $0<V_D<20$ with a 0.01 step. Thus far, I...
I have implemented 1D mesh parallel QR decomposition and LU decomposition,I would like to ask if a linear equation Ax=b,b is a large matrix and I need to shard b or Shard A,b at the same time. Is there any math theory to do that?
NOTE: This code is a piece of code I am using for a master's thesis, so I do not expect someone to do the work for me, but I gladly accept suggestions of any kind. However, I am trying to get the model in this paper implemented using a Fourier transform-based method alternative to the classical FFT, namely the COS meth...
Suppose that I have a convex regular polygon with $k$ vertices on the complex plane, and the first vertex lies on the positive real axis. Is there a neat way to formulate the convex hull with the shape of regular polygon and make it acceptable for CVX solver? I could take the intersection of the half-spaces of each sid...
Consider a convex QP of the form $$ \min_x \bigl\{\tfrac12 x^\top Q x + q^\top x : Ax\leq b\bigr\}\tag{P} $$ with dual $$ \min_y \bigl\{\tfrac12 (A^\top y + q)^\top Q^{\dagger} (A^\top y+q) + b^\top y : y\geq0\bigr\}.\tag{D} $$ Suppose that when solving the problem with an iterative method (interior point method, augme...
Is the first-order Modified Patankar–Euler scheme (MPE) an implicit or explicit method? Is there an open-source code implementing the MPE scheme for a system of ODEs?
New to Gmsh. I am trying to create a very simple mesh that is essentially two cylinders merging into one. So I added two parallel cylinders first (a bit farther from each other). Then I extruded (slanted) the right surface of each along with the circular boundaries. Then I translated everything of the bottom tube up so...
I am trying to solve the ODE of a free fall including air resistance. I therefore defined my ODE as: def f(v, g, k, m): return g - k/m * v**2 which in my opinion should represent the system correctly because m*a = m*g -k*v**2 where a=vdot. Now I solve this ODE using the explicit Euler method like this: h = 0.1 t ...
I am trying to implement (constrained) minimization of a certain function with the augmented Lagrangian method. Where can I find a reference that discusses in detail the good practices for the various algorithmic parameters? For instance: the increase rate for $\mu_k$, the initial value for the Lagrange multipliers, th...
I'm looking for a well-thought quadrature rule for this measure $d\mu(t)=\frac{dt}{t^s}$ for $s\in(0,1)$, the underlying motivation is to compute this integral $$ \lambda^{s-1}=\frac{1}{\Gamma(1-s)}\int_{0}^{\infty} e^{-t\lambda}\frac{dt}{t^s} $$ with $\lambda > 0$, see this reference, Page 5, equation (5), https://arx...
I am applying Newton's method to solve the following nonlinear equation systems $F = 0$: \begin{equation} F = \left[\begin{array}{l} \sqrt{(x_0 - x_4)^2 + (x_1 - x_5)^2} - 6 \\ \sqrt{(x_0 - x_2)^2 + (x_1 - x_3)^2} - \sqrt{(x_4 - x_6)^2 + (x_5 - x_7)^2} \\ \sqrt{(x_0 - x_2)^2 + (x_1 - x_3)^2} - \sqrt{(x_2 - x_4)^2 ...
I am trying to solve this system of nonlinear equations using Newton-Raphson method with continuation (zeroth-order continuation). $F_1(x, y, \xi, \nu) = \left(1 - \frac{1}{\nu}\right) \left(1 - x\right) - \left(1 - \frac{1}{\nu}\right) \left(1 - y\right) + \log{\left(x \right)} - \log{\left(y \right)} + \frac{\left(1 ...
Is there a way to compute the weighted vector inner product xAy with vectors x and y and Matrix A using BLAS/LAPACK while avoiding additional allocations or overwriting the inputs? I'm happy with answers that assume A is symmetric or x=y.
I'm trying to create a loop for a probability distribution. My initial condition is $p_0 = (1, 0, 0, 0, 0)$, $T$ = [0 1/3 1/3 1/3 0; 1/2 0 1/2 0 0; 1/3 1/3 0 1/3 0; 1/3 0 1/3 0 1/3; 0 0 0 1 0], (T is a five by five matrix) and I am trying to find the probability distribution for the first 50 steps my using $p_n = p_0*T...
I am trying to solve the following PDE using the method of lines to discretize space, and then solve it as system of ODEs at each point in space using ODE15s: subject to and initial condition $w(z,t=0) = 0$. I know this must be possible because the paper I'm reading has done this, but I cannot find how to reproduce i...
I am new to Monte Carlo integration and have been tasked with using MC integration in order to calculate the volume of a torus with inner radius 5cm and outer radius 10cm. Below is the code I have used to plot a 3d torus, however what I need to do now is plot an array of random 3d points within the figure window and de...
I have finished testing basic large densely parallel matrix multiplication on 4 gpu's ,and have done work on TSLU and TSQR on cpu's based on mpi. I am going to continue working on the theory of parallel computation of sparse matrices. As far as I know, there are compression formats for sparse matrices like CSR, and the...
I have the following PDE originating from a biphasic drying model, where $\xi \in [0,\Xi]$ is a radial coordinate attached to the dry skeleton of a wet cylindrical body: $$ \frac{\partial u}{\partial t} = \frac{1}{\xi}\frac{\partial}{\partial\xi}\left(\xi D_\xi \frac{\partial u}{\partial \xi}\right), \quad D_\xi = \fra...
I've come across several texts/papers utilizing the concept of a minimum potential energy state corresponding to an equilibrium state, and I know that it is used in FEM formulations that are based on variational/energy methods. My question is, does the weighted residual method not minimize the energy at any step?
I'm trying to generate a mesh which has inlet and outlet boundary conditions at the top (not included in the code below). I need the mesh to be whole, but the issue is the transfinite surface as gmsh is reading the input as 'not a rectangle'. Ideally the whole thing is one surface and a 2D mesh can be generated inside ...
I'm quite interested in this field, Is there any papers about simulating the damage of material(such as alloy) under supersonic combustion, after searching for a while, I didn't find anything
Using the Chebyshev derivative matrix $D$, we can numerically approximate the first and second derivative of a function by doing matrix multiplication: $${df(x) \over dx} = Df(x) \tag 1$$ $${d^2f(x) \over dx^2} = D^2f(x) \tag 2$$ where $x \in \{x_0,x_1,...x_n\}$, $x_j=\cos(j \pi/n)$, $j \in \{0, 1,...n\}$. When we want...
I've been attempting to create a model of a heliocentric orbit based on Newton's law of gravitation: $$ \frac{d^2 \vec r}{dt^2} = -\frac{GM}{|r|^2} \hat r $$ This is what I have so far: import numpy as np import matplotlib.pyplot as plt # Heliocentric orbit u0 = np.array([0.0, 1.515e11, 0.0]) # Approximately 31 km/s ...
As you see this mode is not right, unless for what i understand And the initial conditions were kth_zero = jn_zeros(0, 1) # Obtiene el primer cero de la función de Bessel de orden 0 Z = np.cos(phi) * jv(1, kth_zero * R / radio) # Utiliza el primer cero para J_0 u[0, :, :] = Z.T# conidición incial para tiempo 0 #u[1,...
Suppose we want to calculate $\sqrt{a^2+b^2}-|a|$ in MatLab. Using sqrt(a^2 + b^2) - abs(a) will have some problems: If a or b are too large, it may cause overflow if a and b are too small, it may cause underflow if a>>b, a^2 + b^2 may be equal to a^2 in machine What's a more stable algorithm to calculate this withou...
I have a (closed, manifold, oriented) triangular mesh for which I build a matrix $L\in\mathbb{R}^{n\times n}$ discretising the negated Laplace-Beltrami operator. The matrix $L$ is symmetric positive semi-definite. For small $n$ I can compute the eigendecomposition $L=VDV^*$. Then the counterpart of a Fourier transform ...
I came across the following slide by Theo Diamandis & Zachary Frangella on what makes the linear system $Ax=b$ easy to solve using the conjugate gradient method. Transcription: CG converges quickly when The condition number of $A$ is small The eigenvalues of $A$ are clustered Why is this the case? I suspect this...
I am working in the sphere of orbital simulations, where orbital trajectories are computed using the differential equations describing gravity. Due to the great timescales of orbits, a step size of minutes or even hours is common, that is dt = 60 or dt = 3600. Now here is my problem. Consider the following example diff...
I need to solve many small Toeplitz systems that fit entirely in cache, meaning the computation is compute bound. Are there vectorizable algorithms for this? I found a few older articles: (https://www.sciencedirect.com/science/article/pii/S0377042702009111) but they parallelise in a strided way, which is not suitable f...
I would like convert decimal octal numbers on sharp EL-531TH (or any other) caclulator but when I enable the octal or any other non-decimal function, the decimal key or dot key (marked with red) is disabled. How to do that conversion with a decimal point on a Sharp calculator? When I want to convert, for example 35.685...
I was reading about the 2D Gaussian-blur convolution kernel. A Gaussian vector is a vector where the elements follow a Gaussian distribution. In my case, the kernel is symmetric and hence we take a dyadic product (outer product) of the Gaussian vector to obtain the kernel for 2D. A sample Gaussian kernel implementation...
Apologies if this is the wrong forum to post this question in - I truly don't know where else I would (if you do, please let me know!). But essentially, I am not a mathematician, though I was reading up on the various technological advancements of calculating technology and had the following thought: The TI-84Plus was ...
I am trying to solve the wave equation $$ {\partial ^2u(t,x) \over \partial x^2} = {\partial ^2u(t,x) \over \partial t^2} \tag1 $$ with the following boundary and initial conditions: $$ {\partial u \over \partial x} \Bigg |_{x=0}=0 \tag 2$$ $$ u(t,1) = 0 \tag 3 $$ $$ u(0,x) = 0 \tag 4 $$ $$ {\partial u \over \partial t...
Currently I am trying to solve nonlinear Ricatti equation using FEM (Matlab language): $$\frac{d r(z)}{dz} = i k(z) r(z) + \frac{i k(z)}{2}(\epsilon(z) - 1)(1 + r(z))^2$$ $z = [-h/2, h/2]$ and $r(-h/2)=0$. $$k(z) = 2\cdot \pi\cdot n(z)/\lambda$$ $$n(z) = 1 + sin(\pi\cdot(\frac{z}{h} + \frac{1}{2}))$$ $$\varepsilon(z) =...
I was in touch with Mathematica development team and they indicated that currently Mathematica is not capable to determine whether $$ Sum[Binomial[n - 1, n - i] Sum[Binomial[k + i, i] Binomial[n - 1, n - k], {k, 0, n}], {i, 0, n}] $$ = ? $$ (-1)^n*((-4*n^2 - 16*n - 28)*JacobiP[-1 + n, -1 - 2*n, 2, -1/2] + JacobiP[-2 + ...
I'm trying to repeat a level set FSI problem on the book <Level Set Methods for Fluid-Structure Interaction>, on the page 89, the provided freefem code define a weak form of the discretized equation the algorithm is the $F$ is defined as $$ F=\operatorname{div}\left(E^{\prime}(|\nabla \varphi|)|\nabla \varphi|\left(\...
Many players in the field of engineering simulation software are investing on digital twinning and reduced order modeling techniques, meaning that the field bears potential. I was wondering if among the various subflavours - POD, reduced basis... - there is one in particular that is spreading more than the others, or t...
Consider the following equation, subject to homogeneous Neumann boundary condition. $$ u_t = \Delta u + f(u). $$ The weak formulation is as follows: $$ (u_t,w) = (\Delta u, w) + (f(u),w), \quad \forall w \in H^1(\Omega). $$ The standard finite element scheme is: $$ (u_{h,t},w_h) = (\Delta_h u_h, w_h) + (f(u_h),w), \q...
Consider $$\begin{aligned} \partial_t v + b\cdot \nabla \phi &=0 \\ \partial_t \phi + b\cdot \nabla v &= 0 \end{aligned}$$ for $v:(x,y)\mapsto \mathbb{R}$, unknown and time-dependent ($\phi$ similary), and $b\in \mathbb{R}^2$ given, and divergence-free. A weak form in $H^1$ is $$\begin{aligned} \int \partia...
I have a simple questions on terminology. Is there a difference between softening length and smoothing length? I have been using the 2 terms interchangeably as the minimum distance between particles for calculating particle interactions, and have not found any direct comparison of the 2 terms. For context, I use comp...
Suppose $\mathbf{x}$ is a random variable in $n$ dimensions, and $u$ is a vector. How can I estimate the following quantity in an online fashion? $$f(x)=\max_{\|u\|=1} \frac{ E\left[\langle u\cdot x\rangle ^4\right]}{E\left[\langle u\cdot x\rangle ^2\right]}$$ For a simpler problem of finding $\operatorname{argmax}_{\|...
Need help with the code to estimate the Madelung constant for CsCl lattice: Cs at (0,0,0) Cl at (0.5, 0.5, 0.5) Answer: Converged value I am getting is 0.465. However, the correct answer is approximately 1.763. What am I doing wrong? Code as below. M = 0 L = 10 for i in range(-L,L+1): for j in range(-L,L+1): ...
I am looking into the finite volume method and I have come to a problem with discritisation. Suppose I am looking at a particular cell(I'm dealing) with cartesian grid. at the points $(X_{i},Y_{j}),(X_{i+1},Y_{j}),(X_{i+1},Y_{j+1}),(X_{i},Y_{j+1})$. Call the edges of the call $e,n,w,s$ using the usual notation for FVM....
In Python / Matlab, if you run a routine for SVD on a significantly non-square matrix, X, such as X.shape = (2,15000) you will get significantly longer run time than on a matrix with X.shape = (800,1000), even though 2*15000 = 30000, and 800*1000=800000. That is the second matrix clearly has much more terms with which ...
Suppose that we have a $n\times n$ matrix $A$. We have its LU-factorization as $A=LU$ (or $PA=LU$ that $P$ is a permutation matrix). Now assume we change the last column of matrix $A$ and denote the new matrix as $A^\prime$. What is an efficient algorithm to find the LU-factorization of $A^\prime$ as $P^\prime A^\prim...
I am here once again searching for wisdom, as some of you might notice I asked a related question a few days ago. And now I am struggling to add a forcing term at the center of the membrane, in order to recreate the Circular Chaldni figures, unless as at first approximation. The idea is that with my original code see w...
I wrote this code to find Cholesky factorization of a symmetric positive definite matrix in MatLab: function L = cholesky(A) n = length(A); L = zeros(n, n); for i=1:n l = L_solver(L(1:i-1, 1:i-1), A(1:i-1, i)); L(i, 1:i-1) = l; L(i, i) = sqrt(A(i, i) - l.'*l); end end Which L_so...
Consider $n$ apps and $m$ transactions. $x_{ij}$ is a binary variable, it takes 0 or 1. $x_{ij}$ takes 1 if $i$th app is used for $j$th transaction, else 0. min $\sum_{i=1}^{n}\sum_{j=1}^{m} x_{ij}$ subject to $\sum_{j=1}^{m} x_{ij} \leq 0.25m$ $\sum_{i=1}^{n} x_{ij}$ = 1 $\forall i'$ max($x_{i'j}$)=1 $i'$ = apps thro...
For a project I'm working on, I was working with the following equation $$ w(x) = \int k(x,y)v(y)dy $$ I noticed that if I choose $$ k(x,y) = -\delta'(x-y) $$ Then we probably get (I haven't touched Dirac delta functions for years, please correct me if I am wrong.). $$ v'(x) = -\int \delta'(x-y) v(y)dy \tag{1} $$ Wher...
I am doing some simulations on various systems expressed in 2nd quantization and one of the points of interest of mine was Phase transitions in the Bose-Hubbard model $$ H = \sum_{k} \{ t_k(b^\dagger_{k} b_{k+1} + b_{k} b^\dagger_{k+1}) + U(n_{k}^2 - n_{k}) + \mu n_{k} \} $$ Assuming a linear chain where the bosons are...
Cross posted on StackOverflow I am trying to use the gsl library for calculating 1F1. I have some C code. The following works and matches Mathematica's results for small real arguments z but not large arguments: /* file 1F1.c */ #include <stdio.h> #include <stdlib.h> #include <gsl/gsl_sf.h> #include <gsl/gsl_math.h> ...
I take a plot of father wavelet with this code library(wavethresh) y <- c(1,1,7,9,2,8,8,6) ywd <- wd(y, filter.number=1, family='DaubExPhase') plot(ywd) But the terminal returns: 7 7 7 what this 7 7 7 mean? I try to search in the documentation (link) but without success. Thanks.
I am trying to solve a linear system of ODEs of the form: $$ \frac{du}{dt} = A u, \quad u(0)=k$$ where $A$ is a 2x2 matrix and $u(t)$ is a 2x1 column vector. I want to solve this numerically, using Euler forward scheme, which means that I will use finite differences to approximate the above equation this way: $$ \frac{...
I am dealing with the integro-differential equation for Wigner function, $$\frac{\partial f}{\partial t}+p\frac{\partial f}{\partial x}+\\+\frac{1}{\chi}\left\{\int_{-\pi}^{+\pi}dy\,\int_{-\infty}^{+\infty}dk\,V(y)f(y,k,t)\right\}\left[f\left(x,p-\frac{\chi}{2},t\right)-f\left(x,p+\frac{\chi}{2},t\right)\right]=0.$$ He...
I'm given the 1-step implicit scheme $$y_{n+1} = y_n + \frac{h}{6}[4f(t_n, y_n) + 2f(t_{n+1}, y_{n+1}) + hf'(t_n, y_n)],$$ where $y'(t) = f(t, y)$, and I'm seeking the scheme's local truncation error. I've been able to use a Taylor series to get that $$e_n(h) = hy'(t_{n+1}) - \frac{h^2}{2}y''(t_{n+1}) + O(h^3) - \frac{...
What would be the approach to numerically solve for $\rho(x,t)$ the following equation with some initial conditions $$\frac{\partial\rho}{\partial t} +\sum_{i=1}^n\left(\frac{\partial(\rho g_i)}{\partial x_i}\right)=0,$$ where $x = [x_1 ... x_n]^T$, $\dot{x}=g(x,t)$ and $g(x,t) = [g_1(x,t) ... g_n(x,t)]^T$ is given? Th...
Im currently using a MUSCL scheme with a rusanov flux and Van Leer limiter to simulate the 2d euler equations: $$ \frac{\partial \rho}{\partial t} + \frac{\partial \rho v_x}{\partial x} + \frac{\partial \rho v_y}{\partial y} = 0 $$ $$ \frac{\partial \rho v_x}{\partial t} + \frac{\partial (\rho v_x^2 + P)}{\partial x} +...
Upon solving the 2D wave equation with Neumann boundary conditions $u_x = u_y = 0$ on a rectangular $10 \times 10 \times 10$ grid, I noticed something odd - $u$ seemed to shift upwards with time. This can be demonstrated with the following plot of two time slices: In fact, the value of $u(x, y, t)$ shifted on average ...
I am studying knowledge related to lumped mass finite elements. As is well known, lumped mass finite element methods higher than 2nd order on simplex mesh require the construction of new function spaces (here). Specifically, on elements in the $k$-th order space, it is necessary to add bubble functions of order $k^{\pr...
Setup The 1D convection-diffusion equation is given by: \begin{equation}\tag{1} \frac{\partial u}{\partial t} + v \frac{\partial u}{\partial x} - \mu \frac{\partial^2 u}{\partial x^2} = 0, \end{equation} where $u$ is the solution variable, $v$ is the convection velocity, and $\mu$ is the viscosity coefficient. Spatial...
I am attempting to implement a model outlined in this paper: General magnetostatic shape–shape interactions Background This model allows the calculation of magnetostatic interaction energies between objects of arbitrary shape. In the model, an object is defined as a three-dimensional array $D(\pmb{r})$ which is equal...