instruction
stringlengths
43
28.1k
I have a class of integrals I need to solve numerically which have the form: $$ I_k = \int_a^b \frac{p_k(x)}{x^k} dx, \quad k = 0, 1, \dots, K $$ where $p_k(x)$ is a cubic polynomial on the interval $[a,b]$. I have tried Romberg integration which unfortunately does not produce satisfactory results. Does anyone know of ...
I am studying introduction to Multigrid methods. In all tutorials, authors write that eigenvectors of Laplacian (1D, finite difference) are given as $w_k(x_i) = \sin(k \pi x_i),$ where $x_i$ is a discretization point. Can anybody point me to literature which derives this formula? Or can anybody sketch the derivation?
I'm new in Particle Physics based Computing. I want to simulate an ADS experiment (Accelerator Driven System) in subcritical fast system. I was advised to simulate the experiment with FLUKA with MCNP being coupled with it. On the otherhand, I saw CERN now uses Flair more than FLUKA. is FLUKA and Flair same and if someo...
I'm studying the Finite element method for structural mechanics, and I'm reading this source. 3rd degree polynomials are used as shape functions for beam theory, since they are required to be continuously differentiable to the 4rd derivative. It is said: If such a polynomial is used to derive the shape function, the s...
I'd like to make a web application that lets people play with solving ODE systems, changing parameters with sliders etc. but instead of doing the computations on the server side, solving the equations on their own computer via the web-browser. There's some really nice examples here: http://blog.littleredcomputer.net/je...
I have this function $y = \exp(-x)$. I have a list of $x$ values and corresponding $y$ values. X = [-3., -2., -1., 0., 1., 2., 3., 4., 5., 6.] Y = [20.085536923187668, 7.38905609893065, 2.718281828459045, 1.0, 0.36787944117144233, 0.1353352832366127, 0.049787068367863944, 0.01831563888873418, 0.0067379469990854...
In python, there is a function in scipy (scipy.linalg.eigh_tridiagonal) which is extremely efficient for an exact diagonalization of a symmetric tridiagonal matrix (I think it uses MRRR algorithm, not sure). But only a single core is assigned to solve the exact diagonalization. Is there a way of using remaining cores t...
A very visual picture for Monte Carlo integration is the approximation of $\pi$, by sampling in a square which contains a quarter of the unit circle. We can extend this picture to 3 dimensions, by sampling a cube which contains 1/8 of a sphere. But both cases are quite simple. I want to write a function that generalise...
I would like to compute the integral $$ \frac{\partial}{\partial{x}} \int_{-1}^1 \int_{-1}^1 F(x,y,\xi, \eta) \; d\xi \; d\eta $$ or moving the derivative inside the integrals $$ \int_{-1}^1 \int_{-1}^1 \frac{\partial}{\partial{x}} F(x,y,\xi, \eta) \; d\xi \; d\eta $$ where $F(x,y,\xi, \eta)$ is a complicated rational ...
For reasons to do with extending the range of applicability of this Mathematica package, I would like to have a good handle on the numerical evaluation of functions of the form $$ f(x) = \frac{j_n(\sqrt{x^2-\zeta^2})}{e^{\zeta}}, $$ where $j_n$ is a spherical Bessel function of the first kind, $x$ is real-valued and re...
Does someone knows another trick or solution how can I perform matrix multiplication by its transpose? The current code for 1000 iterations takes too much time for me. #include <iostream> #include <armadillo> class watch : std::chrono::steady_clock { time_point start_ = now(); public: auto elapsed_sec() const {ret...
I recently read the paper "EUCLIDEAN-NORM ERROR BOUNDS FOR SYMMLQ AND CG" by Estrin et al. and there they use an underestimate (i.e. something in $(0,\lambda_{min}]$) of the smallest eigenvalue of the matrix in order to derive a practical upper bound for the L2 error of the iterations. In my case I am dealing with very...
Basically just that. I am trying to write a C++ program that reads in an STL and should compute an unstructured tetrahedral volume mesh based on the surface triangulation given by the STL file. I would like to implement the mesh generation step from scratch, so I am looking for algorithms or literature recommendations ...
We are looking for studies or tools that implemented kinetic modeling with parameter estimation differential evolution or similar optimization techniques in Python. We are trying to understand what already exists in this area. Thanks in advance!
I've recently came across an implementation of the BFGS algorithm but it has an additional step where the Hessian is transformed after the each update. This transformation is done so that certain constraints to the search directions are made. In this case it is optimising a molecules geometry but removes search directi...
The square of the largest singular value of a linear map $A$ can be computed by using the power iteration for $A^TA$ and one advantage of this is that the iteration is matrix free, i.e. you only need to apply the linear map and its adjoint but never need the matrix $A$ explicitly. Do you know any matrix free method to ...
How to choose the cutoff radius so that the atoms do not interact with its periodic image? Especially when simulating macromolecules (proteins).
I am in the process of programming the local & average Nusselt number in a left vertical wall but my Matlab script gives me inappropriate values and it doesn't change with changing of Rayleigh number!! The problem is: how to calculate and impliment the local Nusselt number in a vertical left wall of a cavity. The expre...
I have a problem with Laplace inversion and my function is not numerically stable for the Laplace inverse, but I do not understand the cause of this problem. Here is my code and graph of this problem. Does anyone have any idea? I have also tried all 3 Dehoog Stehfest and Talbot, they all have a different type of instab...
I saw in several places that interpolation operator ($P$) and restriction operator ($P^T$) are usually transposes of each other (up to multiplication by a constant). As I understood it related to Galerkin condition ($A^{2h}=P^TAP$), where $A$ is the original matrix of the system $Au=f$ and $A^{2h}$ is a coarse version ...
I'm trying to solve the following boundary value problem on $[0,\infty]$: $$f^{\prime \prime}=-\frac{1}{r} f^{\prime}+\frac{1}{r^{2}} f+m^{2} f+2 \lambda f^{3}$$ $$f(0)=0 \ ; f(\infty)=\sqrt{-m^2/(2\lambda)} $$ for some constants $m^2<0, \lambda>0$. There is no closed form but we should have $f$ monotonically increasin...
So the question was to use a nested loop to solve a 3D integral with the function conditions (written below in the code) to find $$\int dxdydz $$ and the x and y coordinate of the centre of mass of this domain. I am using 10 integrand evaluations per direction, but I am getting a large error especially while calculatin...
I have implemented a finite difference solver for the 1d wave equation with variable wave speed: $$ u_{tt} = c(x)u_{xx}, \hspace{10mm}c(x) = \dfrac{6 -x^2}{2} \hspace{5mm} $$ on $-2 \leq x \leq 2, t > 0$ with initial conditions: $$u(x,0) = \cos(\dfrac{\pi x}{0.2}), \hspace{5mm} u_t(x,0) = 0 $$ for $-0.1 \leq x \leq 0.1...
I have been stuck for a while now on a WENO scheme implementation and I have a few questions concerning the implementation, but also the theory behind it. For context: I'm currently working on numerical schemes for kinetic equations. Someone suggested to me to look at WENO schemes. However, I somehow am not able to imp...
Could I apply a Q0-discretization to, say, the Poisson equation $\Delta \phi = f$ (where by Q0 I mean piecewise constant, and thus non-continuous, elements)? Solving this with FEM, at least as I know it, involves the gradients of the discretized function $\nabla\phi$, which in a piecewise constant discretization I woul...
In most physics engines there's this concept of "static" bodies, which act as rigid bodies with infinite mass. Then there are "kinematic" bodies that act as static bodies, but their motion is simulated by animation data or by user specifying position or velocity directly. And finally there are the "dynamic" bodies whic...
I am trying to solve the following integral: $$ I (r,\theta) = \frac{1}{2\pi}\int_0^{2\pi}\frac{f(\phi)(1-r^2)}{1+r^2-2r \cos(\theta-\phi)}d\phi$$ where $0\le r<1$ and, $$f(0\le\phi<\pi/2) = +\frac{1}{\sqrt 2}$$ $$f(\pi/2\le\phi<\pi) = -\frac{1}{\sqrt 2}$$ $$f(\pi\le\phi<3\pi/2) = -\frac{1}{\sqrt 2}$$ $$f(3\pi/2\le\phi...
I wonder which software can be used to generate the mesh like below. Anybody has an idea?
I'm trying to solve the following equations numerically in python $$\begin{align} 12\pi\int_0^\infty drf(r)\phi(r)r^4&=E\\ f(r)-\frac{1}{2\mu}\bigg(\frac{d^2\phi(r)}{dr^2}+\frac{2}{r}\frac{d\phi(r)}{dr} \bigg)+m_\pi\phi(r)&=E\phi(r) \end{align} $$ where $f(r)=S\exp(-r^2/b^2)$, while $\mu$ and $m_π$ are constants. I hav...
I'm reading the following table (from https://www.tutorialspoint.com/cprogramming/c_data_types.htm ) Why the precision of the float is 6 decimal places, but I see that the float are in the interval [1.2E-38 , 3.4E38] ? So, I think that I can have 38 decimals of precision. Which is my error?
I have noticed that some commercial solvers transform QCQPs into SOCPs and use SOCP algorithms to solve the resulting problem. I am wondering if there is a benefit to this approach over using a pure QCQP solver. I have done some literature review, and I haven't found any references comparing these two approaches, besid...
I'm running into issues with Python/Julia ODE solvers requiring prohibitively small timesteps to evolve a system of 4 coupled ODEs (the order of magnitude of the state variables and time unit span ~40-50 orders of magnitude). Interestingly if I use a simple explicit Euler approach then I can get past the stiffness at e...
I am trying to set up a 3D CFD scheme for thermal and flow modelling in Python using the finite volume method. The first concern is to build the geometry and an accompanying mesh that is efficient for the purpose (resembling something like the 3rd picture below). For Python, there are many libraries for geometry and m...
I am trying to implement an advection equation for a coupled system of a two-phase flow in a porous media using a WENO scheme [1]. My equation is of the form: \begin{align} \frac{\partial (\phi(x,t) C(x,t))}{\partial t} = - \nabla . (\vec{q(\phi, t, x)} C(x,t)) \end{align} with $\phi$ beeing the porosity, which in thi...
This question is very related to the question Number of decimal of float and double in C. In the second table we may see that the exponent of the float are from -38 to +38. But the IEEE754 standard defines the floats as | sign bit | exponent bits | mantissa | | 1 bit | 8 bits | 23 bits | Then, the exponent...
I'm moving from Excel to Python and I'm trying to solve these equations: $$\begin{align} X_1&=\bigg[\big(3.47-\log(X_2)\big)^2+\big(\log(c)+1.22)^2\bigg]^{0.5}\\ X_2&=\frac{a}{101.32}\bigg(\frac{101.32}{b}\bigg)^{X_3}\\ X_3&=0.381X_1+0.05\bigg(\frac{b}{101.32}\bigg)-0.15 \end{align} $$ I have tried this code import num...
I wish to solve the following using the finite volume method: $$\frac{\partial u}{\partial t}=\frac{D}{r}\frac{\partial}{\partial r}\left(r\frac{\partial u}{\partial r}\right)+Q(t,r)$$ with the following boundary conditions: $$\frac{\partial u}{\partial r}\Bigg|_{r=0}=0,\quad -D\frac{\partial u}{\partial r}\Bigg|_{r=R}...
When it comes to Evolutionary Algorithms (e.g. Genetic Algorithm), I have often heard people make the following broad statement: "Evolutionary Algorithms Do Not Converge." I was curious about know how true this statement is, or does it come with any caveats. For instance, I was interested in knowing if perhaps there mi...
I'm solving a local instability problem for a pipe Poiseuille flow. The coordinate system is columnar, i.e., ($r,\theta,x$) (radial, tangential and axial). The basic flow is $\bar{u_r}=0, \bar{u_\theta}=0$ and $\bar{u_x}=1-r^2, r\in[0,1]$. After putting the perturbation function into the N-S equation, the generalized E...
Background: We're operating a small betatron which makes use of a vacuum tube where electrons are accelerated circularly. First, they get injected (like inserted) and contracted (like squeezed). After a while, these electrons exit the tube and hit a target and convert (hopefully) into photons which will be used as x-ra...
I've posted yesterday a question about solving a non linear equation : it was not clear so I am reformulating my question. I am trying to solve a high-order non linear differential equation presented right below with $F \in [-\eta_{0}, \eta_{0}]$ $\left(5F - 4\eta\frac{dF}{d\eta}\right) = 9 \frac{d}{d\eta}\left(F^{3} \...
I am working on reactive transport and I need to solve this advection equation: \begin{align} \frac{\partial (\phi C)}{\partial t} = - \nabla \cdot \big(\vec{q}(\phi) C\big) \end{align} with $\phi$ being the porosity, C the concentration of an element, and $\vec{q}$ the fluid flux. I am calculating the porosity and th...
Consider the advection equation \begin{equation} \frac{\partial C}{\partial t} + u\frac{\partial C}{\partial x} + v\frac{\partial C}{\partial y} = 0 \end{equation} I want to do a forward time, center space finite difference approximation with the Lax method and a periodic boundary \begin{equation} C_{i, j}^{n+1} = \fra...
I look for a book/manual where I can find implementations of different integration schemes for ordinary differential equations (like 4-th order Runge-Kutta) in Python with Numba. To be more specific, let me provide some details and background. In my research I deal with a system of coupled non-linear differential equat...
It has been a while since I have done some stats, and I have tried to fit a curve using optimize.curve_fit of parameter estimation. I am also interested in the standard deviation of the fitted parameters which I get from the square of the diagonal terms of the covariance matrix. In order to get the estandar deviation I...
I am looking for a set of radial basis functions $\phi_n(x)$ on $\mathbb{R}^+=[0;\infty[$ which satisfy some othogonality condition $$ \int x \phi_n(x) \phi_{n'}^*(x) dx =\delta_{nn'}$$ and "behave" like some (fractional) polynomial $x^{\alpha}$, by which I mean they can be analytically factored as $\phi_n(x)=f_n(x) x...
I would like to be able to model an SDE having the form $$dX_t = \mu(X_t)dt + \sigma(X_t)dW(t) + \int_{\{|c| <1 \}}g(X_t,c)\tilde{N}(dt,dc) + \int_{\{|c| \ge 1 \}}h(X_t,c)N(dt,dc).$$ where $W$ is a standard $1$-dimensional Brownian motion. $N$ is a Poisson process and $\tilde{N}$ is the compensated Poisson process. $N$...
I am trying to solve a scheduling problem with linear programming. I have N disks that each have a capacity of constant C. At each time interval t_i, a set of write requests with different sizes arrive that we need to store their data on the disks. Each disk has a different write speed. we can delay writes, but after w...
I am currently trying to solve a regression problem, which leads me to an optimization problem. Say that we have measured data ($\hat{S}(\omega)\in \mathbb{C}^{N\times N}$), and each entry of this matrix is a $d$-sized vector containing frequency-dependent measurements. We can perform the regression by minimizing \begi...
I have a predefined grid(like this) that is spawned from a regular icosahedradron. It consists of many hexagons and 12 pentagons (corresponding to icosahedradron vertexes). I can tweak the granularity of a grid, but I did not find a way to port this method on a sphere. I want to solve the heat equation on such a grid: ...
I am trying to optimize a non-linear least squares problem with scipy.optimize.minimize. I have simplified my actual problem down to the case where I am just computing the top 'principal components' like in a PCA analysis and the method reports failure to converge (as it does for my full model). However, the result mat...
I want to numerically solve the following equation for $\phi$ on $\mathbb{R}_+^{*2}$: $$ \partial_t \phi (w, t) = \int_0^{+ \infty} k(\alpha w + \beta w', w') \phi(\alpha w + \beta w', t) \phi(w', t) ~dw' - \int_0^{+ \infty} k(\gamma w + \delta w', w') \phi(\gamma w + \delta w', t) \phi(w', t)...
Let $f \in C^0[0, 1]$, and suppose $f \ge 0$. How can I compute $\sup f^{-1}(0)$ efficiently?
I am dealing with a coupled ODE. I have already plotted the solutions out using odeint, but I want to get the value of equilibrium. The ode looks like this: IN,EnN,c,l,XN,N_init,Bx_init=0.1,0.01,0.1,0.1,0.1,0.4,1 init = (N_init, Bx_init) def model(init,t, IN, EnN, c, Qn, l, XN): N_prime = IN - EnN - c*init[1]*init[...
How can I compute the Big O complexity of the Branch and cut algorithm? I am solving an integer linear program using MOSEK that includes $M$ binary variables, but I do not know how to calculate the exact complexity. Is it just O($2^M$)? or are there problems solved at each branching node that have extra complexity to b...
For unums, there is good evidence (see figure 5) that accuracy is better than IEEE floats. (Note: I use the term "unum" broadly to refer to any of the various iterations and revisions to the format.) However, generally we regard "stability as more of a constraint than accuracy". Are there numerical algorithms which can...
I'm endeavouring to use cuSolver to solve a sparse linear system. But when I run my code, it fails with CUSOLVER_STATUS_INTERNAL_ERROR. What's going wrong? How does one debug this error? My MWE follows and uses two data files (chosen somewhat arbitrarily): mat65k.mtx - Manually remove the lines beginning with % rhs650...
I am contacting research and I came across an algorithm in FORTRAN, with which I am not familiar. For the code above I have two questions: What does "DO 1 (...)" mean? I see that there is a "1" on the left of line 6. Does that mean it references line 6? Shouldn't DO statements close with "END DO" ? Thank you in ad...
I am new to understanding pseudorandom number generators and sometimes feel daunted by them. For some time I have used the following approach in my work: In one file, I'd have import numpy as np np.random.seed(1) my_random_process() In another file, I'd have import numpy as np np.random.seed(2) my_random_process() an...
I am trying to compute a matrix-matrix product of N stacked complex double N x N matrices. For simplicity, I assume N = 512. I have written code in C++ parallelized with OMP and using OpenBLAS for the matrix-matrix product. This is the code: #include <iostream> #include <complex> #include <chrono> #include <openblas/cb...
#include <stdio.h> #include <string.h> int main() { float s=0; int i, n; printf("Quantity of terms:"); scanf("%f", &n); for(i==0; i<=n-1; i++); { s=s+1/(i+1); } printf("Sum: %f", s); return 0; } Hi. I'd like to sum up the series $1+1/2+...+1/n$, but I always get the sum zero... Could someone help me? Thank you...
I am attempting to create a python function to assist in calculating the following numerical integration of the Huygens Fresnel integral in the form of def fresnel(x_,y_,x,y,z) where x_ and y_ are $x'$ and $y'$ coordinates. $$E(x,y,z)=\frac{1}{i\lambda}\iint_{-\infty}^{+\infty}E(x',y',0)\frac{ze^{ikr}}{r}dx'dy'$$ where...
I am currently performing optimization onto a quadratic function by manually coding the algorithm: $$\min f = x^T v x - r^T x\\ \text{subject to } x \geq 0\, .$$ Here, optimizing the function without the constraint above is not a problem at all. However, if I want to add this inequality constraint, I do not know how ca...
Edit on May 3rd: I have found the problem. Because the difference of between $k_1$ and $k_2$ is huge, a very small time step need to be chosen so that the right green part can "feel" the heat from the left. Otherwise the temperature profile in the green region would barely change. However, this requres a lot of computa...
I have a set of points of $\mathbb{R}^2$ which is organised in subsets: $$ \cup_{0\leq i<N} \left\{ P_i^j \in \mathbb{R}^2, 0\leq j<M \right\} $$ For all $(i,j)$, I want to find $P_k^l$ in another subset (with $k\not= i$) so that $d(P_k^l,P_i^j)$ is minimal. And "of course" (*), many points with $k=i$ are in general mu...
I come across the following operator in a paper $\mathcal{I}\psi = \psi_{xxxx} + (r~\psi_x)_x$, where $\psi=\psi(x)$ and $r=r(x)$. Periodic boundary condition is employed. It claims that the operator $\mathcal{I}$ is symmetric. Suppose I use finite difference to discretize it, then the first part $\psi_{xxxx}$ is obvio...
I want to decrease the computational time for solving a large number (>1000) of least-squares problems. Given a matrix, the system matrix for each least-squares problem is a submatrix of the given matrix. My idea is to precompute a matrix decomposition of the given matrix, then reuse it for each least-squares problem. ...
I would like to solve the Navier-Stokes equations for the unsteady problem of the flow around a circular cylinder. I would like to understand how to write mathematically the boundary condition for the pressure on the surface of the cylinder (essentially the circle). The domain of the problem is shown in the image below...
Is there a mathematical algorithm that can determine whether a problem is parallelizable? Possibly similar to how the definition for "computable" works out: https://en.wikipedia.org/wiki/Computable_function So a parallelizable program is a program that ...?
I want to fit this data. I have the following model functions. Classic gaussian: def gauss_model(x, mu, sigma): return np.exp(-0.5*((x-mu)/sigma)**2) And a gauss-hermite parametrization, taking account for skewness (parameter h3) and kurtosis (parameter h4) of the distribution: def losvd_param(v, v_rot, v...
I know this is trivial but I don't seem to understand it. In which step of the FE formulation do we enforce the global continuity of the solution? Or in other words, how the construction of the local basis functions on each element allows to glue the solution with continuity across neighbouring elements? To explain wha...
I have been reading the neural ODE paper and I understand that neural ODEs have a continuous depth model structure. And I understand the fact that they are especially very useful for time-series data. But from the benefits of neural ODEs stated in the paper, I can't understand what they mean by adaptive computation. Ca...
I am trying to educate myself on the lattice Boltzmann method to see if it may be useful for simulating some problems in plasma physics that I am interested in. One thing that strikes me is the (seemingly) universal adoption of BGK-style collision operators. Is the method intractable with more sophisticated collision o...
Consider the problem $$u_t - \Delta u = f \text{ on } \Omega\times (0,T)\\u=0 \text{ on } \partial \Omega\times (0,T) \\ u(x,0)=g(x) \text{ on } \Omega$$ with $g$ NOT vanishing on the boundary. If I use a FEM discretization in space, what is the best a priori error (considering both space and time) that I can hope for...
Consider a domain $\Omega \subseteq \mathbb{R}^{2,3}$ which is non convex and with $C^2$ boundary. Could you recommend a good reference where it is explained how: without needing isoparametric elements with a triangulation of simplices one can obtain: some space of linear finite elements $S^h_0$ which vanish on $\p...
I have an integer quadratic program of the form, \begin{align} \underset{x}{\max}&\;\;\|Ax-b\|_2^2\\ \text{subject to}&\;\;x\in{\bf Z}\geq0 \end{align} I'm currently using the (admittedly crude) convex approximation which relaxes the integer constraint, and then recovers a feasible point by rounding each component of $...
I am currently interested in billiards and their trajectories. I would like to simulate a billiard inside a water-tight mesh. A mesh basically consists of a list of points in 3D space (vectors with 3 entries) together with a list of 3 vectors of natural numbers, which specify the corner points of each triangle. Now, I ...
At the Top "right", there is the 2D-density plot of the recorded data (actual), fewer in number. Recorded data has been sampled a on the 8 arms of a regular octagon. These 8 arms are placed along x and y axes and along the diagonals. On the top-left is the interpolated data (thin-plate) of the actual data, i.e. large...
I am solving the equation $$ \frac{\partial \phi}{\partial t} = \frac{\partial}{\partial x} \left( D \frac{\partial \phi}{\partial x} + v\phi \right) $$ using finite differences. I want to include Robin boundaries, that is, boundaries that are closed to both advection and diffusion. I read this excellent question on it...
Note; No special knowledge of Pykrige is needed to answer the question, as I already mention examples in the question! Hi I would like to use Universal Kriging in my code. For this I have data that is structured as follows: Latitude Longitude Altitude H2 O18 Date Year month da...
I am looking in ways to include energy dissipation while propagating a coherent wavepacket in a 1d TDSE. for example I use the split step method: exp[Δt(D+V)]≈exp[ΔtV/2]exp[ΔtD]exp[ΔtV/2], and subtract some epsilon value from the kinetic energy term every step. What other ways can I dissipate energy from the system so ...
I am interested in using a numerical wave tank (NWT) to study the performance of various water wave dampers using MATLAB. I am looking at nonlinear water waves. My current NWT (2d, periodic) is based on the Zakharov/Craig-Sulem formulation, where the Dirichlet-Neumann map is represented via Cauchy integrals and spatial...
I am trying to solve the following PDE by using finite difference \begin{eqnarray*} \Delta u&=& f ~~on~~(0,1)\times(0,1)\\ \frac{\partial u}{\partial y}(x,0)&=&0=\frac{\partial u}{\partial y}(x,1)~for ~x\in[0,1]\\ u(0,y)&=&u(1,y)~for ~y\in[0,1]\\ \end{eqnarray*} For a uniform spacing $h$, I got the following equat...
This is related to my question here https://math.stackexchange.com/questions/4447383/lax-wendroff-scheme-stability-analysis-for-a-linear-system-of-conservation-laws . Consider the numerical scheme given by the finite difference equation: \begin{align*} Q_{i,j,k}^{n+1}&= \Big(I- \frac{\Delta t^2}{\Delta x^2}A^2-\f...
How would you describe the Galerkin method to solving the 3D wave equation $$u_{tt}= c^2\Delta u$$ to someone who wants to implement it immediately? More precisely, we want to solve the Cauchy problem $$u_{tt}= c^2\Delta u , \\ u_t(x,y,z,0)= g(x,y,z) , \\ u(x,y,z,0)= f(x,y,z)$$ where $f, g$ are given compactly support...
I would like to convert this problem into a QP (Quadratic program). $$\text{Maximize } \sum_{k=1}^{K}\sum_{n=1}^{N}log2(1+p_{kn}b_{kn})\\ \text{subject to } \sum_{k=1}^{K}\sum_{n=1}^{N}p_{kn}\leq P_{0}\\ p_{kn}\geq 0, \forall k,n$$ The variables are $p_{kn}, \forall k,n$ Since the optimization variables are continuous ...
I am new to solving PDEs, but have been looking at different implementations of finite difference and finite volume schemes. One thing I have noticed in different implementations is that some implementations use sparse matrices while other implementations--of the same algorithms--use basic loops. I can understand that ...
So I am trying to solve two equations simultaneously. The goal is to find values for $\frac{de}{dt}$ and $\frac{d}{dt}$ which are the rates of change of the variables $a$ and $e$. I am then progressing the system through time by multiplying the rates by a certain time step and adding this to the starting values to obta...
I'm hoping that this type of question is on-topic, and I have put in a little hunting to make sure it isn't a flat out repeat. If it is either of the above, I apologize in advance. I'm an early career computational mathematician who is at least minimally capable with C++, and pretty proficient with something like MATLA...
I would like to know if Taylor-Hood elements $P_2$-$P_1$ form a stable pair for the mixed approximation of Darcy's equation ( or Poisson's equation) with Dirichlet B.C. In the literature I only find them only in the context of the Stokes problem.
This is the $2$-dimensional wave equation $$ u_{tt} = u_{xx} + u_{yy} $$ with initial condition $u(x,y,0)=f(x,y)$ and $u_{t}(x,y,0) = 0$. The inverse Fourier transform used is $$ u(x,y,t) = \iint \hat{u}(\omega_{x}, \omega_{y}, t)e^{(2\pi) \omega_{x} i x} e^{(2\pi) \omega_{y} i y}d\omega_{x} d\omega_{y} $$ this is also...
I am currently making use of a 2D vector field that I would like to be able to describe and characterize. I thought of a few metrics that I could use, but they seem limited for both a qualitative and quantitative analysis. I believe that the divergence and curl of the field would be interesting. The vector field could ...
I need to place a given finite set of points within maximum distance of each other on 2D, constrained by a convex boundary, on Python. Honestly, I'm kind of lost. I have the explicit function to be minimized, but I'm not sure which algorithm I should use to adjust the points recursively. I thought of experimenting with...
Suppose I have a PDE in a rectangular domain that I am solving numerically via a finite difference method. How do I answer the question, "How fine do I need to make the grid to so that my solution is within $\epsilon$ of the true solution?" We can assume some basic interpolation scheme is used to fill in the points out...
I'm trying to implement a numerical method used in quantum chemistry from scratch. I'm using this paper as a reference. It's also available on Sci-Hub. So, the method requires calculating integrals of each spatial dimension (x, y, z) using recursive relations but I got completely lost on how it can be implemented in th...
I am looking for a way to sample points uniformly around a particular point on the unit sphere. Working on spherical coordinates we can express any point on the unit sphere as $(\sin\theta \cos\phi, \sin\theta\sin\phi,\cos\theta)$. Say the initial point $r_0$ has coordinates $(\sin\theta_0 \cos\phi_0, \sin\theta_0\sin\...
I have a spline-based model where I have a set of control points in 3D space. I want to compute pairwise distances between every point on a regular 3D grid and these control points. Is there an efficient algorithm to do this in terms of space (i.e. not having to calculate the full distance matrix)? One thing is that th...
$C=F^TF$ is called the "Right" Cauchy-Green tensor, and $b=FF^T$ is called the "Left" Cauchy-Green tensor. I suppose in $C=F^TF$ the non-transposed $F$ stands on the right, and in $b=FF^T$ it stands on the left, but I guess there's gotta be more to it? Is there any reason for why they are called "right" and "left" spec...
I would like to compute the material derivated of a tensor quantity, in the context of the finite volume method (FVM): The equation is: $$ \frac{\mathrm{d} \textbf{T}}{\mathrm{d} t} = \frac{\partial \textbf{T}}{\partial t} + \vec{v} \cdot \nabla \textbf{T} = \underbrace{\frac{\partial \textbf{T}}{\partial t} + \nabla \...
To my frustration I am struggling to implement leapfrog integration for the time dependent Schrödinger equation. To the best of my knowledge this was first explicitly done in "A fast explicit algorithm for the time‐dependent Schrödinger equation" in 1991 (see https://aip.scitation.org/doi/abs/10.1063/1.168415). I'm fol...