All Questions

Filter by
Sorted by
Tagged with
0
votes
0answers
22 views

Error analysis of Modified Lentz's method

In Numerical Recipes, the authors state: There is at present no rigorous analysis of error propagation in Lentz’s algorithm. This statement is now ~15 years old, so I wonder has this gap in the ...
0
votes
1answer
51 views

How to use cumtrapz correctly?

I have tried to do a trapeze integration with f(x)=x^2, where I know how the antiderivative looks like, so F(x) = (1/3)x^3 Here's my code, just like I tried: ...
3
votes
0answers
46 views

Some formulations of domain coupling lead to saddle point problems. Is this merely an artifact?

Background I wanted to learn how to couple FEM and BEM (for the Poisson equation), because I wanted to better understand how open boundary conditions look like. Therefore I worked through the relevant ...
-1
votes
1answer
23 views

How to connect two cylinders to form a knee in Comsol Multiphysics?

I have this I want it to be single bended wire. How to accomplish?
0
votes
1answer
88 views

I need help with a variational formulation

For this problem \begin{cases} &\frac{d^2 u}{dx^2}=Log(1+x+y),in \quad\Omega=(0,1)^2\\ &u=0,\qquad on \quad\Gamma_{1}: x=0\\ &u=0,\qquad on \quad\Gamma_{3}: x=1\\ &\frac{du}{d\eta}=0,\...
1
vote
1answer
535 views

Split-step Fourier method applied on Schrodinger equation

I'm trying to solve a Schrodinger equation of the form $i\frac{\partial}{\partial t}\psi=-\frac{\partial^2}{\partial x^2}\psi + (V(x)+\alpha|\psi|^2)\psi$ using the split-step Fourier method ...
3
votes
0answers
81 views

Compute Nullspace of Sparse Matrix

I am computing the nullspace of a sparse rectangular $m$ x $n$ matrix $A$, where $m$ << $n$. I do this by computing the QR decomposition of $A^T$ and extract the $n-m$ right-most columns of the ...
35
votes
18answers
9k views

Good examples of “two is easy, three is hard” in computational sciences

I recently encountered a formulation of the meta-phenomenon: "two is easy, three is hard" (phrased this way by Federico Poloni), which can be described, as follows: When a certain problem is ...
3
votes
0answers
82 views

Is the matrix exponential and the Jordan canonical form actually useful for solving differential equations?

All of my yearlong graduate-level Linear Algebra course notes from my professor—an algebraist/representation theorist—shows his love for the exponential map $e^A$ and the Jordan canonical form—and one ...
22
votes
9answers
9k views

Are there any embarrassingly parallel tasks that require a CPU rather than GPU?

I am looking for tasks that are unsuitable for GPUs gain significant speedup as more CPU nodes are added don't require large data transfer or inter-thread communication between nodes. Do any ...
0
votes
0answers
51 views

Applying the result of Cuthill-McKee in SciPy (followup)

This is a followup to Applying the result of Cuthill-McKee in SciPy , where I'm not sure the answer given is correct. It's also 4 years old, so I'm trying a new question. The question is still ...
0
votes
0answers
64 views

Why is my numerical solution to a set of ODEs infinite?

I am trying to solve the following linear PDEs $$\frac{\partial u_x}{\partial x}=-[i\omega b_{||}+\nabla_\perp u_\perp],$$ $$\frac{\partial b_{||}}{\partial x}=-\frac{i}{\omega}\mathcal{L}u_x,$$ $$\...
0
votes
0answers
37 views

Plotting a Magnetic Field in Spherical Coordinates in Python

