# Questions tagged [python]

For mathematical questions about Python; questions purely about the language, syntax, or runtime errors are off-topic here and would likely be better received on Stack Overflow.

797 questions
Filter by
Sorted by
Tagged with
19 views

### Rice formula on time series

I have a time-series which is a mean-reverting spread with a long-run mean (equilibrium) close to zero. I am looking to use the Rice formula to get the level crossings rate, e.g. how many times the ...
10 views

### Recommendations to minimize unknown function with categorical variables

Goal The goal is to minimize an output variable of a computer code whose function is unknown, we will call it F. There are 25 input variables, xij, and 5 output variables, yk. xij, where i ∈ [1,5] ...
28 views

### Is anyone familiar with pandasql? [closed]

I currently try to merge two data frames by using pandasql, but I don't know how to create a new column for my data frame. I tried the code "ALTER TABLE crsp ADD monthid INT()", and it told ...
32 views

### How to create synthetic data for a decaying curve in order to extrapolate it beyond some point?

In the following curve , I would like to extend the measurements beyond $x$=1 in order to have a better estimate of the green curve compared to red line. Note: I do not have the analytical form of the ...
1 vote
9 views

### Is there a efficient way to find only the combinations of interest from V exciting in P [closed]

Is there a efficient way to find only the combinations of interest from V exciting in P I have a list of something like this. V = [2,3,5,7,9,12] Size of V can be ...
28 views

...
24 views

### european call with binomial model in python

I have this exercise to resolve. Calculate the prices of a European and an American call option in an N = 3 period binomial model with $S_0 =$ 1, $u = \frac{1}{2} =$ 2 and $r = - \frac{1}{4}$. ...
17 views

### Calculate normal vectors for each element of a grid in Python

How can I quickly calculate the normal vectors of each mesh of my grid? (grid is defined by the three matrices Mx, My & <...
11 views

### How to Introduce LSTM systemically to autograd? [closed]

Among all the Neural Network structures that are introduced, RNN has received noticeable attention because of the state art included in its gradient computation with backpropagation. On the other hand,...
1 vote
37 views

1 vote
36 views

### Solving PDE in Python

Does anyone know of a "nice" library for solving PDEs in Python that will compute a functional solution, u(x_1...x_n,t). What I want is to be able to pass the PDE(eq), BCs, and/or IVPs and ...
15 views

### Image Deblurring Resources?

I have been researching about image deblurring methods and would like to know if anyone had some good entry points to this. I am looking for references about basic image deblurring, and mainly the ...
14 views

### Calculating flux jacobian using Sympy

I want to obtain the analytical expression of the flux Jacobian of an advection equation in a porous media, which is useful when doing computational fluid dynamics. I thought that I could do that ...
26 views

### Numerically solve inseparable ODE in Python

I have an inseparable, first-order ODE of the form $$f'(t)=g(f'(t), f(t))$$ where $g$ is a rather monstrous combination of terms making it impossible to find some $h$ such that $f'(t)=h(f(t))$. I'd ...
1 vote
44 views

### Fastest way to solve vertex enumeration problem in python

I have a set of 73 linear non-strict inequalities that describe a convex polytope in the 36-dimensional space. All but one of the inequalities are of the form $x>=b$ or $x<=b$. In every but one ...
1 vote
25 views

### Problem About the Order of Convergence of Numerical Method

Sometimes when I did convergence test for my numerical solver, I can't get the exact order of convergence even I am sure that my code is correct. I would like to ask if anyone else has experienced ...
1 vote
16 views

### Visualising Combinations of Two Arrays

I am trying to find the optimal value range for two inputs to get the highest output $\frac{A_i-1}{B_i}$. A = [1.1, 1.2, 1.3, ..., 20] B = [1.1, 1.2, 1.3, ..., 20] So, for each combination of $A_i$ ...
1 vote
46 views

29 views

### Solving system of linear equations across network in Python [closed]

I have a network and I would like to calculate the voltage drop across the nodes (2-5). I know V1=10 and V6=0. The equations at ...
27 views

### Gradient descent calculation split in 2 steps

In a machine learning course I am taking we have an assignment with a notebook (In linear models). So far I have calculated the cost and the sigmoid in a logistic regression and the next exercise ...
23 views

### Numerically solving Differential Equation using Störmer-Verlet

For uni I've got this assignment where I need to numerically solve the differential equation: $$\begin{equation} \begin{cases} x' = y \\ y' = -x \end{cases} \end{equation}$$ ...
40 views

### Why does this algorithm for the Takagi factorization fail here?

In this paper it was found that the Takagi factorization of a complex symmetric matrix $A$ can be calculated from the singular value decomposition $A=U\Lambda V^H$ by $$A = X\Lambda X^T \tag{1}$$ ...
23 views

21 views

### Regression, can someone help me understand this equation?

The criterion for mapping the individual test case to the four ideal functions is that the existing maximum deviation of the calculated regression does not exceed the largest deviation between ...
15 views

### Rotate samples of Circles around an angle $\theta$

I have the following Python-Code ...
54 views

### Numerical simulation of SDE with Lévy noise in Python - Overflow issue

My goal is to simulate a SDE with alpha-stable noise in Python. This is my code: ...
34 views

### Why does Discrete Fourier Transform of $\sin^2(x)$ seemingly have an extra frequency component compared to $|\sin x|$?

I'm trying to better understand Fourier Transform. In python, I took the fourier transform of $\sin^2(x)$ and $|\sin(x)|$ and plotted the absolute value of the coefficients to see which frequencies ...
35 views

49 views