All Questions
8,786
questions
0
votes
0
answers
25
views
How to interpolate a 2D Scatter plot in python
I have the following problem: I am working with ultrasonic data from a sector scan. An example is shown in the following:
From the file I am reading I receive a 2D array. One dimension is the phase ...
1
vote
2
answers
51
views
Why is trapz returning negative values, even when x is sorted ascending and y is all positive?
y = np.array([59817478.73563218, 56195352.29885057, 59679547.70114943,
61071789.08045977, 56678110.91954023, 56900812.06896552,
61942478.73563218, 57360582.18390805, 57423800.57471264,
...
-2
votes
1
answer
46
views
Optimizing Nanogrinding Algorithms with Python for Metal Powders at Room Temperature
I'm working on an advanced nanogrinding technology that enables grinding metals like copper at room temperature, achieving results that are currently deemed impossible with conventional methods. The ...
-1
votes
0
answers
27
views
DeprecationWarning when using scipy.optimize.minimize [duplicate]
import scipy
import math
def LR(x):
return -(1+x*math.exp(-x))/2
max_LR= scipy.optimize.minimize(LR, [1],bounds =[(0, 1/2)])
I get the following error:
DeprecationWarning: Conversion of an ...
1
vote
1
answer
42
views
Why can't I fit my model to Young's interference data accurately?
I'm trying to fit my experimental data from Young's interference experiment to a theoretical model using Python's scipy.optimize module.
I've tried several optimization techniques including curve_fit, ...
0
votes
1
answer
36
views
Variable type of y and subscripting y in Scipy's solve_ivp
I am trying to solve a matrix differential equation in Python using solve_ivp from Scipy, and I have run into some problems.
The code returning dy/dt that I have written is the following:
def fun(y, t,...
-2
votes
2
answers
82
views
How to make integration faster?
I'm using following code but it takes about an hour. Function chi and integrand are working fine, but chi_dop is taking too much time.
How to make it faster?
Any better way to integrate other than ...
1
vote
1
answer
56
views
Use scipy.integrate.nquad to integrate integrals whose result is a complex number
I want to try to numerically integrate the intergal of 1/(1+x**2+y**2), where y is from 0 to sqrt(16-x**2) and x is from 0 to 5.
The problem is that the result is a complex number.
Can scipy.nquad ...
1
vote
1
answer
88
views
Multiple 1D interpolation in 2D array without loop
I have an np array with ndim = 2. I need to sample interpolated values along one dimension, and I would like to do it as efficiently as possible.
I came up with this solution:
for i in range(my_array....
0
votes
2
answers
89
views
Plotting a chirp square signal in python
Wikipedia definition: A chirp is a signal in which the frequency increases (up-chirp) or decreases (down-chirp) with time. In some sources, the term chirp is used interchangeably with sweep signal.
I ...
2
votes
1
answer
39
views
How to plot anndata like matrix to grey 2d numpy array
Input data
mtx: "<COOrdinate sparse matrix of dtype 'int64' with 357558594 stored elements and shape (30562, 96629557)>"
mtx.todense()[0:2,0:8] = matrix([[4050, 24, 21, 3, ...
0
votes
2
answers
101
views
how to generate specific distribution?
I have a metric with 900K users, and I can't generate a distribution that would roughly repeat the existing one. I need this to quickly generate samples for AA AB tests (with guaranteed uplift).
Here ...
1
vote
1
answer
68
views
how do I find the dimension of the span of the intersection/union of two null spaces of different sizes of matrices using numpy/scipy?
I need to find $dim(span(H\cap G))$ and $dim(span(H\cup G))$ where H and G are defined the following way:
I have no idea how to find the intersection/union of their null spaces and after that, I don'...
0
votes
0
answers
36
views
Efficiently multiply a special sparse 3D tensor with a vector in python
I have a 3D tensor T of size (nrows, ncols, ncols), which I would like to multiply with a vector x of size nrows.
However, T will be a huge sparse tensor with 6×6 nonzero entries in each row;
thus, it ...
3
votes
3
answers
125
views
how to calculate this integral using scipy/numpy?
i have the folowing question enter image description here
it's written badly, but for those values of alpha and beta (0.32, 12) i need to find the minimal k at which the integral from -inf to inf of ...