instruction
stringlengths
43
28.1k
We are looking for a code to list all maximal bicliques in bipartite graphs efficiently, as we want to run it on (large and sparse) graphs, with up to roughly a million nodes and edges in no more that a few hours. In the literature, we know this fast implementation which implements the algorithm presented in "Efficient...
I would like some tips in figuring out a good algorithm to find the solution of the following system. Let $\theta$ be a constant in $(0,1)$, let $i,l=1,...,N$, let $a_{l}$ and $b_{i,l}$ be some constants with $a_l \in (0,1)$ and $b_{i,l}>0$ for all $i,l$. Consider the following system of equations in unknowns $z_{1},.....
Suppose that I have a function of, say, three parameters, $f(p_1,p_2,p_3)$ whose output is a field(s) (e.g. velocity field) and is dependent on some real-valued parameters (e.g. viscosity, density, temperature). This function $f$ is computed by some pde solver and is expensive to compute and store. I want to compute $f...
The first routine instantiates numAtoms number of atoms and distributes them in a 6*6*6 grid. The second routine populates the atoms with initial velocities. I want to write a unit test for this routine. Can you give me some ideas on how to do it? NOTE: I know how to write unit tests using GTest. That is not the issue....
I wrote this minimal example to examine the Leapfrog integration algorithm. However, I am not sure it is the correct algorithm, and the listing is giving the correct output. Is this the Leapfrog algorithm? NOTE: I am using the Lennard-Jones system. NOTE-2: I am using C#. using System; public class Vec3 { public do...
% Example1a % % This script demonstrates the use of the Fem code to % solve the BVP % % -div(k*grad u)=f in Omega, % u=g on Gamma_1, % k*du/dn=h on Gamma_2. % % Here Omega is the unit square, Gamma_1 consists of % the top and left edges of the square and Gamma_2 is...
Integration Algorithms The Verlet leapfrog algorithm is an economical version of the basic algorithm, in that it needs to store only one set of positions and one set of velocities for the atoms, and is even simpler to program. The equations defining this algorithm are as follows: ${{v_{{n}+{\frac{1}{2}}}}} = v_{{n}-...
I'm testing libraries for numerical computing and time they take to calculate SVD. During testing I encountered an issue for which I don't have an answer. I generated 2 matrices: random tall matrix using Matlab with function randi([10,50],6000000,6) matrix of the same shape combining vectors with very different ranges...
In Abaqus, there is an option NLGEOM to turn on the geometrical nonlinearity. But I'm not clear what it does specifically. Because it also works with UMAT written for small strain formulation, i.e. using infinitesimal strain and return Cauchy stress. For NLGEOM, does it take in Green-Lagrange strain and convert the Cau...
I was wondering whether there is a closed formula for the eigenvalues and eigenvectors of the discretized Laplacian in (edit) $[0,1]^n$ with a uniform grid, using what I imagine is a $2n+1$ stencil. Furthermore, I was wondering whether there is some existing material on how to create random weighted sparse (graph) Lapl...
I have a set of sparse matrices modulo 2 (i.e systems of equations in the format "a XOR b XOR ... XOR c = 0 or 1" compressed by me into reduced row echelon form). This is a rather large set (1 million matrices). Some of them interact with each other. For example if a matrix contains the row "a XOR b = 0" and another "a...
I am staring intently at this paper by Botsch and Kobbelt. In particular, I want to make the matrix specified in equation 5. I am trying to understand the specific computations I must instruct a computer to produce the matrix. The firs thing I tried is to check both wikipedia and this book (Appendix A.1) in both cases ...
Lennard-Jones force can be computed in two different ways: Version #1: Here, the force computation is a self-contained routine. Vec3 lj_force(const Vec3& r) { double r_mag = std::sqrt(r.x * r.x + r.y * r.y + r.z * r.z); double s_over_r = sigma / r_mag; double s_over_r6 = s_over_r * s_over_r * s_over_r * s_o...
It seems that proving the statement given in the question https://math.stackexchange.com/questions/4601532/a-pen-and-paper-proof-for-a-matrix-implication is difficult analytically. I was thinking what sort of different computational approaches we can take to show that the conjecture is true ? The conjecture is as follo...
I have to build a bilayer using a structure obtained in a previous MD simulation. In the structure, some chains of the molecules cross the simulation box as shown below. I added water layers to the structure as below. Since some of the structure parts are oriented out of the box, I would like to know whether doing the ...
I am searching for a library that can perform adaptive mesh refinement (AMR) on large distributed unstructured meshes. For now, the cells are high-order quads/hexa. I was looking into p4est, which is well-maintained and scales well. I am completely new to AMR, but as far I understood, the forest in p4est consists of on...
Suppose, I have the following listing for a barebone MD simulation: #include <iostream> #include <vector> #include <cmath> #include <random> #include <fstream> typedef double real; // Constants for Argon constexpr real epsilon = 119.8; // Depth of the potential well (in K) constexpr real sigma = 3.405; // Dista...
Part 1, but I'll repeat here. This time we'll move the top boundary. I have a container of water with initial volume $V_0$ and height $L$, open at the top which receives a constant mass flux $\phi$. A sampling line is placed in the container all the way to the bottom which drains the container at some rate $f$. This me...
I am aiming at developing a simulation software mostly aimed at reactive fluid flows applications. Here are a simplified list of points to drive the initial choices (code structure, libraries...): I aim at implementing high-order finite-volume schemes, e.g. WENO5 I aim at using high-order time integrators, fully-impli...
I'm interested in examples of very effective methods in scientific computing that are the sum or naive combination of very ineffective or bad ones.
I asked this question on the math stack exchange and got an answer, but I am just as utterly confused as before. My fundamental goal is to actually construct the matrix, that is, a series of steps I can tell an actual computer to build it up. The gist of it is that there is a 2004 paper called "An Intuitive Framework f...
The Lennard-Jones potential is typically expressed mathematically as: $$ V(r) = 4 \varepsilon \left[ \left(\frac{\sigma}{r}\right)^{12} - \left(\frac{\sigma}{r}\right)^{6} \right] $$ where: $V(r)$ represents the potential energy as a function of the distance $r$ between two particles or molecules. $\varepsilon$ is the...
hello I am trying to numerical simulate the band structure of the one-dimensional periodic arm chair edge states, I use the pybinding model to construct and simulate the arm chair edge states, because we need to use a 4-site lattice to construct the arm chair edges, I believe this causer some problem with the later ca...
Consider a one-parameter family of matrices $A(q)\in \mathbb{R}^{n\times n}$, $q\in\mathbb{R}$. For my applications, $n$ is typically between $5$ and $50$ and $A(q)$ is generally dense, so direct methods for obtaining the entire spectrum of $A(q)$ are applicable and not too expensive. I would like to analyze the eigenv...
I understand the computational implementation of the PC and PI bcs in cartesian case. In terms of the magnetic field components for PI, we have $B_x = B_y = B_z = 0$, and for PC, we have $\partial_x B_x = \partial_x B_y = \partial_x B_z = 0$, given that $x$ is the normal direction to the boundary. Let's say you have a ...
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(\...