# Questions tagged [numpy]

NumPy is the fundamental package for scientific computing with Python.

162 questions
Filter by
Sorted by
Tagged with
1 vote
100 views

### Improvement to naive gradient descent implementation for the Thomson problem

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 ...
143 views

### Helmholtz decomposition of a vector field in Fourier space with Python

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 ...
1 vote
217 views

### Float equality tolerance for single and half precision

Suppose the metric is abs(a-b) <= rtol * max(abs(a), abs(b)) i.e. math.isclose with ...
73 views

### Compute a series of matrix multiplications and matrix norms quickly in Python

I need to compute a series of matrix multiplications involving 3x3 matrices and a series of matrix norms also involving 3x3 matrices and I wonder how I can set these computations up with numpy such ...
91 views

...
460 views

### Time and memory required to diagonalize a 18000 by 18000 matrix using numpy in python

Can someone give an estimate of the Time and memory required to diagonalize a 20000 by 20000 complex hermitian matrix using numpy in python ?
1 vote
100 views

### Convolution/weighted average of two arrays in Python

I have an equation that I need to calculate numerically, but I am having doubts about my approach. I am cross-posting this question from Stack Exchange, because I am not getting any responses. This is ...
58 views

### Eigenvalues of same operator expressed in two different orthonormal basis are coming out different

I have an operator $H$. I express $H$ as a matrix in the orthonormalized $\{ |e > \}$ basis. Then I diagonalize it to obtain eigenvalues, let's say for example $H$ is $6 \times 6$ and the ...
1 vote
478 views

168 views

### How amenable is this 2D Frenkel–Kontorova-like energy minimization problem in Python to the use of a modest PC + GPU? (Heavy reliance on indexing)

@Richard's answer to Going to try to move some of my scipy/numpy calculation to a new GPU, how to avoid disappointing results? is quite helpful, and as promised I've added a simple running example ...
1 vote
289 views

### Trouble inverting complex matrix with numpy and scipy

I have some matrix-valued, complex data $Z(f)$ with $f\in\{f_0,f_1,\dots\}$ and $Z(f_i)$ being a 3x3 matrix. I require the inverse $Z^{-1}(f)$ in my workflow. After encountering some problems with my ...
453 views

### Going to try to move some of my scipy/numpy calculation to a new GPU, how to avoid disappointing results?

update: I've refactored the question based on helpful advice in the linked meta. I'm a heavy user of Python's NumPy and SciPy (and not much else) and for years I could run anything I need on my laptop....
115 views

### How to troubleshoot numerical instability using finite difference for steady-state non-linear heat conduction equation

I have a problem which I believe is numerical instability when trying to solve a heat conduction equation using finite difference. The short version is that when the parameter $I=80.3$ I get the blue ...
281 views

### Calculate determinant of unitary matrices based on SVD implementation

I have a real square matrix $X$ which I need to perform a Singular Value Decomposition on. Now, performing the operation $$X = USV^T$$ as $U$ and $V$ are orthogonal, we know that $\det(X)=\pm\det(S)$...