I am modeling a Helmholtz Coil as two dipoles from far away and I want to plot the magnetic field. $$\mathbf{B}(\mathbf{r}) = \frac{\mu_0 |\mathbf{m}|}{4\pi r^3}\left(2\cos\theta\,\hat{\mathbf{r}} + \...
0
votes
1answer
64 views

Dealing neighbor list in NVT Monte Carlo (MC) simulation

I'm making a NVT Monte Carlo (MC) simulation code with only short range interaction. I found many MC tutorial codes (usually Lennard-Jones system) in online. However, most of them are doing energy ...
3
votes
0answers
35 views

Numerical calculation of the Berry connection

I'm doing some numerical calculations involving Hermitian matrices, and derivatives of the eigenvectors. Essentially, I have an n x n, Hermitian matrix H(x), which is dependent on some continuous ...
5
votes
1answer
88 views

Accurately Computing a Positive Vector in the Nullspace of a Matrix

I'm sure this question has been asked before yet after many hours of searching I am unable to find a definitive answer. The problem at hand is solving the linear system: $$A \mathbf{x} = \mathbf{0}$$ ...
0
votes
1answer
127 views

Red flags for numerical computing?

I've learnt the hard way that you should avoid: computing small numbers as the difference of two large numbers evaluating chaotic functions with imprecise inputs. Are there any other red flags a ...
-1
votes
1answer
95 views

Numerical solution for gradient(slope)

Abstract I have the next equation to find a force, for my problem: $$U=-\int \vec{m}\small{(x)}\times \vec{B}(x)dV$$ $$\vec{F}=-\nabla U$$ Considering 3-dimensional space with x,y,z coordinates, ...
0
votes
0answers
15 views

How to multiply 2 decision variables and a matrix using python

So, basically our agenda is to assign tour guides to tour groups based on this equation and that will be done by these 2 decision variables z(u,g) and y(g,p) where z(u,g) will be 1 if tour guide 'u' ...
0
votes
0answers
26 views

Estimating the dimension of a solution space in nonlinear least squares

Suppose I have a nonlinear least squares problem, $$ \min_{\mathbf{x}} || \mathbf{f}(\mathbf{x}) ||^2 $$ with $n$ residuals and $m$ parameters, so that $\mathbf{x} \in \mathbb{R}^m$, and $\mathbf{f} \...
2
votes
2answers
682 views

Computing the Ising Model for NiO

I am trying to compute the Ising model for NiO. As O carries no magnetic moment, I only need to consider the case of Ni which requires a second nearest neighbour Ising model. As can be seen in the ...
3
votes
1answer
31 views

Ising NiO model energy

I am simulating Ising model for NiO. I have simulated for 2d,3d,triangular lattices, and have tried to do the same with NiO model. There are papers which say that the ground state energy is around -...
1
vote
0answers
25 views

Entropy of a spatially and temporally varying fluid system?

I'm trying to analyze the change in system thermodynamic entropy of an ideal gas system. For reference, I'm analyzing solution techniques for solving the 1D compressible Euler equations: $$ \partial_t ...
2
votes
0answers
42 views

Solving Stokes Equations in 3D - Do I need to treat pressure-velocity coupling iteratively?

I need to develop a code to solve Stokes Equations in 3D in cubic geometries (structured grid, uniform mesh spacing). My code needs to take a pressure gradient in one direction as a BC (pinlet=p1, ...
1
vote
0answers
30 views

Effect of reducing flux consistency order at boundary on convergence order

Consider the 1D nonstationary convection-diffusion PDE $$ \begin{alignat}{2} \partial_t u &= -a \partial_x u + D \partial_{xx}u, &\qquad x \in (0,1), t \in (0,T), \\ f(t) &= \left.\left( a ...
2
votes
1answer
78 views

Dense decomposition of very non-square matrices

I have inherited code that solves Eigen::Matrix problems using the code shown on this page: ...
0
votes
1answer
29 views

Clarification regarding 3D FMM translation operators

I am implementing an adaptive 3D FMM with the "basic" $O(p^4)$ translation operators. I am looking for clarification on the multipole-to-multipole (M2M) translation operator. I will explain my ...
0
votes
1answer
55 views

Solving a sparse linear system using transpose of lower triangular matrix without copying

I have a sparse lower-triangular matrix $L$, and a right-hand side $b$, and I'd like to solve the linear system $$L^T x = b$$ but without explicitly creating $L^T$. Ideally, I could write something ...
4
votes
3answers
83 views

I wrote a 2D Finite Element program for Axial Loaded Plates, but the results are unexpected

TLDR: I used Python to write a 2D Finite Element program using 'Constant Strain Triangles' and my beam keeps pointing slightly upwards instead of straight sideways (like the force). I'm new to FEA and ...
1
vote
1answer
57 views

Simple reference problems for time harmonic Maxwell equations

For Navier-Stokes problems we can often choose a relatively simple verification problem such as the lid driven cavity, flow over a cylinder, or flow over a backward facing step to verify our ...
2
votes
1answer
34 views

what does `cusparse<t>csrsv2_analysis()` do?

In cuSPARSE, you can solve a sparse triangular linear system by calling cusparse<t>csrsv2_solve(). However, you need to call ...
5
votes
0answers
37 views

Origin of phrase `computational microscope'

I have heard the term 'computational microscope' used to describe the practice of molecular simulation (in the context e.g. computational chemistry, materials science) and its use as a numerical tool ...
0
votes
0answers
36 views

scipy's solve_ivp returns erroneous results for a stiff differential equation

I'm using scipy's solve_ivp for solving a stiff differential equation. I'm using method BDF for solving the same. I have already used MATLAB's ode23s and I'm getting correct results in MATLAB. However,...
0
votes
0answers
67 views

Numerical scheme to calculate the normal mode of a set of hyperbolic PDEs?

I would like to solve the linearised, ideal, MHD equations, where the gas pressure is zero. $$\frac{\partial u_x}{\partial t}=v_A^2(x,z)\left[\nabla_{||}b_x - \frac{\partial b_{||}}{\partial x}\right],...
2
votes
0answers
31 views

Non-negative Least Squares to perform Inverse Laplace with weights

I'm trying to perform the inverse Laplace transform of a (noisy) dataset $y_i$ using Tikhonov regularization: $$\min \sum_{i=1}^{N} \left(\int_0^\infty e^{-s_i t} f(t) \, dt - y_i \right)^2 - \lambda^...
4
votes
0answers
18 views

Optimization for sampling multiple points of maximized minimum distance

I'm trying to find a way to sample new points that have maximum minimum-distance (maximin distance). The current situation is where there are ns number of pre-existing sample points. I want N number ...
1
vote
0answers
22 views

Combining many probabilities, modifying, seeking general formula

CONTEXT I need to combine the probability of occurrence of many thousands of events for millions of individuals (trees) in an agent-based/individual-based simulation model developed in NetLogo (agent-...
21
votes
4answers
7k views

F2Py with allocatable and assumed shape arrays

I would like to use f2py with modern Fortran. In particular I'm trying to get the following basic example to work. This is the smallest useful example I could ...
4
votes
2answers
7k views

Tikhonov regularization in the non-negative least square - NNLS (python:scipy)

I am working on a project that I need to add a regularization into the NNLS algorithm. Is there a way to add the Tikhonov regularization into the NNLS implementation of scipy [1]? [2] talks about it, ...
1
vote
1answer
44 views

Bode diagram without bode() function

Is there any way to make a bode plot without using the MATLAB/GNU Octave function bode()? As an example, here is a function I am working on: $$H(s) = \frac{1}{2s^...
4
votes
0answers
192 views

What algorithm does (or did?) Excel use for Bessel functions that is discontinuous at x=8?

Writing this comment reminded me of something I noticed years ago about evaluating Bessel functions of the first kind $J_n(x)$ in Excel. (BESSELJ) I don't use Excel now but at the time I'd checked ...
0
votes
1answer
88 views

Two RK4 method in one program

I want to solve this integral using RK4 by coding in Fortran: $$R=∫1/a(t) dt → dR/dt=1/a(t) =f(t)$$ Initial point: t=0 (or a=0.001) and R=0 And I have to get a(t) by solving another ...
-2
votes
1answer
303 views

Multi-objective optimization problem - Euclidean space

I am looking for some clues for an optimization problem. My problem consists of arriving to a image by optimizing multiple layers with the pixel position probability. This is an overview of the ...
0
votes
0answers
22 views

At what l/d ratio will a frame element start to behave as a shell element?

I'm working in ETABS. There are few columns of dimension 300mmx1400mm. The height of building is 36.6 meter above ground level and the dimension of building is 26mx68m. I'm getting the time period of ...
2
votes
1answer
88 views

Solving an m x m symmetric linear system involving a matrix multiplication versus an (n+m) x (n+m) system

Suppose that $R$ and $D$ are an $n \times m$ and $m \times m$ matrices. Assume that $m \ll n$ and that $D$ is positive definite. We would like to solve the system $(R^T R + D) x = R^T b$. This ...
0
votes
0answers
74 views

A parallelized GMRES solver?

My application calls for solving a dense, 40,000 x 40,000, ill-conditioned linear system. The native SciPy GMRES solver with preconditioning has worked well for my application and solving a single ...
1
vote
1answer
96 views

Why is my Cahn-Hilliard simulation separating out so finely?

I am trying to simulate the Cahn-Hilliard equation using Python, but the 2 fluids aren't separating into big blobs, as desired, under any conditions. I'm setting up (what I think is) an orthogonal ...
0
votes
0answers
26 views

Compute the sum of probabilities when they are given as logits

Say I have a set of numerous probabilities given by their logarithm : $\{\ln p_i, 1 \leq i \leq N\}$. I want to compute $\sum p_i$, if possible without exponentiating $\ln p_i$, since some of those ...
3
votes
3answers
4k views

Runge-Kutta Simulation For Projectile Motion With Drag

I am attempting to simulate projectile flight with drag. However, with a timestep of 0.1 seconds, I am consistently getting an error of ~0.1-1%. ...
0
votes
0answers
60 views

Change one inlet boundary condition

This is a problem in modeling in hydraulic fracturing field. It's quite long so hopefully someone can patiently read and help me. The equation numbers are match those of the reference paper by ...

15 30 50 per page
1
3 4
5
6 7
179