Questions tagged [numpy]
NumPy is the fundamental package for scientific computing with the programming language Python.
765 questions
5
votes
1
answer
171
views
E-car-sharing problem with charging between the bookings
I am writing code that, at some later point, will be part of an academic multi-agent simulation of the learning process of car-sharing users and grid stability. This code deals with finding the price ...
2
votes
1
answer
105
views
Calculation of Correlation Time
I want to calculate the correlation time. First I calculate the auto-correlation function:
$$
\begin{align}
\chi(t) = &\frac{1}{t_{max}-t}\sum\limits_{t'=0}^{t_{max}-t}m(t')m(t'+t)\\
&-\frac{1}...
4
votes
4
answers
1k
views
10
votes
3
answers
2k
views
A Rubik's Cube game in Python
I implemented this Rubik's Cube game in Python, using Canvas and Context2d for user interaction. This was mainly an exercise in &...
7
votes
1
answer
299
views
Modularizing matplolib graphing based on a data dictionary
For plotting I often use a dictionary that contains my data of interest, regarding my numerical simulations. For example I have a numpy array - let's call it ...
4
votes
1
answer
367
views
Half-hexagon neighbour identification under (novel) hierarchical hexagonal grid
Context & Background
Please let me remind you that this project may involve original research; it is important to remember that all content on this site is subject to CC BY-SA 4.0. It is a breach ...
5
votes
1
answer
155
views
backward induction algorithm computation
Is there a way to significantly speed-up this code?
I'm solving a dynamic programming model using a backward induction algorithm. A crucial step is to calculate the current-period value function (VF), ...
2
votes
0
answers
114
views
Profiling for Bézier curve calculations
Recently I posted an answer on a question about Bézier curve calculations. As a micro-synopsis: there are three implementations of De Casteljau's algorithm here, including the original poster's, AJ ...
5
votes
1
answer
336
views
Calculation of clustering metric in Python
When I try to run the following code for arrays with more than 10k elements, it takes hours and I don't know how to make it in the most efficient way.
Any ideas?
...
7
votes
1
answer
855
views
Customizable Multi-Agent Predator/Prey Simulation
I am trying to create a highly customizable "battle simulator". The default setup is a predator/prey relationship (no births); however, I am trying to create code such that it's easy to add ...
3
votes
1
answer
66
views
Getting Graph and Block Animation to Run Smoothly Together
I have been working on some code that produces a live graphic of a graph and blocks moving. It works in theory but does not look like how I want. The animation runs very slow when showing both the ...
3
votes
0
answers
139
views
Analyze Stock Market Bottom Timing without Looping over Data Frame Rows
I am replicating this blog post in Python.
The blog post shows that even if you know future stock market bottoms, only buying stocks when the stock market is below future stock market bottoms provides ...
2
votes
0
answers
2k
views
Local maxima 3D array
I'm trying to find the local maxima in a 3D NumPy array, but I can't seem to find an easy way to do that using NumPy, SciPy, or anything else.
For now I implemented it using ...
5
votes
2
answers
319
views
Srivastava multivariate Fox H function in MATLAB
I was trying to rewrite the Python code in MATLAB.
The result is consistent.
But, the MATLAB code is so slow. Any help would be appreciated.
Ref python code link
The MATLAB code written by me is as ...
4
votes
1
answer
324
views
Implementing a tic tac toe board
This is my attempt at making a class to represent a game board for tic tac toe. I normally hate while loops, but I used one because I can't seem to make the ...