instruction
stringlengths
43
28.1k
I am using MLS-MPM to simulate both solid and fluids. It works, but the amount of time steps I must do for hyperelastic solids is absurd. To give you some perspective, I am able to simulate just the fluid at interactive speeds (60 fps) using only one simulation step per frame. The fluid simulation is just extremely sta...
Here is the code that I am trying to run: syms z_1 z_2 m_1 m_2 x y Q p s t m_1=0.01; m_2=249; x=5; y=5; Q=0.6; p=0.5; s=0.04; t=0.25; func=(62001*sinh(y/100 - z_2/100))/(100*cosh((249*cos(2*pi*(z_1 - x + 1/4)))/2 +249))-(249*sinh(249*y - 249*z_2))/(10000*(cosh((249*cos(2*pi*(z_1 - x + 1/4)))/2 + 249) - 620009999/10000)...
I have the following heat diffusion equation: \begin{alignat}{3} \partial_t u(t, \vec{x}) &= g(\vec{x})\Delta u(t,\vec{x}), &\quad& \vec{x} \in\Omega, \, t\in(0,\infty],\\ \partial_n u(t,\vec{x}) &= 0, &\quad& \vec{x}\in\partial\Omega,\, t\in(0,\infty], \\ u(0,\vec{x})&=f(\vec{x}), &\quad& \vec{x}\in\Omega. \end{aligna...
This is a question to all scientific programmers out there that have experience in academia, industry, ideally both. Consider two figures: Alice has earned a PhD in applied mathematics at a top 10 university, she has two publications in rather good journals, and had to write a certain number of python programs to prot...
I'm learning about the lattice Boltzmann method (LBM) and how it can be parallelized. On Wikipedia, they say, "The LBM was designed from scratch to run efficiently on massively parallel architectures...", with no citations. I understand the basics of LBM (collision, streaming, etc), but I'm struggling to see how it can...
I am trying to understand how to use the improved euler method on MPM simulations. In the kind of MPM simulation I am doing with forward euler the order of operations is as follows: Write particle material properties (i.e. mass) into the discrete gird cells. Read the material properties from the grid to compute materi...
Suppose I have the following function $$f(x,y,z1,z2)=g(x-z1,y-z2)$$ where $g(x,y)$ is a deterministic function from the $X\times Y\to S$ and $z1,z2$ are random variables following a known probability distribution. Now, I wish to plot the distribution of $f$ over the grid of $X\times Y$. How do I do this in SageMath? Sp...
I have an (maybe not so clever) idea to apply the shallow water model for computing the year-round watershed runoff of a catchment. It means using of real topography with variable slopes and roughness, length of the real time period about 31536000 seconds, real precipitation, temperature, snow cover and other data, etc...
i have f(x) that is concave function. My question is g=min(f(x)) is concave or convex? And max(g) is concave or convex? there is a theorem for this?
So there is a numeric technique for updating a deformation gradient in MPM that goes as: $$F_{n+1} = (I + \nabla \vec v \Delta t)F_n$$ This works for small time steps but for large time steps numerical issues ensue. One of the biggest issues is that I assume that the deformation matrix always has a determinant of one, ...
I need to integrate expressions containing powers of the function: Hb = U1.U2*U3.U4 + (permutations of the first term like U1.U3*U2.U4) + Determinant of the matrix [U1,U2,U3,U4]. The U's are 4D unit vectors on different sites, so site 1 has U1 = [ Cos(t21), Sin(t21)*Sin(t11)*Cos(p1), Sin(t21)*Sin(t...
I need to implement in C a method of obtaining transient solution of damped FE models based on modal results for a structural model (imported CAD geometry) defined with hysteretic (structural) damping. This method is also available in Matlab by using solve(model,tlist,"ModalResults",modalResultsVar); However, the main ...
I'm having difficulty solving an initial value problem (IVP) in Python backwards in time. The code is at the end of this post. First, please let me state my simplified problem. The forward IVP is defined as the following $$\left\{ \begin{array}{cl} u'(t)=-21 u + e^{-t}, & \ t\in[0,2] \\ u(0)=1 & \end{array} \right. $$...
I am trying to solve a nonlinear and discontinuous fourth order BVP using the solve_bvp function of SciPy. My equation is $y^{(4)}=cf(y)$, where $f(y)$ is a nonlinear function. This equation is solved in the domain $x\in(0,1)$, and $f(y)=0$ when $x>0.5$. Given the nature of the equation, it is proving out to be difficu...
Context: I have two 3D non-random matrices that have the same dimensions. These matrices represent satellite images with 1 band, so their values are strictly positive. They both present areas that have similar values, while areas without a "pattern" would have more varied values. Problem: Even though they might have si...
I am having difficulty deriving the Cauchy point of the horizontal subproblem $$ \overline{g}_k^T Z_k u + \frac{1}{2} u^T Z_k^T W_k Z_k u \;\;\;\;\mbox{subject to}\;\; \mid \mid Z_k u \mid\mid_2 $$ given in equation (1.5.9) of page 60 of this thesis as $$ -\alpha (Z_k^T Z_k)^{-1} Z_k^T \overline{g}_k $$ From the littl...
When using the eigs function in MATLAB, which is based off of ARPACK, one can manually modify the maximal dimension of the constructed Krylov subspaces, the maximum iteration counts, and the error tolerance. The defaults are min$(2k, 20)$ (where $k$ is the number of requested eigenvalues), $300$, and $10^{-12}$. Depend...
In snes/tutorials/ex13.c, there is a function SetupPrimalProblem(), which sets up the $f_0$ and $f_1$ in PetscDSSetResidual() as described in here, and also the boundary conditions using the exact solution trig_inhomogeneous_u(). Now, I am trying to modify $f_0$, $f_1$, and the boundary conditions in order to solve the...
I am having some difficulty calculating Green's function symbolically in Python for $\phi^4$ theory. The specific rendition of the $\phi^4$ theory I have in mind can be written as follows. $\mathcal{L} = \frac{1}{2}(\partial_t \phi)^2 - \frac{1}{2}(\partial_x \phi)^2 - \frac{1}{2} m^2 \phi^2 - \frac{1}{4!} \lambda \phi...
I am trying to compute numerically the Lyapunov exponents of an ODE. I follow the method described in Parker, Chua "Practical Numerical Algorithms for Chaotic systems" There is also relevant answer here Numerical computation of Lyapunov exponent Below is my code. It gives wrong values for the Lorenz system at classical...
I am using FreeFEM++ to simulate the cylindrical waveguide, but no reasonable solution is returned. Here I'm using the 94 GHz light ($\lambda$ = 3.17mm) as input, and radius of the waveguide is 1.27mm. If more information is needed to be posted, just reply and I will provide it as soon as possible. UPDATE: As is point...
So, I've been attempting to design a simple solver for a problem of finding the gravitational potential of a system using Poisson's equation (let's call the potential phi, $\phi$). The goal is that I apply this potential to the system, move it forward one time step, and then repeat. Right now, I am working with a perio...
I have some data which consists of an exponential process in time convolved with a gating function. I am fitting the underlying exponential using the least squares method. (I also have experimental data for the gating function itself that I convolve with perfect exponentials to get the "fit" and find best parameters to...
I'm trying to figure out how a magnet affects the trajectory of a particle travelling near the speed of light downwards toward the ground. The equation for the force of the magnetic field is pretty difficult to solve, so I'm using Euler's method to approximate it. However, no matter how many timesteps I give Euler's me...
Corner singularities cause instability of finite difference solutions. They occur at the intersection of boundary conditions. I was recently going through an online video course that was explaining how to use the staggered grid and the marker and cell algorithm to solve the lid-driven cavity Navier-Stokes equations. Th...
Background I am decomposing (and then operating on) a symmetric positive definite matrix (a covariance matrix) as part of a larger system. Dimensions range from O(10) to O(300). The covariance matrices have reasonably dimensioned diagonal elements (i.e. do not differ by too many orders of magnitude), but are very stron...
Are there packages for numerical optimization in julia or python, or in any other system for scientific computing, capable of taking into account the discontinuity of gradient at the minimum point? Functions that I need to minimize have form $$ F(X) = \mbox{max}(f_1(X), \ldots, f_n(X)) $$ where $f_i(X)$ are smooth func...
I am trying to formulate an optimization problem where the decision variable is an index of the input array as part of the formulation. For example, I have the following term (this is simplified): $A[ max_t ( \alpha[t] * t ) ] $ A is an input 1D-array $\alpha[t]$ is the integer decision variable So my questions are...
Suppose $A$ is an $m\times n$ matrix with $\operatorname{Tr}(AA^T)=1$. Let $\sigma_i$ be the vector of singular values of $A$. How would I cheaply estimate the following quantity? $$\rho(A)=\sum_i \sigma_i^4$$ Motivation: $1/\rho(A)$ is a measure of "effective rank" of $AA^T$, a numerically stable alternative to algeb...
shape functions are the basis functions that interpolate a function in a subdomain using polynomials. linear interpolation is probably the most convenient approach which results in so-called "tent" functions. a combination of tent functions gives any desired piecewise linear interpolation. The idea can be generalized t...
currently I am solving 2D nonlinear second order differential equation containing mixed derivative. I started searching how to descretisize it and found two formulas for 4th order approximation. First one is just kronecker product of first derivatives $D_x\otimes D_y$. Here is fist question: what is resulting order of ...
Could someone please explain why my implementation of the Crank-Nicolson method applied to the non-steady heat equation won't converge? There shouldn't be any nonlinear aspects to my implementation but scipy's sparse conjugate gradient solver won't seem to converge even when I ramp up the maxiter parameter to 1000. Sci...
The (generalized) eigenvalue problems with a multiple eigenvalue are the ill-posed ones. I have two questions that should be simple for experts: (1) Is the eigenvalue problem much more sensitive to errors for matrices with a cluster of eigenvalues close to each other or for matrices with multiple eigenvalues? (https://...
I am applying a central Finite Difference scheme in space and an implicit Euler scheme in time on a variant of the 2d Burgers equation, of the form:$$u_t + uu_x + uu_y = \nu(u_{xx} + u_{yy})$$ where $u$ is an unknown variable that depends on x,y and t, and $u_t,u_x,u_y$ are the single derivatives of $u$ with respect to...
My knowledge of these subjects is reasonable but limited so please correct anything I say that is wrong. As I understand a hash, with today's technology, is virtually irreversible. Also, any good hash algorithm is completely symmetrical, which I believe means there is a 1:1 relationship between any possible input and o...
Intro and disclaimer: this question concerns developing a career in Scientific Computing in industry, starting from an (applied) mathematics background, say an MSc. It definitely arises from my current, personal situation but I think that formulated as is, it is not opinion based and can help also other people. I am ba...
I'm reading this set of notes on numerical stability of the diffusion equation. I can't seem to derive equation (7.17) from the previous equation. I've tried using $\sin^2(\theta)=\frac{1-\cos(2\theta)}{2}$, I've tried looking for the maximum using the first order optimality conditions. I'm missing a trick. Any help wo...
In computational plasma physics, one often faces problems with extremely high transport anisotropy, 1e6 and more, since transport along the magnetic field is much faster than across. To deal with this in numerical simulations, the common practice is to align the computational grid with the magnetic field, i.e., using g...
The short of it: How can I port bind an interactive transient PBS session to the head node and then port bind the head node to my local machine? So, a chain of port bind of three machines. More details: Disclaimer: I am not totally sure if I understand the minutiae of the differences between port binding and forwarding...
Consider a set of points. For simplicity, let's say that those are 2D points (although the problem works in higher dimensions as well). The goal is to find the minimum possible length of a connected 1-dimensional curve, such that it passes through all the points. Intuitively, the curve will consist of straight lines bu...
I'm trying to build a simple physic simulation with Verlet intergration, which I'm currently implementing as such: tmp = currentPosition currentPosition = currentPosition * 2 - this->previousPosition + acceleration * timeStep * timeStep previousPosition = tmp acceleration = Vector2(0, 0) ...
I have heard that one should avoid varying all parameters in a GSA by the same amount (e.g., 10%, 25% etc.) because it suggests that uncertainty is the same for all parameters. This makes sense to me if we have decent estimates of uncertainty for all the input parameters. However, what happens if there are many paramet...
I am trying to build a Python code that solves a set of coupled differential equations which will be spatially discretized by the method of lines advancing in time. I am planning to use solve_ivp. In my problem, the conservation of species includes the product of gas density and mass fraction of species in the time der...
I have been doing a lot of self-study on numerically solving PDEs so that I can solve system of linear and nonlinear Advection-Diffusion-Reaction (ADR) systems on complex meshes. I have been watching some wonderful videos by Qiqi Wang, as well as reading the books by Langtangen and by Larson and Bengzon. I have also us...
this may be irrelevant for people who need fast code. But for me it's just the opposite -- i.e. in the specific situations when I know that the extra time allows me to make my calculations more accurate, I'm willing to wait for 5 minutes to modify a 1-minute sound file (I'm not joking). My question has two parts. Conv...
Note: This is my first question on stackexchange; please tell me if I'm doing something incorrectly. I am trying to calculate a series of a 2D integrals in Python with an integrand that has several highly localized peaks. I've been using scipy.integrate.dblquad. However, repeatedly evaluating this integral for a series...
Is there a general procedure to detect if in a system of m-nonlinear equations (also non polynomial) of n-unknowns some of the equations are redundant? Can the rank of the Jacobian matrix tell me something? The systems I handle is usually underdetermined, so m is less or equal to n. How I numerically solve the system: ...
Hi this is my first question on the platform so feel free to comment if I have a mistake regarding the question. I'm working on an ellipse detection scheme in which I have markers consisted of 3 concentric circles. I'm able to find the inner and outer circles via fitEllipse method and some thresholding techniques in...
I'm having a program to compute the solution for a fluid-structure interaction model (blood and blood vessel walls) using FEM in MATLAB. The program is running fine but the function that I'm representing doesn't look too well. The differences between the values are too big and the function looks quite spiky. Here are ...
In finite element textbooks there are error estimate inequalities like $e<~h^p$ or $e<~N^{-p/d}$, where h is the FE length scale, d the # of dimensions, p the FE order, N the # of DOFs. Are these only valid for linear PDEs? If not, are these valid for all well defined PDEs with good regularity?
I have the following problem in 1-D: \begin{equation} \partial_t u(t,x) = v(x)\partial_x u(t,x) + \kappa(x) \partial_{xx} u(t,x),\,x\in\Omega;\quad \partial_{\nu}u(t,x) = 0, \,x\in\partial\Omega. \end{equation} I use the standard 3-point stencil for $\partial_{xx}$: $\frac{1}{h^2}\begin{bmatrix} 1 & -2 & 1 \end{bmatrix...
Disclaimer: I previously posted this on SO, but though it would be more relevant for scicomp. The original post has been deleted. I have been trying to recreate the functionality provided by MATLABs ordschur function by calling LAPACK directly (MATLAB uses LAPACKS dtrsen function to do its computation). More specifical...
I am working on fitting analytical curves to experimental data obtained in real viscoelastic tests (in fact, static creep tests). The setting of the problem is: the experimental data I have is a set of data points $(t_{i},y_{i})$ sampled equidistantly in time (i.e., $t_{i+1}=t_{i} + \Delta t$, in which $\Delta t$ is f...
Hi I have a problem to calculate lowest eigenvalue in non-symmetric matrix using Arpack, because my matrix is very complicated and even I have a lot of trouble to made a matrix - vector multiplication. But the Arpack can calculate only the largest magnitude with the simple matrix - vector multiplication, what I know to...
I've heard that matrix is inversion is unstable whereas the SVD is stable. Now, if $A$ is an invertible matrix, then its SVD is $$ A = USV^T $$ Then wouldn't it's inverse just be $$ A^{-1} = (USV^T)^{-1} = VS^{-1}U^T $$ If the inverse is computed this way, why would it lose stability? Because of the multiplications? ...
What could be the best way to implement the roller constraint in finite element code, i.e. constraint of the type $$\mathbf{u} \cdot \mathbf{n} = 0$$ I plan to enforce it in the weak sense by incorporating $$\int_\Gamma \lambda \mathbf{u} \cdot \mathbf{n} \, dA$$ into the weak form. However, it needs to define the Lagr...
I would like to calculate derivative of a given function ( a 1D array) using Array. Here is the code import numpy as np import matplotlib.pyplot as plt Lleft=-np.pi Lright=np.pi L=Lright-Lleft nx = 128 dx=L/nx x = np.linspace(start=Lleft, stop=Lright-dx, num=nx) u0=np.sin(x) #initial_profile uhat = (1 / nx) * np.ff...
Suppose the metric is abs(a-b) <= rtol * max(abs(a), abs(b)) i.e. math.isclose with atol=0. The default for float64 is rtol=1e-9. numpy.allclose uses rtol=1e-5. Both 1e-9 and 1e-5 make sense to me for float64, depending on application - former for stricter equality, latter for engineeresque "good enough". What I seek ...
I have a masters in maths and have been working in industry for a couple of years. Since I specialized more towards pure maths during my studies (theoretical PDEs), I have found myself needing to pick up many computational skills when I started working. Now, I have gained an interest in computational problem solving an...
I have a binary quadratic program with a convex objective function, of the form, \begin{align} \text{minimize}\;\;& x^tAx+b^tx\\ \text{subject to}\;\;& x_i\in\{0,1\} \end{align} where $A$ is positive semidefinite. I've played around a bit with semidefinite relaxations of this problem, but after some empirical testing, ...
It is straightforward to solve the eigenproblem $$\hat{k}^2 \psi = E\psi$$using a finite-difference method. But what about$$\hat{k}^2 \psi = E(1+\alpha E)\psi$$I know it is possible to first solve the case where $\alpha = 0$ and then work out $E$ by solving the quadratic equation $\alpha E^2 + E - E' = 0$. But is it po...
I am looking for AMR/re-meshing software (structured grids would suffice) that is NOT based on quad-octrees, i.e., a fixed refinement rate of 2 but (ideally) something user defined, i.e., ratios of 1.2, 1.5, ... of coarse to fine. Of course, this is a bit more complicated than the standard quad/octree styles, since (fo...
Matrices that achieve the worst case $\rho_n = 2^{n-1}$ element growth in LU factorization with partial pivoting are known; see e.g. Theorem 9.7 in Higham, Nicholas J., Accuracy and stability of numerical algorithms., Philadelphia, PA: SIAM. xxx, 680 p. (2002). ZBL1011.65010. Similar element growth bounds are known for...
From the book "Understanding the Finite Element Method" by Mark S. Gockenbach (Chapter 7), there is stated an integral: $$ \int_{T_k} \kappa \nabla \phi_i \cdot \nabla\phi_j. $$ for a triangle denoted $T_k$. The gradient $\phi_i$ is denoted as: $$\nabla \phi_i = \begin{bmatrix} b_i \\ c_i \end{bmatrix} {on} \hphantom a...
I'm simulating an electromagnetic wave that has a real and imaginary part. Something like: $$ E(x,t) = A(x,t) e^{-i(\omega t - k x)} $$ Where $A(x,t)$ is some complex amplitude. Then taking the physical intensity: $$ I(x,t) \propto |E(x,t)|^2 = A(x,t)\cdot A(x,t)^* = |A(x,t)|^2 $$ Now then if I take the FFT of a bunch...
A number of numerical problems are easy to solve when condition number $\kappa$ of the problem is low. For instance, conjugate gradient descent complexity scales as $O(\sqrt{\kappa})$. However "condition number" is numerically unstable, becoming meaningless for large problems a system that's well conditioned for all ...
I am running a pimpleFoam simulation on a supercomputer. I have to submit it as a job which has an allocated time. The simulation I was running ran out of this allocated time. So then I restarted it with startFrom latestTime; and writeInterval 0.01; in the controlDict, it started printing out many intermediate time r...
I'm not a mathematician, so sorry if I miss some obvious stuff. I'm trying to develop a bot for StarCraft 2, in particular the army control for it. For every army of the enemy, I want to find the minimal possible combination of my units that will be able to defeat it. For example, if I have 20 marines, 10 tanks, and 10...
I have a non-convex region (may contain holes). I want to: Fill region with rectangles No restriction on size or number of rectangles Maximize the area occupied by rectangles Minimize number of rectangles Avoid rectangle overlap Have rectangle axes aligned with bounding box's axes Are there standard heuristic approac...
Suppose we have a fourth-order parabolic PDE $$\partial_t u + a(t)\Delta( \Delta u) - div( b(x,t)\nabla u) =0$$ We split the equation into two second-order equations by introducing $w = \Delta u$ thus $$\partial_t u + a(t) \Delta w - div(b(x,t)\nabla u) =0$$ $$-\Delta u + w =0$$ I discretise the first equation as $$ \...
I'm looking for the "official" name(s) for a procedure for optimizing a convex loss function over a convex subset. This seems to be a default/naïve algorithm that folks come up with before learning the various barrier/penalty methods. I've seen things vaguely like this re-implemented a few times, from first principles ...
I am solving for a dynamic linear elasticity problem: \begin{equation} \dfrac{\partial^2 u}{\partial^2 t} - \nabla \cdot \sigma = f \end{equation} where $ u \in R^2 $ with sufficient BCs and initial values both on $ u $ and it's time derevative. After dicritization with FEM I get the standard: \begin{equation} M \dd...
In Finite Element Analysis, one requires to approximate the solution in terms of basis functions. My questions is, which method in general is better? by 'better', I mean which involves less number of unknowns to yield a certain accuracy? Let the solution of the problem be continuous and smooth in the domain of interest...
I am trying to solve a problem in python using scipy's solve_ivp. The system of ODEs I am trying to solve is for coupled where I am solving for two time-dependent variables: f and T. The derivative of T is in the following format: $$ \frac{dT}{dt}=g(t)+\frac{T}{f} \times \frac{df}{dt} $$ Where $g(t)$ is some function (...
I'm trying to understand the approach described in these questions: How to efficiently implement Dirichlet boundary conditions in global sparse finite element stiffnes matrices How to apply non zero Dirichlet boundary condition in finite elements? While I understand what's happening, I don't understand why the approach...
I'm trying to learn to numerically solve the perturbed Boltzmann-Einstein equations in cosmology using the RK4 method. These are the equations: $$\dot{\Theta}_{r,0}+k\Theta_{r,1}=-\dot{\Phi}$$ $$\dot{\Theta}_{r,1}+\frac{k}{3}\Theta_{r,0}=\frac{-k}{3}\Phi $$ $$\dot{\delta}+ikv=-3\dot{\Phi}$$ $$\dot{v}+\frac{\dot{a}}{a}v...
The aim is to construct symmetric Laplacian matrix $L$ for 2D square domain. I have the following discretization of second derivatives on non-uniform grid (will skip the steps of derivation, any textbook works). velocity vectors $u$ and $v$ are defined on cell faces, $x_i$ corresponds to $u_{i+mk}$, where m is amount o...
Some context of what I am trying to do: I am trying to implement a function that uses the heat method to calculate geodesic distances in a tetrahedral mesh, and I want to calculate the distances for multiple possible starting points. The final part of the heat method is to calculate a solution of $Lu = b$, where $b$ is...
I have a 3D vector field and I want to extract its divergence-free part (also called transverse component), using the Helmholtz decomposition. In principle, this can be done in the Fourier space, as illustrated here in the proof (and also reported here). I wrote this Python function, implementing this straightforward c...
Consider the finite element discretisation of a general second order linear differential equation, with mixed boundary conditions at the end. The boundary conditions are given as $\alpha_0u'(0)+\beta_0u(0)=\gamma_0$ and $\alpha_1u'(1)+\beta_1u(1)=\gamma_1$. Where $u$ is the dependent variable and the domain is $(0,1)$...
According to this link, All eigenpairs of large sparse symmetric matrix. The guy @Baranas seems to have given a very confident answer about solving the whole Eigen spectrum. May I know if anyone has any suggestions on what he is talking about or suggestions on what software to use (currently thinking about SLEPc) that ...
Given some function f(x) and a set of points A representing a linestring (or polygonal chain), I am searching for the point on this linestring that minimizes f(x). An iterative approach would be to do gradient descent and use the linestring direction for linesearch. However, I want to find a non-iterative solution. How...
I am trying to move completely open source. One of the things my research group does is cohesive zone modelling using traction separation laws, which I currently implement in ABAQUS. How easy would it be to write my own code for this? Our geometry is very simple, just two beams which we assume are linear elastic. Are t...
I'm typically using FEM for solid mechanics problems and when I look into performing fluid-structure interaction, I saw they use FV or SPH method for the fluid domain. I'm not an expert in fluid simulation but considering the Navier-Stokes pdes, I can see that they can well be discretized by FEM. Regardless of the inst...
Given a bivariate polynomial system with variables $(x, y, z)$ like (1) $ f_1 = x * a_1 + y * a_2 + z * a_3 = 0 $ (2) $ f_2 = x * a_4 + y * a_5 + z * a_6 = 0$ (3) $ f_3 = x^2 + y^2 - 1 = 0$ how do I determine the solutions/roots numerically? So far, I found out that I can reformulate the equation system into a matrix a...
when we consider a Immersed Membrane Without Shear, we can define a regularized elastic energy as $$\mathcal{E}(\varphi)=\int_{\Omega} E(|\nabla \varphi|) \frac{1}{\varepsilon} \zeta\left(\frac{\varphi}{\varepsilon}\right) d x$$ then after some operations we get **Theorem 3.**4 The temporal variation of $E$ given by th...
Consider an ODE system $$\dot x = f(t, x), \quad x(0) = \xi.$$ A collocation method to solve this ODE (1) assumes that $x$ can be approximated as a polynomial $x(t) \approx \sum_kx_kp_k(t)$ and (2) chooses the coefficients $\{x_k\}$ so that the initial condition is satisfied and so that the ODE is exact at some finite ...
I would like to make a table of values of (for example) Stirling numbers of the second kind. Is there any program that calculates those values from the reucurrence relation or combinatorial definition? Stirling number of the second kind S(n,k) is the number of ways to partition a set of n objects into k non-empty subse...
A function $f$ is strictly convex if $$f((1 - \lambda)x + \lambda y) \le (1 - \lambda)f(x) + \lambda f(y)$$ with equality if and only if $x$ and $y$ are equal. This implies that the second derivative of $f$ is positive-definite. A strongly convex function is one where we also have strictly positive lower bounds on the ...
Hello Computational Science community, I am working on modeling a dynamic system that involves homeostatic regulation in Python and I could use some guidance on how to implement it. Here's a brief overview of the problem: Background: I'm trying to simulate a biological system where different metabolites (chemical speci...
Question: How much would a simplified feed model in an EM simulation alter an antenna's directivity and the E-field phase reading when compared to using a more complicated/realistic feed model? I am simulating a set of custom metal pieces using MATLAB antenna toolbox (MATLAB uses Method of Moments). Originally, I wish ...
I asked this on the Physics site, but it fits much better here, and I now can ask a more specific question. For the scope of the problem, I have a 250-mL bottle filled with pure water and a sampling line at the bottom slowly draining the bottle to analyze, say 2.5 mL/min. The bottle is on the order of 10 cm high. Since...
I would like to make a table of values of a sequence similar to Stirling numbers of the first kind and for the Stirling numbers of the first kind. Stirling numbers of the first kind $c(n,k)$ satisfy the following polynomial relation: $$x(x+1)(x+1)...(x+n-1)=\sum_{k=0}^{n} c(n, k) x^k$$ What is the code in Python that c...
I have small dense square matrices for which I would like to compute the inverse by singular value decomposition, or equivalently solve the eigenvalue problem. While there are many direct methods for the solution or inverse of square matrices (eg gaussian elimination or LU decomposition) there is no such thing for the ...
Do any Density Functional Theory (DFT) codes (for example, QE ABINIT, Fleur, ....) provide the availability of getting the density of states (DOS) which produced by each iteration of the Self-Consistent Loop? If no, so, how can I get them? Thanks in advance!
There are some great libraries with linear solvers for sparse matrices - SuiteSparse is the obvious one. The methods work on sparse matrices with scalar entries. However, often in optimization problems, the matrices consist of dense sub-blocks within a sparse structure. Are there any solver libraries that define block ...
The leapfrog.cpp is an implementation of leapfrog integration algorithm where f() function is being integrated: leapfrog.cpp #include <cmath> #include <vector> struct Particle { double x, y, z; // positions double vx, vy, vz; // velocities }; // Function to calculate f(x, y, z) void f(const Particle& particl...
I am reading up on deep learning and I am trying to understand the backpropagation methods in python nanograd. See; https://github.com/rasmusbergpalm/nanograd This is a method for computing the gradient, however I cannot seem to decode what is going on here. Can anyone help me understand this? Maybe by running through ...
I have a complex monte-carlo cashflow model that traditionally uses the finite difference (FD) method to calculate its derivative at any given point. To improve model performance, I coded forward-mode automatic differentiation (AD) to directly calculate the cashflow derivative. The model is significantly faster using A...
My problem in brief: in some situations, the Runge Kutta 4th order method (RK4) doesn't seem to give 4th order improvement when using a smaller time step. I wonder how this worse-than-expected result can be explained. Consider two identical massive steel spherical balls with radius $R$. The values of the relevant prope...