# Questions tagged [python]

A general purpose high-level programming language that emphasizes ease of code syntax and readability.

460 questions
27 views

### Incorporating a potential barrier in a wave-packet simulation (Fourier Transform method)

I'm trying to simulate the scattering of a wave-packet at a potential barrier in Python. I'm using a Fourier Transform method (not sure if its the same as the Split-Step method), where I apply Fourier ...
47 views

### Solve multi-dimensional optimization problem using basinhopping

I am searching for an optimization solution, which is a 8d vector representing 4 complex elements, where each element is within the complex circle with maximal radius 1.2. The objective function is: ...
58 views

### Python sequence cluster exercise

I am working through an exercise in my textbook and implementing the code in Python to practice dynamic programming. I feel like I am right on the edge of figuring it out, but after many hours, I come ...
27 views

### Charged Particles within magnetic fields [on hold]

I am trying to code the motion of a charged particle within a magnetic field and produce a 3D trajectory plot. The problem I believe is that I need to fix the axes and limit the animation produced. I ...
114 views

### Find a solution of large system of inequalities

I have a large system of homogenous inequalities involving 33 real unknowns of the form $$\vec{F}(z_i)^T \cdot \vec{X}>0\,$$ where $\vec{X} = \left(x_1,...,x_{24}\right)^T$ are the unknowns and ...
11 views

### How to choose metrics for evaluating classification results?

Recently we have developed a python library named PyCM specialized for analyzing multi-class confusion matrices. A parameter recommender system has been added in version 1.9 of this module in order ...
27 views

### Numerically solving the poisson equation, discretisation of the differential operator, mistake?

I'm attempting to numerically solve the poisson equation using Numpy's LinearOperator class. $$-\nabla \cdot \left(\sigma(x, y)\nabla\right)u(x, y) = 1$$ for $(x, y)\in [0, 1]\times [0, 1]$ with ...
96 views

18 views

### Numpy: How to permute array into indices of larger array? [closed]

I have an array of length L with N zeros, and L-N non-zero values. I have another array of length N. I would like to put the values of the shorter array into the positions of the longer array which ...
64 views

### 2d wave equation with finite differences blowing up

I am (naively) trying to solve the 2d wave equation with finite differences. But the system blows up instantly. For simplicity I set the constant $c=1$, then I am left with $$\Delta u =u_{tt}.$$ I ...
216 views

### Applying neumann boundary conditions to diffusion equation solution in python [duplicate]

For the diffusion equation $$\frac{\partial u(x,t)}{\partial t} = D \frac{\partial ^2 u(x,t)}{\partial x^2} + Cu(x,t)$$ with the boundary conditions $u(-\frac{L}{2},t)=u(\frac{L}{2},t)=0$ I've ...
100 views

### Smallest circumscribed circle in spherical geometry

I work in Python 3 on astrophysics projects. I need to compute the smallest circumscribed circle of a set of points in the sky (so described by Right Ascension and Declination). I have found a code ...