# Questions tagged [python]

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

442 questions
805 views

### Neumann boundary conditions for the upwind scheme applied to the advection equation (Python)

I'm trying to solve the linear advection equation $$u_{t} = cu_{x}, \\ x \in [x_{0}, x_{e}], \quad t \in (0, T], \quad c \in \mathbb{R} \\ u(x,0) = f(x)$$ Note that for $c > 0$, the solution is ...
47 views

### Object-oriented non-linear solving in python

I'd like to build a system in Python, consisting of (broadly speaking) objects which are internally described with (not necessarily just linear) equations, that I can connect with each other - similar ...
1k views

### Calculating partial trace of array in NumPy

A simulation I'm doing requires me to calculate the partial trace of a large density matrix. I am trying to calculate it using tools from numpy, but my code seems to be having some problems. For ...
1k views

### Python: Comparing 2D arrays and Returning independent values from those arrays [closed]

I'm sure this would be a common question, however yet to find an answer for. Suppose I have two, 2D vectors in Python ...
94 views

### How much in depth should I cover Python? [closed]

I'm an undergrad who's studying electronics and fields like data sciences and mostly computing seem most interesting to me but have in-depth knowledge in neither. I learnt basic python last winter ...
125 views

### Optimizing for loops by using Einstein summations instead

I have some Python code containing a couple of for loops, which I would like to optimize by using low-level functions. My first approach is to use ...
365 views

### How can this multidimensional integral be efficiently implemented in python using Gauss-Hermite quadrature

I'm playing around with dynamic programming and need to calculate a multidimensional integral $E[V(W)]$ where we assume $W$ has a log normal distribution. I was looking at the following example in ...
637 views

68 views

### vectorizing optimization or root finding [closed]

I need to find the roots of a function. I am currently using scipy.optimize.fsolve ...
137 views

### Lambdify error when sympy array contains number

This example is a dummy example, but it describes exactly whats goes on in my problem. As a result from some sympy calculation and manipulation i got two arrays ...
I need to implement the following in python: For a given discrete time series Zt (t=0 to T), find smallest t such that: $c\sum_{s=0}^t e^{[k(Zt-Zs)+m(t-s)]} >= \frac{p*}{1-p*}$ where c,k,m are ...