Skip to main content

Questions tagged [numpy]

NumPy is the fundamental package for scientific computing with the programming language Python.

5 votes
1 answer
171 views

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

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}...
10 votes
3 answers
2k views

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

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

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

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

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

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

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

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

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

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

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

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 ...

15 30 50 per page
1
2 3 4 5
51