# Questions tagged [python]

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

628 questions
Filter by
Sorted by
Tagged with
41 views

### Sum of random variables - Check your derived distribution against a numerical calculation/histogram

Consider independent random variates $X_0, X_1, . . .$ each uniformly distributed on the support $[0, 1)$ Let's say $Y = X_0 + X_1$, where $X_0$ and $X_1$ are independent uniform random variables with ...
58 views

55 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: ...
33 views

### Integrating Matrix Elements TypeError: f() takes 1 positional argument but 3 were given

I'm working on a linear variational problem for a general PIB and I keep encountering the same problem, and I know its a rather simple solution. Any suggestions? ...
45 views

29 views

### Comparing custom linear regression solver to SciPy equivalent in Python

From a given data set, I set out to complete a task which is below Fit the data of the previous exercise to fit Eq. (8.18) using the SciPy function ...
40 views

### Question regarding the energy computation of the Ising-Spin Model

In most of the Monte-Carlo-Algorithms I studied, I found, at the place where they compute the energy, always a line of code, where they divided by four. For example, this code-snippet is taken from ...
171 views

### Why is 'scipy.sparse.linalg.spilu' less efficient than 'scipy.linalg.lu' for sparse matrix?

I have a matrix B which is sparse and try to utilize a function scipy.sparse.linalg.spilu specialized for sparse matrix to ...
154 views

100 views

### Composite matrices in Numpy

Lets say I have four matrices A, B, C and D, and I want to combine them together into one new matrix for computation: $$\left( \begin{matrix} A & B\\ C & D \end{matrix}\right)$$ How can I ...