Questions tagged [python]

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

492 questions
51 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 ...
2k 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 ...
2k 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 ...
96 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 ...
146 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 ...
467 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 ...
1k views

77 views

vectorizing optimization or root finding [closed]

I need to find the roots of a function. I am currently using scipy.optimize.fsolve ...
160 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 ...
705 views

integral including a vector

I need to calculate the integral of this function def f(z): return ((1-2*z)*np.exp(-d/z))/(((1-z)**(2+d))*(z**(2-d))) Here d is a constant. I am using this ...
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 ...