instruction
stringlengths
43
28.1k
I am working on a fluid mechanics problem with a 4-D dataset (time,x,y,z). I am trying to find the RMS values such as $\overline{u^\prime u^\prime}$,$\overline{v^\prime v^\prime}$,$\overline{w^\prime w^\prime}$ etc., the standard procedure then is to decompose a quantity into its mean and fluctuating components $U = \o...
In Zhang's Algorithm to determine the intrinsic parameter matrix $K$ (see here for slides talking about this), we instead compute the matrix $B = K^{-T}K^{-1}$ since we obtain a linear system in the variables of that matrix. The general idea is that once we obtain $B$, we use the Cholesky decomposition to decompose $B$...
We have developed a (new) numerical scheme to solve the classical wave equation in 3 dimensions and we aim to publish the results. We can read in the aim and scope of the journal of computational and applied mathematics : " ...The computational efficiency (e.g. the convergence, stability, accuracy, ...) should be prove...
Can anyone suggest a rectangular problem I can use for evaluating a large dense linear solver? ($m,n>1000$) IE, ideally something that's easy to download and has been evaluated for some solvers already.
I am implementing an algorithm to identify the anisotropic lines in an unstructured mesh. This is done in the framework of an Agglomeration algorithm for Non-Structured multigrid applied to FV discretization of N-S equations. An Anisotropic line can be defined as a line of cells with the same characteristic: to have an...
I am taking a class on numerical analysis. While the professor was deriving the theory behind quadratic splines, the professor mentioned that a quadratic spline function has the form: $$ p_{i}(x)=a_{i}x^{2}+b_{i}x+c_{i}\quad\forall i=0,1,n $$ For a dataset with $n+1$ points, this means that we have a total of $3n$ unkn...
What evidence exists to suggest that computational science produces more information than studying real phenomena as they are? I think about this topic often, because I think synthetic knowledge is a fascinating topic, but once I begin to observe how empirical things really behave, then I recall that "all models are wr...
I have a square matrix $Y$ and I would like to find the solution $X$ for the following equation: $$X(X^TX)^{-1}=X(Y^TY)^{-1}$$ In this equation, we can suppose that $Y^TY$ is invertible. We could also rewrite the equation as: $$X\left(I-(Y^TY)^{-1}X^TX\right)=0$$ if this could be useful, at least there is no requiremen...
I want to fit a monotonically increasing smooth spline function for a dataset Code: from scipy.interpolate import interp1d import matplotlib.pyplot as plt x = [0., 0.75, 1.8, 2.25, 3.75, 4.5, 6.45, 6.75, 7.5, 8.325, 10.875, 11.25, 12.525, 12.75, 15., 20.85, 21.] y = [2.83811035, 2.81541896, 3.14311655, 3.22373554,...
Today I'm trying to evaluate this differential equation for internal energy in a gas in Fortran: $$ \frac{du}{dt} = - \frac{n_H^2}{\rho}\frac{\Lambda}{n_H^2} $$ Where nH is the density of hydrogen in the gas (costant), u is the internal energy: $$ u(T) = \frac{1}{\gamma - 1}\frac{kT}{\mu m_p} $$ And lambda is the cooli...
I need to create spare matrices with variable elements. Unfortunately, sparse matrix index operations are very slow. Is there any way to speed up the process? Maybe there are some tricks that I don't know of? n=100; n1=prod([6,n,n]); n2=prod([3,n,3,n]); X=sparse(n1,n2); for i=1:n1 X(i,i)=1; end for i=n1-prod([n...
I have the following equation $$ \dfrac{\partial s}{\partial t} + \nabla \cdot \left( \vec{v} s\right) = f(s) $$ Where $f(s)$ is an explicit source term that depends on $s$, e.g., ($\sin(s)\;cos(s)$). When solving with finite volume method (fvm), should I solve the above equation once until a final tolerance? Or should...
I’m looking for code that is well-suited to solving a fairly simple minimization problem: I have a reference point $\mathbf p$ in 3D space, and I want to minimize $\|\mathbf x - \mathbf p\|^2$ subject to a constraint $F(\mathbf x)=0$. The functions $F$ are very smooth, but typically have no useful convexity properties,...
I am currently reading this article by Sigmund. Sigmund, O., Maute, K. Topology optimization approaches. Struct Multidisc Optim 48, 1031–1055 (2013). https://doi.org/10.1007/s00158-013-0978-6 I understand that there are various forms of representation of the general optimization problem and categories such as convex ...
I tried to compute eigen values with the QR-algorithm found here (there is also a wikipedia page also) import numpy as np def qr_algorithm(A, tol=0.000001): Q, R = np.linalg.qr(A) previous = np.empty(shape=Q.shape) for i in range(500): previous[:] = Q X = R @ Q Q, R = np.linalg.qr(X...
If one has the Poisson problem (assume $\int_{\Omega} f = 0$ and $\int_{\Omega} u = 0$): \begin{alignat}{3} \Delta u(x) &= f(x), &\quad&x\in\Omega \\ \partial_nu(x) &= 0, &\quad&x\in\partial\Omega, \end{alignat} then a standard approach is to discretise it using finite differences. For example in 1D we have: \begin{equ...
I’ve been messing around with Ansys and I’m struggling to find the aerofoil coordinates for a NACA 66-012? I looked on Airfoil tools, but it doesn’t allow you to generate a 6 series aerofoil, only 4 and 5. Does anyone know any resource that can generate a 66-012 or any 6 series aerofoil coordinates please?
I've performed a parameter estimation repeat (i.e. 1000 parallel runs with the same initial values of parameters). I am trying to estimate ~20 parameters using measurements from experiments. After running the estimation task (using Evolution strategy algorithm) for 10 hours (using --maxTime argument), the results were ...
I'm not sure if the question suits this section of StackExchange, but I think the chance to get the answer is highest here (compared with other forums). So I hope more tolerance could be shown towrad this question. Thanks!
I want to solve the following system of equations which consists two PDEs and one ODE: \begin{align} \rho_t+v\rho_x &= 0; \newline Y_t+vY_x &= 0 ;\newline v_t &= -\frac{1}{(\int_0^1\rho dx)}\Big[-\frac{1}{3}\frac{1}{Fr^2}\int_0^1(\rho-1) dx +\xi v|v|\Big] \end{align} where $\rho, Y, T$ are function of $(x,...
I want to numerically simulate the motion of a point particle (unit mass) in $N$-dimensional space according to the force $f(\vec{x}, t)$ and bounded by a set of linear constraints (equalities as well as inequalities): $$A_i \vec{x} = \vec{c_i}$$ $$B_j \vec{x} \leq \vec{d_j}$$ The behavior of the particle when it comes...
I'm doing Metropolis-Hastings Monte Carlo simulations of a classical spin Hamiltonian at different temperatures using the parallel tempering algorithm. I have managed to obtain constant exchange rates across replicas by using an optimization of the temperature distribution and making a replica swap attempt after each l...
I would like to solve a set of coupled second order differential equations using inbuilt Matlab/Octave subroutines. These equations arise when trying to model sliding of mass ($m_2$) over a wedge of mass ($m_1$) under gravity and neglecting friction on all sliding surfaces. The equations are of the form: $$ \begin{bm...
Does it make any sense to acquire some sort of knowledge about manufacturing or engineering for computational design optimization? I've viewed computational science to be an abstract science suggesting that things could be studied in isolation (or this could be a goal), but I wonder if there's value in understanding ho...
I am an engineer who is trying to get a deeper understanding of FEM. I have been using the Zienkiewicz texts as my bible. It touches on the issue of incompressibility but I need a more intuitive way to think about what is happening here. My current understanding A 1 field displacement-based formulation has convergence ...
I have parameters $T$ for tension, $b$ for bounciness and $P_t$ for target value that should be approached as t goes to infinity. Currently I have written an equation like so: $\ddot{f}(t)=\frac{T(P_t-f(t))-\ddot{f}(t)}{b}$ Which is taken from code that I have written. However, while the code works, this equation does ...
Is there a unitary $U_{AB}$ such that, for any density operator $\rho$, we have $${\rm {Tr}}_A \left[U_{AB} \left(\frac{I_A}{2} \otimes \rho_B\right)U_{AB}^{\dagger}\right]= \frac{\rho_B}{2}+\frac{I_B}{4} \\ {\rm {Tr}}_B \left[U_{AB} \left(\frac{I_A}{2} \otimes \rho_B\right)U_{AB}^{\dagger}\right]= \frac{\rho_A}{2}+\fr...
The scipy.linalg.qz function implements generalized Schur decomposition for a pair of matrices A, B such that (A, B) = (Q @ AA @ Z*, Q @ BB @ Z*), where AA is quasi upper triangular and BB is upper triangular. The documentation says for the matrix AA "1x1 blocks correspond to real generalized eigenvalues and 2x2 blocks...
I have some data which I cannot manage to model and fit with a known function, so let’s say that they are a sample from the unknow function $f(x)$, which look a sort of skewed bell-shaped distribution. Given $a,b \in \mathbb{R}$ and $\vec{w}$ some parameters of the unknown function: $$\int_{a}^{b} f(x,\vec{w}=\vec{w_1...
The symmetric successive overrelaxation method features the iteration matrix $$P=\left(\frac{D}{\omega}+L\right)\frac{\omega}{2-\omega}D^{-1}\left(\frac{D}{\omega}+U\right)$$ Either as a stationary method or as a preconditioner, a system in that matrix is solved at every iteration. The method depends on a parameter $\o...
In Python I use the package torchdiffeq (as provided here) to solve initial value problems. Given an arbitrary function f(y, t, omega), I am wondering how to pass this additional argument omega to the odeint solver? From the documentation, I see that I can specify options such as the step_size, but I can't figure out h...
Nodal discontinuous Galerkin methods on simplices, like those described in Hesthaven and Warburton, have the nice property that the number of nodes is equal to the minimum number needed to represent a unisolvent order $N$ polynomial in $d$ dimensions, $$N_p = \frac{\prod_{i=1}^{d}(N+i)}{d!}$$ And we can construct $N_p$...
I've been struggling with this problem for a while so I hope someone can help me here. I'm trying to solve the McNabb-Foster equations for hydrogen diffusion in metals using a simple 1D finite element simulation in Python. This works fine under isothermal conditions, but I can't make it work for anisothermic conditions...
I recently started coding a small library of 2D PDE solvers (time dependent and time independent), and my first attempt was a 2D Poisson equation of the form: $$\nabla(\epsilon\nabla\varphi)=\nabla\epsilon\nabla\varphi+\epsilon\nabla^2\varphi=\rho.$$ The general idea was to write a 2D Poisson solver capable of solving ...
It's well known that if we use 2nd order, centered, finite differences for the Laplace operator, we have that the matrix can be written as $$K=I \otimes A + A \otimes I $$ where $I$ is the identity matrix and $A$ is the classical 1D matrix with stencil $\frac{1}{h^2}[1 ,-2, 1]$ My question is: in case I want to employ ...
for my work I am currently trying compare the mean curvature of different meshes. I have the following scheme. I have a ground truth mesh and a comparison mesh, which I want to compare it too. I am using meshlab to do it. 1.) Compute the curvature of the comparison mesh (as a vertex attribute) 2.) Transfer the vertex a...
The MacCormack finite-difference "predictor-corrector" method is well known to generate spurious oscillations near solution discontinuities such as shock waves in gas dynamics equations. Or even in simpler case of scalar advection equation, when advected function contains jumps. For teaching purposes, I'd like to find ...
I am trying to fit a piecewise polynomial function Code: import numpy as np import scipy from scipy.interpolate import UnivariateSpline, splrep from scipy.optimize import curve_fit from matplotlib import pyplot as plt def piecewise_func(x, X, Y): """ cond_l: condition list func_l: function list """ ...
I have implemented Upwind, Lax, Lax-Wendroff, Leapfrog and macCormak method for the linear advection equation with Dirichlet boundary conditions. I am trying to create the order of accuracy plots for these methods but I receive a constant lines for them. Not sure what is the issue. def u0(ig): x = np.arange(0, ig, ...
We often want to use numerical methods to evolve a system in time. That is, for a set of differential equations, we can specify some parameters $\bar{\theta}$ and pass these into our numerical solver program $f$ and get an output $y(t) = f(\bar{\theta})$. Does automatic differentiation still apply to these types of num...
Locally refined meshes are often inevitable for accurate, yet feasible computations. In the context of time-dependent PDEs, however, this comes at the cost that (due to the CFL condition) reducing the mesh width $\Delta x$ implies also that the timestep $\Delta t$ has to be reduced. To alleviate this problem, many effo...
The theory Consider a quantum harmonic oscillator described by the potential $V(q)=\frac{1}{2}m\omega^2 x^2$. In the path integral formulation, the partition function can be written as $$Z\propto\int Dx(\tau)\exp\left(-\frac{S_E}{\hbar}\right) $$ where $\tau$ is Euclidean time and $S_E$ is the Euclidean action for clos...
I'm attempting to carry out transition state optimisations in Gaussian and a lot of my calculations are coming up with errors, the main one being no analytic 2nd derivatives for this method. How can I get past this? I am using the same input as for the local minima, but using the statement opt=(ts,noeigen,calcfc) Am ...
I am currently trying to calculate Landau levels for any system numerically in python. But, I am clueless about where to start rather, how to construct the Hamiltonian. Can anyone help?
The time-dependent Schroedinger equation (TDSE) depends linearly on the system's initial state $\vert \psi(0) \rangle$, such that the solution can be generally written as $$ \vert \psi(t) \rangle = \exp \left( \frac{i}{\hbar} \int_0^t \text{d}t' \widehat{H(t')} \right) \vert \psi(0) \rangle \quad , \quad (1) $$ where t...
The armijo step length formula states that f(x+lr*descent_direction) <=f(x)+c*lr*f_gradient*descent_direction In the above formula lris the learning rate and f is the loss function. In a neural network setup, in order to find the armijo step length for the loss function, I need to calculate the loss on the updated mod...
I'm trying to estimate the parameters (v, n, k) defined in fit_func. I tried the default least squares fit but I couldn't find the parameters successfully. def fit_func(x, v, n, k): return v * x ** n / (k ** n + x ** n) x = [2.5, 2.71317829, 4.08, 4.18604651, 5.19379845, 6.92, 7.98449612, 8.94,...
To what extent can you put trust in a numerical solution obtained by direct solver for an ill-conditioned linear system? In other words, how can you test the solution? Dropping it into the system says nothing, because small residual can lead to a big error for an ill-conditioned system.
Trying to solve numerically the 2D Poisson equation with variable diffusion coefficient $K$, that in general can be discontinuous. $$ \frac{\partial}{\partial x} ( K(x,y)\frac{\partial C}{\partial x}) + \frac{\partial}{\partial y} ( K(x,y)\frac{\partial C}{\partial y}) =a$$ where $a$ is a constant. Would this second ...
I am training a neural network with the multiobjective steepest gradient descent algorithm. The want to steer the direction of the gradient descent so that I land up at a point slightly above where I am landing now. How can I achieve this? Is there any mathematical way to scale the gradients? In case of the neural netw...
Natural neighbor interpolation is defined here, it is an intriguing method that uses voronoi diagrams. Notably it is smooth almost everywhere whereas linear interpolation is only piecewise linear. I was using it for my research but after some playing around it seems to just be... worse than linear. Here is a pic of nat...
Let $X$ and $Y$ be two given $k\times n$ real matrices. If $A$ is a $k\times k$ real matrix then $AX - Y$ is a $k\times n$ real matrix. Applying the Frobenius norm $\| AX - Y \|$, we get a non-negative real number. Let $\mathcal M_k$ be the space of all $k\times k$ real matrices. We have a continuous map $\mathcal M_k\...
I appreciate this might be an easy question, but I've managed to get myself quite thoroughly confused I'm trying to solve a system of physics equations that look as follows $$ \frac{\partial \mathbf{E}}{\partial t}=-\alpha \mathbf{j} \\ \frac{\partial \mathbf{j}}{\partial t}=\beta\mathbf{E}+\gamma\mathbf{j}\times\math...
I am following along Rourke's book and I am trying to do the excercies mentioned in this SO post: Min supporting line for a set of points Design an algorithm to find a line that: has all the points of a given set to one side minimizes the sum of the perpendicular distances of the points to Assume a hull algorithm is...
I have been trying to understand the recently proposed Sparse Identification of Nonlinear Dynamics SINDy. Despite several attempts, I seem to fail to understand the difference between SINDy and the standard methods used for parameter identification in the field of system identification. The PNAS paper neither discusses...
I have a system $\vec{x}_{i + 1} = \vec{x}_i + W_i$ where $W = N(\vec{\mu}, \Sigma)$. For some matrix $H_i$, let $y_i = H_i$ and let $z_i = y_i + R$. Where $R$ is some random variable. We are given $pdf(y_i | z_i)$. Using this, I can calculate the mean and the covariance of $y_i$ conditioned on the observation $z_i$ (I...
How could one calculate the KKT conditions in the case of bound-constrained optimization? In the general sense, given an objective function $J$ and design variables $x \in \mathcal{R}^n$, we consider the following optimization problem: $\min\limits_{x\in \mathcal{R}^n} J(x)$ with the following bounds for $x_j$ $x_j -1 ...
For many linear operators, it is easy to express them as a function. For example, to blur an image, simply compute a weighted sum of neighboring pixels (or even easier, import gaussian_filter from scipy.ndimage). To reverse this process, it is useful to represent this function/linear operator as a matrix, because matri...
Recently, I've been struggling to understand the limitations and capabilities of the successive over-relaxation (SOR) method for boundary value problems which are ill-posed, such as, for instance, boundary value problem (BVP) in form of Poisson equation with pure Neumann boundary conditions ($\nabla^2u=f$ and $\frac{\p...
In passing I was told by someone that $K^{\prime}\in\mathbb{R}^{n\times n}$, will be easier to solve by an algebraic multigrid preconditioned conjugate gradient (CG-AMG) solver than $K$, where $K$ is a discretized elliptic (2nd order) differential operator, that is symmetric positive definite, and \begin{align*} K^{\pr...
Poisson disk or blue noise sampling consists of finding a random, maximal set of points $\{x_i\}$ in a domain $\Omega$ such that $\|x_i - x_j\| \ge r$ for some fixed radius $r$ and for all $i$, $j$. There are several algorithms for efficient blue noise sampling, for example Bridson's algorithm. Blue noise sampling is u...
I am trying to solve a boundary value problem on $[0, \infty]$, using scipy's scipy.integrate.solve_bvp and I am seeing that the solutions are not converging even with high number of iterations, and that they depend strongly on my initial guess. The problem I have is complex but persists even in the following minimal e...
I am trying to solve with high precision the following coupled system $(f,h)$ on $[0,\infty]$: $$-h''-\frac{1}{r}h'+\lambda_c h(f^2-1)+4\lambda_h h^3=0$$ $$-f''-\frac{1}{r}f'+\frac{1}{r^2}f+ f(-\lambda_f+2\lambda_c h^2)+\lambda_f f^3=0$$ where $\lambda_h, \lambda_f, \lambda_c $ are positive constants, and with boundary...
This may be an easy question to answer but I am really stuck. In several topics (especially that of quasicrystals) the Fibonacci chain's Fourier transform and diffraction pattern is mentioned. Despite the chain not being periodic, its diffraction pattern shows sharp peaks (a hallmark of quasicrystals). See for example ...
I'm trying to model some two-dimensional waves, and am unsure how to combine my boundary conditions with spectral methods. The PDE I'd like to explore resembles the equations for damped, driven bending-mode waves in a thin disk or beam: $$\ddot w(\boldsymbol x,t) = -c \nabla^2 \nabla^2 w(\boldsymbol x,t) - d \dot w(\bo...
I have seen finite difference methods for fluid equations (Stokes and Navier--Stokes) that solve a pressure problem first and then a fluid problem. That is, although they solve two different problems, they are two smaller problems, which from a computational point of view is a tremendous advantage compared to solving o...
I'm looking for a way to implement the regular Coulomb wave function in python. This function is a solution to \begin{align} \frac{\text{d}^2\,u}{\text{d}z^2}+\left(1-\frac{2\eta}{z}-\frac{\ell(\ell+1)}{z^2} \right)u(z)=0 \end{align} The regular Coulomb wave function is given by \begin{align} F_\ell(\eta,z) = C_\ell(\e...
TL:DR How can one implement a bifurcation diagram of a seasonally forced epidemiological model such as SEIR (susceptible, exposed, infected, recovered) in Python? I already know how to implement the model itself and display a sampled time series (see this stackoverflow question), but I am struggling with reproducing fi...
Suppose I want to solve an overdetermined linear least squares problem $$ x = \operatorname*{argmin}_{x\in\mathbb{R}^n} \| Ax - b\|^2 $$ where $A \in \mathbb{R}^{m\times n}$ has full column rank. I make no assumptions that this system is nearly consistent. Suppose I know a have access to a matrix $P\in\mathbb{R}^{n\tim...
Assume that $f$ is defined as a composition of functions: $$f=f_2 \circ f_1$$ where $f_1:\mathbb{R}^n \rightarrow \mathbb{R}^{m_1}$ and $f_2:\mathbb{R}^{m_1} \rightarrow \mathbb{R}^n$. We can compute the Jacobian $J_f(x)$ using the chain rule: $$J_f(x) = J_{f_2}(f_1(x))J_{f_1}(x)$$ and we can also compute the Hessian $...
I read somewhere that the Measn squared error loss function acts as L2 norm of the paramter vector. I would like to know if I am using binary cross entropy loss function, do I need to calculate the norm seperately? or the BCE loss function also acts as a norm? As an additional question I would like to know that is grad...
I have working on 2 ways of training a neural network. The first method uses gradient descent updates the model with Adam optimizer. the second method minimizes the norm of the gradient of the functions and updates the network. What is the difference between the two? does normal gradient descent guarantee minimum norm...
I am interested in computing integrals of the form $\iint_{P\times P} Q(x_1,x_2,y_2,y_2) dxdy$ where $P$ is a polygon and $Q$ is a polynomial. The coordinates $(x_1,x_2)$ are in the plane of $P$. Of course $(y_1,y_2)$ represent again coordinates in the plane of $P$, possibly different from previous ones. The above inte...
How should I modify the following matrix formulation of a finite element (FE) approximation of Poisson equation at the (internal) interface denoted by the nodes $i-1$ to $i+1$ having a continuous 1st derivative $\epsilon_1 \nabla\cdot U_1 = \epsilon_2 \nabla\cdot U_2$ at the internal interface nodes (say from $i-1$ to ...
I have a distributed matrix in block cyclic layout. Is there an efficient way to out/in place transpose a distributed matrix with scalapack? Context: I am trying to diagonalize the transpose of a distributed matrix with pzheevd EDIT: Thanks to Ian Bush, It fixed the problem. Bit curious if there is a nice way to do it
I am just starting my MSc and we have been given an assignment in which we must model two-dimensional, laminar, incompressible Poiseuille flow in a channel. We are supposed to use a VELOCITY INLET inlet boundary condition and two different outlet boundary conditions - the OUTFLOW boundary condition and the PRESSURE OUT...
I'm new to Gmsh and after browsing many sites I haven't found the answer for this silly error. Using the native language of the software, I'm assigning a value to the Transfinite property of a bunch of lines (with no consecutive ID's) in my model, using this syntax: value = 10; For i In [81, 83, 85, 87, 72, 73, 75, 77,...
I'm starting to look at ways to analyze the output of a mass spectrometer. My first searches led to some white papers far from what I'm looking for (complex molecules vs simple atoms for me). With mass spectrometers being over a century old I'd thought it'd be easy to find algorithm to extract data from the spectra, bu...
I'm searching for an algorithm that can generate a set of 500 to 2000 characters from the alphabet a-z, A-Z, 0-9 (no interpunctuation) where the set has the following properties: highly compressible with gzip, ideally compressing 2000 characters input to 200 characters output, and generated text looks "random enough" ...
I am trying to solve the following problem: $$ \frac{d^2y}{dx^2}=\sinh(y) $$ Where the boundary conditions are: $y(0)=-1$, and $ \frac{dy(x\rightarrow \infty)}{dx}=0 $. Through central difference approximation, this can be simplified to: $$ y(x_{i+1})-2\cdot y(x_i)+y(x_{i-1})=h^2\cdot \sinh(y(x_i)) $$ Where $h$ is the ...
I am interested in computing the dispersion / phase error(s ?) of an (explicit) Runge-Kutta method when applied to a linear system of ODEs $$ u'(t) = A u(t). \tag{1} \label{1} $$ To begin, consider the linear test equation $$u_t = \lambda u = (x + iy) u \tag{2}$$ and a $S$-stage Runge-Kutta method with stability polyno...
I'm soon going to start a job as a Scientific Computing software developer. My responsibilities as discussed with the manager are as follows: Analyzing/understanding the existing functionalities (numerical algorithms and physical models) in the 2nd version of the code, written in Fortran. Acquiring skills and knowledg...
I'm looking at the solution to a structural mechanics problem that is modeled with first-order elements and then as a comparison with second-order elements. It is clear that the first-order elements behave as very stiff elements and give very different displacements compared to the second-order elements. But shouldn't ...
LAPACK.gglse allows me to solve min x^T Q x s.t. A x = y (in my present use case, $Q$ is symmetric positive definite) without having to think about the numerical stability, computational efficiency, and bug potential of my own attempts of wiring up the solution x^* := L y where L := Q^{-1} A^T (A Q^{-1} A^T)^{-1} Doe...
recently I need to solve a 2D steady state PDE equation. It’s not time dependent, and the only two independent variables are z and r direction. So far for this solution, I was thinking using Method of Lines (MOL) to semi-discretize only the r radius direction and source term, leaving the spatial z coordinate and Tempe...
I am looking for advice on what numerical methods to consider to solve optimization problems like the following, ideally with as few evaluations of the objective function as possible. I am looking to maximize a one-variable function $f(x)$ on an interval $[a, b]$. The function is a black box and cannot be computed out...
I have an oscillatory data generated vs time as shown below. Essentially, I want this data to be averaged and free of any oscillations. I am not satisfied with the results from a simple moving average algorithm. Which moving algorithms or approaches are worth trying?
Please, someone tell me what is wrong in my code it does not give any outputs ( No plot nor print). The code is as below: from scipy.integrate import solve_ivp import numpy as np import matplotlib.pyplot as plt from math import sin, cos, pi def f(t,p): # assigning each ODE to a vector element r,θ,ϕ,x,y,z = p ...
I have multiple set of input (5 parameters) and output from an unknown function. But I know this is a polynomial function. What method can I use to optimize to find the polynomial variable that can fit those parameters? A lot of optimization method that I know need a known function. I have tried optimizing the polynom...
In a current research project, I have a number of matrices with coefficients in ℚ[] for which I want to understand how their rank depends on the value of the parameter . These matrices are: sparse (a typical example is a matrix of size 160x200 with less than 10 non-zero entries per row), rather 'regular' (each entry i...
Recently I have obtained a csv value form and experiment I have computed. However, I was trying to understand how each individual component being calculated. The image attached shows sample point deformation with time as each row represent a time step (I am not sure if I can upload the csv file here as there is no uplo...
I am running a program that uses [a lot of] looping to perform a type of bootstrap analysis. The computational step - PCA - can take a long time (60+) seconds, which means that collectively this program could take almost a week to run serially. I have tried using multiprocessing on a high performance cluster - using co...
Do you suggest any references (papers, monographs, books) about the philosophy of computational science? Recently, I found out about the following two: Winsberg, E. (2009). Computer simulation and the philosophy of science. Philosophy Compass, 4(5), 835-845. Winsberg, E. (2010). Science in the age of computer simulat...
as I have to design a reactor and therefore have to get its length x, I have to solve the following differential equations: $$D_{eg}\tfrac{d^2A_g}{dx^2}-u_g\tfrac{dA_g}{dx} = k_la_b\left(\tfrac{A_g}{H_A}-A_l\right)$$ $$\frac{}{}D_{el}\frac{d^2A_l}{dx^2}-u_l \tfrac{dA_l}{dx}+ k_la_b\left(\tfrac{A_g}{H_A}-A_l\right) = (1...
Where can I find a source code for the SSOR method with Eisenstat's trick? The original paper includes pseudo code but also seems to have minor typos. For that reason, I would be very happy to see an implementation somewhere. Unfortunately, I haven't any in the common libraries (perhaps the code is hidden to deep).
I am trying to compute $\mathbf{X}\mathbf{u}$ for many times in my algorithm, where $\mathbf{X}\in \mathbb{R}^{n\times m}$ and $\mathbf{u} \in \mathbb{R}^{m}$. The problem is that, during the computational process of the algorithm, $\mathbf{X}$ is a constant, however, more and more elements in $\mathbf{X}$ can be chang...
I already asked this question on StackExchange Mathematics, but it seems too domain-specific. Searching where to put Computer Vision related questions it was suggested to use Computational Science since there is no specific CV StackExchange branch. With the direct linear transform, one can calibrate a camera and receiv...
I was reading a book by Simon Haykin on neural networks when I came across the following strong statement (on the pdf's page 188): "However, we still have a computational complexity that is $\mathcal{O}(W^2)$, where $W$ is the size of weight vector $\mathbf{w}$. Quasi-Newton methods are therefore computationally imprac...
What are the most prominent use cases for Java in scientific computing? I've viewed the domain heavily C/C++, Fortran and possibly Python dominant, but what about Java?
Software like Diamond and VESTA allow users to build a supercell by extending the structure along the basis vectors of the latttice. However, I'd like to do something more general and build a supercell from an arbitrary integer matrix transformation. For instance, if I want to convert a primitive hexagonal unit cell in...