# Tagged Questions

NumPy is the fundamental package for scientific computing with Python.

73 views

### Vectorizing list of different functions for Gradient Descent

I am new to machine learning and statistical analysis and am having trouble figuring how I should go about a problem I have. I believe that I understand the gradient descent algorithm and how it ...
184 views

### What does Python offer for distributed/parallel/GPU computing?

Using the SciPy/NumPy libraries, Python is a pretty cool and performing platform for scientific computing. I just wonder: When I have to go parallel (multi-thread, multi-core, multi-node, gpu), what ...
23 views

### Efficiently creating an adjacency matrix from a lattice in numpy

I have an $n$ by $m$ numpy array representing a rectangular lattice $L$, where each site contains a one or a zero, representing two different materials. I'm modelling heat flow across this lattice. ...
35 views

### How to vectorize the GCD algorithm in number theory

In Python there numerous ways to compute the GCD (Greatest Common Divisor) in Python. Here is one: ...
139 views

### how to solve a 2D non-linear Poisson equation?

I am trying to solve the following equation for $P(x,y)$: $$I = P \nabla \cdot \frac{1}{P^2} \nabla{P}$$ where $P$ and $I$ are functions of x and y. $I(x,y)$ and $P(x,y)$ I want to understand ...
88 views

### (numpy/scipy) Build a random vector given mean vector and covariance matrix

After running several calculations with numpy, I end with the mean vector and covariance matrix for a state vector. Is there a way with numpy or scipy to sample a random vector around this mean and ...
461 views

### Complexity of matrix inversion in numpy

I am solving differential equations that require to invert dense square matrices. This matrix inversion consumes the most of my computation time, so I was wondering if I am using the fastest algorithm ...
185 views

### Python Vectorizing a Function Returning an Array

I have the following function that has been vectorized so that for every element in input array t, an array is output: ...
99 views

### How to read the number of periods of this complicated graph?

I have two data sets that are quasi-periodic. They have the same period and can be seen clearly by eye. For example when $x\in(100,200)$, both of them have about 32 periods. Below is a zoom-in of ...
118 views

### Inverse quadratic method only makes one iteration - python

I'm tryin' to implement this method with python3 but i don't solve the problem. This is my code: ...
704 views

### LCM builtin in Python / Numpy

I can write a function to find LCM (lowest common multiple) of an array of integers, but I thought it must have been implemented in numpy or scipy and was expecting something like ...
307 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%. ...
386 views

### Alternatives to numpy.einsum

Given an $n_1 \times \cdots \times n_k \times g \times g$ tensor $A$ (i.e. a collection of $g \times g$ matrices) and an $n_1 \times \cdots \times n_k \times g$ tensor $b$ (i.e. a collection of ...
73 views

### matplotlib contourplot for $\log z$ in the Complex Plane $\mathbb{C}$

I tried using Python's matplotlib on the logarithm and here is what I got, a kind of starburst pattern. Since the angle jumps between $\theta = 0$ and $\theta = 2\pi$, contour assumes there is a ...
106 views

### My calculated laser pulse duration is too large. Where am I wrong?

I am currently writing a small Python script to estimate the pulse duration from the optical spectrum. At the end, the idea is to observe the effects of the spectral phase on the pulse duration and ...
237 views

### How do I correctly multiply vectors and matrices in Python and MATLAB?

I have been trying for 2-3 days now to get L2 regularized logistric regression to work in Matlab (CVX) and Python(CVXPY) but no success. I am fairly new to convex optimization so I am quite frustrated....
197 views

### Can an approximated Jacobian with finite differences cause instability in the Newton method?

I have implemented a backward-Euler solver in python 3 (using numpy). For my own convenience and as an exercise, I also wrote a small function that computes a finite difference approximation of the ...
269 views

950 views

### Numerical integration for modelling curve for superconductors (Python)

I am a physicist who is trying to model the current-voltage characteristics of a superconductor-superconductor junction. The equation for this model is: \begin{align} I(V) = \frac{1}{eR_{\mathrm{n-n}...